One document per Go package under internal/ (plus the cmd entrypoint) that
has non-trivial behavior. Pages are grouped into rank-numbered layer folders
so the directory listing mirrors the dependency stack, top → bottom:
packages/
├── 0-cmd/ rank 0 entrypoint / wiring
├── 1-app/ rank 1 Bubble Tea TUI
├── 2-feature/ rank 2 domain capabilities
├── 3-core/ rank 3 shared contracts
└── 4-infrastructure/ rank 4 stateless helpers
A higher layer may import a lower one; never the reverse (enforced by
tools/layercheck). See ../reference/dependency-rules.md
and ../reference/package-map.md for the
authoritative layer assignment.
Filenames match the package name with no suffix (hook.md, not hooks.md).
Translations sit beside the source with a .zh.md suffix (hook.zh.md), so
the layer structure is expressed once and a missing or stale translation is
visible right next to its original. Every page follows TEMPLATE.md.
| Package |
One-liner |
cmd |
Entrypoint: flag parsing, dependency wiring, provider blank-imports. |
| Package |
One-liner |
app |
Bubble Tea TUI shell, MVU loop, sub-model decomposition. Seed page; rewrite to TEMPLATE pending. |
| Package |
One-liner |
agent |
Main agent session lifecycle (Start/Stop/Send/Outbox + permission bridge). |
broker |
Routes messages between agents: addresses keyed by agent id, for main↔subagent messages and completions. |
command |
Slash command registry (builtin + dynamic + custom + plugin-scoped). |
cron |
Cron expressions and one-shot scheduling for /loop and /schedule. |
hook |
Pre/post hook engine with command / HTTP / LLM / function executors. |
inspector |
Local web UI for transcript replay; SSE live-tail. |
llm |
Provider registry, model store, Client factory implementing core.LLM. |
mcp |
MCP client + transport + Caller for external tool servers. |
plugin |
Plugin loader / installer / marketplace; pushes contributions to other feature packages. |
reminder |
<system-reminder> queue with provider re-emission. |
search |
Pluggable web search backends behind a small Provider interface. |
session |
Transcript persistence, resume, fork, projection. |
setting |
Settings loader + central permission decision gate. |
selflearn |
Background review loop that writes durable memory and agent-created skills. |
skill |
Skill loader, state store, active-skills block consumed by the skills-directory reminder. |
subagent |
Subagent registry + Executor that spawns background core.Agent instances. |
task |
Background task manager (bash and agent tasks). |
tool |
Tool registry, schemas, permission gate, side-effect store. |
| Package |
One-liner |
core |
Agent primitive, System, Tools, LLM, Message — the stable contracts every feature shares. |
| Package |
One-liner |
infrastructure |
log / secret / filecache / markdown / confdir / proc — stateless helpers documented together. |
Model citizens for what feature packages should look like — minimal interface,
concrete return types, no kitchen-sink Service:
reminder — concrete *Service struct, small 2-method Provider interface.
search — pure consumer-defined Provider, no singleton.
worktree — two functions, no types.