Show HN: A working reference implementation of context engineering

Hacker News Top Tools

Summary

A working reference implementation of context engineering — a discipline for designing, retrieving, and injecting organizational context into AI systems to produce accurate, domain-specific outputs. The repo demonstrates five components (corpus, retrieval, injection, output, enforcement) running against Amazon Bedrock with Claude.

I've been presenting at local meetups about Context Engineering, RAG, Skills, etc.. I even have a vbrownbag coming up on LinkedIn about this topic so I figured I would make a basic example that uses bedrock so I can use it in my talks or vbrownbags. Hopefully it's useful.
Original Article
View Cached Full Text

Cached at: 04/20/26, 02:43 PM

outcomeops/context-engineering

Source: https://github.com/outcomeops/context-engineering

Context Engineering

A working reference implementation of context engineering — the discipline of designing, retrieving, and injecting the information an AI system needs to produce accurate, organization-specific outputs.

This repo is the code companion to What Is Context Engineering? on outcomeops.ai. The glossary defines the concepts; this repo shows them running end-to-end against a real corpus on Amazon Bedrock.

Context engineering treats context as a first-class engineering artifact — version-controlled, retrievable, and enforceable — rather than as prompts typed into a chat window.


The five components

A context engineering system has five components. Each folder implements one against the same running example (a Spring PetClinic codebase with ADRs):

#ComponentWhat it doesFolder
1CorpusThe organizational material that defines how you think, build, and decide01-corpus/
2RetrievalIdentifies which portions of the corpus are relevant to a given request02-retrieval/
3InjectionGets retrieved context into the model’s working memory at decision time03-injection/
4OutputProduces reviewable artifacts (code, PRs, docs) shaped by that context04-output/
5EnforcementEnsures the generated output actually reflects the retrieved context05-enforcement/

Plus comparisons/ — the same task run with and without context engineering, plus how CE differs from RAG, Copilot, and agent frameworks.

A system with only components 1–3 is a RAG system. The output and enforcement layers are what make CE different — they make the generated content reviewable and governable.


Running the examples

All examples use Amazon Bedrock with Claude. Each folder has its own requirements.txt and README.md with a runnable command.

Prerequisites:

  • Python 3.11+
  • AWS account with credentials configured (aws configure or env vars)
  • AWS region that supports Claude and Titan (e.g. us-east-1, us-west-2)

This repo uses Anthropic Claude for generation and Amazon Titan for embeddings. Titan and most Bedrock foundation models are auto-enabled on first invocation — no action needed.

Anthropic Claude requires a one-time First Time Use (FTU) form per AWS account. If your account has never used Anthropic models on Bedrock, the first script run will fail with AccessDeniedException. To fix:

  1. Open any Anthropic Claude model in the Bedrock model catalog
  2. Fill the First Time Use form (company, use case — about a minute)
  3. Submit — access is granted immediately, no review queue

If you’re in an AWS Organization child account, the form must be submitted from the management account to inherit access.

Quickstart:

git clone https://github.com/outcomeops/context-engineering.git
cd context-engineering/01-corpus
pip install -r requirements.txt
python ingest_adrs.py ./sample-adrs

Set the model via environment variable if you want to override the default:

export BEDROCK_MODEL_ID="us.anthropic.claude-sonnet-4-5-20250929-v1:0"
export AWS_REGION="us-east-1"

Why this repo exists

Most AI coding assistants produce generic output. An engineer using a generic assistant still has to adapt the output to local patterns — the assistant doesn’t know what your team decided last quarter, what your compliance framework requires, or why you picked one library over another.

A context-engineered system produces output that already conforms to local patterns, because the retrieval layer has fed the model the relevant ADRs, code, and standards at decision time. The enforcement layer ensures the output actually cites what it relied on.

This repo exists to show the pattern in code, end-to-end, so teams can build it themselves or evaluate commercial tools that claim to do it.


Context engineering changes organizations, not just code

The five-component model is the technical frame. Teams that actually deploy it consistently discover the harder shift is organizational. Roles, KPIs, and decision rights in a traditional software org were shaped by a world where AI could not read the corpus. Once it can, the middle layers of that structure start to look different — and the repo above is only useful in the first place because of those changes.


Further reading

Foundational articles, reference guides, and practitioner writeups on context engineering as a discipline:

Companion repositories

Deep dives by component

Each folder’s README has its own curated reading list; the quick index:

  • Corpus — see 01-corpus/ — ADR formats, corpus bootstrapping, self-documenting architecture
  • Retrieval — see 02-retrieval/ — FAISS, “Lost in the Middle,” retrieval economics
  • Injection — see 03-injection/ — prompt structure, token budgets, inference cost
  • Output — see 04-output/ — JSON Schema, Bedrock tool-use, the outcome engineer
  • Enforcement — see 05-enforcement/ — LLM-as-judge research, PR-as-guardrail
  • Comparisons — see comparisons/ — CE vs RAG vs agents vs enterprise search

About

Built by Brian Carpio at OutcomeOps. Questions, corrections, or contributions welcome via issues and PRs.

License

MIT — see LICENSE.

Similar Articles

Effective context engineering for AI agents

Anthropic Engineering

Anthropic publishes a guide defining context engineering as the evolution of prompt engineering, focusing on curating optimal context tokens for AI agents to maintain performance and focus during multi-turn inference.

@eng_khairallah1: https://x.com/eng_khairallah1/status/2053405155630936297

X AI KOLs Timeline

The article argues that context engineering, which involves structuring the information and memory available to an AI, is more critical for performance than prompt engineering alone. It provides a structured overview of a course designed to teach how to build reliable AI systems by managing context layers like session history and persistent memory.