中文 | English
First ask: which mainline step does this example sit on? Then ask: what real complexity does the source add at that step?
If you have not yet located the step, go back to the mainline source map. If you want the staged learning route, return to the Learning Paths.
The source files listed below are first-hop reading targets, not exhaustive ownership boundaries for that behavior.
| Example | Mainline step | What the example intentionally simplifies | Which source files to open next |
|---|---|---|---|
l1_startup.py |
Step 1 — Startup / mode routing | compresses CLI parsing, global config, and runtime-mode dispatch into one startup skeleton | main.tsx, setup.ts, cli/print.ts |
l2_agent_loop.py |
Step 2 — Enter query / queryLoop |
compresses QueryEngine, turn state, and history assembly into one minimal loop | QueryEngine.ts, query.ts |
l3_tool_system.py |
Step 3 — Model output / tool selection | compresses the real tool pool, schemas, and mode filtering into a small registry story | Tool.ts, tools.ts, query.ts |
l4_ui_ink.py |
Step 6 — State / UI update | compresses the Ink component tree, state slices, and message rendering into one visible feedback loop | bootstrap/state.ts, screens/REPL.tsx, components/Messages.tsx |
l5_state_commands.py |
Step 6 — State / UI update | compresses pending-message flow, command dispatch, and history sync into a simplified state machine | screens/REPL.tsx, history.ts, commands/ |
l6_advanced.py |
Step 3 — Model output / tool selection | compresses the real multi-agent / structured-output boundary into a “restricted tools + constrained worker” sketch | tools/SyntheticOutputTool/, coordinator/coordinatorMode.ts, cli/print.ts |
l7_permissions.py |
Step 4 — Tool execution | compresses layered permissions, auto-approval, and dangerous-command checks into one gatekeeper | tools/BashTool/bashPermissions.ts, tools/BashTool/bashSecurity.ts, query.ts |
l8_streaming.py |
Step 3 — Model output / tool selection | compresses provider event streams, chunk repair, and stop-reason handling into a readable async-generator view | services/api/claude.ts, query.ts |
l9_context_mgmt.py |
Step 7 — Next turn / exit conditions | compresses prompt cache, context trimming, and memory extraction into one “how the next turn survives” story | constants/prompts.ts, utils/context.ts, memdir/memdir.ts, services/extractMemories/extractMemories.ts |
- Use the table to locate the example’s mainline step.
- Open the matching source-map section and verify the input / output pair.
- Open only the 1 to 3 source files listed in the table before branching out.
- After those files are stable in your head, decide whether to expand into the matching layer note or source-navigation.
l1 -> l2 -> l8 -> l7 -> l4/l5 -> l9: read in the order a real request actually moves.l3 -> l7 -> l6: lock onto tools and permissions first, then see how controlled multi-agent work reconnects to the mainline.