Define the in-file RFC contract in docs/rfc/README.md § The file format: the header block (`# RFC: <title>` plus a dateless Status enum cross-checked against the lifecycle folder), the per-lifecycle body skeleton (a Problem opener everywhere; Proposal/Alternatives considered/ Acceptance criteria/Risks in proposed/; present-tense Decision/ Consequences with proposal-era headings banned in implemented/; the frozen proposal shape in rejected/), and a mandatory Alternatives considered section with a date-fenced grandfather comment for pre-format RFCs whose alternatives are not reconstructible from the record. Enforce it with a new doc-sync gate, scripts/verify-rfc-format.ts, and normalize all 112 RFCs to it: ~15 Status-line spellings collapse to the enum, 29 Context openers become Problem, the 39 legacy-format XXX debt markers are resolved and banned from reappearing, proposal-era sections in implemented RFCs are rewritten to shipped reality (including the web/fs/subagent seam RFCs' migration plans and test checklists, closing the doc-tiers deferred-work item on the web seam), every RFC gains an Alternatives considered section or the grandfather comment, and the bilingual pair is re-mirrored and re-recorded. Move the generated index tables out of README.md into a fully generated docs/rfc/INDEX.md — gen-rfc-index now writes the whole file, and verify-rfc-classification checks its freshness and rejects index-shaped rows in the curated README — which makes room for the format contract to live in the README front door instead of a separate FORMAT.md. The decision record, and the first RFC written in the new format, is docs/rfc/implemented/process/2026-07-05-uniform-rfc-format.md.
2.8 KiB
RFC: Two LLM adapters as a design-verification twin
Status: implemented
Problem
dsh-llm owns a provider-neutral streaming vocabulary — the StreamChunk protocol (block-start, text-delta, reasoning-delta, tool-call-delta, block-end, usage, finish) and the content-block types (the content-block vocabulary). A vocabulary defined against a single adapter risks baking that adapter's quirks into the "neutral" contract: anything the one implementation happens to do becomes the de-facto spec, and the abstraction is unverified until a second provider arrives — by which point the leak is expensive to fix.
Decision
Ship two adapters against the one contract from the start, deliberately built on different internals:
dsh-llm-deepseek— hand-rolledfetch+ SSE parsing against the DeepSeek API.dsh-llm-pi-ai— the same endpoint through the@earendil-works/pi-ailibrary (its own event vocabulary).
The rule they enforce: anything the StreamChunk vocabulary cannot express for BOTH implementations is a core-vocabulary bug, caught immediately rather than at the next provider. The pair pinned down conventions now documented on StreamChunk in dsh-llm/src/types.ts: usage emitted before finish, nothing after finish, tool-call arguments as raw JSON strings end-to-end, and the two sanctioned error paths (throw from stream() or end with finish {kind:'error'|'aborted'}) that a consumer must handle on both sides — a divergence the library-backed adapter surfaced that a single hand-rolled adapter would have hidden.
Alternatives considered
- A single adapter — less code and half the e2e cost, but leaves the "provider-neutral" claim unverified; the vocabulary would encode DeepSeek-via-fetch assumptions silently.
- A mock second adapter — cheaper but doesn't exercise a real provider's wire quirks, so it proves little. The twin is real-on-real.
Consequences
Double the adapter maintenance and double the key-gated e2e surface (both adapters cover V4 Flash and Pro across representative thinking/effort modes). Bought: a continuously-verified neutrality guarantee for the most leak-prone abstraction in the codebase, and a worked second example for adapter authors. The two share the core Config shape (apiKey/baseURL/models) so a deployment swaps mostly one line, but the reasoning knob differs — dsh-llm-deepseek takes thinking/reasoningEffort, dsh-llm-pi-ai takes a single reasoning level — so a swap translates that field. If the maintenance cost ever outweighs the verification value (e.g. once conformance tests from architectural conformance cover the contract mechanically), retiring the twin to a single adapter + the conformance kit would be a new RFC superseding this one.