Context Engineering In AI
Context Engineering In AI
* Overall, we need to compact the context to stay in AI's smart zone which is usually under 40% of the official max context.
* Remember that there are always system instructions, Claude.md, Built-In Tools, and MCP Tools that take space in the context. Next there is always the prompt and the subagents that locate and analyze the code base.
* So you need to create research.md for the PR with the remaining space of 300 to 1000 lines. These lines include your organization's rules, your team rules, which specific repo, which specific products, which specific modules, which specific directories, and which specific code.
* Next need to create plan to fix ( plan.md ) for the PR. This needs to be the combination of the research.md plus the PRD/ticket/bug report. This plan.md ideally will be 300 to 1000 lines.
Put as much context as you can into files, rather than remembering to put in the prompt. Let AI do what it is good at read, write, edit, grep, bash, etc. More efficient to do HTML instead of JSON in regards to tokens in regards to context. RAG, prompt engineering, State/history, structured output, memory.
Create ADR markdown files to help AI. Architectural Decision Record (ADR) is a short, lightweight doc used in software engineering to capture an important architectural choice, the context behind it, and its resulting consequences. Example 1: we doing pricing a certain way. Example 2: we are not changing API schema, but rather will change as /v2 to never break a contract.
/docs/external = Create markdown files for things external to codebase to help AI. Example 1: what are my external variables like. Example 2: which payment processor. Example 3: which emails I am using for testing. Example 4: where do customers contact me.
Source: by Dex Horthy of HumanLayer
On the modern models, don't get super specific. Describe only the task, guard rails, and exit criteria.
Source: https://www.youtube.com/watch?v=qyPCVqFUyDo

Comments
Post a Comment