Files
deepseek-harness/docs/adr
Tianyi Cui 11a29fdefe feat(invariants): dev-mode event-contract assertions + session-log freeze (RFC 005 pt 3, RFC 008)
New @deepseek-ai/dsh-invariants plugin (pure listeners, off in prod) asserts
the event taxonomy at runtime — seq monotonicity, turn/step nesting, a
tool/result needs a prior tool/call (NOT the converse), legal agent/status
transitions — and deep-freezes logged event data so mutating history throws.
Seeded sessions are checked + frozen on session/created.

The real RFC 008 fix is always-on: deriveMessages now structured-clones the
content it emits, so the loop's sanctioned request/adapter mutation can no
longer reach back and rewrite the append-only log. The pervasive
DeepReadonly<T> type flip is rejected (compile-only, high-noise, castable) —
recorded in ADR 0012, which folds in RFC 008. Wired into both demos.
2026-06-13 23:25:12 +08:00
..

Architecture Decision Records

Short, immutable records of the why behind decisions that shape this codebase. Code and docs say what the system does; ADRs say why it does it that way and what we gave up.

Format: one file per decision, numbered, with Status / Context / Decision / Consequences. An ADR is never edited into a different decision — supersede it with a new one and cross-link.

When to write an ADR

Write one when a decision is all three of: durable (it shapes the codebase beyond a single function or package), contested (there was a real alternative you rejected, and a reasonable engineer might have chosen it), and surprising (a future reader would otherwise ask "why on earth is it done this way?"). The ADR captures the why and what we gave up — the parts code and docs can't.

Do NOT write an ADR for: a mechanical or local choice (a variable name, a one-file refactor); anything already enforced and explained by a gate or a convention in AGENTS.md; or a still-provisional decision tagged TODO(...) in the code — record those as TODOs and promote to an ADR only once they settle. When in doubt, the test is the "why on earth" question: if the code alone would mislead a careful reader about intent, write the ADR.

# Title Status
0001 Vendor Cordis as source, not npm dependencies accepted
0002 Microkernel: extension via Cordis event taxonomy, one concrete loop accepted
0003 Event-sourced sessions with derived message history accepted
0004 Provider-neutral content-block vocabulary owned by dsh-llm accepted
0005 Custom typed tool-schema DSL instead of schemastery accepted
0006 Tool schemas are part of the system-prompt assembly accepted
0007 Mechanical quality gates over prose guidelines accepted
0008 tsdown for JS bundling instead of dumble accepted
0009 Capability seams — interface / implementation / consumer split accepted
0010 Two LLM adapters as a design-verification twin accepted
0011 Runtime arg validation at the model boundary accepted
0012 Dev-mode invariants over compile-time deep-readonly accepted