Files
deepseek-harness/docs/event-producer-consumer.md
Tianyi Cui 3f83a4ee96 review: the persona becomes the system-prompt plugin's deployment config
Review round 2 (tianyicui inline comments):

- dsh-system-prompt itself registers the harness:identity (-100) and
  deployment:persona (0) sections — they must survive a swapped loop
  plugin, so they leave dsh-agent-loop; the persona text is the plugin's
  own validated 'persona' config. The model/cwd variables STAY on the
  loop: runtime facts of the agents it drives.
- AgentOptions.systemPrompt is deleted with all its forwarding plumbing:
  the app configs' systemPrompt keys become 'persona' routed through
  dsh-agent-core (schema = z.intersect of the owners'), the ACP bridge
  and tool-subagent stop carrying persona configuration, and subagent
  children now render the deployment persona like every other agent.
- Example personas drop transport/interface trivia (ACP, CLI) — facts
  irrelevant to the model.
- Root CONTEXT.md removed (not idiomatic); its persona definition was
  wrong under the new ownership anyway.
- Docs, READMEs, the prompt-variables RFC, and generated catalogs
  updated; new loop test pins the assemble-waterfall escape valve
  (an emptied assembly sends NO system field).
2026-07-05 23:23:46 +08:00

6.9 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:394 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:359 agent-loop (waterfall), compact-basic (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:369 agent-loop (waterfall) -
agent/turn-continuation waterfall packages/core/agent/src/types.ts:382 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:33 llm (waterfall) llm-replay
session/created emit packages/core/session/src/index.ts:36 session (emit) invariants, session-persistence
session/event emit packages/core/session/src/index.ts:44 session (emit) acp, invariants, session-persistence, stdio-agent
session/flush parallel packages/core/session/src/index.ts:54 agent-loop (parallel) session-persistence
subagent/end emit packages/subagent/subagent/src/index.ts:96 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:81 subagent (emit) tool-subagent
subagent/start emit packages/subagent/subagent/src/index.ts:89 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.