Files
deepseek-harness/docs/rfc
Tianyi Cui c182543dd5 refactor(acp-example): derive llm-replay script from the session JSONL
Per a design revision, the per-scenario snapshot fixture becomes EXACTLY the
persisted session JSONL (<scenario>/session.jsonl) rather than a hand-authored
llm.json. The log already holds all LLM behavior (assistant/chunk carries every
StreamChunk) AND all harness behavior (tool/call, tool/result, turn/*, usage),
so one artifact drives replay and doubles as a behavioral golden.

llm-replay becomes replay-only (the record-tee is removed; recording is now
"run the real agent once and harvest the .jsonl", done by the harness in a
later commit). deriveReplayScript(events) groups assistant/chunk by (turn,step)
in log order — exact because the loop makes one ctx.llm.stream() call per step
and tags each chunk with the current (turn,step). The two failure modes the log
can't express (a thrown stream — no terminal finish; cancel/hang — timing) use
an optional replay.override.json sidecar.

Hardens against a Codex review finding: a derived group is only valid if it
ends in a `finish` chunk. A group without one is the fingerprint of a thrown
stream() and is NOT silently replayed as a clean stop — deriveReplayScript
throws, naming the (turn,step), so a missing sidecar override fails loud.

Updates the unit tests (parse/derive/load helpers, sidecar override, finish-
terminated grouping, HMR), the example README, and the RFC prose to the JSONL
format. Two goldens (stdout transcript + re-persisted JSONL) and the harness
wiring land in the next commit.
2026-06-19 02:44:33 +08:00
..

RFCs

One kind of design doc lives here. An RFC records a decision or proposal that shapes this codebase — the why and what we gave up, the parts code and docs can't carry. (Earlier this split into separate "ADR" and "RFC" trees; they were unified, since most ADRs were simply implemented RFCs.)

Layout and naming

Files are grouped by lifecycle into three folders, and an RFC moves between them as its status changes:

  • proposed/ — proposals reviewed before implementation; not yet built (or only partly).
  • implemented/ — the decision shipped. The file records what was decided and what was rejected.
  • rejected/ — the proposal was considered and declined. Kept for the record so the rejection isn't re-litigated.

Each file is named yyyy-mm-dd-topic-title.md, where the date is when the topic was first proposed (per git history). Cross-references between RFCs use relative markdown links ([topic](../implemented/2026-…-….md)) — never bare prose or numbers — so they are mechanically checkable and survive moves between folders.

When to write one

Write an RFC when a decision is durable (it shapes the codebase beyond a single function or package), contested (there was a real alternative a reasonable engineer might have chosen), and surprising (a future reader would otherwise ask "why on earth is it done this way?"). A proposal for substantial future work starts in proposed/; a decision already made starts in implemented/.

Do NOT write one for a mechanical or local choice (a variable name, a one-file refactor), for anything already enforced and explained by a gate or a convention in AGENTS.md, or for a still-provisional decision tagged TODO(...) in the code — record those as TODOs and promote to an RFC only once they settle. An RFC is never edited into a different decision: supersede it with a new one and cross-link.

Proposed

Title First proposed
Mutation testing as the coverage counterweight 2026-06-11
Deterministic tests, the replay invariant fixture, and race stress 2026-06-11
Architectural conformance — dependency rules and the adapter kit 2026-06-11
API extractor reports 2026-06-11
Supply chain checks and vendor drift verification 2026-06-11
Agent Client Protocol (ACP) support for external editors 2026-06-14
Multiplex concurrent ACP sessions over one connection 2026-06-14
Optional Code Mode — model writes TypeScript against an SDK of all tools 2026-06-15
Runtime schemas for the event vocabulary (Zod vs the merge-extensible-map pattern) 2026-06-16

Implemented

Title First proposed
Vendor Cordis as source, not npm dependencies 2026-06-11
Microkernel: extension via Cordis event taxonomy, one concrete loop 2026-06-11
Event-sourced sessions with derived message history 2026-06-11
Provider-neutral content-block vocabulary owned by dsh-llm 2026-06-11
Custom typed tool-schema DSL instead of schemastery 2026-06-11
Tool schemas are part of the system-prompt assembly 2026-06-11
Mechanical quality gates over prose guidelines 2026-06-11
tsdown for JS bundling instead of dumble 2026-06-11
Runtime arg validation at the model boundary 2026-06-11
Dev-mode invariants over compile-time deep-readonly 2026-06-11
Property-based testing for protocol-shaped code 2026-06-11
Doc-sync enforcement 2026-06-11
Markdown cross-link validity linting 2026-06-18
Structured error taxonomy 2026-06-11
Capability seams — interface / implementation / consumer split 2026-06-13
Two LLM adapters as a design-verification twin 2026-06-13
Session persistence as an abstract service over SessionEvent 2026-06-14
Every session event is enclosed in a turn 2026-06-15
pnpm as the package manager instead of Yarn 4 2026-06-16
Rich ACP bash rendering — the terminal card (_meta) and command classification 2026-06-18
ACP snapshot tests — record-once / replay-deterministic 2026-06-19

Rejected

Title First proposed
Deep-readonly public surfaces 2026-06-11