Files
deepseek-harness/docs/event-producer-consumer.md
Tianyi Cui c0808d5126 docs: the governing principle — every LLM request is reconstructable from the session log
The reconstructability RFC is the principle's home: model-visible ⟺
logged in both forms, the mechanism (boundary derivation + header
fold), the enforcement (write-time round-trip guard, the dev
invariant), the corollaries ranked (prefix-cache stability first), the
MiniCode lineage with the provenance arrow inverted, and the
alternatives it beat — including the stateful transmission client
whose three-design archaeology lives in PR #162.

Placements per the one-home-per-fact taxonomy: a standing-order line in
root AGENTS.md (with displacement trims to stay inside the 1,575-word
ceiling), the principle statement in architecture.md § Session Log and
its Turn Flow lines (condensed to the ratcheted 1,630 ceiling), the
request-envelope section in core-data-structures/core.md with the
LlmCallConfig paste, both review-requested FIXMEs
(FIXME(call-config-shape) beside the type, FIXME(catalog-verbs) at the
catalog's drift-gate note), cookbook rows redirected off agent/request
(tool filtering → system-prompt/assemble, plan-mode prompt → sections/
inject()), and the llm/stream JSDoc stating the frozen-request
contract. RFC index and all generated catalogs regenerated.
2026-07-06 03:49:35 +08:00

6.8 KiB

Event Producer And Consumer Matrix

This matrix shows which packages dispatch each harness-owned event and which packages listen to it. It is intentionally a table rather than one large graph: events are many-to-many, and dense relation data is easier to review in rows. Dynamic dispatch overrides cover sites that deliberately bypass ctx.emit, such as subagent lifecycle containment.

Event Mode Declared in Dispatchers Listeners
agent/created emit packages/core/agent/src/types.ts:248 agent (emit) stdio-agent
agent/disposed emit packages/core/agent/src/types.ts:255 agent (emit) stdio-agent
agent/error emit packages/core/agent/src/types.ts:404 agent-loop (emit) -
agent/pre-step serial packages/core/agent/src/types.ts:333 agent-loop (serial) compact-basic
agent/prompt-submit waterfall packages/core/agent/src/types.ts:346 agent-loop (waterfall) hooks-claude, hooks-codex
agent/queued emit packages/core/agent/src/types.ts:273 agent-loop (emit) -
agent/request waterfall packages/core/agent/src/types.ts:369 agent-loop (waterfall) -
agent/session-start emit packages/core/agent/src/types.ts:288 agent-loop (emit) hooks-claude, hooks-codex
agent/status emit packages/core/agent/src/types.ts:264 agent-loop (emit) acp, invariants, stdio-agent
agent/step-result waterfall packages/core/agent/src/types.ts:379 agent-loop (waterfall) -
agent/turn-continuation waterfall packages/core/agent/src/types.ts:392 agent-loop (waterfall) hooks-claude, hooks-codex
fs/edit-intent waterfall packages/fs/fs/src/index.ts:123 tool-fs (waterfall) fs-policy
fs/observed emit packages/fs/fs/src/index.ts:138 tool-fs (emit) fs-policy
fs/write-intent waterfall packages/fs/fs/src/index.ts:109 tool-fs (waterfall) fs-policy
llm/stream waterfall packages/llm/llm/src/index.ts:39 llm (waterfall) invariants, llm-replay
session/created emit packages/core/session/src/index.ts:39 session (emit) invariants, session-persistence
session/event emit packages/core/session/src/index.ts:47 session (emit) acp, invariants, session-persistence, stdio-agent
session/flush parallel packages/core/session/src/index.ts:57 agent-loop (parallel) session-persistence
subagent/end emit packages/subagent/subagent/src/index.ts:98 subagent (events.dispatch) hooks-claude
subagent/provider-added emit packages/subagent/subagent/src/index.ts:72 subagent (emit) tool-subagent
subagent/provider-removed emit packages/subagent/subagent/src/index.ts:83 - tool-subagent
subagent/start emit packages/subagent/subagent/src/index.ts:91 subagent (events.dispatch) hooks-claude
system-prompt/assemble waterfall packages/core/system-prompt/src/index.ts:38 system-prompt (waterfall) -
system-prompt/change emit packages/core/system-prompt/src/index.ts:44 system-prompt (emit) -
tools/change emit packages/core/tools/src/index.ts:87 tools (emit) -
tools/post-execute waterfall packages/core/tools/src/index.ts:82 tools (waterfall) hooks-claude, hooks-codex
tools/pre-execute waterfall packages/core/tools/src/index.ts:66 tools (waterfall) hooks-claude, hooks-codex

Maintenance mode: hybrid generated: Cordis event declarations and most producer/listener edges are AST-scanned; dynamic dispatch sites are classified in scripts/gen-doc-graphs.ts.