This directory is the implementation guide for FirstCoder. It is deliberately different from the repository README: the README tells a user how to start the application; these documents explain what happens after they press Enter, where that behavior lives in source, and how to prove a change is correct.
The documentation follows one rule: a claim about runtime behavior must point
to its real implementation boundary. In particular, tool descriptions and JSON
schemas are sent in the provider request's native tools field, not copied into
the system prompt. Permission safety is enforced by program code, not by a
sentence in a prompt.
Read in this order if you are new to the codebase:
- Architecture — package boundaries, dependency rules, and the coupling cleanup.
- Codebase Reading Guide — a map and a first end-to-end trace.
- CLI / TUI Design — process startup, dependency assembly, commands, streaming, and UI state.
- Agent Loop Guardrails — the transaction that turns one user message into model calls and tool results.
- Multimodal Input Design — attachment staging, durable storage, and provider projection.
- Tools Design and Permissions Design — how a model request becomes a controlled local operation.
- Context Management Design — durable facts, provider projection, compaction, and task boundaries.
- Providers Design and Skill System Design — the two main extension seams.
Each design document contains a runnable observation and links to relevant tests. Read code with the document open; the goal is to build an executable mental model, not memorize a directory tree.
| Question | Document |
|---|---|
| What are the package boundaries and dependency rules? | Architecture / 中文 |
| How is the terminal app assembled and updated? | CLI / TUI Design / 中文 |
| How do pasted files and clipboard images become provider content? | Multimodal Input Design / 中文 |
| When does a turn stop, pause, or continue? | Agent Loop Guardrails / 中文 |
| How can long conversations fit a model context window? | Context Management Design / 中文 |
| Why does a write or shell call need approval? | Permissions Design / 中文 |
| How are function schemas and executors connected? | Tools Design / 中文 |
| How does incremental task tracking work? | Unified TaskPlan implementation plan |
| How are OpenAI-compatible and Anthropic protocols normalized? | Providers Design / 中文 |
| How are local skills found and safely loaded? | Skill System Design / 中文 |
| How are external MCP tools configured and permissioned? | MCP Client / 中文 |
Harbor Evaluation is FirstCoder's only benchmark integration. Harbor owns task datasets, isolated environments, verification, and result artifacts; FirstCoder runs inside each task as the agent.
When changing a runtime boundary, update its design document in the same pull request. Include: the new call path, affected state, one failure mode, and a focused test command. Do not document speculative features as available. A short accurate limitation is much more useful than polished fiction.