empirical-sdd 0.35.0 → 0.37.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 (49) hide show
  1. package/CHANGELOG.md +450 -1
  2. package/README.md +115 -8
  3. package/dist/changed-tests.d.ts +15 -0
  4. package/dist/checkouts.d.ts +9 -0
  5. package/dist/cli.js +25695 -19145
  6. package/dist/contract-amendment.d.ts +32 -0
  7. package/dist/contract-summary.d.ts +18 -0
  8. package/dist/coordination.d.ts +41 -1
  9. package/dist/core.d.ts +195 -3
  10. package/dist/demo-integration-repair.js +15107 -9224
  11. package/dist/demo-ticket-policy.js +15092 -9208
  12. package/dist/direct.d.ts +43 -0
  13. package/dist/doctor.d.ts +2 -0
  14. package/dist/evidence.d.ts +103 -1
  15. package/dist/index.d.ts +10 -5
  16. package/dist/index.js +25210 -19285
  17. package/dist/integrations.js +4487 -1871
  18. package/dist/jobs.d.ts +138 -0
  19. package/dist/linear-mcp-tracking.d.ts +4 -1
  20. package/dist/mcp.js +25402 -19237
  21. package/dist/overview.d.ts +14 -1
  22. package/dist/policy.d.ts +1 -1
  23. package/dist/promotion-proof.d.ts +24 -2
  24. package/dist/protocol.d.ts +55 -1
  25. package/dist/protocol.js +57 -7
  26. package/dist/qa.d.ts +87 -7
  27. package/dist/review-baseline.d.ts +44 -0
  28. package/dist/review-triage.d.ts +20 -0
  29. package/dist/review.d.ts +12 -2
  30. package/dist/roadmap.d.ts +166 -0
  31. package/dist/routing.d.ts +2 -0
  32. package/dist/runtime.d.ts +33 -1
  33. package/dist/scope.d.ts +11 -0
  34. package/dist/size-guardrail.d.ts +26 -0
  35. package/dist/specifications.d.ts +3 -0
  36. package/dist/storage.d.ts +6 -3
  37. package/dist/target-sync.d.ts +25 -0
  38. package/dist/tracker-comments.d.ts +1 -0
  39. package/dist/tracker-events.d.ts +9 -0
  40. package/dist/tracker-lifecycle.d.ts +195 -0
  41. package/dist/tracking.d.ts +107 -1
  42. package/dist/types.d.ts +610 -3
  43. package/dist/workspace-graph.d.ts +44 -0
  44. package/docs/mcp.md +599 -52
  45. package/docs/protocol.md +391 -41
  46. package/docs/tracking.md +144 -0
  47. package/docs/verification-performance.md +55 -7
  48. package/docs/versioning.md +9 -11
  49. package/package.json +2 -1
package/CHANGELOG.md CHANGED
@@ -8,6 +8,453 @@ under the alpha rules in [docs/versioning.md](docs/versioning.md).
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [0.37.0] - 2026-09-18
12
+
13
+ ### Added
14
+
15
+ - Repository identity now follows the root of HEAD's first-parent history,
16
+ so full clones can recognize the same durable artifacts. The original
17
+ checkout still accepts its old path-derived id; a reviewed
18
+ `.empirical/identity.json` can declare verified earlier ids for other clones.
19
+ Shallow clones retain a path identity until their full history is available.
20
+ - A clone with an absent local capability claim can select and verify its
21
+ feature. Integrate refuses with `CAPABILITY_CLAIM_UNREACHABLE` when the
22
+ comparison base is unavailable; locks, delegation and ownership transfers
23
+ remain restricted to linked worktrees of one checkout. Legacy authorization
24
+ and delivery/publication markers retain their original identity bindings.
25
+
26
+ - A timed-out verification command now shows its way out. The status card marks the check with `timedOutAfterMs` and adds a decision naming the exits: run it in the background, use a smaller command, hand it to PR CI, raise `timeoutMs` up to the maximum, or stop. The agent is told to offer them instead of rerunning the same command in the foreground, and to suggest the background run before long runs.
27
+
28
+ - Verification progress now reports where the feature stands and whether each
29
+ command passed. QA execution and independent integration replay carry the
30
+ phase and its 1-based position in the feature's phase order
31
+ (`phase 6/8 verify`), derived from the same order the roadmap reports —
32
+ including the review-first Complex order — and their closing heartbeat marks
33
+ `finished: passed` or `finished: failed` alongside the existing exit code,
34
+ timeout and signal detail. Hosts holding a `progressToken` receive the same
35
+ facts in the progress message text, with only the standard notification
36
+ fields. The receipt still decides what a run proves, a timeout or signal is
37
+ never marked passed, and no argv, environment value or child output enters the
38
+ progress channel.
39
+
40
+ - Verify proof no longer goes stale for line-ending-only changes, and human QA
41
+ records can bind the paths they assessed. (SDD-84)
42
+ - **Line endings:** QA receipts record `textTreeDigest` (CRLF normalized to
43
+ LF in text files). At the Verify gate and on the status card, a receipt
44
+ below full CI survives a CRLF-only change. Scoped digests normalize too.
45
+ Promotion and full-CI proof stay byte-exact.
46
+ - **Human records:** `qa-record` accepts `assessedPaths`, so a human record
47
+ survives changes outside what it assessed.
48
+ - **Recorded scope:** an executed receipt's recorded scope must still match
49
+ the current policy command's scope and kind.
50
+ - **Scope matching:** entries are NFC-normalized, repeated `**` collapses,
51
+ and `workspace:../path` resolves by directory first.
52
+
53
+ - After a recorded review, the next local review is a delta re-review. (SDD-85)
54
+ - **What the reviewer sees:** the packet carries `reReview`: the diff since
55
+ the previous reviewed head, the previous canonical review, the findings still
56
+ open, and the non-blocking findings already deferred.
57
+ - **Finding ids:** the reviewer repeats ids that are still open and omits fixed
58
+ ones. Triage reports `findingHistory` with each id as open, fixed, deferred
59
+ or new.
60
+ - **Full review instead:** used when the base moved, the previous head is not
61
+ a merge-free ancestor of HEAD, or the criteria, decisions or amendments
62
+ changed.
63
+ - **Gate check:** the gate rebuilds the same packet from the recorded context
64
+ and refuses a context that no longer matches its stored result.
65
+ - **Pull request body:** deferred findings carried from earlier rounds still
66
+ appear there.
67
+
68
+ - New Complex and promoted Fast features run Review before Verify. Saved
69
+ features retain their original order; Verify preserves and revalidates the
70
+ independent review before advancing to Integrate.
71
+ - Review results may carry structured findings with a severity and a category.
72
+ - Critical, high, security and acceptance findings block, and an approval
73
+ can't carry one.
74
+ - The recorded review returns `triage` with the round and the exits:
75
+ fix (with the Verify checks it re-runs and their estimates), defer
76
+ non-blocking findings to a ticket, open a draft pull request for CI, or
77
+ stop.
78
+ - After the review round limit, the exits must be offered instead of
79
+ another automatic lap.
80
+ - `empirical_review_defer` (`__internal review-defer`) records deferrals.
81
+ - Deliver lists every non-blocking finding and its deferral in the pull
82
+ request body. (SDD-86)
83
+
84
+ - Verification commands may declare `scope: "workspace"` to derive their
85
+ Verify-gate QA receipt scope from the pnpm, npm, yarn, bun or Turbo workspace
86
+ package graph: the target package plus its transitive workspace
87
+ dependencies. The scope is derived again at validation and a changed graph
88
+ makes the receipt stale; ambiguous targets bind the whole tree and record a
89
+ `SCOPE_WORKSPACE_UNRESOLVED` reason.
90
+ - Background verification jobs: `empirical_qa_start`, `empirical_qa_status` and
91
+ `empirical_qa_cancel` (with `__internal qa-start`, `qa-status` and
92
+ `qa-cancel`) run a matrix-authorized command in a detached snapshot worktree
93
+ of the committed `HEAD`, so agents keep working. Jobs are durable records
94
+ under the Git common directory, run one at a time per repository, record a
95
+ normal QA receipt bound to the job commit, report `stale` when the feature
96
+ revision or source tree moves, and always remove their snapshot.
97
+ - Background jobs stream a bounded, redacted live log, record the failing test
98
+ files named by bun, node `--test` and vitest/jest output, and accept
99
+ `testFiles` to rerun only tracked test files through a `testFiles: "changed"`
100
+ command. Roadmaps list recent jobs with stable fields, the CLI status card
101
+ adds a `Regression:` line, and managed skills ask for approval before a
102
+ full regression without CI, run it in the background and keep working.
103
+
104
+ - `empirical_sync_target` (`__internal sync-target [--fetch] [--target <ref>]`)
105
+ keeps a feature branch current with its target: it predicts conflicts with
106
+ `git merge-tree`, merges only when the worktree is clean and conflict-free,
107
+ never rebases, forces or pushes, and otherwise changes nothing and reports the
108
+ conflicting files.
109
+ - The roadmap adds a `decision` waiting item and a sync `nextAction` when the
110
+ branch is behind its target with predicted conflicts or by more than
111
+ `staleness.maxBehind` commits (default 10), read from local refs only. The
112
+ optional `staleness` configuration never blocks a gate.
113
+ - Managed skills sync with the target at every checkpoint and before opening or
114
+ updating a pull request, and re-run only the tests for conflicted files.
115
+ - Size guardrail: Complex features over 6 acceptance criteria or 2
116
+ capabilities in Specify through Implement carry `featureSize`, a non-blocking
117
+ roadmap decision and a `nextAction` proposing slices. `empirical_split_decision`
118
+ records keep (reason required) or split at the exact revision, limits are
119
+ configurable with `sizeGuardrail`, and the skill presents the split option
120
+ before implementing.
121
+ - Time budget and checkpoints: roadmaps carry `time` (`elapsedMs`,
122
+ `phaseElapsedMs`, `budgetMs`, `over`) derived from journal timestamps, and
123
+ the status card shows a `Time:` line. An optional per-lane `budget` in
124
+ `.empirical/config.json` defaults to Fast 30, Quick 60 and Complex 120
125
+ minutes; invalid values fail with `INVALID_CONFIG`. An exceeded budget, or
126
+ Review sending work back to Implement, adds a decision checkpoint with
127
+ explicit exits, and `empirical_checkpoint` records the choice to continue
128
+ with more minutes. The generated skill never continues past an exceeded
129
+ budget without the user's choice.
130
+ - `empirical_qa_plan` returns a Verify `selection` beside the unchanged matrix:
131
+ one command per automated Verify check, chosen as a deterministic
132
+ minimum-cost cover (fewest unknown estimates, lowest summed median duration,
133
+ fewest commands, earliest policy order) with per-entry `estimateMs`,
134
+ `sharedWith` and `reason`. Full-CI commands are never candidates, and
135
+ changed-file commands only when a changed test file matches. Profile plans mark
136
+ `selected` entries, roadmap Verify checks name `selectedCommandId`, and
137
+ `nextAction` runs the selected command once for every check it covers.
138
+ - Local full-suite runs need an explicit, immutable approval bound to the
139
+ feature, revision, commit, tree, policy, command, argv and shown estimate.
140
+ `empirical_qa_approve` (private `qa-approve --revision --command --estimate-ms
141
+ [--yes]`) records it, asking through MCP form elicitation when the host
142
+ advertises elicitation and otherwise marking it `agent-relayed`; the CLI marks
143
+ `cli` or `cli-unattended`. Each approval authorizes one run. Publish's explicit
144
+ publication authorization, passed to `empirical_qa_execute` as
145
+ `publicationAuthorization`, approves Publish's own full-CI run.
146
+ - A deterministic `promotionRoute` (`ci` or `local` with every reason) on the
147
+ roadmap's full-CI check; route `local` shows one authorization item with the
148
+ command, estimate, revision and first reason.
149
+
150
+ ### Changed
151
+
152
+ - Raised the verification command timeout ceiling from 15 to 45 minutes, in the
153
+ runtime bound, both Policy v2 command schemas and the benchmark harness, so a
154
+ long complete suite is no longer killed mid-run. Projects opt in by raising a
155
+ command's `timeoutMs`; this repository's own policy moves after the release,
156
+ because published 0.36.0 and earlier versions, and early 0.37.0 preview
157
+ builds, reject timeouts above 15 minutes.
158
+
159
+ - Generated agent guidance now ships early: open a draft pull request at the
160
+ first coherent commit of feature work, push every commit, and never let test
161
+ runs block commits or pushes. Tests for the change run in the background and
162
+ heavy runs belong to pull-request CI. Push authority covers only the agent's
163
+ own feature branch and draft pull requests, never merges, protected or target
164
+ branches, or force pushes. Implement instructions carry the same rule.
165
+ - An omitted `promotion.fullCi` now means `auto`: pull-request CI with pinned
166
+ required checks proves full CI at Deliver unless an SDD-67 local-forcing reason
167
+ applies, and otherwise the full suite runs locally after approval. The digest
168
+ of an unchanged policy is kept; an explicit `local` is now kept in the parsed
169
+ policy (one digest change) and always runs locally. `remote-checks` is unchanged.
170
+ - A fresh `empirical_qa_execute` or `empirical_evidence_execute` full-CI run
171
+ refuses with `FULL_SUITE_APPROVAL_REQUIRED` before starting without a matching
172
+ approval; receipt reuse needs none.
173
+ - Integrate on `auto`'s route `ci` needs no full-CI receipt and records the
174
+ route in its integration receipt. Independent replay never executes full CI
175
+ and runs only the Verify selection (every bare non-full-CI command when the
176
+ feature changed verification configuration); `integrationReplayCommands`
177
+ plans replay (`integrationReplayPlan` stays as a deprecated export), and a
178
+ policy with only full-CI commands replays nothing with a plan note.
179
+ - Route `ci` also needs delivery authority (`DELIVERY_NOT_AUTHORIZED` otherwise),
180
+ lifecycle observation refuses full-CI commands, and per-command estimates match
181
+ a bare command's exact argv only.
182
+ - Under `auto`, Deliver may push and open the source pull request before proof,
183
+ returns `promotion-proof-required` with `route: "ci"` until the exact head is
184
+ green, and switches to `route: "local"` with the pending approval when remote
185
+ proof is ineligible; it merges nothing before proof.
186
+ - Skill guidance, Verify, consolidation, Integrate, Deliver and Publish
187
+ instructions state that iterating runs nothing, "run the changed tests" runs
188
+ `iterate` once, Verify runs the selection, the full suite runs only as PR CI or
189
+ an approved local run, and agents never approve on the user's behalf.
190
+
191
+ ### Fixed
192
+
193
+ - A source change after an approved review returns `REVIEW_STALE` before
194
+ validating Verify receipts, including when the collected review's tree is stale.
195
+ - Workspace scope inference refuses every spelling of npm's
196
+ `--include-workspace-root` flag, including `=true`, so root tests and source
197
+ remain bound by whole-tree evidence.
198
+
199
+ - Scoped QA receipts recorded by a passing Verify gate remain valid Verify
200
+ evidence through later phases. Review artifacts and promotion proof retain
201
+ exact tree binding; an unrelated edit no longer forces another repair lap.
202
+ - Background log callback declarations use portable byte arrays so packed
203
+ consumers do not require ambient Node `Buffer` types.
204
+ - Split guidance now provides an executable early exit: explicit contract
205
+ revision returns Design or Plan to Specify while retaining the approved
206
+ contract; unapproved Specify work can be narrowed directly. No migration
207
+ required; existing state and receipts retain their schema.
208
+ - Verify command selection respects each command's criterion allowlist; a
209
+ cheaper partial command never displaces a command that can satisfy the check.
210
+ - Background jobs retain their originating checkout, feature, command arguments
211
+ and policy/matrix bindings. A changed policy cannot certify an older command;
212
+ cancellation terminates the detached test process before snapshot cleanup.
213
+ Older queued jobs without execution bindings fail `JOB_STALE` and must be
214
+ restarted; no durable feature-state migration is required.
215
+ - Canonical review failure transitions use triage's recorded-review count and
216
+ round-limit boundary; earlier Verify failures no longer exhaust the first
217
+ review repair. Existing review history is honored without a state migration.
218
+ - Command timeouts now terminate POSIX process groups, attempt Windows process
219
+ tree termination, and bound output cleanup so inherited pipes cannot leave QA
220
+ waiting indefinitely. Timeout receipts remain non-passing even when a wrapper
221
+ exits successfully during termination.
222
+ - Bounded command logs now retain the final output after noisy setup, and
223
+ verification progress reports timeout, signal and exit status on completion.
224
+ - QA reports preparation, command execution, finalization and receipt-reuse
225
+ timings separately. MCP clients requesting progress receive phase updates,
226
+ and the final diagnostic timing summary lives in result metadata, outside the
227
+ immutable receipt.
228
+ - QA skips a second dependency fingerprint when the initial fingerprint is
229
+ unavailable or the command failed, timed out or was cancelled. Such receipts
230
+ remain ineligible for reuse. Invalid retry history is rejected before running
231
+ another command and checked again after execution.
232
+ - Ready-to-close guidance no longer runs full CI during consolidation. Final
233
+ verification profile plans omit commands covering promotion checks such as
234
+ `qa-full-ci`. Full CI follows the approved local or eligible remote promotion
235
+ route instead of being repeated during Verify and integration replay.
236
+ - Verification profile plans list each executable command once with the
237
+ `coveredCheckIds` a single run covers, so a command declared for two checks
238
+ is no longer run twice.
239
+ - A Done Fast feature that is implemented and not integrated accepts on-demand
240
+ optional checks again: `qa-plan`, `qa-execute`, `evidence-execute` and
241
+ `evidence-collect` take its explicit `id`, refused before migration for any
242
+ other feature. Evidence execution for it needs an explicit profile. Receipts
243
+ stay optional and the completion level does not change.
244
+ - Stale evidence receipts refused by `complete` or `reuseReceiptId`, including
245
+ future revisions, another GitHub repository, unknown matrix checks and
246
+ modified artifacts, return `RECEIPT_STALE` with the receipt id and the changed
247
+ binding instead of `UNEXPECTED`.
248
+ - Empty or whitespace-only Context pages are refinement-required, so the
249
+ Context gate no longer passes them.
250
+ - At Verify, `verify` evaluates the active feature's valid on-disk receipts the
251
+ way the completion gate would, so it no longer lists them as missing before
252
+ `complete`. Full-CI, remote-checks and review receipts, and every later gate,
253
+ stay recorded-only.
254
+ - Review refuses an empty committed diff with `REVIEW_DIFF_EMPTY` and keeps
255
+ committed evidence receipts and journal events out of the reviewed diff. The
256
+ diff spans the whole Git worktree when the project is nested in it. Reviews
257
+ recorded under the previous diff must be requested again.
258
+ - A malformed review submission, including one wrapped in a `submission`
259
+ property, returns `INVALID_ARGUMENT` instead of crashing.
260
+ - Doctor recommends `core.longpaths=true` for a Git repository on Windows
261
+ (`GIT_LONGPATHS_DISABLED`), because generated evidence receipt paths can
262
+ exceed Git's Windows path limit.
263
+
264
+ ### Migration
265
+
266
+ - Upgrade to `empirical-sdd@0.37.0`, refresh managed repository/global agent
267
+ skills through Empirical integrations, and restart or reconnect MCP clients
268
+ so they discover the new tools and guidance. Upgrading the package alone does
269
+ not rewrite installed skills or refresh a running server.
270
+ - For delta re-review, pass the returned `reReview` context to the isolated
271
+ reviewer, including the previous verdict and open/deferred findings. Keep the
272
+ ids of still-open findings. Prepare a new packet if deferrals change while a
273
+ review is pending; changed bases, merge history or contracts need a full review.
274
+ - New Verify QA receipts normalize CRLF in ordinary text. Older scoped receipts
275
+ made on a CRLF checkout may become stale and must be rerun. Human records can
276
+ opt into `assessedPaths`; that scope exception applies during Verify only.
277
+ Review and full-CI/promotion proof retain exact binding. See the documented
278
+ line-ending limitations in `docs/protocol.md` when tests depend on text bytes.
279
+ - Keep existing Schema 5 state and receipts; do not reinitialize projects or
280
+ edit evidence to migrate them. New Complex and promoted Fast features record
281
+ `reviewFirst: true`; existing features without that field keep Verify before
282
+ Review. Clients must follow the returned phase and roadmap instead of assuming
283
+ one global order.
284
+ - If every full-suite run must remain local, explicitly configure
285
+ `promotion.fullCi: "local"` in the project policy. An omitted setting now uses
286
+ `auto`, which accepts CI only with eligible pinned required checks and delivery
287
+ authority, otherwise requiring a local run. Each fresh local full-suite run
288
+ needs a separate explicit approval bound to the displayed candidate and
289
+ command; delivery authority alone does not approve it.
290
+ - Re-run checks or obtain a fresh review when Empirical reports stale proof.
291
+ Explicit `local` normalization can change the policy digest once, and the
292
+ review diff now excludes receipts and journal events. Do not rewrite receipt
293
+ bindings to preserve old approvals.
294
+ - To use workspace-derived Verify reuse, opt in with `scope: "workspace"` only
295
+ for commands whose target/dependency graph is resolvable. Commands without a
296
+ scope still bind the whole tree; global inputs always bind, and independent
297
+ review and full-CI promotion proof remain exact.
298
+ - Restart any preview-era background jobs that report `JOB_STALE` because they
299
+ lack the new execution bindings. Existing feature state needs no rewrite.
300
+ - Treat `roadmap.time` as a live clock when comparing status responses; compare
301
+ durable action fields separately. Respect the budget checkpoint and explicit
302
+ continue/split/defer/stop choices returned by the updated guidance.
303
+ - Upgrade every CLI/MCP host before setting command `timeoutMs` above 900000.
304
+ The new ceiling is 2700000 (45 minutes); existing configured limits stay as
305
+ configured. A policy change invalidates its old proof and needs a new approved
306
+ run. Progress consumers should use the returned phase and outcome; MCP keeps
307
+ standard notification fields and carries the extra facts in message text.
308
+ - Before moving legacy evidence to another clone, use a full-history checkout
309
+ (unshallow it first when needed). Use the lineage id from post-upgrade receipt
310
+ provenance and only verified prior ids from that repository's older receipts
311
+ to prepare and review `.empirical/identity.json`, following the format in
312
+ `docs/protocol.md`. Commit the record before relying on it in another clone;
313
+ never admit an unknown id just to make validation pass. Existing local path
314
+ identities remain recognized in their original checkout.
315
+ - A missing capability claim does not contain a recoverable comparison base.
316
+ Perform integration from the owning checkout or explicitly transfer to one of
317
+ its linked worktrees; do not invent a base or copy Git-private claim state to
318
+ simulate cross-machine ownership.
319
+
320
+ ## [0.36.0] - 2026-09-16
321
+
322
+ ### Added
323
+
324
+ - Verification commands may declare an optional `scope` of repository-relative
325
+ path prefixes or simple globs. Their Complex Verify-gate QA receipts record a
326
+ scoped content digest and stay valid when only files outside the scope and
327
+ global configuration change. Full-CI commands refuse `scope`, and promotion,
328
+ remote-checks, review, human and collected evidence keep whole-tree binding.
329
+ - Added the empirical-init **Track every change** ticket preset. It expands the
330
+ complete feature/fix/chore by Fast/Quick/Complex matrix to `required`, shows
331
+ that matrix before setup is saved, and applies the existing strict tracker
332
+ mutation gate to every kind of work until its ticket is synchronized. Active
333
+ Empirical tasks now also require a destination action and tracker-gate check
334
+ before the first write after changing repository root, checkout, worktree, or
335
+ host environment.
336
+ - Automatic Policy v2 post-commit synchronization, prepared Linear MCP intents,
337
+ and recovery of this checkout's pending completed tickets.
338
+ - Explicit Init confirmations for all workflow/delivery mappings and the Done
339
+ milestone, plus receipt-backed release and deployment observations.
340
+ - Action packets, `empirical_status` and `empirical_explain` return a
341
+ deterministic `roadmap`: `progress` and `phases[]` from the engine's single
342
+ phase order per profile (Complex 8, Quick 5, Fast 2 non-terminal phases),
343
+ one `checks[]` entry per verification-matrix check with its state, receipt id
344
+ and last duration (a `passed` state binds the same proof the completion gate
345
+ requires, including the current repository tree digest), an `estimateMs` for unrun and failed checks from prior
346
+ attempt durations, classified `waitingOn[]` items, a concrete `nextAction`
347
+ and `verificationLeft`. Idle checkouts return `roadmap: null`. Roadmaps and
348
+ estimates are recomputed on every read and never change a gate or transition.
349
+ - Human CLI output for `status`, `explain`, `next` and `loop` renders the
350
+ Empirical status card (Done, Not done, Next, Waiting on you, Verification)
351
+ from that roadmap, and `--json` exposes the same `roadmap` field.
352
+ - Generated agent skills require the status card at start or resume, at every
353
+ phase change, at every stop, and before any run whose summed estimate is over
354
+ 60 seconds or unknown, where they state the estimate and offer to defer.
355
+ - `empirical_overview` adds a read-only roadmap summary (progress, phase, next
356
+ action, waiting count, remaining checks) for the first 128 readable spec
357
+ copies; unreadable, failing and beyond-limit copies keep their bounded
358
+ diagnostic and report `roadmap: null`.
359
+ - `empirical_qa_execute` and `empirical_integrate` send MCP
360
+ `notifications/progress` for each existing heartbeat when the request carries
361
+ a `progressToken`; requests without one are unchanged.
362
+ - Added direct mode: the generated local `empirical` skill and the automatic
363
+ instruction block now start with a self-contained Direct mode section. A
364
+ request that says "direct", "without Empirical" or "quick change" is handled
365
+ as a plain agent turn that makes no Empirical call, reads no specification,
366
+ decision, capability or context page, runs a test, lint, typecheck or build
367
+ only when asked, and ends with
368
+ `Changed <X> in <N> files · not tested (not requested) · say "track this" to formalize`.
369
+ - Added `empirical_direct` (library `direct`, private CLI `direct`) with exactly
370
+ three actions: `pause` ("go direct") records `pause: { since, baseCommit }` on
371
+ the selected feature with one `Pause: direct mode` journal event and no spec,
372
+ delta, decision, receipt or tracker gate; `resume` ("back to Empirical")
373
+ clears the pause and folds the paths changed since the base commit in as one
374
+ `iterate` for Fast work in Implement or implemented Done and for iterative
375
+ Complex work in an iterate-eligible phase, and otherwise as one journal event
376
+ that also names any iterate guard a paused feature could not have cleared;
377
+ `track` ("track this") rebuilds direct commits and uncommitted paths from Git
378
+ and starts a Fast (default) or Complex feature whose request lists them.
379
+ - While a feature is paused, `loop` and `next` return only a paused action naming
380
+ `resume`, `status` and `overview` report the pause, and `complete`, `iterate`,
381
+ `consolidate`, `promote`, `retry`, QA execution and recording, evidence
382
+ execution and collection, `integrate`, `deliver` and `publish` fail with
383
+ `FEATURE_PAUSED` without state change.
384
+ - Added an optional team `defaultMode` (`empirical` or `direct`) to
385
+ `.empirical/config.json` and a personal override in the checkout's
386
+ `<git-dir>/empirical-sdd/preferences.json` through `empirical_configure` with
387
+ `scope: "personal"`. Absence keeps existing configuration bytes identical, any
388
+ other value fails `INVALID_CONFIG`, and `status` reports team, personal and
389
+ effective values with a warning for an unreadable or invalid personal file.
390
+ - Complex Implement actions carry `contractSummary`, a deterministic extract of
391
+ the feature's goal, acceptance criteria, accepted decisions and open risks
392
+ bounded to 6,000 characters, with the full spec, design, decisions and plan
393
+ listed as optional `references`. Their `capabilityContext` lists only the
394
+ capabilities the feature's own deltas declare. Iteration actions add
395
+ `adjustmentRequest`, the newest request verbatim, which overrides conflicting
396
+ earlier criteria and decisions; the superseding decision is recorded after the
397
+ change and never blocks Implement completion.
398
+ - During an iteration of a Complex feature started with `iterative: true` (recorded
399
+ durably as `lifecycle.iterative`), contract edits to acceptance criteria, declared
400
+ requirement contents and decisions are an amendment by default:
401
+ `empirical_iterate` and the Implement completion accept them and re-approve the
402
+ amended specification and delta digests in one journal event, without returning
403
+ to Specify and without a human confirmation gate. `amendContract: true`
404
+ (`--amend-contract`) is the explicit equivalent, cannot be combined with
405
+ `reviseContract` (`INVALID_ARGUMENT`), and Fast rejects it with
406
+ `PROFILE_CONFLICT`. The approved contract is retained in
407
+ `contract-revisions/<revision>.baseline.json` and each change in
408
+ `<revision>.amendment.json` with previous and current criterion text and
409
+ superseded decision ids. Consolidation and Review actions, the Review packet and
410
+ `empirical_explain` list every amendment since the last full approval. Raising
411
+ the risk floor, adding or removing a delta capability, adding, removing or
412
+ renaming a requirement block, changing its operation, or changing `impact.json`
413
+ fails with `CONTRACT_REVISION_REQUIRED` and re-approves nothing, while a
414
+ `failed`, `blocked` or `awaiting_human` outcome can still be recorded. The risk
415
+ limit compares the resulting risk level over criteria and declared requirement
416
+ text, so rewording, reordering or lowering the floor is not an escalation.
417
+ Outside the iteration stage, and for Complex features without the iterative
418
+ opt-in, contract edits keep failing with `SPEC_CHANGED`, `DELTA_CHANGED` or
419
+ `IMPACT_CHANGED`, and `reviseContract` is unchanged. Retained history is
420
+ authenticated: a baseline is trusted only while it reproduces the approved
421
+ specification and delta digests, and a missing or malformed amendment record
422
+ fails with `CONTRACT_HISTORY_MISSING` or `CONTRACT_HISTORY_INVALID`.
423
+
424
+ ### Fixed
425
+
426
+ - Any verification command can declare `full-ci`, not only `bun run ci`, so
427
+ repositories built with pnpm, npm, Make, Python or other tools can satisfy the
428
+ promotion gate, use integration replay coverage and opt into `remote-checks`
429
+ (SDD-72). Changed-file commands still cannot declare it. For a non-`bun run ci`
430
+ full-CI command, changes to task-runner manifests in its `cwd` or to files named
431
+ in its argv replay every command during integration and require local proof
432
+ under `remote-checks`. Bun-only policies keep their configuration digest.
433
+ - `rationale.missingContext` now lists only unmet requirements: existing
434
+ artifacts, evidence kinds proven by accepted receipts at the current revision
435
+ and QA checks with passing current receipts are excluded, while
436
+ `requiredContext` is unchanged.
437
+ - CLI step counts came from a hardcoded 10-phase Complex list that included
438
+ Deliver and Publish; they now equal the engine's `roadmap.progress`.
439
+
440
+ ### Migration
441
+
442
+ - Schema 5 is unchanged. Update the installed package, refresh the managed
443
+ Empirical skills and repository instructions, and restart connected agent/MCP
444
+ sessions to load the new direct-mode and status-card guidance.
445
+ - Existing configurations retain their defaults. To adopt direct mode, request
446
+ it explicitly or configure the optional team/personal `defaultMode`. To adopt
447
+ automatic ticket completion on release or deployment, configure and confirm
448
+ the tracker lifecycle status mappings and production environment in Init.
449
+ - Complex iterative features created before 0.36.0 do not have the durable
450
+ `lifecycle.iterative` opt-in and continue using strict contract revision.
451
+ Finish them with the existing revision path, or start new iterative work
452
+ through the normal workflow to use in-place amendments. Do not edit journal
453
+ state or baseline files to add the marker manually.
454
+ - Non-Bun repositories may explicitly mark their full-CI command with `full-ci`;
455
+ changed-file commands remain ineligible. Existing Bun-only policies need no
456
+ change.
457
+
11
458
  ## [0.35.0] - 2026-09-15
12
459
 
13
460
  ### Added
@@ -675,7 +1122,9 @@ Published through GitHub Actions trusted publishing with npm provenance.
675
1122
 
676
1123
  - Prepared and released package version `0.20.2`.
677
1124
 
678
- [Unreleased]: https://github.com/goempirical/empirical-sdd/compare/v0.35.0...HEAD
1125
+ [Unreleased]: https://github.com/goempirical/empirical-sdd/compare/v0.37.0...HEAD
1126
+ [0.37.0]: https://github.com/goempirical/empirical-sdd/compare/v0.36.0...v0.37.0
1127
+ [0.36.0]: https://github.com/goempirical/empirical-sdd/compare/v0.35.0...v0.36.0
679
1128
  [0.35.0]: https://github.com/goempirical/empirical-sdd/compare/v0.34.0...v0.35.0
680
1129
  [0.34.0]: https://github.com/goempirical/empirical-sdd/compare/v0.33.0...v0.34.0
681
1130
  [0.33.0]: https://github.com/goempirical/empirical-sdd/compare/v0.32.0...v0.33.0
package/README.md CHANGED
@@ -92,9 +92,13 @@ Implement → Done (implemented; verification skipped)
92
92
  Complex:
93
93
 
94
94
  ```text
95
- Specify → Design → Plan → Implement → Context? → VerifyReview → Integrate
95
+ Specify → Design → Plan → Implement → Context? → ReviewVerify → Integrate
96
96
  ```
97
97
 
98
+ Existing features retain their saved Verify-before-Review order. New Complex
99
+ features and promoted Fast features review first; changing reviewed code requires
100
+ another review before Verify can finish.
101
+
98
102
  A Complex feature that shows an interface gets its mockup at Specify when the
99
103
  saved mockup preference is enabled. The contract is still open: seeing a screen
100
104
  reveals states and flows that prose misses and those belong in the criteria.
@@ -112,6 +116,11 @@ Choose Fast for small, self-contained changes. Work that builds on an existing
112
116
  foundation and will be integrated belongs in Complex iterative
113
117
  (`empirical_complex` with `iterative: true`): adjust with `empirical_iterate`
114
118
  without test runs, then say "ready to close" to run final verification once.
119
+ Each Complex implementation packet carries a bounded contract summary instead of
120
+ the full documents, and the newest adjustment wins: a behavior change at the same
121
+ risk floor amends the criteria and decisions in place, with the approved contract
122
+ snapshotted for review. Raising the risk floor or changing the declared capability
123
+ scope still requires an explicit contract revision through Specify/Design/Plan.
115
124
 
116
125
  Fast trades verification confidence for less waiting and process. A follow-up
117
126
  adjustment to the same Fast feature uses `empirical_iterate`, from Implement or
@@ -125,21 +134,87 @@ evidence and completion level they originally earned.
125
134
  Delivery is never implied. Empirical does not infer permission to merge a pull
126
135
  request, bypass protection, create a release, or publish a package.
127
136
 
137
+ Every read returns one deterministic roadmap, and every stop shows the same
138
+ status card built from it, so you always see where the work is and what it
139
+ needs from you:
140
+
141
+ ```text
142
+ Empirical · add-team-invitations · Complex · verify (6/8) · rev 5
143
+ Done: specify, design, plan, implement, context
144
+ Not done: verify: qa-unit unrun, qa-browser missing-environment
145
+ Next: Run qa-unit at revision 5 (~2m 10s) when you request tests
146
+ Waiting on you: [test-request] Ask to run 1 check (~2m 10s), or keep iterating
147
+ [environment] qa-browser needs isolated-consumer
148
+ Verification: 2 of 4 checks left (~2m 10s known; 1 unknown)
149
+ Time: 1h 12m of 2h budget
150
+ ```
151
+
152
+ Work does not run silently for hours. Elapsed time comes from the feature's
153
+ journal and is measured against a per-lane budget (defaults: Fast 30, Quick 60,
154
+ Complex 120 minutes; override with `"budget": { "fast": 45 }` in
155
+ `.empirical/config.json`). Past the budget, or when Review sends work back to
156
+ Implement, the card stops at a checkpoint and offers explicit exits: ship as
157
+ is with a draft PR, split, defer non-blocking findings, continue with a new
158
+ budget (`empirical_checkpoint`), or stop.
159
+
160
+ `empirical status`, `explain`, `next` and `loop` print it, `--json` carries the
161
+ same `roadmap`, and the agent skill shows it at every start, phase change and
162
+ stop, and before a long run it estimates and offers to defer. The card reports
163
+ facts; it authorizes nothing.
164
+ ## Work directly when you want to
165
+
166
+ Say "direct", "without Empirical" or "quick change" and the agent just edits:
167
+ no specification, state, phase, receipt, gate, tracker update or worktree
168
+ proposal, and no reading of specs, decisions or context pages. Nothing runs
169
+ unless you ask for it, and the turn ends with one line such as
170
+ `Changed the button label in 1 files · not tested (not requested) · say "track this" to formalize`.
171
+
172
+ Inside a repository or feature that uses Empirical, "go direct" pauses the
173
+ selected feature, "back to Empirical" folds the direct diff back in as one
174
+ iteration, and "track this" rebuilds recent direct commits and uncommitted files
175
+ from Git into a Fast (or Complex) feature. Push, merge, pull request, tag,
176
+ publish, credential use and destructive Git still need an explicit request.
177
+
178
+ A team can set `defaultMode` to `direct` in `.empirical/config.json`, and each
179
+ developer can override it for their own checkout; explicit Fast, Complex or
180
+ "use Empirical" requests always start those lanes.
181
+
182
+ ## Keep features small
183
+
184
+ When a Complex feature grows past 6 acceptance criteria or 2 capabilities, the
185
+ status card asks whether to split it into independently shippable slices, each
186
+ with its own draft PR, or keep it as one with a recorded reason. The question
187
+ never blocks a gate; tune or disable it with `sizeGuardrail` in
188
+ `.empirical/config.json`.
189
+
128
190
  ## Run tests when you need them
129
191
 
130
192
  Fast and Complex iteration do not automatically run tests after edits. Ask for a
131
193
  run when ready:
132
194
 
133
- - “Run the changed tests” or “run the affected tests” uses the `iterate`
134
- verification profile: only commands configured with `testFiles: "changed"`.
135
- - “Now run it”, “run everything” or “ready to close” uses the `final` profile.
195
+ - “Run the changed tests” or “run the affected tests” runs the `iterate`
196
+ verification profile once: only commands configured with `testFiles: "changed"`.
197
+ - “Now run it”, “run everything” or “ready to close” uses the `final` profile,
198
+ which runs only the Verify selection: one cheapest configured command per
199
+ Verify check, never full CI.
136
200
  - “Keep iterating; skip tests for now” leaves verification pending.
137
201
 
138
202
  One test request does not enable automatic reruns after subsequent changes, and
139
- no phase, iteration or consolidation runs tests by itself. One exact full-CI
140
- receipt recorded at Integrate also serves Deliver when nothing changed, and a
141
- repository can opt into `promotion.fullCi: "remote-checks"` so passing GitHub
142
- required checks on the exact pushed commit stand in for local full CI.
203
+ no phase, iteration or consolidation runs tests by itself. The full suite runs
204
+ once, at the very end. By default (`promotion.fullCi` omitted, which means
205
+ `auto`) it runs as pull-request CI when the repository's GitHub delivery pins
206
+ required checks and no SDD-67 local-forcing reason applies; Deliver merges
207
+ nothing until those checks pass on the exact head. Otherwise it runs locally,
208
+ only after you approve that exact run (command, revision and estimate), and one
209
+ exact full-CI receipt recorded at Integrate also serves Deliver when nothing
210
+ changed. Agents never approve on your behalf; Publish's explicit publication
211
+ authorization is the approval for its own full-CI run. An explicit
212
+ `promotion.fullCi: "local"` always runs locally, and `"remote-checks"` keeps
213
+ remote proof without a local fallback.
214
+ A focused command can declare a `scope` of paths so an edit elsewhere does not
215
+ invalidate its Verify receipt; global configuration (policy, manifests,
216
+ lockfiles, workflows, argv-named files) always invalidates it, and full CI and
217
+ promotion proof are never scoped. See [docs/mcp.md](docs/mcp.md).
143
218
  If no focused command is configured, the agent reports the gap instead of
144
219
  silently running the entire suite. Complex still requires real evidence before
145
220
  claiming verified completion; Fast can finish implemented and unverified.
@@ -147,6 +222,24 @@ Explicit final verification or promotion requests include their required checks,
147
222
  and CI/release gates remain enforced. An explicit no-tests request takes
148
223
  precedence over execution and leaves any conflicting gate pending.
149
224
 
225
+ Long local runs can go to the background: `empirical_qa_start` runs the command
226
+ in a snapshot worktree of the committed `HEAD` and returns a job id immediately,
227
+ `empirical_qa_status` reports progress and the receipt, and `empirical_qa_cancel`
228
+ stops it. See [MCP usage](docs/mcp.md#background-verification-jobs).
229
+ When CI is not available, agents ask before a full regression at the end, run
230
+ it in the background with your approval, keep working, and rerun only the
231
+ failing test files if it fails.
232
+
233
+ ### Ship early
234
+
235
+ Agents open a draft pull request at the first coherent commit of feature work
236
+ and push every commit. Commits and pushes never wait on tests: the change's
237
+ tests run in the background while work continues, and heavy or full-suite runs
238
+ belong to pull-request CI unless you approve a local run. This authority covers
239
+ only the agent's own feature branch and draft pull requests; agents never merge,
240
+ never push to protected or target branches, and never force push. Without a
241
+ remote or `gh`, the agent says so and continues locally.
242
+
150
243
  Existing repositories need their managed skills refreshed with `empirical-init`
151
244
  and a restarted agent session after upgrading to receive this guidance.
152
245
 
@@ -198,6 +291,14 @@ executes them through the authenticated Linear MCP tools, and validated results
198
291
  converge the same binding, milestone, and strict-gate records without sharing
199
292
  the OAuth token.
200
293
 
294
+ ### Automatic lifecycle tracking
295
+
296
+ Policy v2 workflow actions now synchronize automatically. Linear MCP hosts
297
+ receive a prepared tracker intent, and trusted host dispatchers can execute it
298
+ automatically. Init confirms every discovered mapping and whether Done means
299
+ local completion, a confirmed release, or production deployment. See
300
+ [Lifecycle tracking](docs/tracking.md) for setup, recovery, and the observation hook.
301
+
201
302
  ## Documentation
202
303
 
203
304
  - [Practical guide](https://goempirical.github.io/empirical-sdd/) — visual onboarding and diagrams
@@ -248,6 +349,12 @@ worktree created by another tool or `git worktree add`, your agent previews and
248
349
  applies Empirical prepare to fill in the missing files.
249
350
  See [local environment files](docs/protocol.md#local-environment-files-in-worktrees).
250
351
 
352
+ Long-lived branches drift. The status card flags a branch that is behind its
353
+ target with predicted conflicts or by more than 10 commits, and your agent syncs
354
+ at each checkpoint: Empirical merges the target only when it is clean and
355
+ conflict-free, never rebases or force-pushes, and names conflicting files right
356
+ away. See [staying current](docs/mcp.md#stay-current-with-the-target-branch).
357
+
251
358
  Ask your agent for the read-only overview to see specs, owners, branches,
252
359
  profiles, progress and verification status together. Unrelated malformed records
253
360
  appear as local diagnostics without selecting or deleting any spec. Independent