scrumrun 1.5.2 → 2.1.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 (112) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/CORE.md +231 -308
  3. package/DECISIONS.md +151 -11
  4. package/LICENSE +21 -0
  5. package/MIGRATION-1-to-2.md +120 -0
  6. package/README.md +147 -78
  7. package/SPEC.md +259 -251
  8. package/bin/claude-install.js +18 -132
  9. package/bin/scrumrun.js +1367 -174
  10. package/docs/COMMANDS.md +71 -0
  11. package/docs/ENTITY-MODEL.md +38 -0
  12. package/docs/RELEASE-SCORECARD.md +43 -0
  13. package/docs/RELEASE.md +51 -0
  14. package/docs/SCHEMA.md +89 -0
  15. package/docs/SEMANTIC-MEMORY.md +68 -0
  16. package/docs/TROUBLESHOOTING.md +78 -0
  17. package/lib/code-intel/adapter.js +20 -0
  18. package/lib/code-intel/javascript.js +199 -0
  19. package/lib/code-intel/learning.js +66 -0
  20. package/lib/code-intel/scanner.js +126 -0
  21. package/lib/commands/manifest.js +118 -0
  22. package/lib/commands/render.js +78 -0
  23. package/lib/memory/index.js +659 -0
  24. package/lib/memory/markdown.js +51 -0
  25. package/lib/memory/service.js +300 -0
  26. package/lib/runtime/budgets.js +23 -0
  27. package/lib/runtime/canonical-snapshot.js +110 -0
  28. package/lib/runtime/context.js +101 -0
  29. package/lib/runtime/orchestrator.js +303 -0
  30. package/lib/runtime/policy-engine.js +184 -0
  31. package/lib/runtime/request-engine.js +132 -0
  32. package/lib/runtime/run-ledger.js +324 -0
  33. package/lib/security/secrets.js +23 -0
  34. package/lib/v2/artifacts.js +363 -0
  35. package/lib/v2/conformance.js +214 -0
  36. package/lib/v2/migration.js +1221 -0
  37. package/lib/v2/project-store.js +44 -0
  38. package/lib/v2/run-ledger-migration.js +240 -0
  39. package/lib/v2/schema.js +148 -0
  40. package/lib/v2/transaction.js +254 -0
  41. package/package.json +16 -6
  42. package/scripts/generate-contract-docs.js +124 -0
  43. package/templates/project/.scrumrun/config.md +4 -7
  44. package/templates/project/.scrumrun/guardrails.md +31 -0
  45. package/templates/project/.scrumrun/map.md +5 -16
  46. package/templates/project/.scrumrun/memory/decisions/.gitkeep +1 -0
  47. package/templates/project/.scrumrun/memory/dossiers/.gitkeep +1 -0
  48. package/templates/project/.scrumrun/memory/insights/.gitkeep +1 -0
  49. package/templates/project/.scrumrun/memory/knowledge/.gitkeep +1 -0
  50. package/templates/project/.scrumrun/method.json +7 -0
  51. package/templates/project/.scrumrun/project.md +6 -12
  52. package/templates/project/.scrumrun/runs/.gitkeep +1 -0
  53. package/templates/project/.scrumrun/sprints/.gitkeep +1 -0
  54. package/templates/project/.scrumrun/state.md +14 -0
  55. package/templates/project/.scrumrun/tasks/.gitkeep +1 -0
  56. package/templates/project/AGENTS.md +16 -49
  57. package/templates/project-lean/AGENTS.md +18 -0
  58. package/templates/shared/skills/scrumrun/SKILL.md +211 -0
  59. package/templates/codex/prompts/sc-agent.md +0 -14
  60. package/templates/codex/prompts/sc-backlog.md +0 -13
  61. package/templates/codex/prompts/sc-challenge.md +0 -57
  62. package/templates/codex/prompts/sc-config.md +0 -18
  63. package/templates/codex/prompts/sc-context.md +0 -24
  64. package/templates/codex/prompts/sc-decisions.md +0 -8
  65. package/templates/codex/prompts/sc-feature.md +0 -16
  66. package/templates/codex/prompts/sc-fix.md +0 -21
  67. package/templates/codex/prompts/sc-goal.md +0 -14
  68. package/templates/codex/prompts/sc-golden.md +0 -14
  69. package/templates/codex/prompts/sc-help.md +0 -12
  70. package/templates/codex/prompts/sc-init.md +0 -14
  71. package/templates/codex/prompts/sc-intake.md +0 -22
  72. package/templates/codex/prompts/sc-know.md +0 -75
  73. package/templates/codex/prompts/sc-map.md +0 -13
  74. package/templates/codex/prompts/sc-review.md +0 -13
  75. package/templates/codex/prompts/sc-sprint.md +0 -28
  76. package/templates/codex/prompts/sc-study.md +0 -23
  77. package/templates/codex/prompts/sc-uninstall.md +0 -14
  78. package/templates/codex/prompts/sc-update.md +0 -8
  79. package/templates/codex/prompts/sc-vault.md +0 -27
  80. package/templates/codex/skills/scrumrun/SKILL.md +0 -412
  81. package/templates/opencode/commands/sc-agent.md +0 -14
  82. package/templates/opencode/commands/sc-backlog.md +0 -13
  83. package/templates/opencode/commands/sc-challenge.md +0 -57
  84. package/templates/opencode/commands/sc-config.md +0 -18
  85. package/templates/opencode/commands/sc-context.md +0 -24
  86. package/templates/opencode/commands/sc-decisions.md +0 -8
  87. package/templates/opencode/commands/sc-feature.md +0 -16
  88. package/templates/opencode/commands/sc-fix.md +0 -21
  89. package/templates/opencode/commands/sc-goal.md +0 -14
  90. package/templates/opencode/commands/sc-golden.md +0 -14
  91. package/templates/opencode/commands/sc-help.md +0 -12
  92. package/templates/opencode/commands/sc-init.md +0 -14
  93. package/templates/opencode/commands/sc-intake.md +0 -22
  94. package/templates/opencode/commands/sc-know.md +0 -75
  95. package/templates/opencode/commands/sc-map.md +0 -13
  96. package/templates/opencode/commands/sc-review.md +0 -13
  97. package/templates/opencode/commands/sc-sprint.md +0 -28
  98. package/templates/opencode/commands/sc-study.md +0 -23
  99. package/templates/opencode/commands/sc-uninstall.md +0 -14
  100. package/templates/opencode/commands/sc-update.md +0 -8
  101. package/templates/opencode/commands/sc-vault.md +0 -27
  102. package/templates/opencode/skills/scrumrun/SKILL.md +0 -412
  103. package/templates/project/.scrumrun/agents.md +0 -36
  104. package/templates/project/.scrumrun/backlog.md +0 -7
  105. package/templates/project/.scrumrun/context.md +0 -61
  106. package/templates/project/.scrumrun/goals/main/decisions.md +0 -9
  107. package/templates/project/.scrumrun/goals/main/history.md +0 -51
  108. package/templates/project/.scrumrun/goals/main/sprint.md +0 -54
  109. package/templates/project/.scrumrun/golden-rules.md +0 -9
  110. package/templates/project/.scrumrun/knowledge.md +0 -15
  111. package/templates/project/.scrumrun/runbook.md +0 -101
  112. package/templates/project/.scrumrun/token-policy.md +0 -43
package/README.md CHANGED
@@ -1,138 +1,207 @@
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
+ **Package:** `2.1.0` · **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
+ 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.
56
75
 
57
- Three surfaces, physically separated:
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.
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
+ ## Semantic project memory
62
79
 
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.
80
+ Canonical memory is human-readable Markdown:
64
81
 
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.
82
+ - `K-NNN` reviewed facts;
83
+ - `DEC-NNN` — normative decisions;
84
+ - `INS-NNN` — contextual rationale, constraints, warnings, and trade-offs;
85
+ - `DOS-NNN` — curated topic/module dossiers.
66
86
 
67
- ---
87
+ The agent can answer questions such as:
68
88
 
69
- ## Documentation
89
+ - Why is this function in this module?
90
+ - Which Decision constrains it?
91
+ - Who depends on it?
92
+ - Which test protects it?
93
+ - What is likely to break if it changes?
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
+ 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.
96
+
97
+ The fast graph/search layer is `.scrumrun/.cache/semantic-index.sqlite`. It is ignored and disposable: deleting it never deletes knowledge. 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.
100
+
101
+ ## Migrating an ongoing v1 project
102
+
103
+ Update the client integrations and automatically run a read-only migration preflight:
78
104
 
79
- For AI clients that do not auto-read project instructions, paste this at the start of a session:
105
+ ```bash
106
+ npx scrumrun@latest update
107
+ ```
108
+
109
+ This shows the source inventory, proposed mappings, and blockers without changing project data. Apply only the verified plan with:
80
110
 
111
+ ```bash
112
+ npx scrumrun@latest update --migrate
81
113
  ```
82
- Read AGENTS.md and .scrumrun/core.md before doing anything else.
83
- Follow ScrumRun exactly.
114
+
115
+ The standalone workflow remains available:
116
+
117
+ ```bash
118
+ npx scrumrun@latest migrate --to 2 --dry-run
119
+ npx scrumrun@latest migrate --to 2 --apply
120
+ npx scrumrun@latest migrate --to 2 --rollback
84
121
  ```
85
122
 
86
- ---
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.
87
124
 
88
- ## Portability
125
+ After migration or an integration update, verify both installed assets and project state:
89
126
 
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.
127
+ ```bash
128
+ npx scrumrun@latest doctor codex --strict
129
+ ```
91
130
 
92
- Compatibility matrix (planned, `method 1.0`):
131
+ `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.
132
+
133
+ ## Canonical tree
134
+
135
+ ```text
136
+ .scrumrun/
137
+ core.md
138
+ guardrails.md
139
+ config.md
140
+ project.md
141
+ method.json
142
+ state.md # generated
143
+ map.md # generated
144
+ features/FEAT-NNN.md
145
+ tasks/TASK-NNN.md
146
+ sprints/SPRINT-NNN.md
147
+ runs/RUN-NNN.md
148
+ reviews/REV-NNN.md
149
+ memory/
150
+ knowledge/K-NNN.md
151
+ decisions/DEC-NNN.md
152
+ insights/INS-NNN.md
153
+ dossiers/DOS-NNN.md
154
+ .cache/semantic-index.sqlite # generated, ignored
155
+ vault.local.md # optional, ignored, never indexed
156
+ ```
93
157
 
94
- | Agent | Slash commands | Skill | Manual (CORE.md) |
95
- |---|---|---|---|
96
- | Claude Code | ✓ | ✓ | ✓ |
97
- | Codex | ✓ | — | ✓ |
98
- | OpenCode | ✓ | — | ✓ |
99
- | Any markdown-capable agent | — | — | ✓ |
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.
100
159
 
101
- A conformance test suite is planned under `tests/conformance/` for verifying implementations against the invariants in `SPEC.md`.
160
+ ## Useful commands
102
161
 
103
- ---
162
+ ```bash
163
+ # inspect the grammar
164
+ npx scrumrun@latest commands
104
165
 
105
- ## Versioning
166
+ # plan without writes, then approve the emitted token
167
+ npx scrumrun@latest sc plan intake "Fix pricing rounding"
168
+ npx scrumrun@latest sc plan intake --approve <token>
106
169
 
107
- Three independent version numbers:
170
+ # verify canonical policy and all twenty executable invariants
171
+ npx scrumrun@latest sc review artifact --run
108
172
 
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.
173
+ # memory lifecycle
174
+ npx scrumrun@latest sc knowledge insight --propose "Pricing stays in backend" --evidence src/pricing.ts
175
+ npx scrumrun@latest sc knowledge insight --confirm INS-001
176
+ npx scrumrun@latest sc knowledge study calculateFinalPrice
112
177
 
113
- Tooling can iterate freely. Adopters pin the method version and update tooling with confidence. Every method change ships with a migration guide.
178
+ # rebuild or inspect the derived graph
179
+ npx scrumrun@latest sc knowledge map --build
180
+ npx scrumrun@latest sc knowledge map --show
181
+ ```
114
182
 
115
- ---
183
+ The command manifest in `lib/commands/manifest.js` generates help and compatibility adapters, preventing client grammar drift.
116
184
 
117
- ## Status
185
+ ## Documentation
118
186
 
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)
187
+ | File | Purpose |
188
+ |---|---|
189
+ | [`CORE.md`](./CORE.md) | Operational runtime guide for agents. |
190
+ | [`SPEC.md`](./SPEC.md) | Normative 2.0 state machines, invariants, and conformance rules. |
191
+ | [`DECISIONS.md`](./DECISIONS.md) | Architectural decisions and trade-offs. |
192
+ | `MIGRATION-1-to-2.md` | Upgrade, verification, rollback, and recovery guide. |
193
+ | [`docs/RELEASE-SCORECARD.md`](docs/RELEASE-SCORECARD.md) | Evidence-backed local readiness scores and residual release risks. |
128
194
 
129
- ---
195
+ ScrumRun remains client-independent: any agent that reads Markdown can follow `CORE.md`; Codex, Claude Code, and OpenCode integrations are accelerators.
130
196
 
131
- ## Contributing
197
+ ## Development
132
198
 
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.
199
+ ```bash
200
+ npm test
201
+ npm pack --dry-run
202
+ ```
134
203
 
135
- ---
204
+ 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
205
 
137
206
  ## License
138
207