substrate-ai 0.20.70 → 0.20.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -1
- package/dist/cli/index.js +2 -2
- package/dist/cli/templates/agents-md-substrate-section.md +29 -1
- package/dist/cli/templates/claude-md-substrate-section.md +32 -3
- package/dist/cli/templates/gemini-md-substrate-section.md +29 -1
- package/dist/{run-Dg4GbCA7.js → run-UrEvbpcE.js} +66 -1
- package/dist/{run-CFYkkZ8e.js → run-e-pS5Tv5.js} +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -101,6 +101,30 @@ substrate resume
|
|
|
101
101
|
substrate cancel
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
+
### Autonomy Modes
|
|
105
|
+
|
|
106
|
+
Substrate exposes a three-step autonomy gradient. Pick the mode that matches how much operator attention the run gets.
|
|
107
|
+
|
|
108
|
+
| Mode | Invocation | Halts on |
|
|
109
|
+
|---|---|---|
|
|
110
|
+
| Attended | `substrate run --halt-on all` | Every decision (info, warning, critical, fatal) |
|
|
111
|
+
| Supervised *(default)* | `substrate run` | Critical + fatal (cost-ceiling, build-fail, scope-violation) |
|
|
112
|
+
| Autonomous | `substrate run --halt-on none --non-interactive --events --output-format json` | Only fatal — scope violations always halt regardless |
|
|
113
|
+
|
|
114
|
+
Exit codes from autonomous runs: `0` = all stories succeeded or auto-recovered; `1` = some stories escalated (run completed); `2` = run-level failure (cost ceiling, fatal halt, orchestrator died). Combine with the canonical post-run review flow:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Canonical CI / overnight pattern:
|
|
118
|
+
substrate run --halt-on none --non-interactive --events --output-format json
|
|
119
|
+
|
|
120
|
+
# Then review the result:
|
|
121
|
+
substrate report --run latest # per-story outcomes + escalation diagnostics
|
|
122
|
+
substrate report --run latest --verify-ac # adds AC-to-Test traceability matrix
|
|
123
|
+
substrate reconcile-from-disk --dry-run # if pipeline reported failed but tree is coherent
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Behind the scenes, the **Recovery Engine** runs a 3-tier auto-fix ladder before any halt — Tier A retries with extra context (build-fail, missing test coverage, AC missing evidence), Tier B drafts a re-scope proposal, Tier C halts for an operator prompt. Re-scope proposals collect on the run manifest as `pending_proposals[]` for next-morning review; back-pressure pauses dispatching at `>= 2` proposals (work-graph-aware) or `>= 5` (safety valve). When a halt is required, the Recovery Engine writes an operator notification to `.substrate/notifications/<run-id>-<timestamp>.json`; `substrate report` reads and clears those.
|
|
127
|
+
|
|
104
128
|
## The Pipeline
|
|
105
129
|
|
|
106
130
|
When you tell Substrate to build something, it runs through up to **six phases** — auto-detecting which phase to start from based on what artifacts already exist.
|
|
@@ -290,6 +314,25 @@ After the pipeline completes, the supervisor:
|
|
|
290
314
|
3. **Runs A/B experiments** — applies each recommendation in an isolated worktree, re-runs affected stories, compares metrics
|
|
291
315
|
4. **Verdicts**: IMPROVED changes are kept and auto-PRed; REGRESSED changes are discarded
|
|
292
316
|
|
|
317
|
+
### Post-Run Review
|
|
318
|
+
|
|
319
|
+
Two commands turn a finished run into actionable operator output:
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
# Structured per-run completion report
|
|
323
|
+
substrate report --run latest # per-story outcomes + escalation diagnostics
|
|
324
|
+
substrate report --run latest --verify-ac # appends AC-to-Test traceability matrix
|
|
325
|
+
substrate report --run latest --output-format json
|
|
326
|
+
|
|
327
|
+
# Path A reconciliation — when pipeline reports failed but tree is coherent
|
|
328
|
+
substrate reconcile-from-disk --dry-run # report without mutating Dolt
|
|
329
|
+
substrate reconcile-from-disk --yes # mark stories complete without prompting
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
`substrate report` resolves the active run via the canonical chain — explicit `--run-id` → `.substrate/current-run-id` → Dolt fallback — and surfaces story outcomes (verified / recovered / escalated / failed), cost vs ceiling, escalation diagnostics, and any operator halt notifications written to `.substrate/notifications/`. `--verify-ac` runs heuristic word-overlap matching between AC text and test names to expose ACs without test coverage.
|
|
333
|
+
|
|
334
|
+
`substrate reconcile-from-disk` is the Path A primitive. When a pipeline reports failure but `git status` + the project gates show the implementation is on disk and passing (a class of false-failures the cross-story-race auto-recovery in Epic 70 addresses but doesn't fully eliminate), this command detects working-tree changes since the run started, runs the gates, and prompts to mark stories complete in Dolt.
|
|
335
|
+
|
|
293
336
|
### Metrics, Cost, and Diff
|
|
294
337
|
|
|
295
338
|
```bash
|
|
@@ -495,7 +538,10 @@ These commands are typically invoked by your AI assistant during pipeline operat
|
|
|
495
538
|
| `substrate run --from <phase>` | Start from a specific phase |
|
|
496
539
|
| `substrate run --stop-after <phase>` | Stop pipeline after this phase |
|
|
497
540
|
| `substrate run --engine graph` | Use the graph execution engine |
|
|
498
|
-
| `substrate run --halt-on <severity>` |
|
|
541
|
+
| `substrate run --halt-on <severity>` | Decision Router halt policy (`all` / `critical` / `none`) — see [Autonomy Modes](#autonomy-modes) |
|
|
542
|
+
| `substrate run --non-interactive` | Suppress all stdin prompts and apply default actions; required for CI/CD |
|
|
543
|
+
| `substrate run --verify-ac` | On-demand AC-to-Test traceability matrix |
|
|
544
|
+
| `substrate run --cost-ceiling <usd>` | Halt run when cumulative cost crosses this threshold |
|
|
499
545
|
| `substrate run --max-review-cycles <n>` | Cycles per story (default 2; use 3 for migrations / interface extraction) |
|
|
500
546
|
| `substrate run --skip-verification` | Skip post-dispatch verification (use sparingly) |
|
|
501
547
|
| `substrate run --help-agent` | Print agent instruction prompt fragment |
|
|
@@ -534,6 +580,9 @@ These commands are typically invoked by your AI assistant during pipeline operat
|
|
|
534
580
|
|
|
535
581
|
| Command | Description |
|
|
536
582
|
|---|---|
|
|
583
|
+
| `substrate report [--run <id\|latest>]` | Per-run completion report — outcomes, cost, escalation diagnostics, halt notifications |
|
|
584
|
+
| `substrate report --verify-ac` | Append heuristic AC-to-Test traceability matrix to the report |
|
|
585
|
+
| `substrate reconcile-from-disk [--dry-run] [--yes]` | Path A reconciliation — gates green + tree coherent ⇒ mark stories complete in Dolt |
|
|
537
586
|
| `substrate annotate` | Tag verification finding as confirmed-defect / false-positive / probe-bug |
|
|
538
587
|
| `substrate probe-author dispatch` | Manually invoke probe-author phase against a single story file |
|
|
539
588
|
| `substrate contracts` | Show contract declarations and verification status |
|
package/dist/cli/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { createEventBus } from "../helpers-CElYrONe.js";
|
|
|
5
5
|
import { AdapterRegistry$1 as AdapterRegistry, BudgetConfigSchema, CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, ConfigError$1 as ConfigError, CostTrackerConfigSchema, DEFAULT_CONFIG, DoltClient, DoltNotInstalled, GlobalSettingsSchema, InMemoryDatabaseAdapter, IngestionServer, MonitorDatabaseImpl, OPERATIONAL_FINDING, PartialGlobalSettingsSchema, PartialProviderConfigSchema, ProvidersSchema, RoutingRecommender, STORY_METRICS, TelemetryConfigSchema, addTokenUsage, aggregateTokenUsageForRun, checkDoltInstalled, compareRunMetrics, createAmendmentRun, createConfigSystem, createDecision, createDoltClient, createPipelineRun, getActiveDecisions, getAllCostEntriesFiltered, getBaselineRunMetrics, getDecisionsByCategory, getDecisionsByPhaseForRun, getLatestCompletedRun, getLatestRun, getPipelineRunById, getPlanningCostTotal, getRetryableEscalations, getRunMetrics, getRunningPipelineRuns, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initializeDolt, listRunMetrics, loadParentRunDecisions, supersedeDecision, tagRunAsBaseline, updatePipelineRun } from "../dist-K_RRWnBX.js";
|
|
6
6
|
import "../adapter-registry-DXLMTmfD.js";
|
|
7
7
|
import { RunManifest, SupervisorLock, ZERO_FINDINGS_BY_AUTHOR, ZERO_FINDING_COUNTS, ZERO_PROBE_AUTHOR_METRICS, aggregateProbeAuthorMetrics, parseRuntimeProbes, readCurrentRunId, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, rollupFindingsByAuthor, rollupProbeAuthorByClass, rollupProbeAuthorMetrics, runAcTraceabilityCheck } from "../manifest-read-BFN1ujjW.js";
|
|
8
|
-
import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GLOBSTAR, GitClient, GrammarLoader, Minimatch, Minipass, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, escape, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runProbeAuthor, runSolutioningPhase, unescape, validateStopAfterFromConflict } from "../run-
|
|
8
|
+
import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GLOBSTAR, GitClient, GrammarLoader, Minimatch, Minipass, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, escape, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runProbeAuthor, runSolutioningPhase, unescape, validateStopAfterFromConflict } from "../run-UrEvbpcE.js";
|
|
9
9
|
import "../errors-pSiZbn6e.js";
|
|
10
10
|
import "../routing-DFxoKHDt.js";
|
|
11
11
|
import { WorkGraphRepository } from "../work-graph-repository-DZyJv5pV.js";
|
|
@@ -9037,7 +9037,7 @@ async function runSupervisorAction(options, deps = {}) {
|
|
|
9037
9037
|
await initSchema(expAdapter);
|
|
9038
9038
|
const { runRunAction: runPipeline } = await import(
|
|
9039
9039
|
/* @vite-ignore */
|
|
9040
|
-
"../run-
|
|
9040
|
+
"../run-e-pS5Tv5.js"
|
|
9041
9041
|
);
|
|
9042
9042
|
const runStoryFn = async (opts) => {
|
|
9043
9043
|
const exitCode = await runPipeline({
|
|
@@ -38,16 +38,33 @@ Check process health:
|
|
|
38
38
|
substrate health --output-format json
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
+
### Autonomy Modes
|
|
42
|
+
|
|
43
|
+
Three-step gradient. Choose by how much operator attention the run gets:
|
|
44
|
+
|
|
45
|
+
| Mode | Invocation | Halts on |
|
|
46
|
+
|---|---|---|
|
|
47
|
+
| Attended | `substrate run --halt-on all` | Every decision |
|
|
48
|
+
| Supervised (default) | `substrate run` | Critical + fatal (cost-ceiling, build-fail, scope-violation) |
|
|
49
|
+
| Autonomous | `substrate run --halt-on none --non-interactive --events --output-format json` | Only fatal |
|
|
50
|
+
|
|
51
|
+
Exit codes from autonomous runs: 0 = succeeded or auto-recovered, 1 = some escalated (run completed), 2 = run-level failure.
|
|
52
|
+
|
|
53
|
+
The Recovery Engine runs a 3-tier auto-fix ladder before any halt — Tier A retries with extra context, Tier B drafts a re-scope proposal, Tier C halts for an operator prompt. Re-scope proposals collect on the run manifest as `pending_proposals[]`. When a halt is required, an operator notification is written to `.substrate/notifications/<run-id>-<timestamp>.json` and surfaced by `substrate report`.
|
|
54
|
+
|
|
41
55
|
### After Pipeline Completes
|
|
42
56
|
|
|
43
57
|
1. Summarize results: X succeeded, Y failed, Z escalated
|
|
44
|
-
2.
|
|
58
|
+
2. Run the post-run report: `substrate report --run latest` (per-story outcomes + escalation diagnostics + halt notifications). Add `--verify-ac` for AC-to-Test traceability.
|
|
59
|
+
3. If pipeline reported failed but tree looks coherent: `substrate reconcile-from-disk --dry-run` (Path A reconciliation). If gates green, run without `--dry-run` to mark stories complete.
|
|
60
|
+
4. Check historical metrics: `substrate metrics --output-format json`
|
|
45
61
|
|
|
46
62
|
### Handling Escalations
|
|
47
63
|
|
|
48
64
|
- On story escalation: read the flagged files and issues, propose a fix, ask the user before applying
|
|
49
65
|
- On minor fix verdict (NEEDS_MINOR_FIXES): offer to fix automatically
|
|
50
66
|
- On build verification failure: read the build output, diagnose the error, propose a fix
|
|
67
|
+
- On reported failure with coherent working tree: run `substrate reconcile-from-disk --dry-run` first; treat its output as source of truth before re-dispatching
|
|
51
68
|
- Never re-run a failed story without explicit user confirmation
|
|
52
69
|
|
|
53
70
|
### Key Commands
|
|
@@ -55,9 +72,20 @@ substrate health --output-format json
|
|
|
55
72
|
| Command | Purpose |
|
|
56
73
|
|---|---|
|
|
57
74
|
| `substrate run --events` | Run pipeline with NDJSON event stream |
|
|
75
|
+
| `substrate run --halt-on <severity>` | Halt policy: `all` / `critical` (default) / `none` |
|
|
76
|
+
| `substrate run --non-interactive` | Suppress stdin prompts |
|
|
77
|
+
| `substrate report [--run <id\|latest>]` | Per-run completion report |
|
|
78
|
+
| `substrate report --verify-ac` | Append AC-to-Test traceability matrix |
|
|
79
|
+
| `substrate reconcile-from-disk [--dry-run] [--yes]` | Path A reconciliation when tree is coherent |
|
|
58
80
|
| `substrate status --output-format json` | Poll current pipeline state |
|
|
59
81
|
| `substrate health --output-format json` | Check process health |
|
|
60
82
|
| `substrate metrics --output-format json` | View historical run metrics |
|
|
61
83
|
| `substrate resume` | Resume an interrupted pipeline run |
|
|
62
84
|
| `substrate run --help-agent` | Full agent instruction reference |
|
|
85
|
+
|
|
86
|
+
### Operator Files (`.substrate/`)
|
|
87
|
+
|
|
88
|
+
- `.substrate/runs/<run-id>.json` — per-run manifest (one file per run; not an aggregate)
|
|
89
|
+
- `.substrate/current-run-id` — plain text file with the latest run ID
|
|
90
|
+
- `.substrate/notifications/<run-id>-<timestamp>.json` — operator halt notifications (deleted by `substrate report` after read)
|
|
63
91
|
<!-- substrate:end -->
|
|
@@ -48,11 +48,27 @@ substrate supervisor --output-format json
|
|
|
48
48
|
|
|
49
49
|
**Interpreting silence:** No output for 5 minutes = normal (agent is working). No output for 15+ minutes = likely stalled. Use `substrate health` to confirm, then consider killing and resuming.
|
|
50
50
|
|
|
51
|
+
### Autonomy Modes
|
|
52
|
+
|
|
53
|
+
Substrate has a three-step autonomy gradient. Choose mode by how much operator attention the run gets:
|
|
54
|
+
|
|
55
|
+
| Mode | Invocation | Halts on |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| Attended | `substrate run --halt-on all` | Every decision (info, warning, critical, fatal) |
|
|
58
|
+
| Supervised *(default)* | `substrate run` | Critical + fatal (cost-ceiling, build-fail, scope-violation) |
|
|
59
|
+
| Autonomous | `substrate run --halt-on none --non-interactive --events --output-format json` | Only fatal — scope violations always halt regardless |
|
|
60
|
+
|
|
61
|
+
Exit codes from autonomous runs: `0` = all stories succeeded or auto-recovered; `1` = some escalated (run completed); `2` = run-level failure (cost ceiling, fatal halt, orchestrator died).
|
|
62
|
+
|
|
63
|
+
The Recovery Engine runs a 3-tier auto-fix ladder before any halt — Tier A retries with extra context (build-fail, missing test coverage, AC missing evidence), Tier B drafts a re-scope proposal, Tier C halts for an operator prompt. Re-scope proposals collect on the run manifest as `pending_proposals[]` for next-morning review; back-pressure pauses dispatching at `>= 2` (work-graph-aware) or `>= 5` (safety valve). When a halt is required, an operator notification is written to `.substrate/notifications/<run-id>-<timestamp>.json` and surfaced by `substrate report`.
|
|
64
|
+
|
|
51
65
|
### After Pipeline Completes
|
|
52
66
|
|
|
53
67
|
1. **Summarize results** conversationally: X succeeded, Y failed, Z escalated
|
|
54
|
-
2. **
|
|
55
|
-
3. **
|
|
68
|
+
2. **Run the post-run report**: `substrate report --run latest` (per-story outcomes + escalation diagnostics + halt notifications). Add `--verify-ac` for AC-to-Test traceability.
|
|
69
|
+
3. **If pipeline reported failed but tree looks coherent**: `substrate reconcile-from-disk --dry-run` — Path A reconciliation. If gates green and the working tree shows the implementation is on disk, run without `--dry-run` (or with `--yes`) to mark stories complete in Dolt.
|
|
70
|
+
4. **Check historical metrics**: `substrate metrics --output-format json`
|
|
71
|
+
5. **Read analysis** (if supervisor was attached): `substrate metrics --analysis <run_id> --output-format json`
|
|
56
72
|
|
|
57
73
|
### Handling Escalations and Failures
|
|
58
74
|
|
|
@@ -60,6 +76,7 @@ substrate supervisor --output-format json
|
|
|
60
76
|
- **On minor fix verdict** (`NEEDS_MINOR_FIXES`): offer to fix automatically
|
|
61
77
|
- **On build verification failure**: read the build output, diagnose the compiler error, propose a fix
|
|
62
78
|
- **On contract mismatch** (`pipeline:contract-mismatch`): cross-story interface conflict — read both stories' files, reconcile types manually
|
|
79
|
+
- **On reported failure with coherent working tree**: run `substrate reconcile-from-disk --dry-run` first; treat the dry-run output as the source of truth before re-dispatching the story
|
|
63
80
|
- **Never re-run a failed story** without explicit user confirmation
|
|
64
81
|
|
|
65
82
|
### Key Commands Reference
|
|
@@ -67,15 +84,27 @@ substrate supervisor --output-format json
|
|
|
67
84
|
| Command | Purpose |
|
|
68
85
|
|---|---|
|
|
69
86
|
| `substrate run --events` | Run pipeline with NDJSON event stream |
|
|
87
|
+
| `substrate run --halt-on <severity>` | Decision Router halt policy: `all` / `critical` (default) / `none` |
|
|
88
|
+
| `substrate run --non-interactive` | Suppress stdin prompts; combine with `--halt-on none` for fully autonomous |
|
|
89
|
+
| `substrate run --verify-ac` | On-demand AC-to-Test traceability matrix |
|
|
90
|
+
| `substrate report [--run <id\|latest>]` | Per-run completion report — outcomes, cost, escalation diagnostics, halt notifications |
|
|
91
|
+
| `substrate report --verify-ac` | Append AC-to-Test traceability matrix to the report |
|
|
92
|
+
| `substrate reconcile-from-disk [--dry-run] [--yes]` | Path A reconciliation when pipeline reports failed but tree is coherent |
|
|
70
93
|
| `substrate supervisor --output-format json` | Monitor active run with auto-recovery and post-run analysis |
|
|
71
94
|
| `substrate status --output-format json` | Poll current pipeline state |
|
|
72
95
|
| `substrate health --output-format json` | Check process health and stall detection |
|
|
73
96
|
| `substrate metrics --output-format json` | View historical run metrics |
|
|
74
97
|
| `substrate resume` | Resume an interrupted pipeline run |
|
|
75
|
-
| `substrate run --help-agent` | Full agent instruction reference
|
|
98
|
+
| `substrate run --help-agent` | Full agent instruction reference |
|
|
76
99
|
| `substrate diff <story>` | Show row-level state changes for a story (requires Dolt) |
|
|
77
100
|
| `substrate history` | View Dolt commit log for pipeline state changes (requires Dolt) |
|
|
78
101
|
|
|
102
|
+
### Operator Files (`.substrate/`)
|
|
103
|
+
|
|
104
|
+
- `.substrate/runs/<run-id>.json` — per-run manifest (one file per run; NOT an aggregate `manifest.json` — that file does not exist)
|
|
105
|
+
- `.substrate/current-run-id` — plain text file with the latest run ID; consulted by canonical run-discovery
|
|
106
|
+
- `.substrate/notifications/<run-id>-<timestamp>.json` — operator halt notifications written by the Recovery Engine; deleted by `substrate report` after read
|
|
107
|
+
|
|
79
108
|
### State Backend
|
|
80
109
|
|
|
81
110
|
Substrate uses Dolt for versioned pipeline state by default. Run `substrate init` to set it up automatically if Dolt is on PATH. Features that require Dolt: `substrate diff`, `substrate history`, OTEL observability persistence, and context engineering repo-map storage.
|
|
@@ -38,16 +38,33 @@ Check process health:
|
|
|
38
38
|
substrate health --output-format json
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
+
### Autonomy Modes
|
|
42
|
+
|
|
43
|
+
Three-step gradient. Choose by how much operator attention the run gets:
|
|
44
|
+
|
|
45
|
+
| Mode | Invocation | Halts on |
|
|
46
|
+
|---|---|---|
|
|
47
|
+
| Attended | `substrate run --halt-on all` | Every decision |
|
|
48
|
+
| Supervised (default) | `substrate run` | Critical + fatal (cost-ceiling, build-fail, scope-violation) |
|
|
49
|
+
| Autonomous | `substrate run --halt-on none --non-interactive --events --output-format json` | Only fatal |
|
|
50
|
+
|
|
51
|
+
Exit codes from autonomous runs: 0 = succeeded or auto-recovered, 1 = some escalated (run completed), 2 = run-level failure.
|
|
52
|
+
|
|
53
|
+
The Recovery Engine runs a 3-tier auto-fix ladder before any halt — Tier A retries with extra context, Tier B drafts a re-scope proposal, Tier C halts for an operator prompt. Re-scope proposals collect on the run manifest as `pending_proposals[]`. When a halt is required, an operator notification is written to `.substrate/notifications/<run-id>-<timestamp>.json` and surfaced by `substrate report`.
|
|
54
|
+
|
|
41
55
|
### After Pipeline Completes
|
|
42
56
|
|
|
43
57
|
1. Summarize results: X succeeded, Y failed, Z escalated
|
|
44
|
-
2.
|
|
58
|
+
2. Run the post-run report: `substrate report --run latest` (per-story outcomes + escalation diagnostics + halt notifications). Add `--verify-ac` for AC-to-Test traceability.
|
|
59
|
+
3. If pipeline reported failed but tree looks coherent: `substrate reconcile-from-disk --dry-run` (Path A reconciliation). If gates green, run without `--dry-run` to mark stories complete.
|
|
60
|
+
4. Check historical metrics: `substrate metrics --output-format json`
|
|
45
61
|
|
|
46
62
|
### Handling Escalations
|
|
47
63
|
|
|
48
64
|
- On story escalation: read the flagged files and issues, propose a fix, ask the user before applying
|
|
49
65
|
- On minor fix verdict (NEEDS_MINOR_FIXES): offer to fix automatically
|
|
50
66
|
- On build verification failure: read the build output, diagnose the error, propose a fix
|
|
67
|
+
- On reported failure with coherent working tree: run `substrate reconcile-from-disk --dry-run` first; treat its output as source of truth before re-dispatching
|
|
51
68
|
- Never re-run a failed story without explicit user confirmation
|
|
52
69
|
|
|
53
70
|
### Key Commands
|
|
@@ -55,9 +72,20 @@ substrate health --output-format json
|
|
|
55
72
|
| Command | Purpose |
|
|
56
73
|
|---|---|
|
|
57
74
|
| `substrate run --events` | Run pipeline with NDJSON event stream |
|
|
75
|
+
| `substrate run --halt-on <severity>` | Halt policy: `all` / `critical` (default) / `none` |
|
|
76
|
+
| `substrate run --non-interactive` | Suppress stdin prompts |
|
|
77
|
+
| `substrate report [--run <id\|latest>]` | Per-run completion report |
|
|
78
|
+
| `substrate report --verify-ac` | Append AC-to-Test traceability matrix |
|
|
79
|
+
| `substrate reconcile-from-disk [--dry-run] [--yes]` | Path A reconciliation when tree is coherent |
|
|
58
80
|
| `substrate status --output-format json` | Poll current pipeline state |
|
|
59
81
|
| `substrate health --output-format json` | Check process health |
|
|
60
82
|
| `substrate metrics --output-format json` | View historical run metrics |
|
|
61
83
|
| `substrate resume` | Resume an interrupted pipeline run |
|
|
62
84
|
| `substrate run --help-agent` | Full agent instruction reference |
|
|
85
|
+
|
|
86
|
+
### Operator Files (`.substrate/`)
|
|
87
|
+
|
|
88
|
+
- `.substrate/runs/<run-id>.json` — per-run manifest (one file per run; not an aggregate)
|
|
89
|
+
- `.substrate/current-run-id` — plain text file with the latest run ID
|
|
90
|
+
- `.substrate/notifications/<run-id>-<timestamp>.json` — operator halt notifications (deleted by `substrate report` after read)
|
|
63
91
|
<!-- substrate:end -->
|
|
@@ -1831,6 +1831,7 @@ async function resolvePackageVersion(startDir) {
|
|
|
1831
1831
|
const __dirname = dirname(__filename);
|
|
1832
1832
|
const base = startDir ?? __dirname;
|
|
1833
1833
|
const paths = [
|
|
1834
|
+
join(base, "../package.json"),
|
|
1834
1835
|
join(base, "../../package.json"),
|
|
1835
1836
|
join(base, "../../../package.json"),
|
|
1836
1837
|
join(base, "../../../../package.json")
|
|
@@ -1887,6 +1888,12 @@ Options:
|
|
|
1887
1888
|
- \`--from <phase>\` — Start from this phase: research, analysis, planning, solutioning, implementation
|
|
1888
1889
|
- \`--stop-after <phase>\` — Stop pipeline after this phase completes
|
|
1889
1890
|
- \`--concurrency <n>\` — Maximum parallel conflict groups (default: 3)
|
|
1891
|
+
- \`--engine <linear|graph>\` — Pipeline execution engine (default: linear)
|
|
1892
|
+
- \`--max-review-cycles <n>\` — Per-story review cycles (default: 2; use 3 for migrations / interface extraction)
|
|
1893
|
+
- \`--cost-ceiling <usd>\` — Halt the pipeline when cumulative cost crosses this threshold
|
|
1894
|
+
- \`--halt-on <severity>\` — Decision Router halt policy: \`all\` halts on every decision, \`critical\` (default) halts only on cost-ceiling / build-fail / scope-violation, \`none\` halts only on fatal
|
|
1895
|
+
- \`--non-interactive\` — Suppress all stdin prompts and apply default actions; required for CI/CD. Combine with \`--halt-on none\` for fully autonomous overnight runs
|
|
1896
|
+
- \`--verify-ac\` — On-demand AC-to-Test traceability matrix (heuristic word-overlap matching between AC text and test names)
|
|
1890
1897
|
- \`--output-format <format>\` — Output format: human (default) or json
|
|
1891
1898
|
- \`--concept <text>\` — Inline concept text (required when --from analysis)
|
|
1892
1899
|
- \`--research\` — Enable the research phase even if not set in the pack config
|
|
@@ -1904,8 +1911,28 @@ substrate run --events --stories 7-1,7-2
|
|
|
1904
1911
|
|
|
1905
1912
|
# Run pipeline with human-readable output (default)
|
|
1906
1913
|
substrate run
|
|
1914
|
+
|
|
1915
|
+
# Fully autonomous (CI/CD canonical pattern):
|
|
1916
|
+
substrate run --halt-on none --non-interactive --events --output-format json
|
|
1907
1917
|
\`\`\`
|
|
1908
1918
|
|
|
1919
|
+
#### Autonomy Modes
|
|
1920
|
+
|
|
1921
|
+
Pick the operator-attention level for the run:
|
|
1922
|
+
|
|
1923
|
+
| Mode | Invocation | Halts on |
|
|
1924
|
+
|---|---|---|
|
|
1925
|
+
| Attended | \`substrate run --halt-on all\` | Every decision (info, warning, critical, fatal) |
|
|
1926
|
+
| Supervised (default) | \`substrate run\` | Critical + fatal (cost-ceiling, build-fail, scope-violation) |
|
|
1927
|
+
| Autonomous | \`substrate run --halt-on none --non-interactive --events --output-format json\` | Only fatal — scope violations always halt regardless |
|
|
1928
|
+
|
|
1929
|
+
Exit codes from autonomous runs:
|
|
1930
|
+
- \`0\` — all stories succeeded or were auto-recovered.
|
|
1931
|
+
- \`1\` — some stories escalated; the run completed.
|
|
1932
|
+
- \`2\` — run-level failure (cost ceiling, fatal halt, orchestrator died).
|
|
1933
|
+
|
|
1934
|
+
After every autonomous run, review the result with \`substrate report --run latest\`.
|
|
1935
|
+
|
|
1909
1936
|
### substrate status
|
|
1910
1937
|
Show status of the most recent pipeline run.
|
|
1911
1938
|
|
|
@@ -2000,6 +2027,44 @@ substrate brainstorm [options]
|
|
|
2000
2027
|
|
|
2001
2028
|
Session commands: \`!wrap\` (save & exit), \`!quit\` (exit without saving), \`!help\`
|
|
2002
2029
|
|
|
2030
|
+
### substrate report
|
|
2031
|
+
Structured per-run completion report — story outcomes, cost vs ceiling, escalation diagnostics, and operator halt notifications. Resolves the active run via the canonical chain (explicit \`--run-id\` → \`.substrate/current-run-id\` → Dolt fallback).
|
|
2032
|
+
|
|
2033
|
+
\`\`\`
|
|
2034
|
+
substrate report [--run <id|latest>] [--output-format human|json] [--verify-ac]
|
|
2035
|
+
\`\`\`
|
|
2036
|
+
|
|
2037
|
+
Options:
|
|
2038
|
+
- \`--run <id|latest>\` — Run ID, or \`latest\` (default) to resolve via the canonical chain
|
|
2039
|
+
- \`--output-format <format>\` — Output format: human (default) or json
|
|
2040
|
+
- \`--verify-ac\` — Append an AC-to-Test traceability matrix (heuristic word-overlap matching between AC text and test names)
|
|
2041
|
+
|
|
2042
|
+
When \`substrate run\` is invoked with \`--halt-on\`, the Recovery Engine writes operator halt notifications to \`.substrate/notifications/<run-id>-<timestamp>.json\`. \`substrate report\` reads and clears those files, surfacing each one in its output.
|
|
2043
|
+
|
|
2044
|
+
### substrate reconcile-from-disk
|
|
2045
|
+
Path A reconciliation primitive — when the pipeline reports failure but the working tree is coherent (gates green, files durable), this command detects working-tree changes since the run started, runs the project's gates, and prompts to mark stories complete in Dolt.
|
|
2046
|
+
|
|
2047
|
+
\`\`\`
|
|
2048
|
+
substrate reconcile-from-disk [--run-id <id>] [--dry-run] [--yes] [--output-format json]
|
|
2049
|
+
\`\`\`
|
|
2050
|
+
|
|
2051
|
+
Options:
|
|
2052
|
+
- \`--run-id <id>\` — Run ID to reconcile (defaults to latest)
|
|
2053
|
+
- \`--dry-run\` — Report what would change without mutating Dolt
|
|
2054
|
+
- \`--yes\` — Skip the confirmation prompt (e.g., for non-interactive use after \`--dry-run\` review)
|
|
2055
|
+
- \`--output-format <format>\` — Output format: human (default) or json
|
|
2056
|
+
|
|
2057
|
+
Use this when \`substrate report\` shows stories \`failed\` but \`git status\` + the project gates indicate the implementation is on disk and passing. The pipeline's failure verdict can be misleading after auto-recovery races; reconcile-from-disk codifies the manual fix.
|
|
2058
|
+
|
|
2059
|
+
## Operator Files (\`.substrate/\`)
|
|
2060
|
+
|
|
2061
|
+
These on-disk files back the new autonomy commands. External monitors (dashboards, Slack bots) can also tail them.
|
|
2062
|
+
|
|
2063
|
+
- \`.substrate/runs/<run-id>.json\` — per-run manifest (one file per run; NOT an aggregate \`manifest.json\`). Production format: do not invent an aggregate file — it does not exist.
|
|
2064
|
+
- \`.substrate/current-run-id\` — plain text file containing the latest run ID; consulted by the canonical run-discovery chain.
|
|
2065
|
+
- \`.substrate/notifications/<run-id>-<timestamp>.json\` — operator halt notifications written by the Recovery Engine when \`--halt-on\` triggers; deleted by \`substrate report\` after read.
|
|
2066
|
+
- \`pending_proposals[]\` field in the run manifest — Recovery Engine Tier B re-scope proposals collected here for next-morning operator review. Back-pressure pauses dispatching at \`>= 2\` proposals (work-graph-aware) or \`>= 5\` (safety valve).
|
|
2067
|
+
|
|
2003
2068
|
## Environment Variables
|
|
2004
2069
|
|
|
2005
2070
|
- \`SUBSTRATE_MEMORY_THRESHOLD_MB\` — Override the free-memory threshold (in MB) for agent dispatch. Default: 512. On macOS, the conservative memory detection may report low availability even when ample RAM exists. Lower this (e.g., 256) if pipelines stall due to memory pressure false positives.
|
|
@@ -46042,4 +46107,4 @@ function registerRunCommand(program, _version = "0.0.0", projectRoot = process.c
|
|
|
46042
46107
|
|
|
46043
46108
|
//#endregion
|
|
46044
46109
|
export { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GLOBSTAR$1 as GLOBSTAR, GitClient, GrammarLoader, Minimatch$1 as Minimatch, Minipass, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, escape$1 as escape, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, normalizeGraphSummaryToStatus, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runProbeAuthor, runRunAction, runSolutioningPhase, unescape$1 as unescape, validateStopAfterFromConflict, wireNdjsonEmitter };
|
|
46045
|
-
//# sourceMappingURL=run-
|
|
46110
|
+
//# sourceMappingURL=run-UrEvbpcE.js.map
|
|
@@ -3,7 +3,7 @@ import "./logger-KeHncl-f.js";
|
|
|
3
3
|
import "./helpers-CElYrONe.js";
|
|
4
4
|
import "./dist-K_RRWnBX.js";
|
|
5
5
|
import "./manifest-read-BFN1ujjW.js";
|
|
6
|
-
import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-
|
|
6
|
+
import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-UrEvbpcE.js";
|
|
7
7
|
import "./routing-DFxoKHDt.js";
|
|
8
8
|
import "./work-graph-repository-DZyJv5pV.js";
|
|
9
9
|
import "./decisions-CzSIEeGP.js";
|