refactor: hard-fork GSD -> MSD (Make Software Done)
Mechanical rename produced by scripts/msd-rename.cjs: gsd/Gsd/GSD -> msd/Msd/MSD across contents and paths, upstream package/repo coordinates -> @golem15/msd-core and golem15com/msd-core. Deep links into upstream history, sibling upstream packages, the GSD-2 import feature, CHANGELOG.md and .changeset/ are kept as-is. Hand edits on top: MSD block-letter banner and logos, LICENSE copyright line, package/plugin identity, regenerated lockfile, install-tree fixtures, derived registries and benchmark baseline; migration checksum baseline re-locked (MSD keeps its own install state, so no install had applied the old sums); sort-order and regex-escaped expectations in tests adjusted.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# ADR-3128: Adaptive runtime evidence for GSD Debug
|
||||
# ADR-3128: Adaptive runtime evidence for MSD Debug
|
||||
|
||||
- **Status:** Proposed
|
||||
- **Date:** 2026-08-07
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
## Context
|
||||
|
||||
`/gsd:debug` routinely reaches several plausible hypotheses that static inspection, the existing test suite, and existing logs cannot distinguish. At that point a solo developer has two bad options: hand-add instrumentation, or let the agent guess. Hand-added instrumentation is easy to forget, contaminates a commit, and is especially unsafe in a dirty worktree. Guessing produces a plausible-but-wrong root cause and an unproven fix.
|
||||
`/msd:debug` routinely reaches several plausible hypotheses that static inspection, the existing test suite, and existing logs cannot distinguish. At that point a solo developer has two bad options: hand-add instrumentation, or let the agent guess. Hand-added instrumentation is easy to forget, contaminates a commit, and is especially unsafe in a dirty worktree. Guessing produces a plausible-but-wrong root cause and an unproven fix.
|
||||
|
||||
GSD already has persistent debug sessions, bug-class routing, context-reset recovery, TDD, five-signal fix acceptance, and human verification. What it lacks is a **bounded protocol** connecting a recorded hypothesis to temporary runtime observations, comparing the identical reproduction before and after a fix, and *proving* every diagnostic edit and artifact was removed before completion.
|
||||
MSD already has persistent debug sessions, bug-class routing, context-reset recovery, TDD, five-signal fix acceptance, and human verification. What it lacks is a **bounded protocol** connecting a recorded hypothesis to temporary runtime observations, comparing the identical reproduction before and after a fix, and *proving* every diagnostic edit and artifact was removed before completion.
|
||||
|
||||
### Why this needs an ADR rather than an issue alone
|
||||
|
||||
@@ -24,8 +24,8 @@ Additionally, ADR-1671's `WHEN_VOCABULARY` is **closed**: every growth from 14 t
|
||||
### What already exists, after #3149
|
||||
|
||||
- `init.debug` (`cmdInitDebug`, `src/init.cts`) — a dedicated entry point, so ADR-1671 admission **gate (2)** ("a fact the init seam demonstrably computes at a real entry point") is satisfied for `debug`. Before it, any debug-scoped atom evaluated `false` forever.
|
||||
- `gsd-core/workflows/debug.md` Step 0 already consumes one init bundle and already documents the `section_manifest` read contract, including that `null` means *read everything* and is **not** the same as an empty `included` array.
|
||||
- `gsd-core/workflows/section-manifest.json` has no `debug` key, because `debug.md` carries no section markers yet. Admission **gate (1)** — a named consuming section of at least 400 bytes — is what this ADR's implementation must satisfy.
|
||||
- `msd-core/workflows/debug.md` Step 0 already consumes one init bundle and already documents the `section_manifest` read contract, including that `null` means *read everything* and is **not** the same as an empty `included` array.
|
||||
- `msd-core/workflows/section-manifest.json` has no `debug` key, because `debug.md` carries no section markers yet. Admission **gate (1)** — a named consuming section of at least 400 bytes — is what this ADR's implementation must satisfy.
|
||||
|
||||
## Decision
|
||||
|
||||
@@ -33,7 +33,7 @@ Additionally, ADR-1671's `WHEN_VOCABULARY` is **closed**: every growth from 14 t
|
||||
|
||||
2. **The session gains an immutable `goal` and an optional `Runtime Evidence` section at `schema_version: 1`.** Legacy sessions are read without migration-only rewrites: an absent `goal` means `find_and_fix`; an absent Runtime Evidence section means `off` + `not_used`. A `find_root_cause_only` session never offers or applies a fix and never edits tracked source.
|
||||
|
||||
3. **Every agent-authored source edit is ledgered before it is made, and cleanup is fail-closed.** Paired non-nested markers carrying exact `gsd-debug-probe:start|end <slug> <probe-id>` payloads, plus a pre-edit SHA-256 over the complete raw UTF-8 block including both marker lines and the file's existing line-ending form. Cleanup removes only a complete balanced block whose bytes still match its saved hash; anything else is `cleanup_failed`, and edits outside the owned block are preserved.
|
||||
3. **Every agent-authored source edit is ledgered before it is made, and cleanup is fail-closed.** Paired non-nested markers carrying exact `msd-debug-probe:start|end <slug> <probe-id>` payloads, plus a pre-edit SHA-256 over the complete raw UTF-8 block including both marker lines and the file's existing line-ending form. Cleanup removes only a complete balanced block whose bytes still match its saved hash; anything else is `cleanup_failed`, and edits outside the owned block are preserved.
|
||||
|
||||
4. **`cleanup_failed` gates every terminal transition.** Diagnosis completion, human verification, abandonment, archive, staging, commit, knowledge-base writes, and all terminal returns are blocked while the ledger is non-clean. The session stays resumable until cleanup is proved. This holds for direct debugger invocation, not only the managed path.
|
||||
|
||||
@@ -49,12 +49,12 @@ Additionally, ADR-1671's `WHEN_VOCABULARY` is **closed**: every growth from 14 t
|
||||
|
||||
### Options considered
|
||||
|
||||
- **Keep GSD passive-only.** Rejected: static evidence often cannot separate falsifiable hypotheses, so the debugger guesses or delegates instrumentation to the human.
|
||||
- **Keep MSD passive-only.** Rejected: static evidence often cannot separate falsifiable hypotheses, so the debugger guesses or delegates instrumentation to the human.
|
||||
- **Always install source probes.** Rejected: observer effects, concurrency semantics, dirty worktrees, privacy, and cleanup risk make always-on instrumentation unsafe.
|
||||
- **Adaptive by default.** #3128's proposed posture, and rejected: it would let the debugger edit tracked source on an ordinary invocation nobody opted into, against a config block whose autonomy settings are uniformly off. See Decision 8.
|
||||
- **Gate on `flag:--runtime-probes`.** Rejected — see Decision 1. It is the ADR-1671:125 silent-exclusion bug reintroduced through the front door.
|
||||
- **Put the protocol body in `gsd-core/references/` and `@`-include it.** Rejected on its own terms: an eager include relocates bytes without reducing loaded context, so the size gate passes while the thing it protects gets worse. A reference read *on demand* at activation time remains correct and is used for the deep protocol detail.
|
||||
- **Adopt or vendor `millionco/debug-agent`.** Rejected: its package, installation, runtime and logging contracts add an external dependency and do not fit GSD's self-contained, generated multi-runtime prompt architecture. Concepts are adapted; no code is copied.
|
||||
- **Put the protocol body in `msd-core/references/` and `@`-include it.** Rejected on its own terms: an eager include relocates bytes without reducing loaded context, so the size gate passes while the thing it protects gets worse. A reference read *on demand* at activation time remains correct and is used for the deep protocol detail.
|
||||
- **Adopt or vendor `millionco/debug-agent`.** Rejected: its package, installation, runtime and logging contracts add an external dependency and do not fit MSD's self-contained, generated multi-runtime prompt architecture. Concepts are adapted; no code is copied.
|
||||
- **Write raw logs into the session or a trace file.** Rejected: unbounded, potentially sensitive, and it contaminates durable shared context.
|
||||
|
||||
## Architecture and contracts
|
||||
@@ -70,7 +70,7 @@ Additionally, ADR-1671's `WHEN_VOCABULARY` is **closed**: every growth from 14 t
|
||||
| Fact | `src/init.cts` — `cmdInitDebug` folds explicit flag → valid saved session policy → `off` default, then emits `runtime_evidence_eligible = (policy !== 'off')` |
|
||||
| Flags | `src/init-command-router.cts` — the `debug:` route's `parseNamedArgs` boolean list gains `runtime-probes` and `no-runtime-probes`; conflicting flags fail closed |
|
||||
|
||||
A coordinated-change guard in `src/section-manifest.cts` throws at module load in **both** directions, so a half-edit cannot ship. `gsd-core/workflows/section-manifest.json` is regenerated by `scripts/gen-section-manifest.cjs --write` and verified by `--check` in `lint:ci`.
|
||||
A coordinated-change guard in `src/section-manifest.cts` throws at module load in **both** directions, so a half-edit cannot ship. `msd-core/workflows/section-manifest.json` is regenerated by `scripts/gen-section-manifest.cjs --write` and verified by `--check` in `lint:ci`.
|
||||
|
||||
**Eligibility is not authorization.** The atom decides only whether the protocol *text* is included. Whether a probe is actually installed on a given run remains subject to every reproduction, privacy, bug-class, perturbation and cleanup precondition, evaluated at run time. `force` never overrides those, nor diagnose-only mode.
|
||||
|
||||
@@ -98,7 +98,7 @@ Captures live under one fresh empty root created by a secure OS temporary-direct
|
||||
|
||||
### 5. Event envelope
|
||||
|
||||
Events are emitted only to the per-run sink named by an ephemeral `GSD_DEBUG_PROBE_SINK`, prefixed `GSDDBG1`, at `schema_version: 1`, carrying session/run/probe IDs, non-empty hypothesis IDs, phase, a positive monotonic per-probe ordinal, location, a fixed allowlisted message and a bounded scalar `data` map. Hard limits: **1 KiB per serialized event, 100 events per probe, 256 KiB per run.** Overflow, malformed or interleaved writes, identity mismatch, duplicate or non-monotonic ordinals, and sink failure each make the affected observation `inconclusive`. Missing events are `inconclusive` unless a control event proves both path execution and a healthy capture channel.
|
||||
Events are emitted only to the per-run sink named by an ephemeral `MSD_DEBUG_PROBE_SINK`, prefixed `MSDDBG1`, at `schema_version: 1`, carrying session/run/probe IDs, non-empty hypothesis IDs, phase, a positive monotonic per-probe ordinal, location, a fixed allowlisted message and a bounded scalar `data` map. Hard limits: **1 KiB per serialized event, 100 events per probe, 256 KiB per run.** Overflow, malformed or interleaved writes, identity mismatch, duplicate or non-monotonic ordinals, and sink failure each make the affected observation `inconclusive`. Missing events are `inconclusive` unless a control event proves both path execution and a healthy capture channel.
|
||||
|
||||
Captured events are **untrusted input** (ADR-1577): they are data to reason over, never instructions.
|
||||
|
||||
@@ -133,10 +133,10 @@ Sequencing inside Phase 1 that the platform forces:
|
||||
|
||||
| File | Bytes | Cap | Headroom |
|
||||
|---|---:|---:|---:|
|
||||
| `gsd-core/workflows/debug.md` | 21,173 | 40,960 | 19,787 |
|
||||
| `agents/gsd-debugger.md` | 48,851 | 57,344 | **8,493** |
|
||||
| `agents/gsd-debug-session-manager.md` | 19,751 | 24,576 | **4,825** |
|
||||
| `gsd-core/workflows/help/modes/full.md` | 38,012 | 40,960 | **2,948** |
|
||||
| `msd-core/workflows/debug.md` | 21,173 | 40,960 | 19,787 |
|
||||
| `agents/msd-debugger.md` | 48,851 | 57,344 | **8,493** |
|
||||
| `agents/msd-debug-session-manager.md` | 19,751 | 24,576 | **4,825** |
|
||||
| `msd-core/workflows/help/modes/full.md` | 38,012 | 40,960 | **2,948** |
|
||||
|
||||
Crossing a tier cap means extracting to `references/`, never a `+N` bump.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user