Skip to content

Commit 01024a9

Browse files
sanbuphyclaude
andcommitted
Rewrite lecture narratives for natural, conversational tone
- Rewrite all 12 Chinese lectures with warmer, more engaging prose - Remove rigid "四种/五种 xxx" numbered list patterns - Vary narrative structure across lectures instead of uniform template - Sync English translations to match new Chinese content - Keep mermaid diagrams, code blocks, exercises, and references intact Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7eb499e commit 01024a9

24 files changed

Lines changed: 808 additions & 1208 deletions

File tree

  • docs
    • en/lectures
      • lecture-01-why-capable-agents-still-fail
      • lecture-02-what-a-harness-actually-is
      • lecture-03-why-the-repository-must-become-the-system-of-record
      • lecture-04-why-one-giant-instruction-file-fails
      • lecture-05-why-long-running-tasks-lose-continuity
      • lecture-06-why-initialization-needs-its-own-phase
      • lecture-07-why-agents-overreach-and-under-finish
      • lecture-08-why-feature-lists-are-harness-primitives
      • lecture-09-why-agents-declare-victory-too-early
      • lecture-10-why-end-to-end-testing-changes-results
      • lecture-11-why-observability-belongs-inside-the-harness
      • lecture-12-why-every-session-must-leave-a-clean-state
    • zh/lectures
      • lecture-01-why-capable-agents-still-fail
      • lecture-02-what-a-harness-actually-is
      • lecture-03-why-the-repository-must-become-the-system-of-record
      • lecture-04-why-one-giant-instruction-file-fails
      • lecture-05-why-long-running-tasks-lose-continuity
      • lecture-06-why-initialization-needs-its-own-phase
      • lecture-07-why-agents-overreach-and-under-finish
      • lecture-08-why-feature-lists-are-harness-primitives
      • lecture-09-why-agents-declare-victory-too-early
      • lecture-10-why-end-to-end-testing-changes-results
      • lecture-11-why-observability-belongs-inside-the-harness
      • lecture-12-why-every-session-must-leave-a-clean-state

docs/en/lectures/lecture-01-why-capable-agents-still-fail/index.md

Lines changed: 59 additions & 67 deletions
Large diffs are not rendered by default.

docs/en/lectures/lecture-02-what-a-harness-actually-is/index.md

Lines changed: 44 additions & 54 deletions
Large diffs are not rendered by default.

docs/en/lectures/lecture-03-why-the-repository-must-become-the-system-of-record/index.md

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,21 @@
55
66
# Lecture 03. Make the Repository Your Single Source of Truth
77

8-
## What Problem Does This Lecture Solve?
8+
Your team's architecture decisions are scattered across Confluence, Slack, Jira, and a few senior engineers' heads. For humans this barely works — you can ask a colleague, search chat history, dig through docs. If all else fails, you can corner someone in the break room. But for an AI agent, information that's not in the repository simply does not exist.
99

10-
Your team's architecture decisions are scattered across Confluence, Slack, Jira, and a few senior engineers' heads. For humans this barely works — you can ask a colleague, search chat history, dig through docs. But for an AI agent, information that's not in the repository simply does not exist.
10+
This isn't an exaggeration. Think about what an agent's inputs actually are: system prompts and task descriptions, file contents from the repository, and tool execution output. That's it. Your Slack history, Jira tickets, Confluence pages, and that architecture decision you discussed with a colleague over coffee on Friday afternoon — the agent can't see any of it. It can't "go ask someone" or "search the chat history." It's an engineer locked inside the repository — everything outside, it knows nothing about.
1111

12-
This lecture explains why you must put everything an agent needs to know into the repo, and how to do it without turning into "writing a bunch of docs nobody reads." The core idea isn't "write more documentation" — it's "put critical decision information where the agent can see it."
12+
So the question becomes: are you going to give this engineer a good map?
1313

14-
## Core Concepts
14+
## What Belongs on the Map
15+
16+
OpenAI states this bluntly: **information that doesn't exist in the repo, doesn't exist for the agent.** They call this the "repo as spec" principle — the repository itself is the highest-authority specification document.
17+
18+
Anthropic's long-running agents documentation echoes this: persistent state is a necessary condition for long-task continuity. Cross-session knowledge recoverability directly determines task success rates. And this state must exist in the repository — because that's the only stable, accessible storage the agent has.
1519

16-
- **Knowledge Visibility Gap**: The proportion of total project knowledge that's NOT in the repository. The bigger the gap, the higher the agent's failure rate.
17-
- **Single Source of Truth**: The code repository as the authoritative source for project decisions, architecture constraints, execution state, and verification standards. The repo is the final word.
18-
- **Cold-Start Test**: Open a brand new agent session using only repo contents — can it answer five basic questions: What is this system? How is it organized? How do I run it? How do I verify it? Where are we now?
19-
- **Discovery Cost**: How much context budget the agent burns to find a key piece of information in the repo. Information hidden in obscure locations has high discovery cost, leaving less budget for the actual task.
20-
- **Knowledge Decay Rate**: The proportion of knowledge entries that become stale per unit of time. Documentation going out of sync with code is the biggest enemy.
21-
- **ACID for Agent State**: Applying database transaction principles (Atomicity, Consistency, Isolation, Durability) to agent state management.
20+
You might think: "Our team is small, knowledge is in everyone's heads, and it works fine." Sure, for humans. But if you're using an agent, accept this fact: the agent can't ask people. Everything it needs to know must be written down and placed where it can find it.
21+
22+
This isn't about "writing more documentation." It's about "putting decision information in the right place." A 50-line `ARCHITECTURE.md` in the `src/api/` directory is ten thousand times more useful than a 500-page design document in Confluence that nobody maintains. It's like a hand-drawn office map taped to your desk versus a beautiful architectural blueprint locked in a filing cabinet — the former is right there when you need it; the latter is technically superior but useless in the moment.
2223

2324
## Knowledge Visibility
2425

@@ -33,6 +34,8 @@ flowchart LR
3334
Warning["If a rule is not in the repo,<br/>the agent cannot see it"] --> Agent
3435
```
3536

37+
How do you test whether your map is good enough? Run a "cold-start test": open a brand new agent session using only repo contents, and see if it can answer five basic questions:
38+
3639
```mermaid
3740
flowchart TB
3841
Q1["What is this system?"] --> A1["AGENTS.md / README"]
@@ -48,29 +51,24 @@ flowchart TB
4851
A5 --> Ready
4952
```
5053

51-
## Why This Happens
52-
53-
Think about what an agent's inputs actually are: system prompts and task descriptions, file contents from the repository, and tool execution output. That's it. Your Slack history, Jira tickets, Confluence pages, and that architecture decision you discussed with a colleague over coffee on Friday afternoon — the agent can't see any of it.
54+
If it can't answer, the map has blank spots. Where the map is blank, the agent guesses — wrong guesses become bugs, excessive guessing wastes context. And every new session guesses all over again. The cost of guessing is always higher than the cost of drawing the map properly in the first place.
5455

55-
This isn't a bug — it's the agent's cognitive architecture. It can't "go ask someone" or "search the chat history" like a human would.
56-
57-
This creates a practical problem: when critical project knowledge only exists outside the repo, the agent either does it wrong (because it doesn't know an implicit rule) or wastes enormous context re-discovering that knowledge. And every new session has to redo this discovery.
58-
59-
OpenAI's harness engineering article states this bluntly: **information that doesn't exist in the repo, doesn't exist for the agent.** They call this the "repo as spec" principle — the repository itself is the highest-authority specification document.
60-
61-
Anthropic's long-running agents documentation echoes this: persistent state is a necessary condition for long-task continuity. Cross-session knowledge recoverability directly determines task success rates. And this state must exist in the repository — because that's the only stable, accessible storage the agent has.
62-
63-
You might think: "Our team is small, knowledge is in everyone's heads, and it works fine." Sure, for humans. But if you're using an agent, accept this fact: the agent can't ask people. Everything it needs to know must be written down and placed where it can find it.
56+
## Core Concepts
6457

65-
This isn't about "writing more documentation." It's about "putting decision information in the right place." A 50-line `ARCHITECTURE.md` in the `src/api/` directory is ten thousand times more useful than a 500-page design document in Confluence that nobody maintains.
58+
- **Knowledge Visibility Gap**: The proportion of total project knowledge that's NOT in the repository. The bigger the gap, the higher the agent's failure rate. How much implicit knowledge about this project lives in your head? Count it all, then see how much made it into the repo — the difference is your visibility gap.
59+
- **System of Record**: The code repository as the authoritative source for project decisions, architecture constraints, execution state, and verification standards. The repo has the final word, nowhere else counts. Like a map that marks "road closed" — you won't go down that road. But if that information only exists in Old Zhang's head, you have to ask Old Zhang every time.
60+
- **Cold-Start Test**: The five questions above. How many it can answer is how complete your map is.
61+
- **Discovery Cost**: How much context budget the agent burns to find a key piece of information in the repo. The more hidden the information, the higher the discovery cost, and the less budget left for the actual task. Hiding critical information in a README ten directory levels deep is like locking the fire extinguisher in a basement safe — it exists, but you can't find it when you need it.
62+
- **Knowledge Decay Rate**: The proportion of knowledge entries that become stale per unit of time. Documentation going out of sync with code is the biggest enemy — worse than no documentation at all.
63+
- **ACID Analogy**: Applying database transaction principles (Atomicity, Consistency, Isolation, Durability) to agent state management. We'll expand on this below.
6664

67-
## How to Do It Right
65+
## How to Draw a Good Map
6866

69-
**Principle 1: Knowledge lives next to code.** A rule about API endpoint authentication belongs next to the API code, not buried in a giant global document. Put a short doc in each module directory explaining that module's responsibilities, interfaces, and special constraints.
67+
**Principle 1: Knowledge lives next to code.** A rule about API endpoint authentication belongs next to the API code, not buried in a giant global document. Put a short doc in each module directory explaining that module's responsibilities, interfaces, and special constraints. Like library shelf labels — you want history books, go straight to the shelf marked "History." No need to search the entire library.
7068

7169
**Principle 2: Use a standardized entry file.** `AGENTS.md` (or `CLAUDE.md`) is the agent's "landing page." It doesn't need to contain all information, but it must let the agent quickly answer three questions: "What is this project," "How do I run it," and "How do I verify it." 50-100 lines is enough.
7270

73-
**Principle 3: Minimal but complete.** Every piece of knowledge should have a clear use case. If removing a rule doesn't affect the agent's decision quality, that rule shouldn't exist. But every question from the cold-start test must have an answer.
71+
**Principle 3: Minimal but complete.** Every piece of knowledge should have a clear use case. If removing a rule doesn't affect the agent's decision quality, that rule shouldn't exist. But every question from the cold-start test must have an answer. This is a delicate balance — not too much, not too little, just enough.
7472

7573
**Principle 4: Update with code.** Bind knowledge updates to code changes. The simplest approach: put architecture docs in the corresponding module directory. When you modify code, you naturally see the doc. After code changes, CI can remind you to check if docs need updating.
7674

@@ -91,34 +89,36 @@ project/
9189
└── Makefile # Standardized commands: setup, test, lint, check
9290
```
9391

94-
**Managing agent state with ACID principles**:
92+
## Managing Agent State with ACID Principles
93+
94+
This analogy comes from database transaction management — you might think it's overcomplicating things, but it actually gives you a very practical framework:
9595

96-
- **Atomicity**: Each "logical operation" (e.g., "add new endpoint and update tests") gets one git commit. If it fails midway, `git stash` to roll back.
97-
- **Consistency**: Define "consistent state" verification predicates — all tests pass, lint reports zero errors. The agent runs verification after each operation; inconsistent intermediate states don't get committed.
98-
- **Isolation**: When multiple agents work concurrently, design state files to avoid race conditions. Simple approach: each agent uses its own progress file, or use git branches for isolation.
99-
- **Durability**: Critical project knowledge lives in git-tracked files. Temporary state can stay in session memory, but cross-session knowledge must be persisted to files.
96+
- **Atomicity**: Each "logical operation" (e.g., "add new endpoint and update tests") gets one git commit. If it fails midway, `git stash` to roll back. All or nothing — no "half done."
97+
- **Consistency**: Define "consistent state" verification predicates — all tests pass, lint reports zero errors. The agent runs verification after each operation; inconsistent intermediate states don't get committed. Like a bank transfer — you can't debit without crediting.
98+
- **Isolation**: When multiple agents work concurrently, design state files to avoid race conditions. Simple approach: each agent uses its own progress file, or use git branches for isolation. Two chefs can't season the same pot simultaneously — who takes responsibility when it's over-salted?
99+
- **Durability**: Critical project knowledge lives in git-tracked files. Temporary state can stay in session memory, but cross-session knowledge must be persisted to files. What's in your head doesn't count — only what's on paper counts.
100100

101-
## Real-World Example
101+
## A Real Transformation Story
102102

103103
A team maintained an e-commerce platform with ~30 microservices. Architecture decisions (inter-service communication protocols, data consistency strategies, API versioning rules) were scattered across: Confluence (partially outdated), Slack (hard to search), a few senior engineers' heads (not scalable), and sporadic code comments (not systematic).
104104

105-
After introducing AI agents, 70% of tasks required human intervention. Nearly every failure involved the agent violating some "everyone knows but nobody wrote down" implicit constraint.
105+
After introducing AI agents, 70% of tasks required human intervention. Nearly every failure involved the agent violating some "everyone knows but nobody wrote down" implicit constraint. It's like a new employee whom nobody told "you need to post your lunch order in the group chat" — they guess wrong, get scolded, but after the scolding still nobody tells them the rule.
106106

107107
The team executed a transformation:
108108
1. Created `AGENTS.md` in the repo root with project overview, tech stack versions, and global hard constraints
109109
2. Added `ARCHITECTURE.md` in each microservice directory describing responsibilities, interfaces, and dependencies
110110
3. Created a centralized `CONSTRAINTS.md` with hard constraints in explicit "MUST/MUST NOT" language
111111
4. Added `PROGRESS.md` in each service directory tracking current work status
112112

113-
After transformation: the same agent could answer all key project questions on cold start, and task completion quality improved significantly (Anthropic's controlled experiment showed that a full harness enables agents to deliver runnable applications, while bare runs cannot).
113+
After transformation: the same agent could answer all key project questions on cold start, and task completion quality improved significantly.
114114

115115
## Key Takeaways
116116

117-
- Knowledge not in the repo doesn't exist for the agent. Putting critical decisions in the repo is the most basic harness investment.
117+
- Knowledge not in the repo doesn't exist for the agent. Putting critical decisions in the repo is the most basic harness investment — draw a good map so you don't get lost.
118118
- Use the "cold-start test" to evaluate repo quality: can a fresh session answer five basic questions using only repo contents?
119119
- Knowledge should be near code, minimal but complete, and updated with code. It's not about writing more docs — it's about putting information in the right place.
120120
- Use ACID principles for agent state: atomic commits, consistency verification, concurrency isolation, durable critical knowledge.
121-
- Knowledge decay is the biggest enemy. Documentation out of sync with code is more dangerous than no documentation.
121+
- Knowledge decay is the biggest enemy. Documentation out of sync with code is more dangerous than no documentation — it sends the agent in the wrong direction while they think they're right.
122122

123123
## Further Reading
124124

0 commit comments

Comments
 (0)