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/SPEC.md CHANGED
@@ -1,324 +1,315 @@
1
1
  # ScrumRun Method Specification
2
2
 
3
- Version: `method 1.0` · Status: draft for review
3
+ Version: `2.0.0` · Status: release candidate
4
4
 
5
- This document is the formal specification of the ScrumRun method. `CORE.md` is the operational guide agents follow at runtime. `SPEC.md` is the source of truth for state machines, invariants, and composition rules.
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
 
7
- If a conflict exists between `CORE.md` and `SPEC.md`, `SPEC.md` wins and `CORE.md` must be updated.
7
+ ## 1. Purpose and principles
8
8
 
9
- ---
9
+ ScrumRun is an evidence-driven Agile runtime for AI-assisted software work. It keeps intent, execution, decisions, and learning distinct while preserving a small daily interface.
10
10
 
11
- ## 1. Terminology
11
+ The method is built on five principles:
12
12
 
13
- | Term | Definition |
14
- |---|---|
15
- | **Method** | The ScrumRun protocol itself, versioned separately from tooling. |
16
- | **Artifact** | A `.md` file under `.scrumrun/` that represents state or intent. |
17
- | **Goal** | The primary long-lived outcome of the project. Exactly one main goal per project. |
18
- | **Sprint** | A bounded unit of work under the main goal. |
19
- | **Feature lane** | An isolated planning surface for work that should not pollute the main goal. |
20
- | **Fix** | A corrective action for a defect or regression. Lighter than a sprint. |
21
- | **Backlog item** | A candidate for future work. Not active, not committed. |
22
- | **Decision** | A pending question that blocks or shapes execution. |
23
- | **Golden rule** | An absolute constraint. Cannot be silently overridden. |
24
- | **Knowledge fact** | A short, approved statement about the project used during planning. |
25
- | **Dossier** | A deep, topic-focused study persisted as a durable document. |
26
- | **Review agent** | A reusable review persona with defined scope and prompt. |
27
- | **Intake** | The natural-language classifier that routes requests to workflows. |
28
- | **Approval gate** | A synchronous checkpoint requiring explicit owner consent. |
13
+ 1. no canonical write before explicit approval;
14
+ 2. Task is the atomic work unit; Sprint is only a timebox or delivery batch;
15
+ 3. every execution attempt is a separate Run;
16
+ 4. Markdown is canonical and generated indexes are disposable;
17
+ 5. knowledge becomes active truth only through evidence and review.
29
18
 
30
- ---
19
+ ## 2. Terminology
20
+
21
+ | Term | Meaning |
22
+ |---|---|
23
+ | Feature | Long-lived initiative explaining why related work matters. |
24
+ | Task | Atomic intended work: what must be changed or learned. |
25
+ | Sprint | Explicit timebox or delivery batch grouping Tasks: when work is grouped. |
26
+ | Run | One concrete attempt to execute a Task: how it happened. |
27
+ | Review | Scoped validation evidence for a Run, artifact, migration, or release. |
28
+ | Knowledge | Reviewed project fact. |
29
+ | Decision | Explicit normative choice and its evidence. |
30
+ | Insight | Contextual explanation, trade-off, warning, or rationale. |
31
+ | Dossier | Curated topic/module memory with evidence and review metadata. |
32
+ | Guardrail | Mandatory project policy that configuration cannot weaken. |
33
+ | Context package | Bounded, temporary evidence assembled for one request. |
34
+ | Semantic index | Ignored SQLite projection of canonical artifacts, code symbols, and relations. |
35
+
36
+ A fix is a Task with `type: fix`. A backlog is a view of Tasks with `status: backlog`; neither is a separate canonical entity.
37
+
38
+ Exact status sets, transitions, directories, cardinalities, and truth-ownership boundaries are generated in [`docs/SCHEMA.md`](docs/SCHEMA.md); they are not duplicated manually here.
39
+
40
+ ## 3. Canonical project model
41
+
42
+ ```text
43
+ .scrumrun/
44
+ core.md
45
+ guardrails.md
46
+ config.md
47
+ project.md
48
+ method.json
49
+ state.md # generated view
50
+ map.md # generated view
51
+ features/FEAT-NNN.md
52
+ tasks/TASK-NNN.md
53
+ sprints/SPRINT-NNN.md
54
+ runs/RUN-NNN.md
55
+ reviews/REV-NNN.md
56
+ memory/
57
+ knowledge/K-NNN.md
58
+ decisions/DEC-NNN.md
59
+ insights/INS-NNN.md
60
+ dossiers/DOS-NNN.md
61
+ .cache/ # ignored and disposable
62
+ semantic-index.sqlite
63
+ contexts/
64
+ vault.local.md # optional, ignored, never indexed/rendered
65
+ ```
31
66
 
32
- ## 2. Artifact Catalog
67
+ `guardrails.md` is the only canonical project-policy file. A v1 `golden-rules.md` may remain as migrated source evidence, but it is never a competing v2 authority.
33
68
 
34
- Every artifact lives at a canonical path and carries mandatory frontmatter. Files without valid frontmatter are treated as untrusted context.
69
+ ### 3.1 Universal frontmatter
35
70
 
36
- ### 2.1 Frontmatter schema (universal)
71
+ Every canonical entity file must contain:
37
72
 
38
73
  ```yaml
39
74
  ---
40
- id: <artifact-id> # e.g. SPR-042, FIX-007, KNOW-K-013
41
- kind: sprint|fix|feature|goal|backlog|decision|golden|knowledge|dossier|agent|review
42
- status: <see state machine per kind>
43
- created: YYYY-MM-DD
44
- updated: YYYY-MM-DD
45
- method: 1.0 # method version at time of creation
75
+ id: TASK-018
76
+ kind: task
77
+ status: running
78
+ created: 2026-07-21
79
+ updated: 2026-07-21
80
+ method: 2.0.0
46
81
  ---
47
82
  ```
48
83
 
49
- ### 2.2 Path map
50
-
51
- | Kind | Path |
52
- |---|---|
53
- | goal (main) | `.scrumrun/goals/main/sprint.md` |
54
- | goal history | `.scrumrun/goals/main/history.md` |
55
- | goal decisions | `.scrumrun/goals/main/decisions.md` |
56
- | feature | `.scrumrun/features/<slug>/feature.md` |
57
- | feature sprint | `.scrumrun/features/<slug>/sprint.md` |
58
- | feature history | `.scrumrun/features/<slug>/history.md` |
59
- | feature decisions | `.scrumrun/features/<slug>/decisions.md` |
60
- | fix | `.scrumrun/fixes.md` (append-only) |
61
- | backlog | `.scrumrun/backlog.md` |
62
- | golden rules | `.scrumrun/golden-rules.md` |
63
- | knowledge facts | `.scrumrun/knowledge.md` |
64
- | dossier | `.scrumrun/knowledge/dossiers/<slug>.md` |
65
- | map | `.scrumrun/map.md` |
66
- | context | `.scrumrun/context.md` |
67
- | config | `.scrumrun/config.md` |
68
- | agents | `.scrumrun/agents.md` |
69
- | reviews | `.scrumrun/reviews/<id>.md` |
70
- | vault (local) | `.scrumrun/vault.local.md` |
71
-
72
- ---
73
-
74
- ## 3. State Machines
84
+ IDs, filenames, kind, status, real ISO dates, and method version must agree. Unknown fields and authored prose are preserved. Duplicate fields, malformed frontmatter, unsafe paths, and symlinked canonical paths are invalid.
75
85
 
76
- ### 3.1 Sprint
86
+ ### 3.2 Stable identifiers
77
87
 
78
- ```
79
- proposed ──approve──▶ approved ──run──▶ running ──complete──▶ done
80
- │ │ │
81
- │ └──backlog──▶ shelved
82
- │ │
83
- └──reject──▶ rejected └──abort──▶ aborted
84
-
85
- running ──block──▶ blocked ──unblock──▶ running
88
+ | Kind | Identifier |
89
+ |---|---|
90
+ | Feature | `FEAT-NNN` |
91
+ | Task | `TASK-NNN` |
92
+ | Sprint | `SPRINT-NNN` |
93
+ | Run | `RUN-NNN` |
94
+ | Review | `REV-NNN` |
95
+ | Knowledge | `K-NNN` |
96
+ | Decision | `DEC-NNN` |
97
+ | Insight | `INS-NNN` |
98
+ | Dossier | `DOS-NNN` |
99
+
100
+ Relations use stable IDs or qualified code subjects. Example:
101
+
102
+ ```text
103
+ FEAT-003
104
+ └── TASK-018
105
+ ├── executed_by → RUN-044
106
+ ├── included_in → SPRINT-012
107
+ ├── constrained_by → DEC-018
108
+ └── generated → INS-041
86
109
  ```
87
110
 
88
- **Transitions:**
89
- - `proposed → approved`: owner approval required.
90
- - `approved → running`: explicit `--run` or intake execution consent.
91
- - `running → done`: all acceptance criteria met AND review agents passed.
92
- - `running → blocked`: unresolved decision, missing dependency, or golden rule fire.
93
- - `running → aborted`: owner-initiated cancellation. Requires reason in history.
94
- - `approved → shelved`: sent to backlog before execution.
111
+ ## 4. State machines
95
112
 
96
- **Invariant references:** I-01, I-02, I-05, I-07.
113
+ Only the following transitions are valid.
97
114
 
98
- ### 3.2 Fix
115
+ ### Feature
99
116
 
100
- ```
101
- proposed ──approve──▶ approved ──run──▶ running ──complete──▶ done
102
-
103
- └──escalate──▶ (becomes sprint)
117
+ ```text
118
+ backlog proposed|active|cancelled
119
+ proposed → active|cancelled
120
+ active paused|completed|cancelled
121
+ paused → active|cancelled
104
122
  ```
105
123
 
106
- Fix is lighter than sprint: no formal review agents required unless the affected area has agents configured. If scope grows during execution, `escalate` promotes to sprint with the same id lineage recorded in history.
124
+ ### Task
107
125
 
108
- ### 3.3 Feature lane
109
-
110
- ```
111
- proposed ──approve──▶ active ──archive──▶ archived
112
-
113
- └──merge-to-main──▶ merged
126
+ ```text
127
+ backlog → proposed|running|cancelled
128
+ proposed → running|cancelled
129
+ running validating|failed|blocked|cancelled
130
+ validating → learning|failed|blocked
131
+ learning → completed|failed|blocked
132
+ partial|failed|blocked → running|cancelled
114
133
  ```
115
134
 
116
- A feature lane is a container for sprints. Its sprints follow the sprint state machine independently. `merge-to-main` folds accepted sprints into main goal history.
135
+ ### Sprint
117
136
 
118
- ### 3.4 Backlog item
119
-
120
- ```
121
- added ──promote──▶ (becomes sprint|fix|feature)
122
-
123
- └──drop──▶ dropped
137
+ ```text
138
+ proposed → running|cancelled
139
+ running → partial|completed|blocked|cancelled
140
+ partial running|completed|cancelled
141
+ blocked → running|cancelled
124
142
  ```
125
143
 
126
- Backlog items have no execution state. Promotion creates a new artifact.
144
+ ### Run
127
145
 
128
- ### 3.5 Decision
129
-
130
- ```
131
- open ──resolve──▶ resolved
132
-
133
- └──defer──▶ deferred
146
+ ```text
147
+ executing → validating|failed|blocked
148
+ validating → learning|failed|blocked
149
+ learning completed|failed|blocked
150
+ partial → executing|failed|blocked
151
+ blocked → executing|failed
134
152
  ```
135
153
 
136
- An open decision that blocks a running sprint moves the sprint to `blocked` (see 3.1).
137
-
138
- ### 3.6 Knowledge fact
139
-
154
+ A failed or blocked Run is never reused as a new attempt. Retrying its Task creates a new `RUN-NNN` with an incremented attempt and preserves the previous Run byte-for-byte.
155
+
156
+ ### Review and memory
157
+
158
+ ```text
159
+ Review: proposed → running; running → passed|failed
160
+ failed → running|archived; passed → archived
161
+ Knowledge: candidate → approved|rejected; approved → deprecated|invalidated
162
+ rejected → candidate; deprecated → approved
163
+ Decision: open → resolved|deprecated|invalidated; resolved → deprecated|invalidated
164
+ deprecated → open
165
+ Insight: candidate → confirmed|invalidated
166
+ confirmed → stale|deprecated|invalidated
167
+ stale → confirmed|deprecated|invalidated; deprecated → confirmed
168
+ Dossier: active → stale|deprecated|archived; stale → active|deprecated|archived
169
+ deprecated → archived
140
170
  ```
141
- proposed ──approve──▶ approved ──deprecate──▶ deprecated
142
-
143
- └──reject──▶ rejected (kept for anti-repetition)
144
- ```
145
-
146
- Only `approved` facts are planning truth. `rejected` facts are preserved to prevent re-proposing the same bad assumption.
147
171
 
148
- ### 3.7 Dossier
149
-
150
- ```
151
- drafted ──approve──▶ current ──update──▶ current ──deprecate──▶ deprecated
172
+ Confirmation/resolution requires at least one resolvable evidence reference. An active Dossier requires evidence at creation; refreshing an already active Dossier records verification without changing its state. AI extraction may create candidates only.
173
+
174
+ ## 5. Request and execution protocol
175
+
176
+ ```text
177
+ RECEIVED
178
+ → CONTEXTUALIZING (Project Scan + History Engine + Decision Engine)
179
+ → CONTEXT_PACKAGE
180
+ → POLICY
181
+ → RISK
182
+ → CLASSIFICATION
183
+ → PLANNING
184
+ → AWAITING_APPROVAL
185
+ → EXECUTING
186
+ → VALIDATING
187
+ → LEARNING
188
+ → COMPLETED | FAILED | BLOCKED
152
189
  ```
153
190
 
154
- Every `update` records the previous `commit` hash. A dossier older than the current HEAD by more than N commits (configurable) is marked stale in `context.md`.
155
-
156
- ### 3.8 Golden rule
157
-
158
- ```
159
- proposed ──approve──▶ active ──retire──▶ retired
160
- ```
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, and canonical context fingerprint.
161
192
 
162
- Active golden rules cannot be silently bypassed (see I-08). Retirement requires explicit owner action and is logged.
193
+ 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.
163
194
 
164
- ---
195
+ Run transitions synchronously update the linked Task and append transition evidence. A paired write failure restores both files. Entering `learning` may extract structured candidates from the Run, but extraction failure never blocks Run progress.
165
196
 
166
- ## 4. Composition Rules
197
+ ## 6. Policy and precedence
167
198
 
168
- Which artifact can generate which:
199
+ When guidance conflicts, apply this order:
169
200
 
170
- | From / Generates → | Sprint | Fix | Feature | Backlog | Decision | Knowledge | Dossier |
171
- |---|---|---|---|---|---|---|---|
172
- | Intake | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
173
- | Goal (`--set`) | | | | ✓ | ✓ | — | — |
174
- | Sprint (running) | | ✓ | — | ✓ | ✓ | ✓ | — |
175
- | Fix (running) | ✓ (escalate) | — | — | — | ✓ | ✓ | — |
176
- | Feature (active) | | | | ✓ | ✓ | ✓ | — |
177
- | Study | — | — | — | ✓ | — | ✓ | ✓ |
178
- | Review | — | ✓ | — | ✓ | ✓ | ✓ | — |
201
+ 1. current explicit owner constraints;
202
+ 2. universal method invariants in `core.md`/this specification;
203
+ 3. active project Guardrails;
204
+ 4. resolved Decisions and confirmed, non-stale Memory relevant to the subject;
205
+ 5. the approved Task and active Run;
206
+ 6. Sprint/Feature grouping context;
207
+ 7. generated `state.md`, `map.md`, context packages, and indexes as navigation only.
179
208
 
180
- Blocking relationships:
209
+ Configuration controls preferences but cannot weaken higher levels. Missing or stale context must be surfaced, never rendered as certainty.
181
210
 
182
- - An `open` decision **linked** to a sprint blocks that sprint.
183
- - A `proposed` golden rule does not block anything.
184
- - An `active` golden rule blocks any transition that would violate it.
185
- - A `stale` dossier does not block, but must be surfaced in intake responses.
211
+ ## 7. Semantic memory and code intelligence
186
212
 
187
- ---
213
+ 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.
188
214
 
189
- ## 5. Precedence
215
+ The derived graph may contain:
190
216
 
191
- When guidance conflicts, apply in this strict order:
192
-
193
- ```
194
- 1. Golden rules (active)
195
- 2. Open decisions linked to current work
196
- 3. Approved knowledge facts
197
- 4. Current sprint / feature plan
198
- 5. Backlog priority
199
- 6. Dossiers and map
200
- 7. context.md (never authoritative)
217
+ ```text
218
+ defined_in
219
+ depends_on
220
+ used_by
221
+ protected_by
222
+ constrained_by
223
+ introduced_by
224
+ modified_by
225
+ has_insight
226
+ evidenced_by
201
227
  ```
202
228
 
203
- Higher precedence always wins. Lower precedence never silently overrides.
204
-
205
- ---
206
-
207
- ## 6. Invariants
208
-
209
- Numbered for stable reference. Every implementation must uphold all of these.
210
-
211
- - **I-01** — No sprint may transition from `proposed` to `running` without explicit owner approval.
212
- - **I-02** — No code changes may occur outside a `running` sprint, a `running` fix, or an explicitly authorized quick task.
213
- - **I-03** — An active golden rule cannot be bypassed by any command, flag, or config. Retirement is the only path.
214
- - **I-04** — Intake is read-only. Intake cannot create, modify, or delete artifacts. Intake cannot modify code.
215
- - **I-05** — Main goal history and feature lane history are physically separate files and never merge automatically.
216
- - **I-06** — Approval is synchronous and explicit. Ambiguous acknowledgements (e.g., "ok", "sure") do not constitute approval unless the owner has enabled `Quick Tasks: allow` for that class of action.
217
- - **I-07** — Every state transition writes exactly one entry to the relevant history file. History is append-only.
218
- - **I-08** — Golden rules are checked before every planning or execution workflow. A rule fire during a running sprint moves that sprint to `blocked`.
219
- - **I-09** — `context.md` is never authoritative. All planning must verify against canonical artifacts and source.
220
- - **I-10** — Only `approved` knowledge facts inform planning. `pending` and `rejected` facts are context, not truth.
221
- - **I-11** — Secrets from `vault.local.md` must never appear in history, knowledge, backlog, reviews, commits, or logs.
222
- - **I-12** — Every artifact carries `id`, `kind`, `status`, `created`, `updated`, and `method` frontmatter fields.
223
- - **I-13** — A dossier update must record the source commit hash for drift detection.
224
- - **I-14** — Quick tasks may be executed with `Quick Tasks: allow`, but never bypass golden rules, security checks, or explicit user constraints.
225
- - **I-15** — Rejecting a knowledge fact preserves it in `rejected` state to prevent re-proposing the same assumption.
226
-
227
- ---
228
-
229
- ## 7. Intake Protocol (Formal)
229
+ JavaScript/TypeScript symbols carry a qualified id, path, kind, line, content fingerprint, commit, and adapter identity. A move with the same fingerprint may be remapped. A rename/removal that cannot be proved is retained as orphaned context. Code or evidence drift marks linked memory stale in the projection; it never silently rewrites canonical Markdown.
230
230
 
231
- Intake is the single natural-language entry point. Formal steps:
231
+ Queries must explain content/relation matches, return evidence/provenance, distinguish candidate/confirmed/stale/inactive/orphaned truth, cap result and relation counts, and exclude rejected/deprecated/invalidated records by default.
232
232
 
233
- 1. **Load minimum context:** `core.md`, `golden-rules.md`, `config.md`, `context.md`, and the header of `map.md`.
234
- 2. **Interpret intent** using the desired outcome, not keyword matching.
235
- 3. **Determine risk class:** trivial / bounded / cross-cutting / sensitive.
236
- 4. **Load conditional context** based on risk class:
237
- - trivial: current sprint header only.
238
- - bounded: current sprint + relevant dossier + relevant knowledge facts.
239
- - cross-cutting: full sprint plan + all decisions + map.
240
- - sensitive: everything in cross-cutting + full history relevant to affected modules.
241
- 5. **Classify** into one of: `quick-task`, `discovery`, `sprint`, `fix`, `feature`, `backlog`, `reject`, `clarify`.
242
- 6. **Compose response:**
243
- - Recommendation with rationale.
244
- - Up to two alternatives with tradeoffs.
245
- - Risks and unknowns.
246
- - Explicit approval request.
247
- 7. **Wait for approval.** No side effects until owner responds.
233
+ The agreed v1 control-context baseline is 48,000 characters. A fresh lean v2 intake control package, excluding the user's request, must remain at or below 12,000 characters (25%). Default semantic retrieval returns at most 10 records and 40 relations per record; hard caps are 100/100.
248
234
 
249
- Response format is machine-parseable enough to be logged verbatim in `history.md` if the request is approved.
235
+ ## 8. Generated views and cache
250
236
 
251
- ---
252
-
253
- ## 8. Approval Semantics
254
-
255
- Approval is a first-class concept and comes in three kinds:
256
-
257
- | Kind | What it permits |
258
- |---|---|
259
- | **Planning approval** | Create planning records (sprint plan, fix plan, backlog item, dossier draft). |
260
- | **Execution approval** | Change application code, run tests, execute review agents. |
261
- | **Structural approval** | Modify golden rules, retire rules, change config, delete artifacts. |
262
-
263
- Config policy `Execution Approval: always` requires both planning AND execution approvals separately. `implementation-only` collapses them for the recommended path but still requires an explicit yes before code changes.
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. Deleting `.cache/` must not remove authored knowledge, and rebuilding it from unchanged sources must yield equivalent query results.
264
238
 
265
- There is intentionally no mode that grants blanket implementation permission.
266
-
267
- ---
239
+ 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.
268
240
 
269
- ## 9. History Semantics
241
+ ## 9. Migration from v1
270
242
 
271
- `history.md` files are append-only. Every entry has:
243
+ Migration is explicit and reversible:
272
244
 
245
+ ```text
246
+ scrumrun migrate --to 2 --dry-run
247
+ scrumrun migrate --to 2 --apply
248
+ scrumrun migrate --to 2 --rollback
273
249
  ```
274
- ## <YYYY-MM-DD HH:MM> · <id> · <transition>
275
- - Owner: <name or "agent-approved">
276
- - Reason: <one line>
277
- - Files touched: <optional list>
278
- - Commit: <optional hash>
279
- ```
280
-
281
- History is the audit substrate. It answers "what happened, when, and why" without requiring `git log`.
282
-
283
- ---
284
-
285
- ## 10. Method Versioning
286
-
287
- `method` version is separate from `cli` and `skill` versions.
288
-
289
- - **Patch** (`1.0.x`): clarifications, non-normative additions.
290
- - **Minor** (`1.x.0`): additive changes (new artifact kind, new state, new invariant).
291
- - **Major** (`x.0.0`): breaking changes (removed states, changed invariants, changed frontmatter schema, changed path map).
292
-
293
- Every method-version change ships with `MIGRATION-<from>-to-<to>.md`.
294
250
 
295
- Tooling versions may change freely. `skill 1.4.2` and `cli 1.4.2` can implement `method 1.0`. A future `skill 2.0.0` can still implement `method 1.0`.
296
-
297
- ---
298
-
299
- ## 11. Conformance
300
-
301
- An implementation is ScrumRun-compatible if it:
302
-
303
- 1. Honors every invariant in §6.
304
- 2. Implements the state machines in §3 for every artifact it exposes.
305
- 3. Enforces precedence in §5.
306
- 4. Provides intake per §7 or refuses to accept natural-language requests entirely.
307
- 5. Writes history per §9.
308
- 6. Declares the `method` version it targets.
251
+ `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
+
253
+ The migrator must:
254
+
255
+ - hash every source file and block;
256
+ - keep a byte-exact ignored backup;
257
+ - transform in staging and validate before an atomic switch;
258
+ - map each source block to a destination or explicit warning;
259
+ - preserve original v1 files byte-exactly in the ignored backup while removing legacy-only aggregates from the active v2 tree;
260
+ - detect incomplete hybrid v1/v2 layouts and reuse proven canonical Task/Sprint/Run relations instead of duplicating them;
261
+ - normalize only deterministic schema aliases and require resolvable evidence for active migrated memory;
262
+ - be idempotent;
263
+ - reject symlinks, malformed markers, ambiguous destructive guesses, and concurrent source changes;
264
+ - rollback only when doing so cannot erase post-migration work.
265
+
266
+ Legacy sprint entries become Tasks. History entries become Runs only with an evidenced Task relation. A Sprint is created only from real grouping/timebox evidence. Feature lanes become Features, fixes become `type: fix` Tasks, backlog items become backlog Tasks, extracted insights remain candidates, and golden rules become stable-id Guardrails.
267
+
268
+ ## 10. Normative invariants
269
+
270
+ - **I-01** No canonical artifact or code write occurs before explicit approval.
271
+ - **I-02** Approval creates a linked Task/Run pair atomically or creates nothing.
272
+ - **I-03** Task is atomic work; Sprint only groups Tasks with real batch/timebox evidence.
273
+ - **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.
275
+ - **I-06** `guardrails.md` is canonical project policy and configuration cannot weaken it.
276
+ - **I-07** Markdown is canonical; SQLite and generated views are disposable projections.
277
+ - **I-08** AI-created facts/insights remain candidates until explicit human confirmation.
278
+ - **I-09** Confirmed claims have resolvable evidence and review metadata.
279
+ - **I-10** Rejected, deprecated, and invalidated memory is auditable but not active truth; stale memory is labeled.
280
+ - **I-11** Vault values never enter context, artifacts, indexes, reports, logs, commits, or approval tokens.
281
+ - **I-12** Canonical artifacts have valid, matching id/kind/status/date/method frontmatter.
282
+ - **I-13** Missing/stale projections are surfaced and never treated as authoritative.
283
+ - **I-14** Context and semantic retrieval are bounded and explain why evidence matched.
284
+ - **I-15** Migration is explicit; dry-run and ordinary update perform no project writes.
285
+ - **I-16** Migration preserves hashed source coverage, backup, mapping, idempotency, and safe rollback.
286
+ - **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.
288
+ - **I-19** Code intelligence is derived, adapter-based, fingerprinted, and cannot silently confirm memory.
289
+ - **I-20** Post-validation learning proposes candidates and never blocks Task/Run completion.
290
+
291
+ ## 11. Command grammar
292
+
293
+ The only canonical root is:
294
+
295
+ ```text
296
+ /sc <noun> <subject> <action> [args]
297
+ ```
309
298
 
310
- A conformance test suite lives at `tests/conformance/` and MUST pass for any release claiming compatibility.
299
+ Exactly five nouns exist: `plan`, `knowledge`, `rules`, `review`, and `config`. The implementation manifest is the command source of truth for help and client adapters. Fresh installs expose `/sc`; generated v1 aliases may remain for one compatibility cycle and must execute the canonical route.
311
300
 
312
- ---
301
+ Unknown syntax fails deterministically and never guesses a mutation.
313
302
 
314
- ## 12. Open Questions
303
+ ## 12. Conformance and compatibility
315
304
 
316
- Items to resolve before `method 1.0` freezes. Tracked as `⚠️ revisitar` per plan discipline.
305
+ An implementation may claim ScrumRun method 2.0.0 only when it:
317
306
 
318
- - ⚠️ Should `blocked` be a real state or a decoration on `running`?
319
- - ⚠️ How is a dossier "stale threshold" measured — commits since capture, or file-level touch?
320
- - ⚠️ Should quick tasks generate a lightweight artifact (e.g., `tasks.md` line) or only a history entry?
321
- - ⚠️ Precedence between two active golden rules that conflict — defined explicit order, or rejection at rule creation?
322
- - ⚠️ Do feature lane sprints inherit main goal golden rules automatically, or opt-in?
307
+ 1. passes positive and negative tests for I-01 through I-20;
308
+ 2. enforces every exposed state machine and schema;
309
+ 3. proves read-only intake and dry-run migration through full-tree fingerprints;
310
+ 4. proves migration failure recovery, rollback safety, and vault exclusion;
311
+ 5. proves cache deletion/rebuild equivalence and inactive-memory filtering;
312
+ 6. bounds context/retrieval and records benchmark budgets;
313
+ 7. declares method `2.0.0` and requires Node.js `>=22.13.0` for the native SQLite index.
323
314
 
324
- Resolution goes to `DECISIONS.md` as an ADR when closed.
315
+ Method changes follow semantic versioning. Breaking entity, path, invariant, or state changes require a major version and a migration guide.