# Harness Engineering From CC to AI Coding: a book built from a minified Claude Code build

> A Chinese technical book that takes the public Claude Code v2.1.88 release package and its source maps apart to recover how the agent loop, context budget, permissions and hooks are actually built. The English edition is scaffolding.

**ZhangHanDong/harness-engineering-from-cc-to-ai-coding** — Harness Engineering From Claude Code source code to AI Coding

- Repository: https://github.com/ZhangHanDong/harness-engineering-from-cc-to-ai-coding
- Website: https://zhanghandong.github.io/harness-engineering-from-cc-to-ai-coding/
- Stars: 1,512 · Forks: 274
- Language: HTML
- License: MIT
- Published: 2026-10-07 · Updated: 2026-10-07 · Language: en
- Canonical page: https://hysenlabs.com/projects/zhanghandong-harness-engineering-from-cc-to-ai-coding

## The evidence base is a shipped bundle, not a source release

Claude Code is distributed as a compiled product rather than open source, so the author's method was to take the public release package for version `v2.1.88` and work from its source maps to recover structure. The README is explicit that the aim is not to reproduce Anthropic's documentation but to extract architectural patterns from a real implementation, and the notes section repeats that the content is for technical study and does not represent Anthropic's official position.

That provenance matters for how you weigh claims. Source maps give you function boundaries, module groupings and call structure. They do not give you the original variable names, the original comments, or the reasoning behind a design decision. So a chapter describing a compaction threshold can tell you a number exists and where it is enforced; it cannot tell you why that number was chosen. Readers who approach this expecting official documentation will find something different and arguably more useful, since it describes what shipped rather than what was intended.

The version number is the other constraint. Every structural claim is pinned to `v2.1.88`. A CLI product on a fast release cadence will have moved, so treat the book as a snapshot of one build and check whether the patterns it describes still match what you can observe in the version you use.

## Seven parts moving from agent loop up to production practice

The book is organised as seven main parts plus four appendices, and the ordering is the argument: you cannot discuss caching before you understand context, and you cannot discuss permissions before you understand what the agent is allowed to do.

The first part covers overall architecture, the agent loop and tool execution orchestration. The second moves to prompt engineering, covering the system prompt, tool prompts, and model specific tuning. The third is context management, which in this book's framing means auto compaction, micro compaction, token budgets and prompt cache behaviour rather than generic advice about writing shorter prompts.

Part four isolates prompt caching as its own topic. Part five is security and permissions, covering permission modes, the rule system, a YOLO classifier and hooks. Part six covers advanced subsystems: multi agent orchestration, a skills system, feature flags and a pipeline for unreleased capabilities. The seventh part is lessons learned from building AI agents, aimed at people who write these systems rather than use them.

The audience is stated as engineers working on AI coding, agent frameworks and model tool calling platforms, developers who want to understand Claude Code's implementation in detail, and teams trying to turn source analysis into reusable patterns. The primary language is Chinese, with a short English alias, and the repository tracks only what the published site needs, which is why the file list is short.

## Compaction and token budgets treated as a resource problem

The chapter list puts auto compaction and micro compaction in the same bucket as token budgets and prompt caching, which is the most useful thing the outline reveals. Most discussions of coding agents treat context overflow as an error to avoid. A production harness treats it as a budget to manage, and that framing changes what you build.

Auto compaction is the coarse move: when the window fills, summarize and continue. Micro compaction operates at a smaller granularity, presumably trimming or rewriting specific segments rather than the whole transcript. Which one you need depends on whether your failure mode is a runaway session or a long one that is mostly still relevant. A harness that only has the coarse move will summarize away detail the user still needs; one with only fine-grained trimming has no answer for a genuinely full context.

Prompt caching interacts with both. Cacheable prefixes are wasted if compaction rewrites the head of the conversation, so the order of operations between trimming and caching decides whether you are re-billing the same thousands of tokens on every turn. The book lists this as a dedicated part rather than a subsection, which suggests it treats it as a first-class subsystem. If you are building a harness and have not thought about the interaction between compaction and cache invalidation, that part is the one to read.

The README does not give numbers, thresholds or configuration keys, so the specifics have to come from the hosted pages or the appendices.

## Permission modes, rules and the YOLO classifier

Part five is the one most likely to change how you design a harness. It lists permission modes, a rule system, a YOLO classifier and hooks, which reads as four distinct mechanisms rather than one.

Permission modes give the user a dial for how much the agent can do without asking, from read only through to full auto. Rules are the fine-grained allow and deny layer beneath that. Hooks let you run your own code at defined points in the loop, which is how you would add audit logging, secret redaction or a project specific check without patching the agent. The YOLO classifier is the most interesting of the four to read about, because a classifier sitting in the permission path suggests the system learns or estimates whether an action is risky rather than matching it against a fixed list.

That design has obvious appeal and obvious failure modes. A classifier that is too eager makes the agent feel dangerous; one that is too cautious trains users to click through every prompt until they stop reading. The useful question, which the book presumably addresses somewhere in part five, is what happens on a false positive. The README does not describe the false positive path, so if permission safety is your concern, that is the section to read closely and the failure behaviour you will have to judge for yourself.

Feature flags appear in part six alongside the unreleased capability pipeline, which suggests permission and tool behaviour is expected to change over time behind switches. For anyone wrapping a harness, that means treating its permission surface as a versioned API.

## Reading it locally with mdbook

The site is built with mdBook, which is the Rust book tool, and both the Chinese and English editions are standard mdBook layouts in the tree. Two commands are all it takes:

```bash
mdbook build book
mdbook serve book
```

The default preview address is `http://localhost:3000`. The English edition lives in `book-en/`, so you would build that directory to preview it instead, and it will look sparse for the reason described below.

The tree also contains directories that are not chapters: `examples/` with a `code-review-agent/` subdirectory, `scripts/`, `specs/`, `docs/` and a `.claude/` folder alongside a `CLAUDE.md` at the root. A `CLAUDE.md` in a repository about coding agents is a small signal about the author's own workflow, and the `examples/code-review-agent/` entry suggests the book is accompanied by at least one runnable agent rather than prose alone.

Publishing is GitHub Pages from the `main` branch, with the repository deliberately tracking only files needed for the book to deploy. That is a sensible choice for a reading project and explains why the repository looks sparse next to the size of the topic.

## The English edition is a shell, and that is the practical limit

The README states this plainly: the English site already has its directories, cover and chapter placeholder pages, with per-chapter translation still to be completed. Both hosted URLs exist, the English one marked as a preview. So an English reader currently gets the outline, the cover and the promise rather than the text.

Set against that, the Chinese edition is described as complete across seven parts and four appendices, with a published technical book behind a hosted site, and the repository carries an MIT `LICENSE` file. The licence situation is straightforward, and the repository metadata agrees with it.

There are no GitHub releases, and the last push was on 2026-04-10. For a book project that is not a concern; for a pattern catalogue extracted from a moving CLI it means the reconstruction has a fixed anchor version and no changelog recording which chapters were revised as the product moved.

The practical reading order is the seven part outline as a checklist against your own harness. If you are missing auto compaction, that is part three. If your context strategy and your caching strategy have never been reconciled, that is part four. If you have permissions but no hooks, that is part five. The book is most valuable to someone who already knows the shape of the problem and wants a second engineer's reconstruction of the answers, which is also what its stated audience asks for.

## Conclusion

This repository is worth reading if you build AI coding agents and want someone else's reconstruction of the hard parts rather than your own. The value is concentrated in the middle chapters, where compaction, prompt caching, permission modes and hooks get treated as engineering problems with budgets and failure modes. Two constraints bound that value. The analysis starts from a distributed minified bundle and source maps, so identifiers are recovered rather than original, and a version string of v2.1.88 dates the evidence. And the English site is currently a skeleton: the README says it has directories, a cover and chapter placeholders with translation still to come, which means an English reader gets the structure and the reading list rather than the chapters. Start with the Chinese pages on the hosted site, and if you want the transferable ideas without the language, the seven part outline in the README maps closely enough onto the engineering problems you are already solving.

## FAQ

### What is harness engineering in AI agents?

Harness engineering is the practice of building the system around a model rather than the prompt alone: the agent loop, tool execution, context budgeting, permission enforcement, caching and hooks that turn a language model into something you can run in production. This book studies that layer by reverse engineering a shipped Claude Code build, and part six covers orchestration, skills and feature flags as instances of it.

### Which AI coding harness is considered the best?

The book does not rank harnesses. It takes Claude Code version v2.1.88 apart and describes how one implementation handles the agent loop, context compaction, prompt caching and permissions, then generalises those into reusable patterns. Whether those patterns transfer to the harness you use is the judgement the book leaves to you.

### Is the English edition of this harness engineering book finished?

No. The README says the English site has its directories, cover and chapter placeholder pages in place, with translation to be filled in chapter by chapter. The Chinese edition is the complete one, and it also carries a short English alias alongside it.

### How do I build and preview the book locally?

It is an mdBook project. Run `mdbook build book` to build it and `mdbook serve book` to preview it, which serves on `http://localhost:3000` by default. The English edition lives in the `book-en/` directory and builds the same way.

## Sources

- [Issues](https://github.com/ZhangHanDong/harness-engineering-from-cc-to-ai-coding/issues)
- [License: MIT](https://github.com/ZhangHanDong/harness-engineering-from-cc-to-ai-coding/blob/main/LICENSE)
- [Project website](https://zhanghandong.github.io/harness-engineering-from-cc-to-ai-coding/)
- [README](https://github.com/ZhangHanDong/harness-engineering-from-cc-to-ai-coding/blob/main/README.md)
- [ZhangHanDong/harness-engineering-from-cc-to-ai-coding on GitHub](https://github.com/ZhangHanDong/harness-engineering-from-cc-to-ai-coding)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/zhanghandong-harness-engineering-from-cc-to-ai-coding
