scrumrun 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -0
- package/CORE.md +17 -3
- package/DECISIONS.md +56 -0
- package/MIGRATION-1-to-2.md +11 -0
- package/README.md +23 -5
- package/SPEC.md +30 -10
- package/bin/scrumrun.js +175 -11
- package/docs/COMMANDS.md +10 -4
- package/docs/ENTITY-MODEL.md +1 -1
- package/docs/RELEASE-SCORECARD.md +43 -0
- package/docs/RELEASE.md +19 -12
- package/docs/SCHEMA.md +11 -0
- package/docs/SEMANTIC-MEMORY.md +1 -1
- package/docs/TROUBLESHOOTING.md +13 -1
- package/lib/commands/manifest.js +15 -3
- package/lib/commands/render.js +4 -0
- package/lib/memory/index.js +201 -41
- package/lib/memory/service.js +3 -0
- package/lib/runtime/budgets.js +4 -0
- package/lib/runtime/canonical-snapshot.js +110 -0
- package/lib/runtime/context.js +5 -45
- package/lib/runtime/mutation-gateway.js +434 -0
- package/lib/runtime/orchestrator.js +130 -65
- package/lib/runtime/policy-engine.js +267 -0
- package/lib/runtime/request-engine.js +32 -24
- package/lib/runtime/review-service.js +92 -0
- package/lib/runtime/run-ledger.js +546 -0
- package/lib/runtime/workspace-state.js +146 -0
- package/lib/security/secrets.js +15 -1
- package/lib/v2/artifacts.js +24 -1
- package/lib/v2/conformance.js +78 -12
- package/lib/v2/migration.js +74 -10
- package/lib/v2/run-ledger-migration.js +268 -0
- package/lib/v2/schema.js +28 -1
- package/lib/v2/transaction.js +254 -0
- package/package.json +1 -1
- package/scripts/generate-contract-docs.js +11 -0
- package/templates/project/.scrumrun/guardrails.md +8 -0
- package/templates/project/.scrumrun/map.md +4 -3
- package/templates/project/.scrumrun/method.json +7 -1
- package/templates/project/.scrumrun/state.md +7 -14
- package/templates/project/AGENTS.md +2 -1
- package/templates/project-lean/AGENTS.md +3 -1
- package/templates/shared/skills/scrumrun/SKILL.md +19 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,51 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes follow Semantic Versioning.
|
|
4
4
|
|
|
5
|
+
## Unreleased
|
|
6
|
+
|
|
7
|
+
### Security
|
|
8
|
+
|
|
9
|
+
- Added fail-closed, 15-minute, path-scoped Mutation Gateway permits with policy/workspace binding, before/after hashes, read-only and symlink checks, new-secret detection, and append-only Run evidence.
|
|
10
|
+
- Deferred Guardrails now become persisted Run obligations; unresolved obligations, policy drift, workspace bypass, and pending canonical transactions block completion.
|
|
11
|
+
- Fresh and explicitly migrated projects require structured `Status`, `Enforcement`, `Scope`, and `Rule` fields and advertise Guardrail, obligation, and Mutation Gateway schemas in `method.json`.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Project conformance now covers 21 executable invariants and detects active Run mutation bypasses.
|
|
16
|
+
|
|
17
|
+
## 2.1.1 - 2026-07-22
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- Semantic indexing now detects whether the current `node:sqlite` build provides FTS5 instead of assuming the optional module exists.
|
|
22
|
+
- Node.js 22.13 uses a deterministic, parameterized lexical fallback for artifact and code search while runtimes with FTS5 retain BM25 retrieval.
|
|
23
|
+
- Semantic cache schema 4 records the selected search backend and safely rebuilds an FTS5 cache when it is opened by a runtime without FTS5.
|
|
24
|
+
|
|
25
|
+
### Validation
|
|
26
|
+
|
|
27
|
+
- Added explicit automatic-backend and forced-fallback tests, including multi-token matching, code-symbol retrieval, cache metadata, and absence of FTS virtual tables.
|
|
28
|
+
- The complete 143-test suite passes in the exact `node:22.13.0` runtime that exposed the release regression.
|
|
29
|
+
|
|
30
|
+
## 2.1.0 - 2026-07-22
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- Canonical Run ledger schema with stable event ids, RFC3339 timestamps, actors, reasons, and typed evidence.
|
|
35
|
+
- Explicit early-v2 Run-ledger preflight/apply/rollback through `migrate --to 2` and `update --migrate`.
|
|
36
|
+
- Conformance checks that reconstruct Run state and detect event-order, evidence, timestamp, and frontmatter drift.
|
|
37
|
+
- Durable multi-file mutation journal with byte-exact rollback, interruption recovery, hash-only receipts, and explicit `doctor --recover`.
|
|
38
|
+
- Executable Policy Engine with stable Guardrail ids, explicit passed/blocked/deferred results, and deterministic conformance checks.
|
|
39
|
+
- Shared canonical projection fingerprint plus metadata-watch/content-hash freshness checks for `state.md`, `map.md`, and semantic SQLite.
|
|
40
|
+
- Evidence-backed release scorecard separating local readiness from external registry/tag gates.
|
|
41
|
+
|
|
42
|
+
### Changed
|
|
43
|
+
|
|
44
|
+
- Run is now the sole operational-history authority; Task status is synchronized without duplicated transition prose.
|
|
45
|
+
- Run completion requires evidenced validation, learning, and completion transitions.
|
|
46
|
+
- Intake classification and risk detection now recognize multilingual runtime, schema, migration, transaction, release, and cross-cutting signals.
|
|
47
|
+
- Semantic cache schema 3 removes commit-only invalidation and performs a one-time disposable rebuild from older cache schemas.
|
|
48
|
+
- `map --show` now refuses missing or stale fingerprints instead of presenting an unverified projection.
|
|
49
|
+
|
|
5
50
|
## 2.0.0 - 2026-07-21
|
|
6
51
|
|
|
7
52
|
### Breaking
|
package/CORE.md
CHANGED
|
@@ -84,6 +84,8 @@ AGENTS.md
|
|
|
84
84
|
|
|
85
85
|
Canonical truth is Markdown. SQLite/cache data stores only rebuildable indexes, symbol projections, relations, and bounded context packages. Deleting `.cache/` must never delete authored truth.
|
|
86
86
|
|
|
87
|
+
`state.md` and the semantic index use two-tier freshness checks. Matching path/stat watch fingerprints avoid rereading unchanged sources; any metadata drift falls back to complete content hashing. A cache schema mismatch rebuilds the disposable index once. Watch metadata is only an optimization and never authority.
|
|
88
|
+
|
|
87
89
|
`vault.local.md`, migration backups, and caches are local-only. Their values never appear in logs, history, reviews, memory, reports, commits, or normal responses.
|
|
88
90
|
|
|
89
91
|
## Authority and read policy
|
|
@@ -146,7 +148,9 @@ Intake must:
|
|
|
146
148
|
5. recommend one route and, in guided mode, at most two useful alternatives;
|
|
147
149
|
6. ask one explicit approval question before execution; config may change presentation, never remove the gate.
|
|
148
150
|
|
|
149
|
-
|
|
151
|
+
Policy evaluation is structured per active `GR-NNN`: `passed`, `blocked`, or `deferred`. A block must cite the exact Guardrail id and reason code. Deferred checks must be visible in the plan and re-evaluated at their named execution boundary; they are never silently counted as passed. Invalid/duplicate Guardrails or configuration that weakens approval block conformance and intake.
|
|
152
|
+
|
|
153
|
+
Before approval, do not create canonical files, update status, edit application code, or retain request content outside ignored disposable context cache. The approval token binds both canonical context and the workspace fingerprint; drift in either requires a new intake. Ambiguous acknowledgement is not approval.
|
|
150
154
|
|
|
151
155
|
## Execution lifecycle
|
|
152
156
|
|
|
@@ -165,15 +169,22 @@ Rules:
|
|
|
165
169
|
|
|
166
170
|
- one Run belongs to one Task;
|
|
167
171
|
- one Task may have multiple immutable attempts;
|
|
168
|
-
- every state transition writes exactly one append-only
|
|
172
|
+
- every state transition writes exactly one append-only `RUN-NNN-EVT-NNN` JSON event with RFC3339 time, actor, reason, and typed evidence;
|
|
173
|
+
- the Run ledger is operational history; Task synchronizes current status without copying the Run event;
|
|
174
|
+
- validation, learning, completion, failure, block, and resume require a reason or evidence;
|
|
169
175
|
- validation must match the risk and acceptance criteria;
|
|
170
176
|
- configured reviews run before completion;
|
|
177
|
+
- every deferred policy result is persisted as a Run Guardrail obligation;
|
|
178
|
+
- before changing application/source files, issue a short-lived path-scoped mutation permit and record the verified before/after hashes in the Run;
|
|
179
|
+
- unrecorded workspace drift, policy drift, out-of-scope paths, unsafe symlinks, new secret-like content, or unresolved obligations block validation/completion;
|
|
171
180
|
- learning proposes memory candidates after validation and never auto-confirms AI inference;
|
|
172
181
|
- complete a Sprint only when all its included Tasks meet the Sprint exit gate;
|
|
173
182
|
- do not mark work complete merely because time or token budget ended.
|
|
174
183
|
|
|
175
184
|
Canonical mutations are schema-validated, lossless, and atomic. Preserve unknown fields, prose, and unrelated owner edits. A failed mutation must leave canonical state unchanged or recoverable.
|
|
176
185
|
|
|
186
|
+
Task/Run pair mutations use an ignored durable journal under `.scrumrun/.backup/transactions/`. A captured failure rolls back immediately; an interrupted `prepared` transaction is rolled back before the next approved mutation, while an interrupted `committed` transaction is verified and finalized. Audit only reports `TRANSACTION_PENDING`. Recovery writes occur only when the approved operation is retried or `doctor --recover` is explicitly invoked, and recovery refuses to overwrite bytes that match neither side of the journal.
|
|
187
|
+
|
|
177
188
|
## Semantic memory
|
|
178
189
|
|
|
179
190
|
### Knowledge
|
|
@@ -220,6 +231,7 @@ scrumrun migrate --to 2 --rollback
|
|
|
220
231
|
```
|
|
221
232
|
|
|
222
233
|
- ordinary install/update never applies a migration; update performs a read-only v1 preflight, and only explicit `update --migrate` applies its verified plan;
|
|
234
|
+
- early v2 Run prose is also preflighted read-only and upgraded explicitly to ledger schema 1 with byte-exact backup and safe rollback;
|
|
223
235
|
- dry-run writes no project data;
|
|
224
236
|
- apply inventories source hashes, creates a byte-exact local backup, transforms in staging, validates, and activates by atomic directory swap;
|
|
225
237
|
- incomplete hybrid v1/v2 trees reuse existing evidenced canonical relations instead of creating duplicate Tasks/Runs;
|
|
@@ -239,7 +251,7 @@ Legacy sprint plan entries normally become Tasks. History attempts become Runs w
|
|
|
239
251
|
- `task --add|--list|--show|--run|--audit|--cancel|--retry`
|
|
240
252
|
- `sprint --add|--list|--show|--start|--complete|--block`
|
|
241
253
|
- `feature --add|--list|--show|--activate|--complete`
|
|
242
|
-
- `run --list|--show|--validate|--learn|--complete|--resume|--fail|--block`
|
|
254
|
+
- `run --list|--show|--authorize-mutation|--record-mutation|--satisfy-guardrail|--validate|--learn|--complete|--resume|--fail|--block`
|
|
243
255
|
- `intake <request>`
|
|
244
256
|
- `challenge <question>`
|
|
245
257
|
|
|
@@ -283,6 +295,8 @@ Review is read-only unless fixes are separately authorized. Report findings by s
|
|
|
283
295
|
- Intake is read-only.
|
|
284
296
|
- No execution without explicit valid approval.
|
|
285
297
|
- Guardrails cannot be bypassed; they may only be superseded/retired with history.
|
|
298
|
+
- Active Guardrails produce explicit passed/blocked/deferred evaluations; blocks cite stable ids and deferred checks remain visible until their execution gate.
|
|
299
|
+
- Material mutations require path-scoped permits and append-only hash evidence; completion fails closed on policy/workspace drift or unresolved obligations.
|
|
286
300
|
- Task is atomic; Sprint is grouping; Run is an attempt.
|
|
287
301
|
- Retries preserve prior Runs.
|
|
288
302
|
- History is append-only.
|
package/DECISIONS.md
CHANGED
|
@@ -294,3 +294,59 @@ Date: 2026-07-21
|
|
|
294
294
|
**Consequences** — Ongoing projects cannot silently miss the required migration, while automation and cautious users retain a zero-write default. Cost: update output is longer inside a v1 project and the update command must remain migration-aware.
|
|
295
295
|
|
|
296
296
|
**Alternatives considered** — Automatically applying during every update: rejected because updating client integrations is not implicit consent to rewrite project state. Keeping update unaware: safer in isolation but makes partial upgrades easy and confusing.
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## ADR-021 — Run owns a structured append-only event ledger
|
|
301
|
+
Status: accepted
|
|
302
|
+
Date: 2026-07-22
|
|
303
|
+
|
|
304
|
+
**Context** — A prose `history.md` made operational truth expensive to parse and allowed two incompatible event formats, ambiguous same-day entries, duplicated Task/Run history, and status derived from punctuation-sensitive text.
|
|
305
|
+
|
|
306
|
+
**Decision** — Run is the sole operational-history authority. Every native Run stores schema-versioned `RUN-NNN-EVT-NNN` JSON events with RFC3339 time, actor, ordered `from`/`to`, reason, and typed evidence. Task synchronizes current status without copying event prose. Early-v2 Runs migrate explicitly: deterministic chains are recovered; ambiguity becomes an evidenced snapshot rather than an invented transition.
|
|
307
|
+
|
|
308
|
+
**Consequences** — Status reconstruction and audit are deterministic, retries preserve attempts, and agents can retrieve a bounded Run instead of rereading a global log. Cost: event/schema migrations and stricter evidence gates become release obligations.
|
|
309
|
+
|
|
310
|
+
**Alternatives considered** — Keep one append-only Markdown history with a better template: simpler storage, but still global, token-heavy, and vulnerable to parser drift. Duplicate transitions into Task: convenient locally but creates two authorities.
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## ADR-022 — Canonical multi-file mutations use durable local transactions
|
|
315
|
+
Status: accepted
|
|
316
|
+
Date: 2026-07-22
|
|
317
|
+
|
|
318
|
+
**Context** — Approval, Run transitions, and retries update linked artifacts. Per-file atomic rename prevents partial bytes but cannot prevent a crash after only one file has committed.
|
|
319
|
+
|
|
320
|
+
**Decision** — Linked canonical mutations use an ignored durable transaction journal with prepared/committed states, byte-exact before images, content hashes, fsync-backed writes, deterministic recovery, and hash-only receipts. Prepared work rolls back; committed work is verified and finalized. Recovery refuses to overwrite owner changes made after interruption. Ordinary audit reports pending recovery but remains read-only.
|
|
321
|
+
|
|
322
|
+
**Consequences** — Task/Run pairs cannot silently diverge after an interrupted mutation. Failure injection proves rollback and recovery. Cost: more local I/O and a transaction schema that must be validated as hostile input.
|
|
323
|
+
|
|
324
|
+
**Alternatives considered** — Best-effort compensating writes: cannot distinguish interruption from later owner edits. SQLite as canonical transaction store: violates Markdown portability and creates another authority.
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## ADR-023 — Guardrails are evaluated by an executable Policy Engine
|
|
329
|
+
Status: accepted
|
|
330
|
+
Date: 2026-07-22
|
|
331
|
+
|
|
332
|
+
**Context** — Canonical Guardrails without deterministic evaluation could be present in context yet silently ignored or described as passed. Migrated prose also makes aggressive inference unsafe.
|
|
333
|
+
|
|
334
|
+
**Decision** — Active stable-id Guardrails produce structured `passed`, `blocked`, or `deferred` evaluations. Blocks cite the exact `GR-NNN` id and reason code. Deferred checks remain visible for their mutation, migration, review, or owner boundary. Fresh rules declare enforcement explicitly; migrated prose uses conservative inference and ambiguous rules stay manual. Configuration cannot disable approval or weaken active policy.
|
|
335
|
+
|
|
336
|
+
**Consequences** — Policy advice is traceable to project authority instead of model opinion, while uncertainty stays explicit. Cost: not every project rule can be automated; manual/deferred enforcement remains a first-class result.
|
|
337
|
+
|
|
338
|
+
**Alternatives considered** — Treat every loaded rule as passed unless a keyword matches: false assurance. Block all manual rules at intake: safe but makes legitimate project-specific policy unusable.
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## ADR-024 — Derived freshness uses metadata fast path and content-hash fallback
|
|
343
|
+
Status: accepted
|
|
344
|
+
Date: 2026-07-22
|
|
345
|
+
|
|
346
|
+
**Context** — Recomputing every artifact hash and reparsing the entire code graph before each status or semantic query makes a disposable index defeat its purpose. Trusting timestamps alone would make cache metadata an accidental authority.
|
|
347
|
+
|
|
348
|
+
**Decision** — `state.md` and semantic SQLite store a source fingerprint plus a watch fingerprint over path/stat identity. An unchanged watch avoids source reads. Any metadata drift triggers a complete canonical/source content fingerprint before staleness is asserted. Cache schemas are explicit and mismatches force one rebuild. Commit-only changes do not invalidate semantically unchanged code.
|
|
349
|
+
|
|
350
|
+
**Consequences** — Normal queries stay fast while content remains the final verifier. State and intake share one canonical fingerprint implementation. Cost: metadata-only touches may trigger one full verification, and scanner changes require a cache-schema bump.
|
|
351
|
+
|
|
352
|
+
**Alternatives considered** — Hash every source on every query: maximally simple but O(project) on the hot path. Timestamp-only cache validity: faster but allows derived metadata to masquerade as truth.
|
package/MIGRATION-1-to-2.md
CHANGED
|
@@ -32,6 +32,17 @@ npx scrumrun@latest update --migrate
|
|
|
32
32
|
|
|
33
33
|
`--migrate` is explicit consent. Ordinary update never changes canonical project data.
|
|
34
34
|
|
|
35
|
+
### Early v2 Run upgrade
|
|
36
|
+
|
|
37
|
+
Projects created by earlier 2.x builds may contain prose-based Run transitions or inferred Guardrail fields. The same ongoing-project commands detect this layout without writes and, after explicit `--migrate`, upgrade the Run ledger and security schemas:
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
.scrumrun/.migration/run-ledger-v1/manifest.json
|
|
41
|
+
.scrumrun/.migration/run-ledger-v1/backup/runs/RUN-NNN.md
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Every changed Run, `guardrails.md`, and `method.json` is hashed and backed up byte-exactly. Inferred legacy Guardrail fields become explicit without deleting the original prose. Proven transition chains become ordered `RUN-NNN-EVT-NNN` events. When only the recorded status is provable, migration emits one evidenced `snapshot`; it does not invent the missing path. Existing terminal Runs remain historical; new/retried Runs bind policy obligations and the Mutation Gateway. Replay is idempotent, an interrupted apply restores prepared sources, and rollback refuses when a changed artifact moved after migration.
|
|
45
|
+
|
|
35
46
|
## Standalone flow
|
|
36
47
|
|
|
37
48
|
```bash
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
ScrumRun gives an agent a small command surface and a precise project memory: what should be done, how each attempt happened, which decisions constrain the code, and why the architecture exists in its current form.
|
|
6
6
|
|
|
7
|
-
**Method target:** `2.0.0` · **Runtime:** Node.js `>=22.13.0` · **License:** MIT
|
|
7
|
+
**Package:** `2.1.1` · **Method target:** `2.0.0` · **Runtime:** Node.js `>=22.13.0` · **License:** MIT
|
|
8
8
|
|
|
9
9
|
## The model
|
|
10
10
|
|
|
@@ -71,6 +71,10 @@ EXECUTING → VALIDATING → LEARNING → COMPLETED | FAILED | BLOCKED
|
|
|
71
71
|
|
|
72
72
|
Nothing canonical is persisted before approval. Failed retries remain available as separate Runs.
|
|
73
73
|
|
|
74
|
+
Each Run contains a machine-validated event ledger. Events have stable ids such as `RUN-044-EVT-003`, RFC3339 timestamps, actors, reasons, and typed evidence for commands, tests, files, reviews, decisions, insights, and risks. Run is the only operational history; Task keeps its approved scope and synchronized current status without duplicating those events. Completion is rejected when validation or learning evidence is missing.
|
|
75
|
+
|
|
76
|
+
Linked Task/Run writes use a durable ignored transaction journal. Captured failures roll back immediately; interrupted operations are recovered byte-exactly on retry or through explicit `doctor --recover`. Read-only audit reports pending recovery and never repairs state silently.
|
|
77
|
+
|
|
74
78
|
## Semantic project memory
|
|
75
79
|
|
|
76
80
|
Canonical memory is human-readable Markdown:
|
|
@@ -90,7 +94,9 @@ The agent can answer questions such as:
|
|
|
90
94
|
|
|
91
95
|
AI extraction creates candidates only. Confirmation requires resolvable evidence. Stale and invalidated memory is labeled; rejected/deprecated/invalidated records are excluded from active truth by default.
|
|
92
96
|
|
|
93
|
-
The fast graph/search layer is `.scrumrun/.cache/semantic-index.sqlite`. It is ignored and disposable: deleting it never deletes knowledge. The current JavaScript/TypeScript adapter derives qualified symbols plus `defined_in`, `depends_on`, `used_by`, and `protected_by` relations.
|
|
97
|
+
The fast graph/search layer is `.scrumrun/.cache/semantic-index.sqlite`. It is ignored and disposable: deleting it never deletes knowledge. The index selects FTS5/BM25 when the current Node.js SQLite build provides it and otherwise uses a deterministic, parameterized lexical fallback; both backends preserve bounded graph retrieval without changing canonical Markdown. Unchanged queries use a metadata-only freshness check; metadata drift falls back to complete content fingerprints before rebuilding. Cache-schema upgrades force one safe disposable rebuild. The current JavaScript/TypeScript adapter derives qualified symbols plus `defined_in`, `depends_on`, `used_by`, and `protected_by` relations.
|
|
98
|
+
|
|
99
|
+
`map.md` is shown only when its source fingerprint matches the current semantic index. A fresh placeholder or stale map is rejected with an explicit rebuild instruction instead of being presented as project truth.
|
|
94
100
|
|
|
95
101
|
## Migrating an ongoing v1 project
|
|
96
102
|
|
|
@@ -114,7 +120,7 @@ npx scrumrun@latest migrate --to 2 --apply
|
|
|
114
120
|
npx scrumrun@latest migrate --to 2 --rollback
|
|
115
121
|
```
|
|
116
122
|
|
|
117
|
-
Migration uses content hashes, a byte-exact ignored backup, staging validation, an atomic directory switch, a source-to-destination report, idempotent replay, and rollback protection. It also recognizes incomplete hybrid v1/v2 trees, reuses already-linked canonical work, and normalizes only deterministic schema aliases. Legacy-only files leave the active tree but remain byte-exact in the ignored backup; vault contents remain local. Ambiguous history remains an explicit warning, and the migrator never invents a Sprint or Run.
|
|
123
|
+
Migration uses content hashes, a byte-exact ignored backup, staging validation, an atomic directory switch, a source-to-destination report, idempotent replay, and rollback protection. It also recognizes incomplete hybrid v1/v2 trees, reuses already-linked canonical work, and normalizes only deterministic schema aliases. Early v2 Run prose is preflighted and upgraded to the structured ledger by the same explicit `update --migrate` gate; ambiguous paths become evidenced snapshots instead of invented transitions. Legacy-only files leave the active tree but remain byte-exact in the ignored backup; vault contents remain local. Ambiguous history remains an explicit warning, and the migrator never invents a Sprint or Run.
|
|
118
124
|
|
|
119
125
|
After migration or an integration update, verify both installed assets and project state:
|
|
120
126
|
|
|
@@ -149,7 +155,9 @@ npx scrumrun@latest doctor codex --strict
|
|
|
149
155
|
vault.local.md # optional, ignored, never indexed
|
|
150
156
|
```
|
|
151
157
|
|
|
152
|
-
`guardrails.md` is canonical project policy. `config.md` contains preferences and cannot weaken
|
|
158
|
+
`guardrails.md` is canonical project policy. Active `GR-NNN` rules are evaluated into explicit `passed`, `blocked`, or `deferred` results; blocks identify the exact Guardrail and deferred checks stay visible for their execution-time gate. `config.md` contains preferences and cannot weaken policy. Duplicate/unknown Guardrails, disabled approval, and unsafe read-only paths fail conformance. `state.md`, `map.md`, context packages, and SQLite are generated navigation aids, never authority. `state.md` carries the same source fingerprint used by intake, an RFC3339 generation time, and a watch fingerprint for fast verified staleness checks.
|
|
159
|
+
|
|
160
|
+
Approved Runs persist every deferred result as an append-only obligation and bind the exact policy plus workspace baseline. Material source edits use a 15-minute, path-scoped Mutation Gateway permit. Recording verifies before/after hashes, owner/read-only scope, symlinks, new secret-like content, and workspace drift. Validation and completion fail closed when edits bypass that chain or obligations remain unresolved.
|
|
153
161
|
|
|
154
162
|
## Useful commands
|
|
155
163
|
|
|
@@ -161,6 +169,15 @@ npx scrumrun@latest commands
|
|
|
161
169
|
npx scrumrun@latest sc plan intake "Fix pricing rounding"
|
|
162
170
|
npx scrumrun@latest sc plan intake --approve <token>
|
|
163
171
|
|
|
172
|
+
# authorize and record a material source mutation
|
|
173
|
+
npx scrumrun@latest sc plan run --authorize-mutation RUN-001 --path src/pricing.ts
|
|
174
|
+
npx scrumrun@latest sc plan run --record-mutation RUN-001 --permit MUT-... --note "Pricing change recorded"
|
|
175
|
+
|
|
176
|
+
# record an audit-derived Review, then resolve a persisted completion gate
|
|
177
|
+
npx scrumrun@latest sc review artifact --run
|
|
178
|
+
npx scrumrun@latest sc review artifact --record --task TASK-001 --run RUN-001 --evidence "npm test: passed"
|
|
179
|
+
npx scrumrun@latest sc plan run --satisfy-guardrail RUN-001 --guardrail GR-003 --review REV-001
|
|
180
|
+
|
|
164
181
|
# memory lifecycle
|
|
165
182
|
npx scrumrun@latest sc knowledge insight --propose "Pricing stays in backend" --evidence src/pricing.ts
|
|
166
183
|
npx scrumrun@latest sc knowledge insight --confirm INS-001
|
|
@@ -171,7 +188,7 @@ npx scrumrun@latest sc knowledge map --build
|
|
|
171
188
|
npx scrumrun@latest sc knowledge map --show
|
|
172
189
|
```
|
|
173
190
|
|
|
174
|
-
The command manifest in `lib/commands/manifest.js` generates help and compatibility adapters, preventing client grammar drift.
|
|
191
|
+
The command manifest in `lib/commands/manifest.js` generates help and compatibility adapters, preventing client grammar drift. A recorded artifact Review cannot self-declare success: ScrumRun reruns the audit and derives the `REV-NNN` verdict from the result.
|
|
175
192
|
|
|
176
193
|
## Documentation
|
|
177
194
|
|
|
@@ -181,6 +198,7 @@ The command manifest in `lib/commands/manifest.js` generates help and compatibil
|
|
|
181
198
|
| [`SPEC.md`](./SPEC.md) | Normative 2.0 state machines, invariants, and conformance rules. |
|
|
182
199
|
| [`DECISIONS.md`](./DECISIONS.md) | Architectural decisions and trade-offs. |
|
|
183
200
|
| `MIGRATION-1-to-2.md` | Upgrade, verification, rollback, and recovery guide. |
|
|
201
|
+
| [`docs/RELEASE-SCORECARD.md`](docs/RELEASE-SCORECARD.md) | Evidence-backed local readiness scores and residual release risks. |
|
|
184
202
|
|
|
185
203
|
ScrumRun remains client-independent: any agent that reads Markdown can follow `CORE.md`; Codex, Claude Code, and OpenCode integrations are accelerators.
|
|
186
204
|
|
package/SPEC.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ScrumRun Method Specification
|
|
2
2
|
|
|
3
|
-
Version: `2.0.0` · Status:
|
|
3
|
+
Version: `2.0.0` · Status: stable
|
|
4
4
|
|
|
5
5
|
`SPEC.md` defines normative meanings and invariants. `lib/v2/schema.js` defines the machine-enforced ids, paths, statuses, transitions, structural relations, and truth ownership metadata; `lib/commands/manifest.js` defines command grammar. `CORE.md` is the operational runtime guide. Generated `docs/SCHEMA.md` must match the executable schema byte-for-byte. A conflict is a conformance failure: semantics defer to SPEC, mechanically enforced values defer to the schema, grammar defers to the command manifest, and the conflicting representation must be corrected.
|
|
6
6
|
|
|
@@ -108,6 +108,14 @@ FEAT-003
|
|
|
108
108
|
└── generated → INS-041
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
+
### 3.3 Run event ledger
|
|
112
|
+
|
|
113
|
+
A newly authored Run declares `ledger: 1` and owns exactly one append-only operational event stream under `## Events`. Event ids are stable and scoped to the Run (`RUN-044-EVT-001`, `RUN-044-EVT-002`, ...). Each JSON event records a contiguous sequence, RFC3339 timestamp, timestamp precision, actor, source and destination states, reason, and typed evidence.
|
|
114
|
+
|
|
115
|
+
Native Runs begin with `created → executing`. A migration may instead create one evidenced `snapshot` as the historical baseline when the source proves a recorded status but not its full transition path. A snapshot exposes that uncertainty and never fabricates intermediate states.
|
|
116
|
+
|
|
117
|
+
The ledger is the execution authority. Task retains approved scope and synchronized current status, but does not copy Run events. Conformance reconstructs the Run state from its ledger and rejects missing or duplicate ids, invalid ordering, time reversal, illegal transitions, frontmatter drift, missing evidence, and unevidenced completion.
|
|
118
|
+
|
|
111
119
|
## 4. State machines
|
|
112
120
|
|
|
113
121
|
Only the following transitions are valid.
|
|
@@ -188,11 +196,13 @@ RECEIVED
|
|
|
188
196
|
→ COMPLETED | FAILED | BLOCKED
|
|
189
197
|
```
|
|
190
198
|
|
|
191
|
-
Everything through `AWAITING_APPROVAL` is read-only. It may exist in process memory or ignored cache only. A valid approval token binds the normalized request, policy result, classification, risk, issuance time,
|
|
199
|
+
Everything through `AWAITING_APPROVAL` is read-only. It may exist in process memory or ignored cache only. A valid approval token binds the normalized request, policy result, classification, risk, issuance time, canonical context fingerprint, and complete workspace fingerprint. Canonical or source drift after planning invalidates approval.
|
|
192
200
|
|
|
193
201
|
Approval atomically creates one Task and its first Run. If either write fails, neither may remain. Project changes after planning invalidate the token. Reusing a successfully consumed token is idempotent.
|
|
194
202
|
|
|
195
|
-
|
|
203
|
+
The approved Run binds the exact Guardrail-policy fingerprint and a canonical workspace baseline. Every post-approval `deferred` check becomes an append-only Guardrail obligation. A material source mutation requires a short-lived, path-scoped permit issued from that baseline; recording it verifies before/after hashes, policy freshness, path scope, read-only boundaries, symlink safety, and newly introduced secret-like content. Unrecorded workspace drift fails closed. A Run cannot complete while an obligation is unresolved or the workspace differs from its last recorded mutation.
|
|
204
|
+
|
|
205
|
+
Run transitions synchronously update the linked Task and append exactly one structured event to the Run ledger. Validation, learning, completion, failure, block, and resume transitions require a reason or typed evidence. Task status changes without receiving a duplicate narrative history. Multi-file mutations use a durable local transaction journal: `prepared` operations roll back byte-exactly after failure/interruption, while `committed` journals are verified and finalized. Ordinary audit is read-only and reports pending recovery; `doctor --recover` or retrying the approved mutation performs recovery explicitly. Entering `learning` may extract structured candidates from the Run, but extraction failure never blocks Run progress.
|
|
196
206
|
|
|
197
207
|
## 6. Policy and precedence
|
|
198
208
|
|
|
@@ -208,6 +218,10 @@ When guidance conflicts, apply this order:
|
|
|
208
218
|
|
|
209
219
|
Configuration controls preferences but cannot weaken higher levels. Missing or stale context must be surfaced, never rendered as certainty.
|
|
210
220
|
|
|
221
|
+
Every project Guardrail has a stable `GR-NNN` identity, lifecycle status, rule text, enforcement mode, and optional scope/source. Intake evaluates active Guardrails into structured `passed`, `blocked`, or `deferred` results. A block names the responsible Guardrail and machine-readable reason code; a deferred result is shown explicitly and must be enforced at the mutation, migration, review, or owner gate it names. Deferred checks do not become evidence of a pass.
|
|
222
|
+
|
|
223
|
+
The executable Policy Engine may infer enforcement for migrated prose, but fresh v2 policy declares it explicitly. Unknown enforcement, duplicate ids, inactive-only policy, configuration that disables approval, and unsafe read-only paths fail conformance. Configuration can tune presentation and workflow preferences; it cannot retire, bypass, or weaken active Guardrails.
|
|
224
|
+
|
|
211
225
|
## 7. Semantic memory and code intelligence
|
|
212
226
|
|
|
213
227
|
Memory records include subject, source, evidence, validity window, confidence where useful, review trigger, and last-verified commit. Insight types may include placement rationale, design constraint, known trade-off, failure history, usage warning, compatibility reason, business rule, performance reason, security reason, and testing note.
|
|
@@ -234,7 +248,9 @@ The agreed v1 control-context baseline is 48,000 characters. A fresh lean v2 int
|
|
|
234
248
|
|
|
235
249
|
## 8. Generated views and cache
|
|
236
250
|
|
|
237
|
-
`state.md`, `map.md`, context packages, and `.cache/semantic-index.sqlite` are non-authoritative projections. They carry source fingerprints or are treated as stale.
|
|
251
|
+
`state.md`, `map.md`, context packages, and `.cache/semantic-index.sqlite` are non-authoritative projections. They carry source fingerprints or are treated as stale. `state.md` uses the exact canonical fingerprint bound into intake, plus a projection schema, RFC3339 generation time, and a disposable watch fingerprint. SQLite stores its source and watch fingerprints with an explicit cache schema.
|
|
252
|
+
|
|
253
|
+
Freshness checks use a two-tier strategy: unchanged path/stat identity proves that no source read or reparse is needed; changed metadata triggers a complete canonical/source content fingerprint before staleness is asserted. Cache metadata may optimize verification but never supplies project truth. A cache-schema mismatch forces one disposable rebuild. Deleting `.cache/` must not remove authored knowledge, and rebuilding it from unchanged sources must yield equivalent query results.
|
|
238
254
|
|
|
239
255
|
The index must never scan or store `vault.local.md`. Source scanning is bounded, skips dependencies/build output and symlinks, and uses replaceable language adapters.
|
|
240
256
|
|
|
@@ -250,6 +266,8 @@ scrumrun migrate --to 2 --rollback
|
|
|
250
266
|
|
|
251
267
|
`npx scrumrun@latest update` performs the same read-only preflight when run inside a v1 project and leaves project data untouched. `update --migrate` is an explicit request to apply the verified plan; it is not implicit migration.
|
|
252
268
|
|
|
269
|
+
Inside an early v2 project, the same commands preflight and explicitly upgrade legacy Run prose to ledger schema 1. Deterministic transition chains are recovered; incomplete history becomes an evidenced snapshot. Apply keeps byte-exact ignored backups, verifies hashes, is idempotent, and supports rollback that refuses to erase later Run changes.
|
|
270
|
+
|
|
253
271
|
The migrator must:
|
|
254
272
|
|
|
255
273
|
- hash every source file and block;
|
|
@@ -271,7 +289,7 @@ Legacy sprint entries become Tasks. History entries become Runs only with an evi
|
|
|
271
289
|
- **I-02** Approval creates a linked Task/Run pair atomically or creates nothing.
|
|
272
290
|
- **I-03** Task is atomic work; Sprint only groups Tasks with real batch/timebox evidence.
|
|
273
291
|
- **I-04** Every retry creates a new Run and preserves earlier attempts.
|
|
274
|
-
- **I-05** Only declared state transitions are accepted and paired transitions are recoverable.
|
|
292
|
+
- **I-05** Only declared, ordered, evidenced state transitions are accepted; Run event ids are unique and paired transitions are recoverable.
|
|
275
293
|
- **I-06** `guardrails.md` is canonical project policy and configuration cannot weaken it.
|
|
276
294
|
- **I-07** Markdown is canonical; SQLite and generated views are disposable projections.
|
|
277
295
|
- **I-08** AI-created facts/insights remain candidates until explicit human confirmation.
|
|
@@ -284,9 +302,10 @@ Legacy sprint entries become Tasks. History entries become Runs only with an evi
|
|
|
284
302
|
- **I-15** Migration is explicit; dry-run and ordinary update perform no project writes.
|
|
285
303
|
- **I-16** Migration preserves hashed source coverage, backup, mapping, idempotency, and safe rollback.
|
|
286
304
|
- **I-17** Migration warnings preserve ambiguity; they never invent Sprints, Runs, approval, or truth.
|
|
287
|
-
- **I-18** Partial writes, conflicting overwrites, unsafe paths, and symlink traversal fail without corrupting canonical state.
|
|
305
|
+
- **I-18** Partial/interrupted writes, conflicting overwrites, unsafe paths, and symlink traversal fail or recover without corrupting canonical state or overwriting later owner work.
|
|
288
306
|
- **I-19** Code intelligence is derived, adapter-based, fingerprinted, and cannot silently confirm memory.
|
|
289
307
|
- **I-20** Post-validation learning proposes candidates and never blocks Task/Run completion.
|
|
308
|
+
- **I-21** Material mutations are policy-bound, path-scoped, hash-verified, append-only, and fail closed on bypass; unresolved Guardrail obligations block completion.
|
|
290
309
|
|
|
291
310
|
## 11. Command grammar
|
|
292
311
|
|
|
@@ -304,12 +323,13 @@ Unknown syntax fails deterministically and never guesses a mutation.
|
|
|
304
323
|
|
|
305
324
|
An implementation may claim ScrumRun method 2.0.0 only when it:
|
|
306
325
|
|
|
307
|
-
1. passes positive and negative tests for I-01 through I-
|
|
326
|
+
1. passes positive and negative tests for I-01 through I-21;
|
|
308
327
|
2. enforces every exposed state machine and schema;
|
|
309
328
|
3. proves read-only intake and dry-run migration through full-tree fingerprints;
|
|
310
329
|
4. proves migration failure recovery, rollback safety, and vault exclusion;
|
|
311
|
-
5.
|
|
312
|
-
6.
|
|
313
|
-
7.
|
|
330
|
+
5. reconstructs every native Run status from a valid, evidenced ledger and detects tampering;
|
|
331
|
+
6. proves cache deletion/rebuild equivalence and inactive-memory filtering;
|
|
332
|
+
7. bounds context/retrieval and records benchmark budgets;
|
|
333
|
+
8. declares method `2.0.0` and requires Node.js `>=22.13.0` for the native SQLite index.
|
|
314
334
|
|
|
315
335
|
Method changes follow semantic versioning. Breaking entity, path, invariant, or state changes require a major version and a migration guide.
|