6. Context Lifecycle
Instruction Debt
Rules accumulate. They are rarely removed. This is instruction debt: the gradual accumulation of rules that are outdated, redundant, or contradictory, each still consuming context budget.
Signs of instruction debt:
- A rule refers to a library you stopped using six months ago
- Two rules say opposite things about the same pattern
- A rule covers an edge case that only applied during a specific migration
- The same constraint is stated three times in different sections
- Developers comment out or ignore specific rules because they conflict with current practice
Instruction debt has compounding costs: each conflicting or irrelevant rule displaces a useful one, and models behave unpredictably when rules conflict.
Quarterly audit rhythm: Schedule a context audit every quarter (or after major project milestones). The audit prompt:
Review every rule in CLAUDE.md for:
1. Relevance: Does this still apply to the current stack and patterns?
2. Specificity: Is this actionable, or is it too vague to enforce?
3. Conflicts: Does this contradict another rule?
4. Coverage: Is this already covered by a more general rule?
For each rule, classify as: KEEP | UPDATE | ARCHIVE | DELETERun this as an actual Claude session, feeding the current CLAUDE.md and asking for a structured audit.
The Update Loop
The most common mistake after a bad Claude output is to fix the output manually and move on. This is a wasted learning opportunity.
Bad loop:
Claude generates wrong pattern
→ Developer manually fixes it
→ Next session: Claude generates wrong pattern again
→ Developer manually fixes it again
→ Repeat indefinitelyGood loop:
Claude generates wrong pattern
→ Developer identifies the root cause (missing rule? vague rule? conflicting rules?)
→ Developer updates CLAUDE.md with a corrected or new rule
→ Next session: Claude generates correct pattern
→ Rule stays in config permanentlyThe update loop is how your configuration system learns from experience. Each bad output is a signal that something is missing or broken in your context engineering. Treat it as a bug report against CLAUDE.md, not just a one-off failure.
Practical format for rule updates:
When adding a rule from a failure, include the rationale inline:
- Use the `Result<T, E>` type for service functions, not try/catch
(Rationale: try/catch at service level hides error types from callers;
Result forces explicit error handling at the call site)The rationale serves two purposes: it helps future auditors understand why the rule exists, and it gives Claude better context for applying the rule correctly.
Knowledge Feeding After Sprints
At the end of each sprint or release cycle, run a brief knowledge feeding session:
- New patterns: "We standardized on X approach for Y type of problem in this sprint. Add this to CLAUDE.md."
- Anti-patterns discovered: "We tried X and it caused Y. Add a rule to avoid it."
- Architecture decisions: "We decided to use X over Y because Z. Document this so Claude doesn't suggest Y."
- Deprecated patterns: "We're moving away from X. Add a rule to use Y instead and flag existing X usages."
This keeps the context system current without requiring large periodic overhauls.
The ACE Pipeline
For teams that run Claude Code in automated or semi-automated workflows, the ACE pipeline provides a structured execution model. This is a config-persistence loop operating across sessions. It is distinct from arXiv:2510.04618 (Stanford/SambaNova, Oct 2025), which uses the same acronym for an inference-time context evolution technique. For the operational improvements that build on this pipeline, see Section 10 (Signal Taxonomy) and Section 11 (Loop Closure).
Assemble → Check → ExecuteAssemble: Build context from the team profile + project modules. Produces a CLAUDE.md specific to the developer and task context.
Check: Run canary validation, a set of 3-5 test prompts that verify key behaviors before the actual task. If canary checks fail, fix the context issue before proceeding.
Execute: Run Claude with the validated context on the actual task.
#!/usr/bin/env bash
# ace.sh — Assemble, Check, Execute
PROFILE="${1:-}"
TASK="${2:-}"
if [[ -z "$PROFILE" || -z "$TASK" ]]; then