ADR-0020: The Style Sheet — In-Session Working Memory (Inner Loop)
Status
Proposed / exploring. Prompted by the memory-posture work (2026-07-08).
The inner-loop sibling to ADR-0012 (the outer, distillation loop). Governed by
the memory posture in ADR-0019. Revisit for promotion to accepted (+ a spec)
after the core loop (SPEC-0001..0003) is standing; depends on ADR-0011.
Context and Problem Statement
Skill distillation (ADR-0012) is the outer loop: slow, batched, across many trajectories and outcomes, run periodically as a meta-dispatch that proposes named skills. That is the right cadence for durable, cross-project institutional knowledge — but it is the only place Stet currently lets learning accumulate.
Within a single dispatch or a single review session, context also accumulates — and today it evaporates:
- The agent discovers "this codebase wants errors wrapped this way," tries an approach that fails, and learns a local convention — all of which is only frozen into the trajectory capstone (ADR-0011) at the very end, as a record, not as live working memory.
- The human marks up the galley ("no, use the existing helper"), the dispatch finishes, and a re-dispatch on the same PR starts cold — the second attempt does not begin where the first left off.
- There is no fast, live, local scratch surface that both the agent and the human write to during the work, before anything is committed.
One common answer to the general problem is a persistent, always-on knowledge graph. That is the wrong shape for Stet: continuous silent persistence breaks the provenance/compliance guarantees the PR ceremony exists to provide (ADR-0019). We want the speed of an inner loop without giving up the discipline of the outer one. This ADR proposes a fast, local-first, ephemeral working memory whose only exit to durability is the PR ceremony.
Framing — the copyeditor's style sheet
The publishing metaphor already names this artifact. A copyeditor keeps a style sheet: a running, per-manuscript record of decisions made while reading — how this book spells, capitalizes, hyphenates, treats numbers. It is distinct from the house's style guide, which is the durable, cross-title standard. The style sheet is fast, local to one manuscript, and mostly discarded when the job is done — except for the decisions worth promoting into house style.
That is exactly the inner loop:
galley → margin markup → style sheet (inner, live, local, per-target)
│ graduates via PR ceremony
▼
house style = skills (outer, durable — ADR-0012)
- Style sheet = in-session working memory (this ADR).
- House style = distilled skills (ADR-0012).
Sketch / Decisions
Local-first, ephemeral working set
A per-session, plain-text (Markdown), mutable style sheet maintained during a
dispatch/review, kept in local scratch that is not committed (e.g. a gitignored
app-support / .stet/cache/ area, keyed by target — repo + PR/branch). Reads and
writes are cheap; updating it requires no PR ceremony. It is a scratchpad, not
an artifact.
Shared and inspectable, live
Both actors write to it in-session: the agent records what it learned (conventions found, approaches ruled out, clarifications received); the human's margin markup (ADR-0006) lands there too. The human can read and edit it live — local-first, plain text, no black box (ADR-0019's trust principle applied at session granularity).
Warm re-dispatch
A re-dispatch against the same target seeds from the style sheet, so iteration n+1 does not start cold. This is the in-session compounding: the fast loop that ADR-0012's cadence is too slow to provide.
The invariant — durability only by graduation (load-bearing)
The style sheet's only path to durability is graduation into a reviewed PR artifact. It is never silently persisted and never mutates an agent's durable behavior on its own. At PR time each entry either:
- rides along as part of the trajectory capstone (ADR-0011) — the record of this specific piece of work; or
- is proposed as a distillation candidate / skill (ADR-0012) — promotion into house style, reviewed like any change; or
- is discarded with the scratch.
Because the style sheet is high-signal (it is the distilled residue of one focused session, already curated by the human's markup), it is excellent distillation fuel — it feeds the outer loop rather than bypassing it. The PR ceremony stays load-bearing for compliance/provenance (ADR-0019): nothing an agent durably knows arrived without review.
Separation from the outer loop (explicit)
| Inner loop (this ADR) | Outer loop (ADR-0012) | |
|---|---|---|
| Scope | one dispatch / review session, one target | many sessions, over time |
| Speed | live, per-iteration | periodic / N merged PRs |
| Actor | the dispatched agent + the human, in real time | a distillation meta-dispatch |
| Storage | local scratch, not committed, ephemeral | committed, reviewed skills |
| Durability | only by graduating into a PR artifact | is the durable artifact |
The two are deliberately kept apart so the fast loop cannot quietly become durable memory.
Privacy & isolation
- Because the style sheet is local and never committed by default, the ADR-0011 secret-scan + redaction gate runs at graduation time — when any content flows into a committed trajectory or a proposed skill — not continuously. The gate is still mandatory on that path.
- Concurrent dispatches each get their own sandbox (ADR-0018). The style sheet is app-side, keyed by target, so concurrent work on the same target needs a merge story (see Open Questions) — it must never become a covert cross-sandbox channel.
Why it fits
- Good, because it delivers memory that compounds at session granularity while preserving Stet's provenance discipline — speed without silent persistence.
- Good, because it reuses existing seams: markup (ADR-0006) writes to it, the trajectory (ADR-0011) and distillation (ADR-0012) are its two graduation targets.
- Good, because the style-sheet metaphor is native to Stet's editorial vocabulary (galley → margin → style sheet → house style) and cleanly distinct from "skills."
- Good, because keeping it local + ephemeral means it adds no new committed-artifact surface and no new always-on persistence risk.
Open questions
- Session boundary. Is a "session" one dispatch, one PR's full review-and-re-dispatch cycle, or a time window? Determines keying and GC.
- Entry schema. The shape of a style-sheet entry and how it maps to a trajectory event (ADR-0011) vs. a skill candidate (ADR-0012) at graduation.
- Graduation UX. Fully automatic-with-review, or does the human/agent explicitly promote entries? Default leaning: entries are surfaced as candidates; promotion is a proposal reviewed through the loop, never automatic-and-silent.
- Retention / GC. What happens to local scratch on abandon, on merge, on timeout; default TTL.
- Harness seam. Some harnesses (ADR-0004) keep their own working notes; the inner loop must be harness-agnostic, so it needs a projection seam (like skill injection in ADR-0012) rather than assuming a specific harness's scratch.
- Concurrent-target merge. If two dispatches touch the same target, do they share one style sheet or fork-and-merge? Echoes ADR-0013's cell-wise (Dolt) merge thinking; must not become a side channel between sandboxes (ADR-0018).
Consequences (tentative)
- Adds a local, ephemeral
StyleSheetworking-memory concept keyed by target, a live read/write seam shared by agent and human markup, and a graduation step that routes entries into ADR-0011 (trajectory) or ADR-0012 (skill) via the PR ceremony. - Adds warm-start seeding to re-dispatch (ADR-0006 dispatch path).
- Introduces a graduation-time hook onto the ADR-0011 secret-scan gate.
- Depends on ADR-0011 (a graduation target) and is governed by ADR-0019 (the "one law"); explicitly a sibling to, not a replacement for, ADR-0012.
More Information
Prompted by the memory-posture work (2026-07-08). A continuous, always-on knowledge graph is the anti-pattern this ADR deliberately avoids (continuous silent persistence); the inner loop stays fast but routes all durability through the PR ceremony. Governed by ADR-0019 (memory posture). Sibling to ADR-0012 (outer loop). Shared theme: the project learns over time.