scrumrun 1.5.2 → 2.0.0

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.
Files changed (106) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/CORE.md +224 -311
  3. package/DECISIONS.md +95 -11
  4. package/LICENSE +21 -0
  5. package/MIGRATION-1-to-2.md +109 -0
  6. package/README.md +137 -78
  7. package/SPEC.md +248 -257
  8. package/bin/claude-install.js +18 -132
  9. package/bin/scrumrun.js +1259 -174
  10. package/docs/COMMANDS.md +69 -0
  11. package/docs/ENTITY-MODEL.md +38 -0
  12. package/docs/RELEASE.md +44 -0
  13. package/docs/SCHEMA.md +80 -0
  14. package/docs/SEMANTIC-MEMORY.md +68 -0
  15. package/docs/TROUBLESHOOTING.md +66 -0
  16. package/lib/code-intel/adapter.js +20 -0
  17. package/lib/code-intel/javascript.js +199 -0
  18. package/lib/code-intel/learning.js +66 -0
  19. package/lib/code-intel/scanner.js +126 -0
  20. package/lib/commands/manifest.js +109 -0
  21. package/lib/commands/render.js +75 -0
  22. package/lib/memory/index.js +600 -0
  23. package/lib/memory/markdown.js +51 -0
  24. package/lib/memory/service.js +300 -0
  25. package/lib/runtime/budgets.js +19 -0
  26. package/lib/runtime/context.js +141 -0
  27. package/lib/runtime/orchestrator.js +270 -0
  28. package/lib/runtime/request-engine.js +128 -0
  29. package/lib/security/secrets.js +23 -0
  30. package/lib/v2/artifacts.js +343 -0
  31. package/lib/v2/conformance.js +167 -0
  32. package/lib/v2/migration.js +1161 -0
  33. package/lib/v2/project-store.js +44 -0
  34. package/lib/v2/schema.js +128 -0
  35. package/package.json +16 -6
  36. package/scripts/generate-contract-docs.js +113 -0
  37. package/templates/project/.scrumrun/config.md +4 -7
  38. package/templates/project/.scrumrun/guardrails.md +23 -0
  39. package/templates/project/.scrumrun/map.md +4 -16
  40. package/templates/project/.scrumrun/memory/decisions/.gitkeep +1 -0
  41. package/templates/project/.scrumrun/memory/dossiers/.gitkeep +1 -0
  42. package/templates/project/.scrumrun/memory/insights/.gitkeep +1 -0
  43. package/templates/project/.scrumrun/memory/knowledge/.gitkeep +1 -0
  44. package/templates/project/.scrumrun/method.json +4 -0
  45. package/templates/project/.scrumrun/project.md +6 -12
  46. package/templates/project/.scrumrun/runs/.gitkeep +1 -0
  47. package/templates/project/.scrumrun/sprints/.gitkeep +1 -0
  48. package/templates/project/.scrumrun/state.md +21 -0
  49. package/templates/project/.scrumrun/tasks/.gitkeep +1 -0
  50. package/templates/project/AGENTS.md +16 -49
  51. package/templates/project-lean/AGENTS.md +18 -0
  52. package/templates/shared/skills/scrumrun/SKILL.md +201 -0
  53. package/templates/codex/prompts/sc-agent.md +0 -14
  54. package/templates/codex/prompts/sc-backlog.md +0 -13
  55. package/templates/codex/prompts/sc-challenge.md +0 -57
  56. package/templates/codex/prompts/sc-config.md +0 -18
  57. package/templates/codex/prompts/sc-context.md +0 -24
  58. package/templates/codex/prompts/sc-decisions.md +0 -8
  59. package/templates/codex/prompts/sc-feature.md +0 -16
  60. package/templates/codex/prompts/sc-fix.md +0 -21
  61. package/templates/codex/prompts/sc-goal.md +0 -14
  62. package/templates/codex/prompts/sc-golden.md +0 -14
  63. package/templates/codex/prompts/sc-help.md +0 -12
  64. package/templates/codex/prompts/sc-init.md +0 -14
  65. package/templates/codex/prompts/sc-intake.md +0 -22
  66. package/templates/codex/prompts/sc-know.md +0 -75
  67. package/templates/codex/prompts/sc-map.md +0 -13
  68. package/templates/codex/prompts/sc-review.md +0 -13
  69. package/templates/codex/prompts/sc-sprint.md +0 -28
  70. package/templates/codex/prompts/sc-study.md +0 -23
  71. package/templates/codex/prompts/sc-uninstall.md +0 -14
  72. package/templates/codex/prompts/sc-update.md +0 -8
  73. package/templates/codex/prompts/sc-vault.md +0 -27
  74. package/templates/codex/skills/scrumrun/SKILL.md +0 -412
  75. package/templates/opencode/commands/sc-agent.md +0 -14
  76. package/templates/opencode/commands/sc-backlog.md +0 -13
  77. package/templates/opencode/commands/sc-challenge.md +0 -57
  78. package/templates/opencode/commands/sc-config.md +0 -18
  79. package/templates/opencode/commands/sc-context.md +0 -24
  80. package/templates/opencode/commands/sc-decisions.md +0 -8
  81. package/templates/opencode/commands/sc-feature.md +0 -16
  82. package/templates/opencode/commands/sc-fix.md +0 -21
  83. package/templates/opencode/commands/sc-goal.md +0 -14
  84. package/templates/opencode/commands/sc-golden.md +0 -14
  85. package/templates/opencode/commands/sc-help.md +0 -12
  86. package/templates/opencode/commands/sc-init.md +0 -14
  87. package/templates/opencode/commands/sc-intake.md +0 -22
  88. package/templates/opencode/commands/sc-know.md +0 -75
  89. package/templates/opencode/commands/sc-map.md +0 -13
  90. package/templates/opencode/commands/sc-review.md +0 -13
  91. package/templates/opencode/commands/sc-sprint.md +0 -28
  92. package/templates/opencode/commands/sc-study.md +0 -23
  93. package/templates/opencode/commands/sc-uninstall.md +0 -14
  94. package/templates/opencode/commands/sc-update.md +0 -8
  95. package/templates/opencode/commands/sc-vault.md +0 -27
  96. package/templates/opencode/skills/scrumrun/SKILL.md +0 -412
  97. package/templates/project/.scrumrun/agents.md +0 -36
  98. package/templates/project/.scrumrun/backlog.md +0 -7
  99. package/templates/project/.scrumrun/context.md +0 -61
  100. package/templates/project/.scrumrun/goals/main/decisions.md +0 -9
  101. package/templates/project/.scrumrun/goals/main/history.md +0 -51
  102. package/templates/project/.scrumrun/goals/main/sprint.md +0 -54
  103. package/templates/project/.scrumrun/golden-rules.md +0 -9
  104. package/templates/project/.scrumrun/knowledge.md +0 -15
  105. package/templates/project/.scrumrun/runbook.md +0 -101
  106. package/templates/project/.scrumrun/token-policy.md +0 -43
package/DECISIONS.md CHANGED
@@ -18,7 +18,7 @@ Date: YYYY-MM-DD
18
18
  ---
19
19
 
20
20
  ## ADR-001 — Markdown as the sole persistence format
21
- Status: accepted
21
+ Status: superseded in part by ADR-017
22
22
  Date: 2026-07-17
23
23
 
24
24
  **Context** — ScrumRun needs a persistence layer for state that is (a) portable across AI agents, (b) diffable via git, (c) readable by humans without tooling, (d) editable by hand in an emergency.
@@ -39,7 +39,7 @@ Date: 2026-07-17
39
39
 
40
40
  **Decision** — Approval gates are synchronous checkpoints requiring explicit owner response. There is intentionally no config option to grant blanket implementation permission (see I-01, I-06).
41
41
 
42
- **Consequences** — Slower than fully autonomous execution. But every code change has a recorded owner decision. Cost: friction on trivial tasks — mitigated by the `Quick Tasks: allow` policy, which still cannot override golden rules.
42
+ **Consequences** — Slower than fully autonomous execution. But every code change has a recorded owner decision. Cost: friction on trivial tasks — mitigated by concise quick-task planning, never by removing the approval gate or bypassing Guardrails.
43
43
 
44
44
  **Alternatives considered** — Async approval (approve later): breaks the "audit trail matches execution" property. Silent execution with rollback: rollback is not a substitute for consent.
45
45
 
@@ -74,7 +74,7 @@ Date: 2026-07-17
74
74
  ---
75
75
 
76
76
  ## ADR-005 — Main goal and feature lanes are physically separate
77
- Status: accepted
77
+ Status: superseded by ADR-015
78
78
  Date: 2026-07-17
79
79
 
80
80
  **Context** — Feature ideas frequently arrive mid-sprint. Merging them into main sprint history dilutes the narrative of the main goal and makes historical audit harder.
@@ -88,12 +88,12 @@ Date: 2026-07-17
88
88
  ---
89
89
 
90
90
  ## ADR-006 — Golden rules cannot be silently bypassed
91
- Status: accepted
91
+ Status: superseded by ADR-016
92
92
  Date: 2026-07-17
93
93
 
94
94
  **Context** — Configuration flags that disable safety features are the most common source of preventable damage in AI-assisted workflows.
95
95
 
96
- **Decision** — Active golden rules have highest precedence. There is no command flag, no config option, and no intake path that disables them. Retirement requires explicit owner action and is logged (see I-03, I-08).
96
+ **Decision** — Active project rules have highest precedence. There is no command flag, no config option, and no intake path that disables them. Retirement requires explicit owner action and is logged. ADR-016 later renamed and consolidated this authority as canonical Guardrails.
97
97
 
98
98
  **Consequences** — Guarantees that "add rule X" produces durable behavior. Cost: cannot temporarily suspend a rule — must retire, act, re-add. Intentional friction.
99
99
 
@@ -102,7 +102,7 @@ Date: 2026-07-17
102
102
  ---
103
103
 
104
104
  ## ADR-007 — `context.md` is never authoritative
105
- Status: accepted
105
+ Status: superseded by ADR-017
106
106
  Date: 2026-07-17
107
107
 
108
108
  **Context** — Token economy pressure encourages agents to trust cached summaries. A summary that is 90% accurate is a summary that will mislead 10% of the time on production decisions.
@@ -116,7 +116,7 @@ Date: 2026-07-17
116
116
  ---
117
117
 
118
118
  ## ADR-008 — Fixes and sprints coexist as distinct kinds
119
- Status: accepted
119
+ Status: superseded by ADR-015
120
120
  Date: 2026-07-17
121
121
 
122
122
  **Context** — A production bug is not a full sprint. Forcing every corrective action through the sprint protocol (plan, review, complete) adds overhead disproportionate to the risk.
@@ -185,15 +185,15 @@ Date: 2026-07-17
185
185
 
186
186
  ---
187
187
 
188
- ## ADR-013 — Six-command grammar (planned, not yet implemented)
189
- Status: proposed
188
+ ## ADR-013 — Root command with five domain nouns
189
+ Status: accepted
190
190
  Date: 2026-07-17
191
191
 
192
192
  **Context** — Twenty `sc-*` commands accumulated organically. Overlap between commands (study/know/map/context, sprint/fix/feature/backlog/goal) suggests the grammar has grown by addition rather than design.
193
193
 
194
- **Decision** — Consolidate the 20 verbs into 6 nouns: `/sc`, `/sc plan`, `/sc knowledge`, `/sc rules`, `/sc review`, `/sc config`. Legacy commands become invisible aliases for one release cycle, then removed.
194
+ **Decision** — Expose one root command, `/sc`, with five domain nouns: `plan`, `knowledge`, `rules`, `review`, and `config`. Actions remain canonical long flags. Client integrations are generated from one command manifest. Legacy commands are real compatibility adapters during migration, never prompts that merely tell the user to invoke another command.
195
195
 
196
- **Consequences** — Grammar reflects method structure (§4 composition). Discoverability improves without hiding power. Cost: one-time migration effort for existing users — currently only the author.
196
+ **Consequences** — The installed surface becomes genuinely smaller and the grammar reflects method structure. One manifest prevents drift between clients, help, tests, and documentation. Cost: v1 installations require an explicit migration path.
197
197
 
198
198
  **Alternatives considered** — Keep 20 with better docs: does not address root cause (design accretion). Reduce to 2 (only intake + one power command): loses the ability to script determin­istically.
199
199
 
@@ -210,3 +210,87 @@ Date: 2026-07-17
210
210
  **Consequences** — Method is usable in the owner's native language without translation overhead. Cost: docs and examples may lag between languages — accepted.
211
211
 
212
212
  **Alternatives considered** — Auto-detect from user input: unreliable across sessions and mixed-language inputs.
213
+
214
+ ---
215
+
216
+ ## ADR-015 — Task, Sprint, Feature, and Run are separate entities
217
+ Status: accepted
218
+ Date: 2026-07-21
219
+
220
+ **Context** — Earlier ScrumRun versions treated a sprint as the smallest executable unit. That conflated a task with an Agile timebox, made retries overwrite operational meaning, and forced agents to infer relationships from large Markdown catalogs.
221
+
222
+ **Decision** — Task is the atomic unit of intended work. Sprint is a timebox or delivery batch that references tasks. Feature is a long-lived initiative that can span tasks and sprints. Run is one concrete execution attempt of a task. All relations use stable ids: `FEAT-NNN`, `TASK-NNN`, `SPRINT-NNN`, and `RUN-NNN`.
223
+
224
+ **Consequences** — Agents can traverse an explicit graph, retry a task without erasing failed attempts, distinguish product intent from execution, and attach decisions/insights to the correct granularity. Cost: migration must split legacy sprint records into the new entities without inventing false detail.
225
+
226
+ **Alternatives considered** — Keep sprint as the atomic work item: simpler storage but semantically incorrect and weak for retries. Nest task files under features/sprints: creates duplicated ownership and fragile moves.
227
+
228
+ ---
229
+
230
+ ## ADR-016 — Guardrails are canonical and lean is a read policy
231
+ Status: accepted
232
+ Date: 2026-07-21
233
+
234
+ **Context** — A generated `guardrails.md` sourced from `golden-rules.md` duplicated the most important rules and could drift or point to missing canonical files in lean mode.
235
+
236
+ **Decision** — `.scrumrun/guardrails.md` is the single canonical project-policy artifact and replaces `golden-rules.md`. Universal method invariants remain in `core.md`; owner/project constraints live in `guardrails.md`; operational preferences live in `config.md`. Lean mode changes the initial read set, not the completeness of stored truth.
237
+
238
+ **Consequences** — The normal agent hot path is `AGENTS.md → guardrails.md → state.md`, with `core.md` and targeted canonical artifacts loaded only when needed. Cost: v1 golden rules require a lossless migration into guardrails.
239
+
240
+ **Alternatives considered** — Keep both files: preserves v1 paths but creates ambiguous precedence and drift. Make guardrails generated: fast to read but unsafe as an authority.
241
+
242
+ ---
243
+
244
+ ## ADR-017 — Semantic memory uses Markdown truth and a derived index
245
+ Status: accepted
246
+ Date: 2026-07-21
247
+
248
+ **Context** — Semantic code memory needs fast relationship queries, while ScrumRun's portability requires human-readable, diffable, tool-independent truth.
249
+
250
+ **Decision** — Knowledge, architectural decisions, insights, dossiers, tasks, sprints, features, and runs remain canonical Markdown artifacts. SQLite under `.scrumrun/.cache/` stores only rebuildable indexes, code symbols, derived relations, and temporary context packages. Deleting the cache must never delete authored knowledge.
251
+
252
+ **Consequences** — Agents get graph-speed retrieval without locking project memory to a database. Confirmed insights require evidence; AI extraction creates candidates only. Cost: rebuild and equivalence tests become release requirements.
253
+
254
+ **Alternatives considered** — SQLite as canonical storage: faster writes but opaque diffs and weaker portability. Markdown-only scanning: portable but increasingly slow and token-heavy.
255
+
256
+ ---
257
+
258
+ ## ADR-018 — ScrumRun v2 persists only after approval
259
+ Status: accepted
260
+ Date: 2026-07-21
261
+
262
+ **Context** — Contextualization, risk assessment, classification, and planning must inspect significant project state, but intake is required to remain side-effect free.
263
+
264
+ **Decision** — `RECEIVED → CONTEXTUALIZING → POLICY → RISK → CLASSIFICATION → PLANNING → AWAITING_APPROVAL` is transient. Context packages may exist only in ignored disposable cache. Explicit approval creates or updates the canonical Task and starts a Run. A Run then moves through `executing → validating → learning → completed|failed|blocked`.
265
+
266
+ **Consequences** — Intake remains read-only while approved execution becomes fully auditable. Retries create new runs for the same task. Learning proposes `K`, `DEC`, or `INS` records but never confirms them automatically.
267
+
268
+ **Alternatives considered** — Persist every received request: stronger raw audit but violates read-only intake and retains unapproved user content. Reuse task status for attempts: loses retry history.
269
+
270
+ ---
271
+
272
+ ## ADR-019 — v1-to-v2 migration is explicit, lossless, and reversible
273
+ Status: accepted
274
+ Date: 2026-07-21
275
+
276
+ **Context** — ScrumRun 1.x stores atomic work as sprint entries inside aggregate Markdown files. ScrumRun 2.0 separates Feature, Task, Sprint, Run, and Memory. Blindly renaming files would either lose history or invent relationships that never existed.
277
+
278
+ **Decision** — `scrumrun migrate --to 2` is an explicit workflow with `--dry-run`, content-hashed inventory, local backup, staged transformation, validation, atomic application, mapping report, idempotent replay, and `--rollback`. Ordinary updates never auto-migrate project data. An update may perform a read-only preflight; only the explicit `update --migrate` flag applies the verified plan. Legacy sprint entries become Tasks; historical attempts become Runs; a v2 Sprint is created only when v1 evidence supports a real grouping/timebox. Uncertain mappings are preserved and flagged, never guessed.
279
+
280
+ **Consequences** — Every source block is traceable to a destination id and users can recover the complete v1 tree. Cost: the v2 artifact kernel must ship with dual-layout readers and realistic migration fixtures before the new layout becomes default.
281
+
282
+ **Alternatives considered** — In-place rewrite: smaller implementation but unsafe and hard to audit. Preserve v1 forever: avoids migration risk but prevents a coherent v2 domain model.
283
+
284
+ ---
285
+
286
+ ## ADR-020 — Ongoing projects preflight migration during update
287
+ Status: accepted
288
+ Date: 2026-07-21
289
+
290
+ **Context** — Existing users naturally run `npx scrumrun@latest update` to receive new client commands. If project migration is completely separate, an ongoing v1 project can receive a v2 command surface without noticing that its canonical layout still needs review.
291
+
292
+ **Decision** — When `update` runs inside a v1 project, it automatically executes the v1→v2 dry-run and prints its verified inventory, mappings, warnings, and blockers. The preflight is read-only. Project state changes only when the owner supplies `--migrate`, which applies the same verified migration workflow and preserves standalone rollback.
293
+
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
+
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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Leander Costa
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,109 @@
1
+ # Migrating ScrumRun 1.x to 2.0
2
+
3
+ ScrumRun 2.0 changes the domain model: legacy “sprint entries” usually become Tasks, execution history becomes Runs, and Sprints exist only when the source proves a real timebox or delivery batch. Migration is therefore explicit, hashed, staged, and reversible.
4
+
5
+ ## Requirements
6
+
7
+ - Node.js `>=22.13.0`.
8
+ - A readable `.scrumrun/` v1 directory with no symlinks inside it.
9
+ - Enough local disk space for a byte-exact backup plus the migrated tree.
10
+ - A clean understanding of any post-migration changes before rollback.
11
+
12
+ The local vault stays at `.scrumrun/vault.local.md`; its content is preserved and never printed. Secret-like content outside the vault blocks migration so it is not duplicated into new artifacts.
13
+
14
+ ## Recommended ongoing-project flow
15
+
16
+ ```bash
17
+ npx scrumrun@latest update
18
+ ```
19
+
20
+ Inside a v1 project, update installs the current client integrations and runs a zero-write migration preflight. Review:
21
+
22
+ - source fingerprint and file count;
23
+ - generated artifact counts;
24
+ - source-to-destination mappings;
25
+ - warnings and blockers.
26
+
27
+ Apply exactly that workflow only after review:
28
+
29
+ ```bash
30
+ npx scrumrun@latest update --migrate
31
+ ```
32
+
33
+ `--migrate` is explicit consent. Ordinary update never changes canonical project data.
34
+
35
+ ## Standalone flow
36
+
37
+ ```bash
38
+ npx scrumrun@latest migrate --to 2 --dry-run
39
+ npx scrumrun@latest migrate --to 2 --apply
40
+ ```
41
+
42
+ After apply, inspect:
43
+
44
+ ```text
45
+ .scrumrun/.migration/v1-to-v2/manifest.json
46
+ .scrumrun/.migration/v1-to-v2/report.md
47
+ .scrumrun/tasks/
48
+ .scrumrun/runs/
49
+ .scrumrun/sprints/
50
+ .scrumrun/features/
51
+ .scrumrun/memory/
52
+ ```
53
+
54
+ The `.migration/` directory is ignored. The manifest records the original tree fingerprint, every generated file hash, mappings, archived paths, and warnings. The backup contains the byte-exact original tree. After apply, legacy-only aggregate files exist only in that backup, so the active tree has one unambiguous v2 layout.
55
+
56
+ Incomplete hybrid trees are supported. If canonical `TASK-NNN`, `SPRINT-NNN`, or `RUN-NNN` artifacts already represent a legacy entry, the report marks it `represented-by-existing-v2` and does not create a duplicate. Deterministic pre-release aliases such as a Decision with `status: confirmed` may be normalized to the declared v2 status while the original bytes remain in the backup. Anything ambiguous is blocked or warned instead of guessed.
57
+
58
+ ## Mapping rules
59
+
60
+ | v1 source | v2 result |
61
+ |---|---|
62
+ | Main/feature sprint entry | Task with legacy provenance |
63
+ | History attempt linked by evidence | Run for the migrated Task |
64
+ | Explicit timebox/delivery batch | Sprint grouping Tasks |
65
+ | Feature lane | Feature plus linked Tasks/Runs |
66
+ | Backlog item | Task with `status: backlog` |
67
+ | Fix | Task with `type: fix`; Run when execution is evidenced |
68
+ | Approved/pending/rejected knowledge | Same semantic state in `K-NNN` |
69
+ | Reusable AI-like insight | Candidate `INS-NNN`, never confirmed |
70
+ | Decision | `DEC-NNN` with original source hash/content |
71
+ | Golden rule | Stable-id entry in canonical `guardrails.md` |
72
+ | Dossier/review | Canonical dossier/review artifact with provenance |
73
+
74
+ Ambiguous records remain preserved and produce warnings. The migrator never invents a Sprint, Run, approval, or confirmed insight.
75
+
76
+ ## Verification
77
+
78
+ ```bash
79
+ npx scrumrun@latest status
80
+ npx scrumrun@latest sc review artifact --run
81
+ npx scrumrun@latest doctor codex --strict
82
+ npx scrumrun@latest sc knowledge map --build
83
+ npx scrumrun@latest sc knowledge study <topic-or-symbol>
84
+ ```
85
+
86
+ Apply is idempotent. Re-running it reports that the project is already migrated and changes nothing.
87
+
88
+ ## Rollback
89
+
90
+ ```bash
91
+ npx scrumrun@latest migrate --to 2 --rollback
92
+ ```
93
+
94
+ Rollback verifies the backup fingerprint and first checks whether it would erase post-migration canonical, vault, source, or new-file changes. Disposable cache and newly generated `state.md`/`map.md` views do not block restoration. If any unsafe difference exists, rollback refuses.
95
+
96
+ When rollback refuses:
97
+
98
+ 1. read the listed changed paths;
99
+ 2. copy/export work you want to keep outside `.scrumrun/`;
100
+ 3. restore or deliberately reconcile those paths;
101
+ 4. run rollback again.
102
+
103
+ Do not delete `.scrumrun/.migration/` until the migration has been accepted and rollback is no longer required.
104
+
105
+ ## Failure recovery
106
+
107
+ Apply transforms a staging copy and validates it before an atomic directory switch. Injected and real failures before/during the switch restore the v1 tree. If a process is interrupted, do not manually merge staging directories: rerun the dry-run, inspect `.scrumrun` and sibling `.scrumrun-v2-*`/`.scrumrun-v1-*` temporary paths, and recover using the verified backup/manifest.
108
+
109
+ If the preflight reports a malformed `method.json`, a symlink, an unresolved collision, an active memory record without deterministic evidence, or secret-like content outside the vault, fix that blocker and repeat the dry-run. No canonical migration writes occur while blocked.
package/README.md CHANGED
@@ -1,138 +1,197 @@
1
1
  # ScrumRun
2
2
 
3
- > A protocol for AI-assisted software development.
4
- > Sprints, decisions, invariants, history — auditable and portable across agents.
3
+ > A simple, fast, evidence-driven Agile runtime for AI coding agents.
5
4
 
6
- **Method:** `1.0` (draft) · **CLI/Skill:** `1.5.0` · **License:** MIT
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.
7
6
 
8
- ScrumRun gives AI coding agents a stable memory, an explicit approval model, and a state machine for the work they do. The method is documented so any markdown-capable agent can follow it. Client-specific integrations (Claude Code, Codex, OpenCode) are optimizations, not requirements.
7
+ **Method target:** `2.0.0` · **Runtime:** Node.js `>=22.13.0` · **License:** MIT
9
8
 
10
- ---
9
+ ## The model
11
10
 
12
- ## Install
11
+ ```text
12
+ Feature = why the initiative matters
13
+ Task = what atomic work must be done
14
+ Sprint = when Tasks are grouped as a timebox/batch
15
+ Run = how one concrete attempt happened
16
+ Memory = what the project learned and why
17
+ ```
13
18
 
14
- ```bash
15
- npx scrumrun@latest init
19
+ ```text
20
+ FEAT-003
21
+ └── TASK-018
22
+ ├── executed_by → RUN-044
23
+ ├── included_in → SPRINT-012
24
+ ├── constrained_by → DEC-018
25
+ └── generated → INS-041
16
26
  ```
17
27
 
18
- Local by default: creates `AGENTS.md` and `.scrumrun/`, adds them to `.git/info/exclude`. Use `--shared` to commit them.
28
+ A Task does not need a Sprint. A retry creates a new Run. A fix is a Task with `type: fix`; backlog is a view of backlog Tasks.
19
29
 
20
- ### Migrating from the GitHub installer
30
+ See [`docs/SCHEMA.md`](docs/SCHEMA.md) for the generated executable contract and [`docs/ENTITY-MODEL.md`](docs/ENTITY-MODEL.md) for the conceptual guide.
21
31
 
22
- Older installations used `npx github:leandercosta/scrumrun`. Replace the installed client commands and skill with the npm release by running once:
32
+ ## Install
23
33
 
24
34
  ```bash
25
- npx scrumrun@latest update all
35
+ npx scrumrun@latest install
36
+ npx scrumrun@latest init
26
37
  ```
27
38
 
28
- This overwrites only the ScrumRun integrations for Codex, Claude Code, and OpenCode. It does not remove or reset project data, `.scrumrun/`, `AGENTS.md`, knowledge, history, decisions, backlog, or the local vault.
39
+ `install` adds the client integration; `init` creates the project tree. Initialization is local by default: `.scrumrun/` and the generated agent hint are added to `.git/info/exclude`. Use `--shared` when the team wants to commit the project memory.
29
40
 
30
- From then on, use `npx scrumrun@latest ...`. Projects using the legacy pre-`.scrumrun/` file layout can additionally run:
41
+ ScrumRun installs one canonical agent command:
31
42
 
32
- ```bash
33
- npx scrumrun@latest migrate
43
+ ```text
44
+ /sc <noun> <subject> <action> [args]
34
45
  ```
35
46
 
36
- ---
47
+ The five nouns are `plan`, `knowledge`, `rules`, `review`, and `config`.
37
48
 
38
- ## Usage
49
+ ## Daily flow
39
50
 
40
- Once initialized, talk to your agent in natural language:
51
+ Natural language is the normal entry point:
41
52
 
53
+ ```text
54
+ Move calculateFinalPrice to checkout.
55
+ Fix duplicate charges after refresh.
56
+ Study why pricing depends on TaxCalculator.
42
57
  ```
43
- add a save button to the profile form
44
- checkout charges twice after refresh
45
- study the payments module
46
- run the next sprint
58
+
59
+ ScrumRun runs a read-only pipeline before asking for approval:
60
+
61
+ ```text
62
+ RECEIVED → CONTEXTUALIZING → POLICY → RISK → CLASSIFICATION
63
+ → PLANNING → AWAITING_APPROVAL
47
64
  ```
48
65
 
49
- The agent runs intake (read-only), classifies the request, proposes a route, and asks for approval before touching artifacts or code. No configuration silently grants blanket implementation permission.
66
+ Explicit approval atomically creates a Task and a Run. Execution then follows:
50
67
 
51
- If you prefer explicit commands, they exist. The canonical grammar uses long flags (`--add`, `--run`, `--audit`, `--approve`). See `CORE.md` for the full reference.
68
+ ```text
69
+ EXECUTING → VALIDATING → LEARNING → COMPLETED | FAILED | BLOCKED
70
+ ```
52
71
 
53
- ---
72
+ Nothing canonical is persisted before approval. Failed retries remain available as separate Runs.
54
73
 
55
- ## How it works
74
+ ## Semantic project memory
56
75
 
57
- Three surfaces, physically separated:
76
+ Canonical memory is human-readable Markdown:
58
77
 
59
- - **Project rules** golden rules and configuration that every agent honors.
60
- - **Main goal** the primary plan, its sprints, decisions, and history.
61
- - **Feature lanes** isolated planning that does not pollute the main goal.
78
+ - `K-NNN`reviewed facts;
79
+ - `DEC-NNN`normative decisions;
80
+ - `INS-NNN`contextual rationale, constraints, warnings, and trade-offs;
81
+ - `DOS-NNN` — curated topic/module dossiers.
62
82
 
63
- Every artifact is a `.md` file under `.scrumrun/` with mandatory frontmatter. State transitions are explicit and recorded in `history.md` (append-only). `context.md` is a token-safe snapshot used as a reading guide — never as authoritative truth.
83
+ The agent can answer questions such as:
64
84
 
65
- Fifteen numbered invariants (`I-01`…`I-15`) define behavior that cannot be silently overridden. Golden rules have highest precedence. Intake is strictly read-only. Approval is synchronous and explicit.
85
+ - Why is this function in this module?
86
+ - Which Decision constrains it?
87
+ - Who depends on it?
88
+ - Which test protects it?
89
+ - What is likely to break if it changes?
66
90
 
67
- ---
91
+ 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.
68
92
 
69
- ## Documentation
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.
70
94
 
71
- | File | Purpose |
72
- |---|---|
73
- | [`CORE.md`](./CORE.md) | Operational guide agents follow at runtime. |
74
- | [`SPEC.md`](./SPEC.md) | Formal method specification — state machines, invariants, composition rules. |
75
- | [`DECISIONS.md`](./DECISIONS.md) | ADRs explaining why the method is the way it is. |
76
- | `.scrumrun/config.md` | Owner preferences (language, approval policy, quick-task policy). |
77
- | `.scrumrun/golden-rules.md` | Absolute constraints for the project. |
95
+ ## Migrating an ongoing v1 project
78
96
 
79
- For AI clients that do not auto-read project instructions, paste this at the start of a session:
97
+ Update the client integrations and automatically run a read-only migration preflight:
80
98
 
99
+ ```bash
100
+ npx scrumrun@latest update
81
101
  ```
82
- Read AGENTS.md and .scrumrun/core.md before doing anything else.
83
- Follow ScrumRun exactly.
102
+
103
+ This shows the source inventory, proposed mappings, and blockers without changing project data. Apply only the verified plan with:
104
+
105
+ ```bash
106
+ npx scrumrun@latest update --migrate
84
107
  ```
85
108
 
86
- ---
109
+ The standalone workflow remains available:
87
110
 
88
- ## Portability
111
+ ```bash
112
+ npx scrumrun@latest migrate --to 2 --dry-run
113
+ npx scrumrun@latest migrate --to 2 --apply
114
+ npx scrumrun@latest migrate --to 2 --rollback
115
+ ```
89
116
 
90
- ScrumRun is designed to outlive specific AI clients. Any agent that reads markdown and follows instructions can implement it by reading `CORE.md`. Slash commands and skills are conveniences, not dependencies.
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.
91
118
 
92
- Compatibility matrix (planned, `method 1.0`):
119
+ After migration or an integration update, verify both installed assets and project state:
93
120
 
94
- | Agent | Slash commands | Skill | Manual (CORE.md) |
95
- |---|---|---|---|
96
- | Claude Code | ✓ | ✓ | ✓ |
97
- | Codex | ✓ | — | ✓ |
98
- | OpenCode | ✓ | — | ✓ |
99
- | Any markdown-capable agent | — | — | ✓ |
121
+ ```bash
122
+ npx scrumrun@latest doctor codex --strict
123
+ ```
100
124
 
101
- A conformance test suite is planned under `tests/conformance/` for verifying implementations against the invariants in `SPEC.md`.
125
+ `doctor` compares managed prompt/skill contents with the package, so an obsolete installation is reported as `stale` rather than `ok` merely because the file exists.
126
+
127
+ ## Canonical tree
128
+
129
+ ```text
130
+ .scrumrun/
131
+ core.md
132
+ guardrails.md
133
+ config.md
134
+ project.md
135
+ method.json
136
+ state.md # generated
137
+ map.md # generated
138
+ features/FEAT-NNN.md
139
+ tasks/TASK-NNN.md
140
+ sprints/SPRINT-NNN.md
141
+ runs/RUN-NNN.md
142
+ reviews/REV-NNN.md
143
+ memory/
144
+ knowledge/K-NNN.md
145
+ decisions/DEC-NNN.md
146
+ insights/INS-NNN.md
147
+ dossiers/DOS-NNN.md
148
+ .cache/semantic-index.sqlite # generated, ignored
149
+ vault.local.md # optional, ignored, never indexed
150
+ ```
102
151
 
103
- ---
152
+ `guardrails.md` is canonical project policy. `config.md` contains preferences and cannot weaken it. `state.md`, `map.md`, context packages, and SQLite are generated navigation aids, never authority.
104
153
 
105
- ## Versioning
154
+ ## Useful commands
106
155
 
107
- Three independent version numbers:
156
+ ```bash
157
+ # inspect the grammar
158
+ npx scrumrun@latest commands
108
159
 
109
- - **`method`** the protocol itself. Major bumps only on breaking spec changes.
110
- - **`cli`** the installer and command surface.
111
- - **`skill`** the agent-facing instructions.
160
+ # plan without writes, then approve the emitted token
161
+ npx scrumrun@latest sc plan intake "Fix pricing rounding"
162
+ npx scrumrun@latest sc plan intake --approve <token>
112
163
 
113
- Tooling can iterate freely. Adopters pin the method version and update tooling with confidence. Every method change ships with a migration guide.
164
+ # memory lifecycle
165
+ npx scrumrun@latest sc knowledge insight --propose "Pricing stays in backend" --evidence src/pricing.ts
166
+ npx scrumrun@latest sc knowledge insight --confirm INS-001
167
+ npx scrumrun@latest sc knowledge study calculateFinalPrice
114
168
 
115
- ---
169
+ # rebuild or inspect the derived graph
170
+ npx scrumrun@latest sc knowledge map --build
171
+ npx scrumrun@latest sc knowledge map --show
172
+ ```
116
173
 
117
- ## Status
174
+ The command manifest in `lib/commands/manifest.js` generates help and compatibility adapters, preventing client grammar drift.
118
175
 
119
- - ✅ Portable `CORE.md` for cross-agent execution
120
- - ✅ Natural-language intake with approval gates
121
- - ✅ Sprint, feature lane, fix, backlog, decision, knowledge artifacts
122
- - ✅ Golden rules with unbypassable precedence
123
- - ✅ Formal `SPEC.md` and `DECISIONS.md` (method 1.0 draft)
124
- - 🚧 Command grammar consolidation (20 commands → 6, see ADR-013)
125
- - 🚧 Method versioning separated from CLI
126
- - 🚧 Portability matrix + conformance test suite
127
- - 🚧 Landing page at [`scrumrun.dev`](https://scrumrun.dev)
176
+ ## Documentation
128
177
 
129
- ---
178
+ | File | Purpose |
179
+ |---|---|
180
+ | [`CORE.md`](./CORE.md) | Operational runtime guide for agents. |
181
+ | [`SPEC.md`](./SPEC.md) | Normative 2.0 state machines, invariants, and conformance rules. |
182
+ | [`DECISIONS.md`](./DECISIONS.md) | Architectural decisions and trade-offs. |
183
+ | `MIGRATION-1-to-2.md` | Upgrade, verification, rollback, and recovery guide. |
130
184
 
131
- ## Contributing
185
+ ScrumRun remains client-independent: any agent that reads Markdown can follow `CORE.md`; Codex, Claude Code, and OpenCode integrations are accelerators.
132
186
 
133
- The method is public and versioned. Proposals that change spec, invariants, or state machines require an ADR entry in `DECISIONS.md`. Tooling changes follow standard PR flow.
187
+ ## Development
188
+
189
+ ```bash
190
+ npm test
191
+ npm pack --dry-run
192
+ ```
134
193
 
135
- ---
194
+ The release gates cover artifact/state conformance, read-only intake, migration failure recovery, semantic cache equivalence, code graph behavior, vault exclusion, and CLI compatibility.
136
195
 
137
196
  ## License
138
197