loki-mode 11.3.0 → 11.3.1
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 +68 -650
- package/SKILL.md +4 -4
- package/VERSION +1 -1
- package/autonomy/completion-council.sh +2 -2
- package/autonomy/context-tracker.py +4 -4
- package/autonomy/council-v2.sh +1 -1
- package/autonomy/grill.sh +1 -1
- package/autonomy/lib/done-recognition.sh +1 -1
- package/autonomy/lib/prd-enrich.sh +1 -1
- package/autonomy/lib/voter-agents.sh +1 -1
- package/autonomy/loki +99 -75
- package/autonomy/run.sh +30 -18
- package/autonomy/sandbox.sh +1 -1
- package/autonomy/tui.sh +6 -5
- package/autonomy/verify.sh +1 -1
- package/bin/loki +166 -59
- package/completions/_loki +2 -0
- package/completions/loki.bash +2 -2
- package/dashboard/__init__.py +1 -1
- package/dashboard/server.py +25 -31
- package/docs/ARCHITECTURE.md +337 -0
- package/docs/BRANDING.md +124 -0
- package/docs/CLI-REFERENCE.md +7 -1
- package/docs/COMPONENTS.md +447 -0
- package/docs/DEPLOYMENT.md +9 -9
- package/docs/DOCKER.md +469 -0
- package/docs/INSTALLATION.md +67 -1045
- package/docs/KNOWN-ISSUES.md +11 -35
- package/docs/TESTING.md +161 -0
- package/docs/air-gapped.md +1 -2
- package/docs/alternative-installations.md +14 -24
- package/docs/architecture/DECISIONS.md +333 -0
- package/docs/audit-logging.md +7 -7
- package/docs/authentication.md +3 -3
- package/docs/authorization.md +1 -1
- package/docs/certification/04-production-deployment/lab.md +6 -6
- package/docs/certification/04-production-deployment/lesson.md +4 -4
- package/docs/certification/README.md +1 -1
- package/docs/control-plane-container.md +2 -2
- package/docs/dev/real-run.md +34 -0
- package/docs/dev/release-checklist.md +2 -2
- package/docs/exit-codes.md +3 -3
- package/docs/git-workflow.md +3 -3
- package/docs/metrics.md +37 -55
- package/docs/network-security.md +1 -1
- package/docs/siem-integration.md +5 -5
- package/docs/v10/CLI-MODERN.md +4 -3
- package/docs/v10/DECISIONS.md +44 -0
- package/docs/v10/DEPS.md +22 -22
- package/docs/v10/ENGINE.md +1 -1
- package/docs/v10/FAILURE-CLASSES.md +118 -1
- package/docs/v10/FOUNDER-QUEUE.md +1 -0
- package/docs/v10/GUARDS.md +13 -0
- package/docs/v10/LEGACY-REMOVAL.md +4 -6
- package/docs/v10/METRICS.md +2 -2
- package/docs/v10/MODERNIZE.md +1 -1
- package/docs/v10/OPERATING-MODEL.md +2 -1
- package/docs/v10/PROGRESS.md +29 -0
- package/docs/v11/COST-HALF.md +352 -0
- package/docs/v11/MARKET-SLICES.md +315 -0
- package/docs/v11/REGISTRIES.md +730 -0
- package/loki-ts/data/model-pricing.json +52 -24
- package/loki-ts/dist/loki.js +1036 -957
- package/mcp/__init__.py +1 -1
- package/package.json +1 -1
- package/packages/control-plane/dist/server.js +2467 -736
- package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
- package/src/protocols/mcp-client.js +6 -2
- package/src/protocols/mcp-server.js +13 -3
- package/tools/audit-docs.py +1 -1
- package/web-app/dist/assets/{AdminPage-D_e45uTw.js → AdminPage-CMkHNJbF.js} +1 -1
- package/web-app/dist/assets/{Avatar-T3nIpoaf.js → Avatar-BJyjV7Zi.js} +1 -1
- package/web-app/dist/assets/{Badge-BKqb59pP.js → Badge-D572l0uq.js} +1 -1
- package/web-app/dist/assets/{Button-DjVlkh8_.js → Button-T4BnOZgl.js} +1 -1
- package/web-app/dist/assets/{CockpitPage-DXJgLGmh.js → CockpitPage-Cj_GFsNn.js} +1 -1
- package/web-app/dist/assets/{ComparePage-BRP_eVc_.js → ComparePage-A8m4ZXak.js} +1 -1
- package/web-app/dist/assets/{ErrorBoundary-CLjpGLjC.js → ErrorBoundary-hugCg5yg.js} +1 -1
- package/web-app/dist/assets/{EvidenceReceiptPanel-DX-vb4Xy.js → EvidenceReceiptPanel-CuJKDC2G.js} +1 -1
- package/web-app/dist/assets/{GitHubIssuesPanel-214HVHtX.js → GitHubIssuesPanel-BYGKjarC.js} +1 -1
- package/web-app/dist/assets/{GitHubPRsPanel-BEiZKc4t.js → GitHubPRsPanel-c7sFIJlf.js} +1 -1
- package/web-app/dist/assets/{HomePage-VvMHS5ga.js → HomePage-A1MIkG2P.js} +2 -2
- package/web-app/dist/assets/{LoginPage-5WD-v7n3.js → LoginPage-8KQMRhtR.js} +1 -1
- package/web-app/dist/assets/{MagicPage-DUQT_Jye.js → MagicPage-C05QW2Lx.js} +1 -1
- package/web-app/dist/assets/{MetricsPage-lga-z79v.js → MetricsPage-Oukv5hme.js} +1 -1
- package/web-app/dist/assets/{NotFoundPage-CGhBX3G1.js → NotFoundPage-DKIwsawz.js} +1 -1
- package/web-app/dist/assets/{ProjectPage-CdzF2GzZ.js → ProjectPage-DwFRPLCG.js} +3 -3
- package/web-app/dist/assets/{ProjectsPage-DRG64N8s.js → ProjectsPage-CgY4YYDX.js} +1 -1
- package/web-app/dist/assets/{SettingsPage-5fzW9Frb.js → SettingsPage-BpfcSjUA.js} +1 -1
- package/web-app/dist/assets/{ShowcasePage-DrTdxO4y.js → ShowcasePage-BqBakC4K.js} +1 -1
- package/web-app/dist/assets/{SystemSettingsPage-C9Mqs6Rd.js → SystemSettingsPage-CZLu5VB0.js} +1 -1
- package/web-app/dist/assets/{TeamsPage-CUGPdSWo.js → TeamsPage-D55S1jKz.js} +1 -1
- package/web-app/dist/assets/{TemplatesPage-CNraDY0F.js → TemplatesPage-D3SydvxN.js} +1 -1
- package/web-app/dist/assets/{TerminalOutput-BIu_6Pea.js → TerminalOutput-hNg8G1-e.js} +1 -1
- package/web-app/dist/assets/{activity-Bk-kgqaf.js → activity-D2C0VagO.js} +1 -1
- package/web-app/dist/assets/{bell-BXmUdmo8.js → bell-CMvYi36w.js} +1 -1
- package/web-app/dist/assets/{bot-CiuzXxUR.js → bot-BvtQ6lmo.js} +1 -1
- package/web-app/dist/assets/{check-BEzjXppd.js → check-B13xkXed.js} +1 -1
- package/web-app/dist/assets/{chevron-left-AYWCXHf8.js → chevron-left-emu6r49E.js} +1 -1
- package/web-app/dist/assets/{circle-alert-BNg2uSRq.js → circle-alert-CExlwjuy.js} +1 -1
- package/web-app/dist/assets/{clock-DTj0kkGT.js → clock-D7Uas3oL.js} +1 -1
- package/web-app/dist/assets/{cloud-x4nTDBLT.js → cloud-CkB4S86C.js} +1 -1
- package/web-app/dist/assets/{code-xml-BVh_MLrk.js → code-xml-SL9IIWIn.js} +1 -1
- package/web-app/dist/assets/{database-DdfBaowG.js → database-BQFkd7t1.js} +1 -1
- package/web-app/dist/assets/{dollar-sign-XuYFmAOY.js → dollar-sign-qHmnNYsU.js} +1 -1
- package/web-app/dist/assets/{file-code-corner-D4cRnmeL.js → file-code-corner-C2YUDP0K.js} +1 -1
- package/web-app/dist/assets/{file-plus-CyoVlHc_.js → file-plus-C_ooIkDe.js} +1 -1
- package/web-app/dist/assets/{globe-Y6IK2RPW.js → globe-CQ-GL485.js} +1 -1
- package/web-app/dist/assets/{hammer-BKzr9VZI.js → hammer-U05L_D7V.js} +1 -1
- package/web-app/dist/assets/{index-B20cSx5G.js → index-CooHd7I-.js} +3 -3
- package/web-app/dist/assets/{layers-DebNOhGS.js → layers-Buo17rjW.js} +1 -1
- package/web-app/dist/assets/{loader-circle-DyGbrEgd.js → loader-circle-15vK3oV1.js} +1 -1
- package/web-app/dist/assets/{lock-BKPpyt20.js → lock-BeXLebuJ.js} +1 -1
- package/web-app/dist/assets/{package-egF5Wi4y.js → package-MVh_6-6R.js} +1 -1
- package/web-app/dist/assets/{plus-OiEgKIc-.js → plus-Dh_nd9vS.js} +1 -1
- package/web-app/dist/assets/{refresh-cw-CzKvrONq.js → refresh-cw-C9cBJEAT.js} +1 -1
- package/web-app/dist/assets/{rotate-ccw-Bu2mII0p.js → rotate-ccw-D3PAtzST.js} +1 -1
- package/web-app/dist/assets/{scroll-text-CSkiyax8.js → scroll-text-DZCoXQjo.js} +1 -1
- package/web-app/dist/assets/{server-DlPthJFw.js → server-OCOLI5J_.js} +1 -1
- package/web-app/dist/assets/{shield-alert-CbpHWQQX.js → shield-alert-oVhmf1_h.js} +1 -1
- package/web-app/dist/assets/{thumbs-up-DgGpZe-Q.js → thumbs-up-B-kbX4vN.js} +1 -1
- package/web-app/dist/assets/{trash-2-BV3GlCB-.js → trash-2-EL6moveW.js} +1 -1
- package/web-app/dist/assets/{trending-down-Y4TJtXhD.js → trending-down-Cl3kjpsx.js} +1 -1
- package/web-app/dist/assets/{trending-up-DsDNoHZY.js → trending-up-DST7I6M2.js} +1 -1
- package/web-app/dist/assets/{upload-gkThrc_I.js → upload-CUOT780G.js} +1 -1
- package/web-app/dist/assets/{usePolling-jpNSeNAe.js → usePolling-Djmt90eb.js} +1 -1
- package/web-app/dist/assets/{user-3Zez1WOK.js → user-BRBohA6J.js} +1 -1
- package/web-app/dist/index.html +1 -1
- package/docs/ARCHITECTURE-OVERVIEW.md +0 -209
- package/docs/AUTONOMI-ECOSYSTEM.md +0 -107
- package/docs/COCKPIT-SPEC.md +0 -72
- package/docs/COCKPIT-UX-MANDATE.md +0 -53
- package/docs/COMPETITIVE-ANALYSIS.md +0 -303
- package/docs/COMPETITIVE-NEXT-10.md +0 -316
- package/docs/COMPETITIVE-RALPH-ZEROSHOT-2026-07-08.md +0 -81
- package/docs/DASHBOARD-9.12-EVIDENCE.md +0 -97
- package/docs/DASHBOARD-ARCHITECTURE.md +0 -425
- package/docs/DASHBOARD_V2_CHECKLIST.md +0 -243
- package/docs/DEMOS.md +0 -63
- package/docs/ENTERPRISE-IDENTITY-ROADMAP.md +0 -206
- package/docs/EVIDENCE-RECEIPT-BUILD-APPLICABILITY.md +0 -79
- package/docs/FEAT-PRDREUSE-DOCKER-PLAN.md +0 -144
- package/docs/GATE-FAILURE-TRIAGE.md +0 -254
- package/docs/HANDOFF-2026-08-03.md +0 -439
- package/docs/LOOP-CANDIDATE-PROPOSAL-v1.md +0 -167
- package/docs/LOOP-HARNESS-AUDIT.md +0 -684
- package/docs/MERGE-DEDUP-MAP.md +0 -420
- package/docs/MERGE-ROUTE-MAP.md +0 -139
- package/docs/MODEL-REGISTRY-PLAN.md +0 -155
- package/docs/OUTCOME-FRONTIER.md +0 -536
- package/docs/P2-SPEC-ROBUSTNESS-PLAN.md +0 -192
- package/docs/PLANS-INDEX.md +0 -32
- package/docs/PRD-REUSE-DONE-RECOGNITION-PLAN.md +0 -536
- package/docs/PROMPT-ABLATION-RESULT.md +0 -97
- package/docs/R4-TRUST-TRAJECTORY-DESIGN.md +0 -127
- package/docs/R5-AUTO-WIKI-DESIGN.md +0 -137
- package/docs/R6-ROLLBACK-CHECKPOINT-PLAN.md +0 -107
- package/docs/R7-ZERO-CONFIG-FIRST-RUN-PLAN.md +0 -137
- package/docs/R8-SHAREABLE-TEAM-ASSETS-PLAN.md +0 -129
- package/docs/R9-OPEN-CORE-HOOKS-PLAN.md +0 -113
- package/docs/RARV-C-100X-PLAN.md +0 -286
- package/docs/RARV-C-LOOP-EFFICIENCY-PLAN.md +0 -470
- package/docs/SHAREABLE-PROOF-PLAN.md +0 -194
- package/docs/SONNET5-DEFAULT-PLAN.md +0 -157
- package/docs/SPEED-AND-FIRST-PASS-PLAN.md +0 -281
- package/docs/STALE-STATE-AUDIT.md +0 -174
- package/docs/SYNERGY-TASKS.md +0 -143
- package/docs/TASKLIST-ACCURACY-PLAN.md +0 -355
- package/docs/TOP-100-BACKLOG.md +0 -159
- package/docs/V8-ACCEPTANCE-TRIAGE-2026-07-24.md +0 -114
- package/docs/V8-COMPLEXITY-AUDIT-2026-07-24.md +0 -45
- package/docs/V8-MAJOR-RELEASE-PLAN.md +0 -137
- package/docs/V8-OVERNIGHT-PLAN-2026-07-25.md +0 -82
- package/docs/V8-SDK-RESEARCH-RAW.md +0 -129
- package/docs/WELCOME-OPENER-PLAN.md +0 -106
- package/docs/adoption-baseline-2026-07-31.md +0 -84
- package/docs/architecture/bmad-integration-epic.md +0 -271
- package/docs/architecture/bmad-integration-review.md +0 -86
- package/docs/architecture/bmad-integration-validation.md +0 -249
- package/docs/architecture/bmad-loki-voice-agent-council-analysis.md +0 -61
- package/docs/auto-claude-comparison.md +0 -250
- package/docs/bug-fixes/agent-01-cli-fixes.md +0 -101
- package/docs/bug-fixes/agent-02-purplelab-fixes.md +0 -88
- package/docs/bug-fixes/agent-03-dashboard-fixes.md +0 -119
- package/docs/bug-fixes/agent-04-memory-fixes.md +0 -105
- package/docs/bug-fixes/agent-05-provider-fixes.md +0 -86
- package/docs/bug-fixes/agent-06-integration-fixes.md +0 -101
- package/docs/bug-fixes/agent-07-dash-run-fixes.md +0 -101
- package/docs/bug-fixes/agent-08-docker-fixes.md +0 -164
- package/docs/bug-fixes/agent-09-e2e-build-fixes.md +0 -69
- package/docs/bug-fixes/agent-10-e2e-fullstack-fixes.md +0 -102
- package/docs/bug-fixes/agent-11-e2e-session-fixes.md +0 -70
- package/docs/bug-fixes/agent-12-scenario-fixes.md +0 -120
- package/docs/bug-fixes/agent-13-enterprise-fixes.md +0 -143
- package/docs/bug-fixes/agent-14-uat-newuser-fixes.md +0 -88
- package/docs/bug-fixes/agent-15-uat-poweruser-fixes.md +0 -132
- package/docs/bug-fixes/agent-19-code-review.md +0 -316
- package/docs/bug-fixes/agent-20-architecture-review.md +0 -331
- package/docs/competitive/bolt-new-analysis.md +0 -579
- package/docs/competitive/emergence-others-analysis.md +0 -605
- package/docs/competitive/replit-lovable-analysis.md +0 -622
- package/docs/dashboard-guide.md +0 -487
- package/docs/enterprise/migration.md +0 -265
- package/docs/history/one-run-audit.md +0 -304
- package/docs/plans/FORGE-AUTONOMOUS-QUEUE.md +0 -312
- package/docs/plans/ULTRAPLAN-FORGE-BAAS.md +0 -612
- package/docs/plans/UT2-6-LSP-DIAGNOSTIC-BROADCAST.md +0 -394
- package/docs/prd-purple-lab-ide.md +0 -152
- package/docs/prd-purple-lab-platform-v2.md +0 -223
- package/docs/prd-purple-lab-platform.md +0 -319
- package/docs/retrospectives/v7.5.15-fleet-postmortem.md +0 -325
- package/docs/retrospectives/v7.5.15-honesty-audit.md +0 -136
- package/docs/retrospectives/v7.5.15-llm-failure-modes.md +0 -49
- package/docs/show-hn-post.md +0 -46
- package/docs/test-scenarios/enterprise-scenarios.md +0 -732
- package/docs/thick2thin.md +0 -173
|
@@ -0,0 +1,730 @@
|
|
|
1
|
+
# D91 item 3: hotspot registries
|
|
2
|
+
|
|
3
|
+
Status: design (Architect). Not implemented. Not committed.
|
|
4
|
+
Measured on main @ f754f66cb, 2026-10-08.
|
|
5
|
+
|
|
6
|
+
## Why
|
|
7
|
+
|
|
8
|
+
Every 11.3 feature edited the same five places in loki-ts/src. Those edits
|
|
9
|
+
serialized the merge queue and made every feature touch the Seal. The goal: a
|
|
10
|
+
new feature adds one contributor file plus one registry line, and never edits
|
|
11
|
+
the hotspot body again.
|
|
12
|
+
|
|
13
|
+
This is a pure refactor:
|
|
14
|
+
- Every golden stays byte-identical.
|
|
15
|
+
- Verdict precedence is preserved exactly.
|
|
16
|
+
- Each slice moves logic; it never changes behavior. Behavior bugs found while
|
|
17
|
+
reading are listed in "Findings" and stay as they are.
|
|
18
|
+
|
|
19
|
+
## Global rules for every registry
|
|
20
|
+
|
|
21
|
+
1. Explicit order key. Every contributor carries a numeric `order`, unique within
|
|
22
|
+
its registry and spaced by 100 so a feature can slot in between. The registry
|
|
23
|
+
sorts by `order` when it loads and throws on a duplicate key. Import order and
|
|
24
|
+
array literal order never decide output.
|
|
25
|
+
2. No self-registration. Contributor files export a plain object. The registry
|
|
26
|
+
file imports each one by name and lists it in one array. A new feature adds
|
|
27
|
+
one file plus one line in that array. Module side effects never register
|
|
28
|
+
anything.
|
|
29
|
+
3. Guard test per registry:
|
|
30
|
+
- pin the sorted id sequence (a literal array in the test)
|
|
31
|
+
- reverse the source array, re-sort, and assert identical output
|
|
32
|
+
- assert that a duplicate `order` throws
|
|
33
|
+
4. Shared helper: `loki-ts/src/util/ordered.ts` exports
|
|
34
|
+
`ordered<T extends {id: string; order: number}>(xs: T[]): T[]`. It sorts, and
|
|
35
|
+
throws on a duplicate id or a duplicate order.
|
|
36
|
+
5. Placement:
|
|
37
|
+
- D42 says every verdict path stays in core, so the verdict registries live
|
|
38
|
+
in core at `loki-ts/src/engine10/verdict/`. They count against the 5000-line
|
|
39
|
+
core cap (measured 4683, so 317 lines of headroom).
|
|
40
|
+
- e10ext (1479/1500) and features/ (2976/3000) are full. Non-verdict
|
|
41
|
+
registries go in a new `loki-ts/src/contrib/` with its own cap (proposed
|
|
42
|
+
1200 lines) and the D66 import rules: no `stages/` import except a
|
|
43
|
+
whole-statement `import type` of seal, verify or wall.
|
|
44
|
+
- The new cap needs CTO sign-off (RG-06).
|
|
45
|
+
6. Dist is never committed by a slice. The Release Manager rebuilds dist in the
|
|
46
|
+
main checkout, because a symlinked node_modules breaks the source maps.
|
|
47
|
+
|
|
48
|
+
## Existing partial registries (reuse, do not duplicate)
|
|
49
|
+
|
|
50
|
+
| Where | What | Status |
|
|
51
|
+
|---|---|---|
|
|
52
|
+
| engine10/registry.ts | E-32 lazy module REGISTRY, guarded by registry.test.ts | A real registry. Keep it. The new registries are not lazy-loaded. |
|
|
53
|
+
| engine10/cli.ts `TABLE` | subcommand table | A real registry for subcommands. Start flags are not in it. |
|
|
54
|
+
| runner/router/route_block.ts | `withRouteLine` (:149), `withSealRoute` (:159), `routeStartLine` (:54) | A decorator pattern. It is the first contributor in each of 3 hotspots: seal route notes, the PR verdict annotation, and the start-line route segment. |
|
|
55
|
+
| features/pr_criteria.ts | `layoutPrBody` | Partial PR layout. RG-20 calls it unchanged from a section. |
|
|
56
|
+
| engine10/pr_body.ts | `renderPrBody` (48-58) | Test-only: no production caller (pr.ts imports only `draftReason`). Not a registry. Left alone. |
|
|
57
|
+
|
|
58
|
+
## Hotspot 1: Seal verdict chain (HIGH)
|
|
59
|
+
|
|
60
|
+
File: `loki-ts/src/engine10/stages/seal.ts` (359 lines).
|
|
61
|
+
|
|
62
|
+
Current ranges:
|
|
63
|
+
- 147-161: `verdictOf`, base rules where the first match wins
|
|
64
|
+
- 164-167: `targetProofOf`
|
|
65
|
+
- 213-235: gathering facts
|
|
66
|
+
- 236-244: the verdict chain:
|
|
67
|
+
1. `capGroupVerdict(verdictOf(...), grp)`
|
|
68
|
+
2. `supplyGuard` then `supplyVerdict` (239-240)
|
|
69
|
+
3. `crossReview` then `minVerdict` (241)
|
|
70
|
+
4. `mutationProof`: runs only when the verdict is VERIFIED and mutation is
|
|
71
|
+
enabled, and downgrades to PARTIAL only when
|
|
72
|
+
`mutationStrict() && plan.behavior_change` (243-244)
|
|
73
|
+
- 245-297: not_proven assembly (24 ordered contributors, listed below)
|
|
74
|
+
- 299-333: receipt body; key order is load-bearing
|
|
75
|
+
- 335: sealContract notes, added after the body is built
|
|
76
|
+
- 337-343: signing (adds SIGNING_UNAVAILABLE)
|
|
77
|
+
- 351-356: stage data plus the `receipt.sealed` emit, which carries
|
|
78
|
+
`route_line` but not `mutation_line`
|
|
79
|
+
|
|
80
|
+
Precedence facts the registry must keep:
|
|
81
|
+
- RANK (xreview.ts) is FAILED=0, SPEC_CONFLICT=0, PARTIAL=1,
|
|
82
|
+
ALREADY_SATISFIED=2, VERIFIED=2.
|
|
83
|
+
- `minVerdict` never upgrades.
|
|
84
|
+
- `capGroupVerdict`: if problems > 0 the result is FAILED, except that
|
|
85
|
+
SPEC_CONFLICT is kept. If `!allUnitsPass`, VERIFIED or ALREADY_SATISFIED
|
|
86
|
+
becomes PARTIAL.
|
|
87
|
+
- `supplyVerdict`: blocked and VERIFIED gives FAILED.
|
|
88
|
+
- Step order matters even though every step only lowers the verdict:
|
|
89
|
+
- mutation runs only when the verdict is VERIFIED
|
|
90
|
+
- xreview's notes depend on the verdict it received
|
|
91
|
+
So the order is pinned by key, not left to commutativity.
|
|
92
|
+
|
|
93
|
+
Interfaces (`engine10/verdict/types.ts`):
|
|
94
|
+
```ts
|
|
95
|
+
export interface SealState { ctx; plan; facts; grp; supply?; xr?; notes: Set<string>; dropped: Set<string> }
|
|
96
|
+
export interface VerdictStep { id: string; order: number;
|
|
97
|
+
run(v: Verdict, s: SealState): Verdict | Promise<Verdict> }
|
|
98
|
+
export interface NoteContributor { id: string; order: number; add(s: SealState): void }
|
|
99
|
+
export interface ReceiptSection { id: string; order: number;
|
|
100
|
+
slot: "after_verdict" | "after_evidence" | "tail";
|
|
101
|
+
fields(s: SealState): Record<string, unknown> } // tail sections may add notes
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Verdict steps and their order:
|
|
105
|
+
- base 100 (`verdictOf`)
|
|
106
|
+
- group_cap 200
|
|
107
|
+
- supply 300 (async)
|
|
108
|
+
- xreview 400 (async)
|
|
109
|
+
- mutation_strict 500
|
|
110
|
+
|
|
111
|
+
The runner clamps every step so it can never raise the rank. If a step returns
|
|
112
|
+
a higher rank, the runner throws in tests and keeps the lower verdict in
|
|
113
|
+
production. A test pins this.
|
|
114
|
+
|
|
115
|
+
Note contributors, in this order (100 apart, starting at 100):
|
|
116
|
+
1. deep, supply, grp and xr notes
|
|
117
|
+
2. proof reason
|
|
118
|
+
3. wall not_run
|
|
119
|
+
4. wall discarded
|
|
120
|
+
5. A-103b sealed-copy scan
|
|
121
|
+
6. diff not computed
|
|
122
|
+
7. weak tests (fills `dropped`)
|
|
123
|
+
8. uncovered after limit
|
|
124
|
+
9. not_run checks
|
|
125
|
+
10. flaky
|
|
126
|
+
11. verify not_proven minus dropped
|
|
127
|
+
12. commit not_proven and scope_notes
|
|
128
|
+
13. pre_red
|
|
129
|
+
14. tests_reverted
|
|
130
|
+
15. kill blocking
|
|
131
|
+
16. model override
|
|
132
|
+
17. task source
|
|
133
|
+
18. mutation "no" note
|
|
134
|
+
19. repo
|
|
135
|
+
20. resumed
|
|
136
|
+
21. cost: no iteration ids
|
|
137
|
+
22. cost: unmetered
|
|
138
|
+
23. wall result not recorded
|
|
139
|
+
24. route notes
|
|
140
|
+
|
|
141
|
+
Post-body notes run in their own phase: `seal_contract`, then signing (signing
|
|
142
|
+
stays inline).
|
|
143
|
+
|
|
144
|
+
Why order is a hazard here:
|
|
145
|
+
- `not_proven` is a Set, so insertion order lands in receipt.json bytes and in
|
|
146
|
+
the receipt hash.
|
|
147
|
+
- receipt.json is written with `JSON.stringify`, so key order matters for the
|
|
148
|
+
file bytes. The hash uses sorted `canonicalJson`, so it does not see key
|
|
149
|
+
order.
|
|
150
|
+
- events data key order also lands in output.
|
|
151
|
+
|
|
152
|
+
Pinning tests:
|
|
153
|
+
- loki-ts/tests/engine10:
|
|
154
|
+
- seal.test.ts
|
|
155
|
+
- fc21b_verdict.test.ts
|
|
156
|
+
- cap.test.ts
|
|
157
|
+
- check_result.test.ts
|
|
158
|
+
- supply_guard.test.ts
|
|
159
|
+
- seal_group.test.ts
|
|
160
|
+
- mutation_proof.test.ts
|
|
161
|
+
- portable_receipt
|
|
162
|
+
- seal_verify_roundtrip
|
|
163
|
+
- log_seal
|
|
164
|
+
- failover_receipt
|
|
165
|
+
- dsse
|
|
166
|
+
- dsse_followups
|
|
167
|
+
- route_receipt_golden
|
|
168
|
+
- e2e.test.ts
|
|
169
|
+
- tests/moat: p1, p2, p8
|
|
170
|
+
- New: RG-00 (precedence) and RG-01 (receipt bytes and note order)
|
|
171
|
+
|
|
172
|
+
## Hotspot 2: PR body (MEDIUM)
|
|
173
|
+
|
|
174
|
+
File: `loki-ts/src/engine10/stages/pr.ts` (124 lines).
|
|
175
|
+
- Imports: 12-15
|
|
176
|
+
- `briefSection`: 59-64
|
|
177
|
+
- Seal read: 71-75
|
|
178
|
+
- Line 78 awaits `beforeAfterBlock`. Line 79 concatenates:
|
|
179
|
+
`withSealRoute(renderReviewerBody(..), env, seal) + intentSection + evidenceSection + briefSection + beforeAfter + mutation_line`
|
|
180
|
+
|
|
181
|
+
`e10ext/reviewer_body.ts` (55 lines) renders 5 fixed sections at 40-55:
|
|
182
|
+
1. What the issue asked
|
|
183
|
+
2. What changed and why
|
|
184
|
+
3. How it was tested
|
|
185
|
+
4. NOT PROVEN
|
|
186
|
+
5. Receipt
|
|
187
|
+
|
|
188
|
+
Interface (`contrib/pr_sections.ts`):
|
|
189
|
+
```ts
|
|
190
|
+
export interface PrSection { id: string; order: number; kind: "append";
|
|
191
|
+
prepare?(c: PrCtx): Promise<void>; render(c: PrCtx): string }
|
|
192
|
+
export interface PrAnnotation { id: string; order: number; apply(body: string, c: PrCtx): string }
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Rules:
|
|
196
|
+
- All `prepare` calls are awaited first, sequentially, in order. Today that is
|
|
197
|
+
only before_after, which keeps the current single await.
|
|
198
|
+
- Then `render` runs in order.
|
|
199
|
+
- Annotations wrap the reviewer body before the appends. Route is order 100.
|
|
200
|
+
- Append order:
|
|
201
|
+
- intent 200
|
|
202
|
+
- evidence 300
|
|
203
|
+
- brief 400
|
|
204
|
+
- before_after 500
|
|
205
|
+
- mutation 600
|
|
206
|
+
- Reviewer body sections (RG-21), 100 to 500, in the order of the 5 sections
|
|
207
|
+
above.
|
|
208
|
+
|
|
209
|
+
Pinning tests:
|
|
210
|
+
- pr_body_golden.test.ts (fixture tests/fixtures/pr-body-firelater17)
|
|
211
|
+
- pr.test.ts
|
|
212
|
+
- reviewer_body.test.ts
|
|
213
|
+
- intent_card
|
|
214
|
+
- before_after
|
|
215
|
+
- visual_evidence
|
|
216
|
+
- pause_audit
|
|
217
|
+
- supervisor_backstop
|
|
218
|
+
- New: RG-02
|
|
219
|
+
|
|
220
|
+
## Hotspot 3: supervisor start line (MEDIUM)
|
|
221
|
+
|
|
222
|
+
File: `loki-ts/src/engine10/supervisor.ts` (351 lines).
|
|
223
|
+
- 228-243: `main` argv parse:
|
|
224
|
+
- flags: --no-pr, --deep, --json, --verbose, --max-cost[=], --provider
|
|
225
|
+
- --resume exits 2
|
|
226
|
+
- 267-270: start line:
|
|
227
|
+
`START_LINE, baseLine, capNote` joined by ", ", then optional
|
|
228
|
+
`; downgrade: ...`, `; <routeStart>` and `; <startText(estimate)>`, then "\n".
|
|
229
|
+
A SUBSCRIPTION_NOTE line follows when verbose, not json, and the cap source is
|
|
230
|
+
subscription.
|
|
231
|
+
- Side effects such as `env.LOKI_E10_COST_ESTIMATE` stay inline. Segments must
|
|
232
|
+
be pure.
|
|
233
|
+
- 300-305: `run.started` data, with an optional `downgrades` key
|
|
234
|
+
- About 306-312: the pr hook rebuilds `seal` from the `receipt.sealed` event
|
|
235
|
+
data (see Findings)
|
|
236
|
+
|
|
237
|
+
Interface (`contrib/start_line.ts`):
|
|
238
|
+
```ts
|
|
239
|
+
export interface StartSegment { id: string; order: number; group: "head" | "tail";
|
|
240
|
+
text(c: StartCtx): string | null } // null means omit
|
|
241
|
+
export interface StartExtraLine { id: string; order: number; line(c: StartCtx): string | null }
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Rules:
|
|
245
|
+
- Head segments are joined by ", ": engine 100, base 200, cap 300.
|
|
246
|
+
- Tail segments are each prefixed by "; ": downgrade 400, route 500,
|
|
247
|
+
estimate 600.
|
|
248
|
+
- Extra lines: subscription 100.
|
|
249
|
+
- `run.started` fields (RG-31) follow the same pattern, with key order by
|
|
250
|
+
`order`.
|
|
251
|
+
|
|
252
|
+
Pinning tests:
|
|
253
|
+
- router_optout_golden.test.ts: the start line is cut before "; estimate: ",
|
|
254
|
+
fixture pre_router_models.json, and LOKI_GOLDEN_UPDATE=1 is the update
|
|
255
|
+
convention (:182). The estimate must stay the last segment.
|
|
256
|
+
- e2e.test.ts:131
|
|
257
|
+
- budget_cap.test.ts
|
|
258
|
+
- cost_preview.test.ts
|
|
259
|
+
- route_receipt_golden
|
|
260
|
+
- New: RG-03
|
|
261
|
+
|
|
262
|
+
## Hotspot 4: plan output (MEDIUM)
|
|
263
|
+
|
|
264
|
+
File: `loki-ts/src/engine10/stages/plan.ts` (126 lines).
|
|
265
|
+
- 31-45: `buildPlanBrief(router, intentCard, behaviorChange)` takes positional
|
|
266
|
+
booleans. Instruction order: router, intent, behavior.
|
|
267
|
+
- 67: the variant event
|
|
268
|
+
- 68-69: skip paths
|
|
269
|
+
- 98: the failure path
|
|
270
|
+
- 111-123: data, with key order:
|
|
271
|
+
1. plan, relevant_files, iteration_ids, duration_s
|
|
272
|
+
2. `...ic.data` (intent)
|
|
273
|
+
3. `...pr.units()`, route_record (router)
|
|
274
|
+
4. `...readBehaviorChange`
|
|
275
|
+
Field order differs from instruction order, so one order key cannot serve
|
|
276
|
+
both.
|
|
277
|
+
|
|
278
|
+
Interface (`contrib/plan_fields.ts`):
|
|
279
|
+
```ts
|
|
280
|
+
export interface PlanContributor { id: string; briefOrder: number; fieldOrder: number;
|
|
281
|
+
enabled(c: PlanCtx): boolean; instruction?(c): string;
|
|
282
|
+
rawTransform?(raw: string, c): string; fields?(c, raw): Record<string, unknown> }
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Orders:
|
|
286
|
+
- router: brief 100, field 200
|
|
287
|
+
- intent: brief 200, field 100, plus a `rawTransform`
|
|
288
|
+
- behavior: brief 300, field 400
|
|
289
|
+
|
|
290
|
+
`buildPlanBrief` keeps its exported signature as a thin wrapper, because tests
|
|
291
|
+
call it directly. Fixed base fields stay inline, ahead of every contributor
|
|
292
|
+
field.
|
|
293
|
+
|
|
294
|
+
Pinning tests:
|
|
295
|
+
- plan.test.ts
|
|
296
|
+
- plan_route
|
|
297
|
+
- intent_card
|
|
298
|
+
- router_optout_golden
|
|
299
|
+
- e10ext/prefix_identity
|
|
300
|
+
- full_job_brief
|
|
301
|
+
- fc21_cap
|
|
302
|
+
- sizing
|
|
303
|
+
- New: RG-04
|
|
304
|
+
|
|
305
|
+
## Hotspot 5: start dispatch (MEDIUM)
|
|
306
|
+
|
|
307
|
+
`loki-ts/src/commands/start.ts` (269 lines):
|
|
308
|
+
- 29-37: VALUE_FLAGS
|
|
309
|
+
- 39: BOOL_ENV_FLAGS (empty)
|
|
310
|
+
- 43: NOOP_BOOL_FLAGS
|
|
311
|
+
- 63-70: acceptedFlags
|
|
312
|
+
- 107-226: `parseStartArgs`. Validation order: provider, then session-model,
|
|
313
|
+
then attempts.
|
|
314
|
+
- 234-237: `runEngine10` argv
|
|
315
|
+
- 245-269: `runStart`
|
|
316
|
+
|
|
317
|
+
`bin/loki` (714 lines):
|
|
318
|
+
- 347-376: attempts pre-pass (`if` at 351)
|
|
319
|
+
- 384-479: the v10 case; `start)` at 420 maps --budget to --max-cost
|
|
320
|
+
- 483-488: missing-bun check; start exits 1 using `command -v bun`, not
|
|
321
|
+
`_loki_bun` (290)
|
|
322
|
+
- 511-562: `_loki_start_needs_bash`
|
|
323
|
+
- 568-578: the final start block (`exec bun "$BUN_CLI" "$@"` at 577)
|
|
324
|
+
|
|
325
|
+
TS interface (`contrib/start_flags.ts`):
|
|
326
|
+
```ts
|
|
327
|
+
export interface StartFlag { flag: string; aliases?: string[]; order: number;
|
|
328
|
+
kind: "value" | "bool" | "noop"; validate?(v: string, a: StartArgs): string | null;
|
|
329
|
+
into(a: StartArgs, v?: string): void; engineArgv?(a: StartArgs): string[] }
|
|
330
|
+
```
|
|
331
|
+
- `acceptedFlags` and the usage text are derived from the table.
|
|
332
|
+
- Validation runs in `order`: provider 100, session-model 200, attempts 300.
|
|
333
|
+
- `runEngine10` argv is built from `engineArgv` in order: no-pr, provider,
|
|
334
|
+
max-cost.
|
|
335
|
+
|
|
336
|
+
Bash (`autonomy/lib/start-routes.sh`, sourced the same way bin/loki already
|
|
337
|
+
sources autonomy/lib at lines 53 and 132; autonomy/ ships in the npm files
|
|
338
|
+
list):
|
|
339
|
+
- Ordered handler names in one array, run in this order:
|
|
340
|
+
- 100 attempts
|
|
341
|
+
- 200 e10_ref
|
|
342
|
+
- 300 no_bun
|
|
343
|
+
- 400 legacy_flag_refuse
|
|
344
|
+
- 500 provider_refuse
|
|
345
|
+
- 600 bun_exec
|
|
346
|
+
- Each handler reads and rewrites the global `LOKI_START_ARGV` array, because
|
|
347
|
+
`set --` inside a function does not change the caller's positional
|
|
348
|
+
parameters.
|
|
349
|
+
- A handler returns 0 to continue, or execs or exits.
|
|
350
|
+
- Must stay compatible with bash 3.2.
|
|
351
|
+
- Must preserve two quirks byte-for-byte:
|
|
352
|
+
- the bun check uses `command -v bun`
|
|
353
|
+
- `--attempts 1` is stripped
|
|
354
|
+
|
|
355
|
+
Pinning tests:
|
|
356
|
+
- loki-ts/tests/commands/start.test.ts
|
|
357
|
+
- runner/attempts-dispatch.test.ts, attempts.test.ts
|
|
358
|
+
- tests/test-engine10-dispatch.sh
|
|
359
|
+
- test-start-bash-diversion.sh
|
|
360
|
+
- test-sdk-loop-routing.sh
|
|
361
|
+
- test-d65-routing.sh
|
|
362
|
+
- test-opencode-start.sh
|
|
363
|
+
- moat p4, p9
|
|
364
|
+
- New: RG-05
|
|
365
|
+
|
|
366
|
+
## Findings (not fixed by this refactor; the refactor preserves them)
|
|
367
|
+
|
|
368
|
+
F1. The PR `mutation_line` looks unreachable in production. The supervisor pr
|
|
369
|
+
hook rebuilds `seal` from the `receipt.sealed` event data (supervisor.ts about
|
|
370
|
+
306-312). That emit (seal.ts:351-356) carries `route_line` but no
|
|
371
|
+
`mutation_line`. Verify this with a live run before filing it in
|
|
372
|
+
FAILURE-CLASSES.md. RG-20 keeps the mutation section as is.
|
|
373
|
+
|
|
374
|
+
F2. start.ts has dead flag branches. --aider-model, --aider-flags,
|
|
375
|
+
--cline-model, --max-iterations and similar flags are rejected as unknown, so
|
|
376
|
+
their `argVal` branches never run. START_USAGE still advertises them, which is a
|
|
377
|
+
user-visible lie.
|
|
378
|
+
- RG-50 derives the usage text from the table. That would change the usage
|
|
379
|
+
bytes, so RG-50 must keep the usage literal as it is.
|
|
380
|
+
- Fix the lie in a separate slice after the registry lands.
|
|
381
|
+
|
|
382
|
+
F3. `renderPrBody` in pr_body.ts is test-only. Candidate for deletion later.
|
|
383
|
+
|
|
384
|
+
## Wall checks (every slice)
|
|
385
|
+
|
|
386
|
+
- W1: goldens byte-identical, and no fixture or golden file changes:
|
|
387
|
+
`git diff --name-only main -- 'loki-ts/tests/**/fixtures/**' 'tests/fixtures/**' '*golden*'`
|
|
388
|
+
must be empty, except the new golden files the RG-0x slices add. Never set
|
|
389
|
+
LOKI_GOLDEN_UPDATE=1.
|
|
390
|
+
- W2: the precedence suite:
|
|
391
|
+
`cd loki-ts && bun test tests/engine10/verdict_precedence.test.ts tests/engine10/seal_chain_golden.test.ts tests/engine10/fc21b_verdict.test.ts tests/engine10/cap.test.ts tests/engine10/seal.test.ts`
|
|
392
|
+
- W3: `cd loki-ts && bun run typecheck`
|
|
393
|
+
- W4: size guard:
|
|
394
|
+
`cd loki-ts && bun test tests/engine10/budget.test.ts` and
|
|
395
|
+
`bash scripts/structural-checks.sh`
|
|
396
|
+
- W5 (HIGH only): `bash tests/moat/run.sh p1 p2 p8`
|
|
397
|
+
- W6 (dispatch slices only): `bash tests/moat/run.sh p4 p9`
|
|
398
|
+
|
|
399
|
+
Core line allowance:
|
|
400
|
+
- RG-10 +40, RG-11 +25, RG-12 +20, RG-13 +10 (total +95, which leaves 222 of
|
|
401
|
+
headroom)
|
|
402
|
+
- Every other slice must have a net core delta of 0 or less.
|
|
403
|
+
|
|
404
|
+
Core measurement:
|
|
405
|
+
```
|
|
406
|
+
e=loki-ts/src/engine10; m=$(find $e/modernize -name '*.ts' -print0 | xargs -0 cat | wc -l); t=$(find $e -name '*.ts' -print0 | xargs -0 cat | wc -l); echo core=$((t-m))
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
Baton chains (one writer at a time on each shared file):
|
|
410
|
+
- seal.ts: RG-10, then RG-11, then RG-12, then RG-13
|
|
411
|
+
- supervisor.ts: RG-30, then RG-31, then RG-52
|
|
412
|
+
- plan.ts: RG-40, then RG-41
|
|
413
|
+
|
|
414
|
+
Review: HIGH slices use pair-mode review under D91 and unanimous opus reviewers
|
|
415
|
+
(D12).
|
|
416
|
+
|
|
417
|
+
## Slice cards
|
|
418
|
+
|
|
419
|
+
Waves:
|
|
420
|
+
- Wave 0 (RG-00 to RG-06): goldens and the home. Fully parallel, test or guard
|
|
421
|
+
files only.
|
|
422
|
+
- Wave 1: the first registry per hotspot, with existing logic moved in
|
|
423
|
+
unchanged.
|
|
424
|
+
- Waves 2 and 3: migrate the remaining inline pieces.
|
|
425
|
+
|
|
426
|
+
### RG-00 verdict precedence suite (HIGH, 25 min)
|
|
427
|
+
Goal: pin verdict precedence independently of seal.ts before anything moves.
|
|
428
|
+
File set: `loki-ts/tests/engine10/verdict_precedence.test.ts` (new).
|
|
429
|
+
Steps:
|
|
430
|
+
1. Freeze a verbatim copy of today's `verdictOf` rule list inside the test as
|
|
431
|
+
the oracle.
|
|
432
|
+
2. Run a full matrix of its inputs (every boolean fact and proof state)
|
|
433
|
+
against the live `verdictOf`.
|
|
434
|
+
3. Table-test `capGroupVerdict`, `supplyVerdict`, `minVerdict` and the
|
|
435
|
+
mutation-strict downgrade over every Verdict times every flag.
|
|
436
|
+
4. Assert that no step ever raises RANK.
|
|
437
|
+
Wall: W2 (this file), W3. It adds no src lines.
|
|
438
|
+
Commands: `cd loki-ts && bun test tests/engine10/verdict_precedence.test.ts`
|
|
439
|
+
Done when: green on main and red when any rule in seal.ts:147-161 is swapped
|
|
440
|
+
(mutate locally, then revert).
|
|
441
|
+
|
|
442
|
+
### RG-01 seal receipt golden (HIGH, 30 min)
|
|
443
|
+
Goal: pin receipt.json bytes and not_proven insertion order end to end.
|
|
444
|
+
File set:
|
|
445
|
+
- `loki-ts/tests/engine10/seal_chain_golden.test.ts` (new)
|
|
446
|
+
- `loki-ts/tests/engine10/fixtures/seal_chain_golden.json` (new)
|
|
447
|
+
Steps:
|
|
448
|
+
1. Drive `seal` through about 8 scenarios that together fire every note
|
|
449
|
+
contributor and every optional receipt key:
|
|
450
|
+
- group
|
|
451
|
+
- supply blocked
|
|
452
|
+
- xreview notes
|
|
453
|
+
- mutation strict
|
|
454
|
+
- failover
|
|
455
|
+
- spec_conflict
|
|
456
|
+
- pre_existing_dirty
|
|
457
|
+
- unsigned
|
|
458
|
+
2. Normalize only time, paths and sha fields.
|
|
459
|
+
3. Assert exact file bytes, the not_proven array order, the receipt.sealed
|
|
460
|
+
event data key order, and stage data.
|
|
461
|
+
Wall: W2, W3, W5.
|
|
462
|
+
Commands: `cd loki-ts && bun test tests/engine10/seal_chain_golden.test.ts`
|
|
463
|
+
Done when: reversing any two `not_proven.add` calls in seal.ts turns it red.
|
|
464
|
+
|
|
465
|
+
### RG-02 PR sections golden (MEDIUM, 20 min)
|
|
466
|
+
File set:
|
|
467
|
+
- `loki-ts/tests/engine10/pr_sections_golden.test.ts` (new)
|
|
468
|
+
- `loki-ts/tests/engine10/fixtures/pr_sections_golden.json` (new)
|
|
469
|
+
Goal: a body golden with every section present (intent, evidence, brief,
|
|
470
|
+
before_after, mutation_line, route) and one with every section absent.
|
|
471
|
+
Wall: W1, W3. Commands: `bun test tests/engine10/pr_sections_golden.test.ts`
|
|
472
|
+
|
|
473
|
+
### RG-03 start line and run.started golden (MEDIUM, 20 min)
|
|
474
|
+
File set: `loki-ts/tests/engine10/start_line_golden.test.ts` (new, inline
|
|
475
|
+
expectations).
|
|
476
|
+
Goal: cover every segment combination (downgrade, route, estimate,
|
|
477
|
+
subscription with verbose) and the `run.started` data key order including
|
|
478
|
+
`downgrades`.
|
|
479
|
+
Wall: W1, W3. Commands: `bun test tests/engine10/start_line_golden.test.ts`
|
|
480
|
+
|
|
481
|
+
### RG-04 plan output golden (MEDIUM, 20 min)
|
|
482
|
+
File set: `loki-ts/tests/engine10/plan_output_golden.test.ts` (new).
|
|
483
|
+
Goal: cover the brief text and the data key order for all 8 combinations of
|
|
484
|
+
router, intent and behavior, plus the skip and failure paths and the variant
|
|
485
|
+
event.
|
|
486
|
+
Wall: W1, W3. Commands: `bun test tests/engine10/plan_output_golden.test.ts`
|
|
487
|
+
|
|
488
|
+
### RG-05 start dispatch goldens (MEDIUM, 30 min)
|
|
489
|
+
File set:
|
|
490
|
+
- `loki-ts/tests/commands/start_parse_golden.test.ts` (new)
|
|
491
|
+
- `tests/test-start-dispatch-golden.sh` (new)
|
|
492
|
+
- `tests/fixtures/start-dispatch-golden.tsv` (new)
|
|
493
|
+
- `tests/run-all-tests.sh` (run_test row)
|
|
494
|
+
- `tests/shard-durations.tsv` (row)
|
|
495
|
+
- `scripts/local-ci.sh` (run_check row near 1562)
|
|
496
|
+
Goal:
|
|
497
|
+
- TS: parse result, error text and engine argv for every flag, the validation
|
|
498
|
+
order and the usage text bytes.
|
|
499
|
+
- Bash: for about 25 argv cases, the route taken (attempts, e10, no-bun,
|
|
500
|
+
refuse, exec) and the rewritten argv. Stub bun, use `LOKI_NO_BROWSER=1`, and
|
|
501
|
+
keep everything under `loki_run_tmp_create`.
|
|
502
|
+
Wall: W1, W3, W4, W6, shellcheck, `timeout -k` on every external call,
|
|
503
|
+
bash 3.2.
|
|
504
|
+
Commands:
|
|
505
|
+
- `bash tests/test-start-dispatch-golden.sh`
|
|
506
|
+
- `cd loki-ts && bun test tests/commands/start_parse_golden.test.ts`
|
|
507
|
+
- `bash scripts/structural-checks.sh`
|
|
508
|
+
|
|
509
|
+
### RG-06 contrib/ home and ordered helper (MEDIUM, 15 min, needs CTO ack)
|
|
510
|
+
File set:
|
|
511
|
+
- `loki-ts/src/util/ordered.ts` (new)
|
|
512
|
+
- `loki-ts/tests/util/ordered.test.ts` (new)
|
|
513
|
+
- `loki-ts/tests/engine10/budget.test.ts` (contrib cap 1200 plus D66-style
|
|
514
|
+
import rule)
|
|
515
|
+
- `scripts/structural-checks.sh` (line_budgets row, lines 43-55)
|
|
516
|
+
Goal:
|
|
517
|
+
- `ordered()` sorts by order and throws on a duplicate id or order. Tests for
|
|
518
|
+
each.
|
|
519
|
+
- The empty contrib/ cap passes.
|
|
520
|
+
- A planted `import { x } from "../engine10/stages/seal"` in contrib fails the
|
|
521
|
+
guard (mutate, then revert).
|
|
522
|
+
Wall: W3, W4. Commands:
|
|
523
|
+
- `cd loki-ts && bun test tests/util/ordered.test.ts tests/engine10/budget.test.ts`
|
|
524
|
+
- `bash scripts/structural-checks.sh`
|
|
525
|
+
|
|
526
|
+
### RG-10 verdict step registry (HIGH, 30 min, after RG-00, RG-01, RG-06)
|
|
527
|
+
File set:
|
|
528
|
+
- `loki-ts/src/engine10/verdict/types.ts` (new)
|
|
529
|
+
- `loki-ts/src/engine10/verdict/chain.ts` (new)
|
|
530
|
+
- `loki-ts/src/engine10/verdict/steps.ts` (new)
|
|
531
|
+
- `loki-ts/src/engine10/stages/seal.ts` (lines 236-244 only)
|
|
532
|
+
- `loki-ts/tests/engine10/verdict_chain_registry.test.ts` (new)
|
|
533
|
+
Goal:
|
|
534
|
+
- Move the four transforms (base 100, group_cap 200, supply 300, xreview 400,
|
|
535
|
+
mutation_strict 500) unchanged into step objects.
|
|
536
|
+
- `runVerdictChain` sorts with `ordered()` and applies the rank clamp.
|
|
537
|
+
- seal.ts calls it once.
|
|
538
|
+
- Supply and xreview results land on SealState so the notes still see them.
|
|
539
|
+
Guard test:
|
|
540
|
+
- pins the id order
|
|
541
|
+
- reverse-array invariance
|
|
542
|
+
- a test-only step returning a higher rank is clamped, and the runner throws
|
|
543
|
+
under test
|
|
544
|
+
Wall: W1, W2, W3, W4 (core +40 max), W5.
|
|
545
|
+
Commands: W2 and W5 command lines plus
|
|
546
|
+
`bun test tests/engine10/verdict_chain_registry.test.ts`
|
|
547
|
+
Reviewers: pair-mode, two opus.
|
|
548
|
+
|
|
549
|
+
### RG-11 not_proven note registry (HIGH, 30 min, after RG-10)
|
|
550
|
+
File set:
|
|
551
|
+
- `loki-ts/src/engine10/verdict/notes.ts` (new)
|
|
552
|
+
- `loki-ts/src/engine10/stages/seal.ts` (245-297 and 335)
|
|
553
|
+
- `loki-ts/tests/engine10/verdict_notes_registry.test.ts` (new)
|
|
554
|
+
Goal:
|
|
555
|
+
- Move the 24 note blocks, in today's order, into `NoteContributor`s with
|
|
556
|
+
orders 100 to 2400.
|
|
557
|
+
- weak_tests (700) fills `s.dropped`, and verify_not_proven (1100) reads it.
|
|
558
|
+
Add a guard assertion that the order of those two can never invert.
|
|
559
|
+
- The post-body phase holds `seal_contract`.
|
|
560
|
+
Wall: W1, W2 (RG-01 order assertions), W3, W4 (core +25), W5.
|
|
561
|
+
Commands: W2 plus `bun test tests/engine10/verdict_notes_registry.test.ts`
|
|
562
|
+
|
|
563
|
+
### RG-12 receipt section and seal output registry (HIGH, 30 min, after RG-11)
|
|
564
|
+
File set:
|
|
565
|
+
- `loki-ts/src/engine10/verdict/receipt_sections.ts` (new)
|
|
566
|
+
- `loki-ts/src/engine10/stages/seal.ts` (299-333 and 351-356)
|
|
567
|
+
- `loki-ts/tests/engine10/receipt_sections_registry.test.ts` (new)
|
|
568
|
+
Goal:
|
|
569
|
+
- Fixed head keys (schema through verdict) stay inline.
|
|
570
|
+
- Optional keys become sections in slots:
|
|
571
|
+
- after_verdict: implement_limit, group, failover, spec_conflict_reason
|
|
572
|
+
- after_evidence: pre_existing_dirty
|
|
573
|
+
- tail: cost, time, provider, model, resumed, events_sha256, seal_evidence
|
|
574
|
+
(adds notes), log_seal, receiptBlock, mutation, route, supply
|
|
575
|
+
- Within each slot, key insertion order equals today's order.
|
|
576
|
+
- Emit data fields follow the same pattern, so `mutation_line` stays absent
|
|
577
|
+
(F1).
|
|
578
|
+
Wall: W1 (byte-identical receipt.json), W2, W3, W4 (core +20), W5, and
|
|
579
|
+
`bun test tests/engine10/portable_receipt* tests/engine10/dsse*`
|
|
580
|
+
|
|
581
|
+
### RG-13 verdictOf base-rule table (HIGH, 30 min, after RG-12)
|
|
582
|
+
File set:
|
|
583
|
+
- `loki-ts/src/engine10/verdict/base_rules.ts` (new)
|
|
584
|
+
- `loki-ts/src/engine10/stages/seal.ts` (147-161)
|
|
585
|
+
Goal: the first-match rules become `{id, order, when(facts), verdict}`, evaluated
|
|
586
|
+
in order. `verdictOf` stays exported with the same signature.
|
|
587
|
+
Wall: W2. RG-00's frozen-oracle matrix is the authority here and must be green
|
|
588
|
+
with zero diffs. Also W3, W4 (core +10) and W5.
|
|
589
|
+
|
|
590
|
+
### RG-20 PR section registry (MEDIUM, 30 min, after RG-02, RG-06)
|
|
591
|
+
File set:
|
|
592
|
+
- `loki-ts/src/contrib/pr_sections.ts` (new)
|
|
593
|
+
- `loki-ts/src/contrib/pr/` (one file per section: route, intent, evidence,
|
|
594
|
+
brief, before_after, mutation)
|
|
595
|
+
- `loki-ts/src/engine10/stages/pr.ts` (12-15, 59-64, 78-79)
|
|
596
|
+
- `loki-ts/tests/contrib/pr_sections.test.ts` (new)
|
|
597
|
+
Goal:
|
|
598
|
+
- pr.ts line 79 becomes `renderPrBody(ctx)` from contrib.
|
|
599
|
+
- before_after keeps its single await through `prepare`.
|
|
600
|
+
- pr.ts net lines must go down.
|
|
601
|
+
- contrib must not import stages/. Pass the seal data in as a type-only value.
|
|
602
|
+
Wall: W1 (pr_body_golden, RG-02), W3, W4.
|
|
603
|
+
Commands: `bun test tests/engine10/pr_body_golden.test.ts tests/engine10/pr_sections_golden.test.ts tests/engine10/pr.test.ts`
|
|
604
|
+
|
|
605
|
+
### RG-21 reviewer body sections (MEDIUM, 25 min, after RG-02)
|
|
606
|
+
File set:
|
|
607
|
+
- `loki-ts/src/e10ext/reviewer_body.ts`
|
|
608
|
+
- `loki-ts/tests/e10ext/reviewer_body_registry.test.ts` (new)
|
|
609
|
+
Goal: the 5 sections become an ordered array (100 to 500) inside the same file.
|
|
610
|
+
e10ext net lines must be 0 or less, because e10ext is at 1479 of 1500.
|
|
611
|
+
Wall: W1 (reviewer_body.test.ts, pr_body_golden), W3, W4.
|
|
612
|
+
|
|
613
|
+
### RG-30 start-line segment registry (MEDIUM, 20 min, after RG-03, RG-06)
|
|
614
|
+
File set:
|
|
615
|
+
- `loki-ts/src/contrib/start_line.ts` (new)
|
|
616
|
+
- `loki-ts/src/engine10/supervisor.ts` (267-270)
|
|
617
|
+
- `loki-ts/tests/contrib/start_line.test.ts` (new)
|
|
618
|
+
Goal:
|
|
619
|
+
- Head segments: engine 100, base 200, cap 300.
|
|
620
|
+
- Tail segments: downgrade 400, route 500, estimate 600.
|
|
621
|
+
- Extra lines: subscription.
|
|
622
|
+
- Side effects stay in supervisor.ts.
|
|
623
|
+
- A guard asserts estimate is the last tail segment, because
|
|
624
|
+
router_optout_golden cuts the line there.
|
|
625
|
+
Wall: W1 (router_optout_golden, e2e:131, budget_cap, cost_preview, RG-03), W3,
|
|
626
|
+
W4 (core 0 or less).
|
|
627
|
+
|
|
628
|
+
### RG-31 run.started field registry (MEDIUM, 20 min, after RG-30)
|
|
629
|
+
File set:
|
|
630
|
+
- `loki-ts/src/contrib/run_started.ts` (new)
|
|
631
|
+
- `loki-ts/src/engine10/supervisor.ts` (300-305)
|
|
632
|
+
Goal: optional data keys (downgrades today) become ordered contributors. Base
|
|
633
|
+
keys stay inline and first.
|
|
634
|
+
Wall: W1 (RG-03 key order), W3, W4.
|
|
635
|
+
|
|
636
|
+
### RG-40 plan contributor registry (MEDIUM, 30 min, after RG-04, RG-06)
|
|
637
|
+
File set:
|
|
638
|
+
- `loki-ts/src/contrib/plan_fields.ts` (new)
|
|
639
|
+
- `loki-ts/src/contrib/plan/` (router.ts, intent.ts, behavior.ts)
|
|
640
|
+
- `loki-ts/src/engine10/stages/plan.ts` (31-45 and 111-123)
|
|
641
|
+
- `loki-ts/tests/contrib/plan_fields.test.ts` (new)
|
|
642
|
+
Goal:
|
|
643
|
+
- Use the briefOrder and fieldOrder pairs from Hotspot 4.
|
|
644
|
+
- `buildPlanBrief(router, intentCard, behaviorChange)` stays exported as a
|
|
645
|
+
wrapper.
|
|
646
|
+
- The guard pins both sequences separately.
|
|
647
|
+
Wall: W1 (plan.test, plan_route, intent_card, router_optout_golden,
|
|
648
|
+
prefix_identity, full_job_brief, RG-04), W3, W4.
|
|
649
|
+
|
|
650
|
+
### RG-41 plan variant fields (MEDIUM, 20 min, after RG-40)
|
|
651
|
+
File set:
|
|
652
|
+
- `loki-ts/src/engine10/stages/plan.ts` (67-69 and 98)
|
|
653
|
+
- `loki-ts/src/contrib/plan_fields.ts`
|
|
654
|
+
Goal: the variant event data and the skip and failure paths read contributor
|
|
655
|
+
`fields` through the registry, with key order pinned by RG-04.
|
|
656
|
+
Wall: W1, W3, W4.
|
|
657
|
+
|
|
658
|
+
### RG-50 start flag registry, TS (MEDIUM, 30 min, after RG-05, RG-06)
|
|
659
|
+
File set:
|
|
660
|
+
- `loki-ts/src/contrib/start_flags.ts` (new)
|
|
661
|
+
- `loki-ts/src/commands/start.ts` (29-70 and 107-237)
|
|
662
|
+
- `loki-ts/tests/contrib/start_flags.test.ts` (new)
|
|
663
|
+
Goal:
|
|
664
|
+
- VALUE_FLAGS, NOOP_BOOL_FLAGS, acceptedFlags, the argVal branches, validation
|
|
665
|
+
(provider 100, session-model 200, attempts 300) and `runEngine10` argv all
|
|
666
|
+
come from one table.
|
|
667
|
+
- Dead branches (F2) move over as table rows with identical rejection
|
|
668
|
+
behavior.
|
|
669
|
+
- START_USAGE stays a literal (byte-identical).
|
|
670
|
+
Wall: W1 (start.test, RG-05 TS), W3, W4, W6.
|
|
671
|
+
|
|
672
|
+
### RG-51 bash start route registry (MEDIUM, 30 min, after RG-05)
|
|
673
|
+
File set:
|
|
674
|
+
- `autonomy/lib/start-routes.sh` (new)
|
|
675
|
+
- `bin/loki` (351-376, 420-438, 483-488, 511-562, 568-578)
|
|
676
|
+
Goal:
|
|
677
|
+
- Ordered handler array: 100 attempts, 200 e10_ref, 300 no_bun,
|
|
678
|
+
400 legacy_flag_refuse, 500 provider_refuse, 600 bun_exec, using the global
|
|
679
|
+
`LOKI_START_ARGV`.
|
|
680
|
+
- Keep `command -v bun` and the `--attempts 1` strip.
|
|
681
|
+
- No `${!var}`, because bin/loki may be sourced in contexts where zsh
|
|
682
|
+
semantics leak in.
|
|
683
|
+
Wall:
|
|
684
|
+
- W1 (RG-05 bash golden, test-engine10-dispatch, test-start-bash-diversion,
|
|
685
|
+
test-sdk-loop-routing, test-d65-routing, test-opencode-start)
|
|
686
|
+
- W6
|
|
687
|
+
- `bash -n bin/loki autonomy/lib/start-routes.sh`
|
|
688
|
+
- shellcheck
|
|
689
|
+
- bash 3.2: `/bin/bash tests/test-start-dispatch-golden.sh`
|
|
690
|
+
|
|
691
|
+
### RG-52 engine10 run flag registry (MEDIUM, 25 min, after RG-31)
|
|
692
|
+
File set:
|
|
693
|
+
- `loki-ts/src/contrib/run_flags.ts` (new)
|
|
694
|
+
- `loki-ts/src/engine10/supervisor.ts` (228-243)
|
|
695
|
+
Goal: the supervisor `main` flags (no-pr, deep, json, verbose, max-cost with
|
|
696
|
+
both forms, provider, plus the resume exit 2) become ordered rows. Usage and
|
|
697
|
+
error bytes stay identical.
|
|
698
|
+
Wall: W1 (e2e, test-engine10-dispatch), W3, W4, W6.
|
|
699
|
+
|
|
700
|
+
## Slice summary
|
|
701
|
+
|
|
702
|
+
| ID | Tier | Budget | After | Primary files |
|
|
703
|
+
|---|---|---|---|---|
|
|
704
|
+
| RG-00 | HIGH | 25 | - | tests/engine10/verdict_precedence.test.ts |
|
|
705
|
+
| RG-01 | HIGH | 30 | - | tests/engine10/seal_chain_golden.test.ts, fixture |
|
|
706
|
+
| RG-02 | MED | 20 | - | tests/engine10/pr_sections_golden.test.ts, fixture |
|
|
707
|
+
| RG-03 | MED | 20 | - | tests/engine10/start_line_golden.test.ts |
|
|
708
|
+
| RG-04 | MED | 20 | - | tests/engine10/plan_output_golden.test.ts |
|
|
709
|
+
| RG-05 | MED | 30 | - | start_parse_golden.test.ts, test-start-dispatch-golden.sh, tsv, runner rows |
|
|
710
|
+
| RG-06 | MED | 15 | CTO ack | util/ordered.ts, budget.test.ts, structural-checks.sh |
|
|
711
|
+
| RG-10 | HIGH | 30 | 00,01,06 | engine10/verdict/{types,chain,steps}.ts, seal.ts 236-244 |
|
|
712
|
+
| RG-11 | HIGH | 30 | 10 | engine10/verdict/notes.ts, seal.ts 245-297,335 |
|
|
713
|
+
| RG-12 | HIGH | 30 | 11 | engine10/verdict/receipt_sections.ts, seal.ts 299-333,351-356 |
|
|
714
|
+
| RG-13 | HIGH | 30 | 12 | engine10/verdict/base_rules.ts, seal.ts 147-161 |
|
|
715
|
+
| RG-20 | MED | 30 | 02,06 | contrib/pr_sections.ts, contrib/pr/*, pr.ts |
|
|
716
|
+
| RG-21 | MED | 25 | 02 | e10ext/reviewer_body.ts |
|
|
717
|
+
| RG-30 | MED | 20 | 03,06 | contrib/start_line.ts, supervisor.ts 267-270 |
|
|
718
|
+
| RG-31 | MED | 20 | 30 | contrib/run_started.ts, supervisor.ts 300-305 |
|
|
719
|
+
| RG-40 | MED | 30 | 04,06 | contrib/plan_fields.ts, contrib/plan/*, plan.ts 31-45,111-123 |
|
|
720
|
+
| RG-41 | MED | 20 | 40 | plan.ts 67-69,98, contrib/plan_fields.ts |
|
|
721
|
+
| RG-50 | MED | 30 | 05,06 | contrib/start_flags.ts, commands/start.ts |
|
|
722
|
+
| RG-51 | MED | 30 | 05 | autonomy/lib/start-routes.sh, bin/loki |
|
|
723
|
+
| RG-52 | MED | 25 | 31 | contrib/run_flags.ts, supervisor.ts 228-243 |
|
|
724
|
+
|
|
725
|
+
Start first:
|
|
726
|
+
- RG-01: the HIGH receipt golden that every seal slice depends on, and the
|
|
727
|
+
longest pole.
|
|
728
|
+
- RG-06: unblocks every contrib/ slice. It needs CTO ack; if that is pending,
|
|
729
|
+
start RG-00 in its place.
|
|
730
|
+
All of wave 0 is parallel-safe.
|