claude-code-source-analysis (xiaonancs)
Summary
A systems-engineering reconstruction of the complete Claude Code agent harness from a reverse-engineered v2.1.88 snapshot (includes the extracted source zip plus appendix analyses). Part of a series that also covers OpenAI Codex CLI internals, giving a comparative harness view.
Key Takeaways
- Reconstructs the full harness from an actual extracted v2.1.88 snapshot
- Sister studies (Codex CLI) enable cross-harness comparison
- Strong on context management and compaction mechanics
Reliability Note
Independent reverse-engineering effort - unofficial, verify against official Anthropic docs and behavior.
Flows informed by this source
4Implement Context Compaction
Keep long agent sessions alive by compacting old conversation into structured summaries before the context window fills.
+1 more steps to Done
Best forproduction-grade builds with strict verification
Session Summaries That Survive Compaction
Write durable session summaries at the right moments so knowledge outlives compaction and process restarts.
+1 more steps to Done
Best forbuilders who have shipped a basic app before
Prompt-Cache-Aware Conversation Design
Structure your agent's context for prefix caching: stable prefixes, append-only history, and cache-friendly dynamic content.
Best forbuilders who have shipped a basic app before
Tool Result Size Management
Stop tool outputs from flooding context: budgets per tool, smart truncation, pagination, and reference-based results.
+1 more steps to Done
Best forbuilders who have shipped a basic app before