[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-2216":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":8,"htmlUrl":8,"language":9,"languages":8,"totalLinesOfCode":8,"stars":10,"forks":11,"watchers":12,"openIssues":13,"contributorsCount":13,"subscribersCount":13,"size":13,"stars1d":13,"stars7d":14,"stars30d":15,"stars90d":13,"forks30d":13,"starsTrendScore":13,"compositeScore":16,"rankGlobal":8,"rankLanguage":8,"license":17,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":20,"hasPages":18,"topics":21,"createdAt":8,"pushedAt":8,"updatedAt":22,"readmeContent":23,"aiSummary":24,"trendingCount":13,"starSnapshotCount":13,"syncStatus":14,"lastSyncTime":25,"discoverSource":26},2216,"context-engineering","outcomeops\u002Fcontext-engineering","outcomeops",null,"Python",127,8,122,0,2,5,2.86,"MIT License",false,"main",true,[],"2026-06-12 02:00:38","# Context Engineering\n\nA 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.\n\nThis repo is the code companion to [**What Is Context Engineering?**](https:\u002F\u002Fwww.outcomeops.ai\u002Fcontext-engineering) on outcomeops.ai. The glossary defines the concepts; this repo shows them running end-to-end against a real corpus on Amazon Bedrock.\n\n> Context engineering treats context as a first-class engineering artifact — version-controlled, retrievable, and enforceable — rather than as prompts typed into a chat window.\n\n---\n\n## The five components\n\nA context engineering system has five components. Each folder implements one against the same running example (a Spring PetClinic codebase with ADRs):\n\n| # | Component | What it does | Folder |\n|---|---|---|---|\n| 1 | **Corpus** | The organizational material that defines how you think, build, and decide | [`01-corpus\u002F`](.\u002F01-corpus) |\n| 2 | **Retrieval** | Identifies which portions of the corpus are relevant to a given request | [`02-retrieval\u002F`](.\u002F02-retrieval) |\n| 3 | **Injection** | Gets retrieved context into the model's working memory at decision time | [`03-injection\u002F`](.\u002F03-injection) |\n| 4 | **Output** | Produces reviewable artifacts (code, PRs, docs) shaped by that context | [`04-output\u002F`](.\u002F04-output) |\n| 5 | **Enforcement** | Ensures the generated output actually reflects the retrieved context | [`05-enforcement\u002F`](.\u002F05-enforcement) |\n\nPlus [`comparisons\u002F`](.\u002Fcomparisons) — the same task run with and without context engineering, plus how CE differs from RAG, Copilot, and agent frameworks.\n\nA 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.\n\n---\n\n## Case studies\n\nReal-world deployments built on the same context-engineering pattern this repo implements. The repo files are engineer-facing; the canonical buyer-facing versions live on outcomeops.ai.\n\n- [**OutcomeOps AI Assist**](.\u002Fcase-studies\u002Foutcomeops-ai-assist.md) — workspace budgets, OCSF audit + SIEM export, and the integration-trio pattern that put OneDrive and OneNote in production on the same day. Canonical: [www.outcomeops.ai\u002Fcase-studies\u002Foutcomeops-ai-assist](https:\u002F\u002Fwww.outcomeops.ai\u002Fcase-studies\u002Foutcomeops-ai-assist).\n- [**RetrieveIT.ai**](.\u002Fcase-studies\u002Fretrieveit-ai.md) — multi-tenant semantic-search SaaS from domain registration to production in 6 days; multi-tenant isolation, encrypted OAuth, fail-closed billing — all pre-decided in the ADR library. Canonical: [www.outcomeops.ai\u002Fcase-studies\u002Fretrieveit-ai](https:\u002F\u002Fwww.outcomeops.ai\u002Fcase-studies\u002Fretrieveit-ai).\n- [**MyFantasy.ai**](.\u002Fcase-studies\u002Fmyfantasy-ai.md) — AI-suggested \u002F human-approved scoring pipeline at $0.031 per episode; the trust boundary is the architecture. 60 Lambdas in 22 days against RuPaul's Drag Race All Stars. Canonical: [www.outcomeops.ai\u002Fcase-studies\u002Fmyfantasy-ai](https:\u002F\u002Fwww.outcomeops.ai\u002Fcase-studies\u002Fmyfantasy-ai).\n- More case studies: [www.outcomeops.ai\u002Fcase-studies](https:\u002F\u002Fwww.outcomeops.ai\u002Fcase-studies)\n\n---\n\n## Examples\n\nShort, reproducible demonstrations of context engineering in practice.\n\n- [**Three ADRs rewrote the generated code**](.\u002Fexamples\u002Fthree-adrs-spring-petclinic.md) — the smoking-gun A\u002FB test on Spring PetClinic. Same model, same prompt, same codebase; three markdown files change the output architecture. Two public Git branches you can diff yourself. Canonical: [www.outcomeops.ai\u002Fblogs\u002Fhow-3-adrs-changed-everything-spring-petclinic-proof](https:\u002F\u002Fwww.outcomeops.ai\u002Fblogs\u002Fhow-3-adrs-changed-everything-spring-petclinic-proof).\n\n---\n\n## Running the examples\n\nAll examples use **Amazon Bedrock** with Claude. Each folder has its own `requirements.txt` and `README.md` with a runnable command.\n\n**Prerequisites:**\n\n- Python 3.11+\n- AWS account with credentials configured (`aws configure` or env vars)\n- AWS region that supports Claude and Titan (e.g. `us-east-1`, `us-west-2`)\n\nThis 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.\n\n**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:\n\n1. Open any Anthropic Claude model in the [Bedrock model catalog](https:\u002F\u002Fconsole.aws.amazon.com\u002Fbedrock\u002Fhome#\u002Fmodel-catalog)\n2. Fill the First Time Use form (company, use case — about a minute)\n3. Submit — access is granted immediately, no review queue\n\nIf you're in an AWS Organization child account, the form must be submitted from the management account to inherit access.\n\n**Quickstart:**\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Foutcomeops\u002Fcontext-engineering.git\ncd context-engineering\u002F01-corpus\npip install -r requirements.txt\npython ingest_adrs.py .\u002Fsample-adrs\n```\n\nSet the model via environment variable if you want to override the default:\n\n```bash\nexport BEDROCK_MODEL_ID=\"us.anthropic.claude-sonnet-4-5-20250929-v1:0\"\nexport AWS_REGION=\"us-east-1\"\n```\n\n---\n\n## Why this repo exists\n\nMost 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.\n\nA 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.\n\nThis 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.\n\n---\n\n## Context engineering changes organizations, not just code\n\nThe 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.\n\n- [The rise of the outcome engineer](https:\u002F\u002Fwww.outcomeops.ai\u002Fblogs\u002Fthe-rise-of-the-outcome-engineer) — the emerging role\n- [Engineers who own the outcome](https:\u002F\u002Fwww.outcomeops.ai\u002Fblogs\u002Fengineers-who-own-the-outcome) — the operating model\n- [OutcomeOps and context engineering: the next corporate evolution beyond DevOps](https:\u002F\u002Fwww.outcomeops.ai\u002Fblogs\u002Foutcomeops-and-context-engineering-the-next-corporate-evolution-beyond-devops) — what comes after DevOps\n- [Death of the traditional product owner](https:\u002F\u002Fwww.outcomeops.ai\u002Fblogs\u002Fdeath-of-the-traditional-product-owner) — the product-side role shift\n- [Measuring what actually matters](https:\u002F\u002Fwww.outcomeops.ai\u002Fblogs\u002Fmeasurng-what-actually-matters) — the KPI shift\n\n---\n\n## Further reading\n\nFoundational articles, reference guides, and practitioner writeups on context engineering as a discipline:\n\n- [Effective context engineering for AI agents](https:\u002F\u002Fwww.anthropic.com\u002Fengineering\u002Feffective-context-engineering-for-ai-agents) (Anthropic, Sep 2025) — curating and limiting what an agent sees\n- [The rise of context engineering](https:\u002F\u002Fblog.langchain.com\u002Fthe-rise-of-context-engineering\u002F) (LangChain, Jun 2025) — the article that made the term widely used\n- [Context engineering for agents](https:\u002F\u002Fblog.langchain.com\u002Fcontext-engineering-for-agents\u002F) (LangChain, Jul 2025) — write\u002Fselect\u002Fcompress\u002Fisolate framing\n- [Context Engineering: Bringing Engineering Discipline to Prompts](https:\u002F\u002Faddyo.substack.com\u002Fp\u002Fcontext-engineering-bringing-engineering) (Addy Osmani, Jul 2025) — engineering-discipline framing\n- [Context Engineering Guide](https:\u002F\u002Fwww.promptingguide.ai\u002Fguides\u002Fcontext-engineering-guide) (PromptingGuide.ai) — reference entry\n- [Documenting Architecture Decisions](https:\u002F\u002Fcognitect.com\u002Fblog\u002F2011\u002F11\u002F15\u002Fdocumenting-architecture-decisions) (Michael Nygard, 2011) — the original ADR essay; the format used throughout this repo\n- [OutcomeOps and context engineering: the next corporate evolution beyond DevOps](https:\u002F\u002Fwww.outcomeops.ai\u002Fblogs\u002Foutcomeops-and-context-engineering-the-next-corporate-evolution-beyond-devops) (OutcomeOps) — the organizational thesis behind this repo\n- [OutcomeOps: self-documenting architecture — when code becomes queryable](https:\u002F\u002Fwww.outcomeops.ai\u002Fblogs\u002Foutcomeops-self-documenting-architecture-when-code-becomes-queryable) (OutcomeOps) — how ADR corpora compound as code evolves\n- [The real cost of knowledge: why most AI engineering platforms over-engineer RAG](https:\u002F\u002Fwww.outcomeops.ai\u002Fblogs\u002Fthe-real-cost-of-knowledge-why-most-ai-engineering-platforms-over-engineer-rag) (OutcomeOps) — against premature retrieval infrastructure\n- [What AI-assisted development actually looks like in two years](https:\u002F\u002Fwww.outcomeops.ai\u002Fblogs\u002Fwhat-ai-assisted-development-actually-looks-like-in-two-years) (OutcomeOps) — the working developer's view\n\n## Companion repositories\n\n- [bonigarcia\u002Fcontext-engineering](https:\u002F\u002Fgithub.com\u002Fbonigarcia\u002Fcontext-engineering) — book companion from Boni García; organized by chapter with polyglot examples\n- [davidkimai\u002FContext-Engineering](https:\u002F\u002Fgithub.com\u002Fdavidkimai\u002FContext-Engineering) — concepts, patterns, and techniques\n- [Meirtz\u002FAwesome-Context-Engineering](https:\u002F\u002Fgithub.com\u002FMeirtz\u002FAwesome-Context-Engineering) — curated list of papers, tools, and articles\n- [joelparkerhenderson\u002Farchitecture-decision-record](https:\u002F\u002Fgithub.com\u002Fjoelparkerhenderson\u002Farchitecture-decision-record) — the definitive ADR resource list\n\n## Deep dives by component\n\nEach folder's README has its own curated reading list; the quick index:\n\n- **Corpus** — see [`01-corpus\u002F`](.\u002F01-corpus#further-reading) — ADR formats, corpus bootstrapping, self-documenting architecture\n- **Retrieval** — see [`02-retrieval\u002F`](.\u002F02-retrieval#further-reading) — FAISS, \"Lost in the Middle,\" retrieval economics\n- **Injection** — see [`03-injection\u002F`](.\u002F03-injection#further-reading) — prompt structure, token budgets, inference cost\n- **Output** — see [`04-output\u002F`](.\u002F04-output#further-reading) — JSON Schema, Bedrock tool-use, the outcome engineer\n- **Enforcement** — see [`05-enforcement\u002F`](.\u002F05-enforcement#further-reading) — LLM-as-judge research, PR-as-guardrail\n- **Comparisons** — see [`comparisons\u002F`](.\u002Fcomparisons#further-reading) — CE vs RAG vs agents vs enterprise search\n\n---\n\n## About\n\nBuilt by Brian Carpio at [OutcomeOps](https:\u002F\u002Fwww.outcomeops.ai). Questions, corrections, or contributions welcome via issues and PRs.\n\n## License\n\nMIT — see [LICENSE](.\u002FLICENSE).\n","outcomeops\u002Fcontext-engineering 是一个实现上下文工程的参考项目，旨在设计、检索和注入AI系统所需的信息以生成准确且特定于组织的输出。该项目使用Python开发，包含五个核心组件：语料库管理、信息检索、上下文注入、输出生成以及执行监督，确保生成的内容既可审查又符合预设规则。它特别适用于需要将机构知识精确融入AI决策过程的场景，如企业级应用开发、智能助手构建等，通过版本控制的方式管理上下文信息，提高了AI系统的可靠性和一致性。","2026-06-11 02:48:55","CREATED_QUERY"]