@lsctech/polaris 0.3.22 → 0.3.23

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 (146) hide show
  1. package/dist/cli/adopt-assets.js +13 -0
  2. package/dist/cli/adopt-genesis.js +85 -4
  3. package/dist/cli/adopt-instructions.js +3 -3
  4. package/dist/cli/adopt-report.js +15 -1
  5. package/dist/cli/adopt-rules.js +44 -8
  6. package/dist/cli/adopt-workspace.js +2 -2
  7. package/dist/cli/adoption-inventory.js +5 -2
  8. package/dist/cli/init.js +5 -4
  9. package/dist/config/provider-detect.js +19 -2
  10. package/dist/workspace/.polaris/skills/ROUTING.md +4 -0
  11. package/dist/workspace/.polaris/skills/closeout-librarian/POLARIS.md +9 -8
  12. package/dist/workspace/.polaris/skills/docs-ingest/SKILL.md +2 -2
  13. package/dist/workspace/.polaris/skills/docs-ingest/chain.md +1 -1
  14. package/dist/workspace/.polaris/skills/docs-ingest/steps/04-place-and-link.md +5 -5
  15. package/dist/workspace/.polaris/skills/docs-ingest/steps/05-finalize-ingest.md +1 -1
  16. package/dist/workspace/.polaris/skills/docs-promote/SKILL.md +6 -6
  17. package/dist/workspace/.polaris/skills/docs-promote/chain.md +5 -5
  18. package/dist/workspace/.polaris/skills/docs-promote/steps/04-conflict-surface.md +1 -1
  19. package/dist/workspace/.polaris/skills/docs-promote/steps/06-execute-promote-deprecate.md +3 -3
  20. package/dist/workspace/{workspace/.polaris → .polaris}/skills/docs-review/SKILL.md +1 -1
  21. package/dist/workspace/{workspace/.polaris → .polaris}/skills/docs-triage/SKILL.md +1 -1
  22. package/dist/workspace/{workspace/.polaris → .polaris}/skills/docs-triage/chain.md +1 -1
  23. package/dist/workspace/.polaris/skills/polaris-analyze/SKILL.md +1 -1
  24. package/dist/workspace/.polaris/skills/polaris-analyze/chain.md +2 -2
  25. package/dist/workspace/.polaris/skills/polaris-analyze/issue-reconciliation.md +1 -1
  26. package/dist/workspace/.polaris/skills/polaris-analyze/linked-skills/repo-analysis.md +3 -4
  27. package/dist/workspace/.polaris/skills/polaris-analyze/steps/02-map-affected-code.md +2 -2
  28. package/dist/workspace/.polaris/skills/polaris-catalog/SKILL.md +5 -5
  29. package/dist/workspace/.polaris/skills/polaris-catalog/chain.md +3 -3
  30. package/dist/workspace/.polaris/skills/polaris-catalog/steps/04-classify-and-place.md +3 -3
  31. package/dist/workspace/.polaris/skills/polaris-reconcile/SKILL.md +2 -2
  32. package/dist/workspace/.polaris/skills/polaris-run/SKILL.md +1 -1
  33. package/dist/workspace/.polaris/skills/polaris-run/chain.md +17 -17
  34. package/dist/workspace/.polaris/skills/polaris-run/linked-skills/repo-analysis.md +3 -4
  35. package/dist/workspace/.polaris/skills/polaris-run/steps/01-orient-cluster.md +3 -3
  36. package/dist/workspace/.polaris/skills/polaris-run/steps/03-select-child.md +1 -1
  37. package/dist/workspace/.polaris/skills/polaris-run/steps/06-commit-and-update-linear.md +2 -2
  38. package/dist/workspace/.polaris/skills/polaris-run/steps/07-decide-continuation.md +3 -3
  39. package/dist/workspace/.polaris/skills/polaris-run/steps/08-closeout-librarian.md +1 -1
  40. package/dist/workspace/.polaris/skills/polaris-run/steps/08-final-delivery.md +2 -2
  41. package/dist/workspace/.polaris/skills/polaris-run/steps/09-final-delivery.md +1 -1
  42. package/dist/workspace/.polaris/skills/polaris-tools/README.md +1 -1
  43. package/dist/workspace/POLARIS_RULES.md +169 -0
  44. package/package.json +3 -2
  45. package/dist/workspace/workspace/.polaris/roles/analyst.md +0 -38
  46. package/dist/workspace/workspace/.polaris/roles/closeout-librarian.md +0 -122
  47. package/dist/workspace/workspace/.polaris/roles/cognition-librarian.md +0 -37
  48. package/dist/workspace/workspace/.polaris/roles/finalizer.md +0 -45
  49. package/dist/workspace/workspace/.polaris/roles/foreman.md +0 -165
  50. package/dist/workspace/workspace/.polaris/roles/librarian.md +0 -74
  51. package/dist/workspace/workspace/.polaris/roles/worker.md +0 -119
  52. package/dist/workspace/workspace/.polaris/session-type +0 -1
  53. package/dist/workspace/workspace/.polaris/skills/ROUTING.md +0 -113
  54. package/dist/workspace/workspace/.polaris/skills/caveman/SKILL.md +0 -74
  55. package/dist/workspace/workspace/.polaris/skills/caveman-compress/scripts/compress.py +0 -272
  56. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/POLARIS.md +0 -46
  57. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/SKILL.md +0 -59
  58. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/chain.md +0 -116
  59. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/01-load-cluster-context.md +0 -78
  60. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/02-drift-reconciliation.md +0 -157
  61. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/03-reconcile-polaris-md.md +0 -93
  62. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/04-reconcile-summary-md.md +0 -106
  63. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/05-doc-ingestion.md +0 -114
  64. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/06-link-validation.md +0 -128
  65. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/07-yaml-linking.md +0 -95
  66. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/08-librarian-commit.md +0 -119
  67. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/09-sealed-result.md +0 -118
  68. package/dist/workspace/workspace/.polaris/skills/docs-ingest/SKILL.md +0 -68
  69. package/dist/workspace/workspace/.polaris/skills/docs-ingest/chain.json +0 -23
  70. package/dist/workspace/workspace/.polaris/skills/docs-ingest/chain.md +0 -149
  71. package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/01-orient-ingest.md +0 -85
  72. package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/02-classify-batch.md +0 -87
  73. package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/03-conflict-check.md +0 -66
  74. package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/04-place-and-link.md +0 -77
  75. package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/05-finalize-ingest.md +0 -49
  76. package/dist/workspace/workspace/.polaris/skills/docs-promote/SKILL.md +0 -79
  77. package/dist/workspace/workspace/.polaris/skills/docs-promote/chain.json +0 -25
  78. package/dist/workspace/workspace/.polaris/skills/docs-promote/chain.md +0 -80
  79. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/01-orient-promote.md +0 -53
  80. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/02-review-candidates.md +0 -51
  81. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/03-read-linked-code.md +0 -50
  82. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/04-conflict-surface.md +0 -65
  83. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/05-await-approval.md +0 -61
  84. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/06-execute-promote-deprecate.md +0 -65
  85. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/07-finalize-promote.md +0 -44
  86. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/SKILL.md +0 -94
  87. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/chain.json +0 -20
  88. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/chain.md +0 -105
  89. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/issue-reconciliation.md +0 -149
  90. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/issue-template.md +0 -133
  91. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/linked-skills/repo-analysis.md +0 -55
  92. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/01-fetch-and-orient.md +0 -79
  93. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/02-map-affected-code.md +0 -58
  94. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/03-assess-issue.md +0 -58
  95. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/04-blocker-check.md +0 -60
  96. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/05-create-cluster-plan.md +0 -197
  97. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/06-final-report.md +0 -60
  98. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/SKILL.md +0 -91
  99. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/chain.json +0 -22
  100. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/chain.md +0 -85
  101. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/01-orient-catalog.md +0 -92
  102. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/02-reconcile-polaris-md.md +0 -33
  103. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/03-reconcile-summary-md.md +0 -70
  104. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/04-classify-and-place.md +0 -117
  105. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/05-catalog-commit.md +0 -94
  106. package/dist/workspace/workspace/.polaris/skills/polaris-medic/SKILL.md +0 -52
  107. package/dist/workspace/workspace/.polaris/skills/polaris-medic/chain.md +0 -111
  108. package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/01-orient-medic.md +0 -75
  109. package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/02-diagnose.md +0 -79
  110. package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/03-repair.md +0 -64
  111. package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/04-validate.md +0 -66
  112. package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/05-create-chart.md +0 -85
  113. package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/06-closeout.md +0 -86
  114. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/SKILL.md +0 -75
  115. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/chain.json +0 -20
  116. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/chain.md +0 -67
  117. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/steps/01-orient-reconcile.md +0 -82
  118. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/steps/02-reconcile-polaris-md.md +0 -95
  119. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/steps/03-reconcile-summary-md.md +0 -108
  120. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/steps/04-reconcile-commit.md +0 -88
  121. package/dist/workspace/workspace/.polaris/skills/polaris-run/SKILL.md +0 -135
  122. package/dist/workspace/workspace/.polaris/skills/polaris-run/chain.json +0 -19
  123. package/dist/workspace/workspace/.polaris/skills/polaris-run/chain.md +0 -298
  124. package/dist/workspace/workspace/.polaris/skills/polaris-run/execution-adapter.md +0 -34
  125. package/dist/workspace/workspace/.polaris/skills/polaris-run/linked-skills/repo-analysis.md +0 -58
  126. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/01-orient-cluster.md +0 -96
  127. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/02-prepare-branch.md +0 -53
  128. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/03-select-child.md +0 -63
  129. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/04-execute-child.md +0 -75
  130. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/05-validate-child.md +0 -57
  131. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/06-commit-and-update-linear.md +0 -74
  132. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/07-decide-continuation.md +0 -89
  133. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/08-closeout-librarian.md +0 -146
  134. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/08-final-delivery.md +0 -91
  135. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/09-final-delivery.md +0 -104
  136. package/dist/workspace/workspace/.polaris/skills/polaris-tools/README.md +0 -63
  137. package/dist/workspace/workspace/.polaris/skills/polaris-tools/SKILL.md +0 -94
  138. package/dist/workspace/workspace/.polaris/skills/polaris-tools/tools.js +0 -191
  139. package/dist/workspace/workspace/smartdocs/architecture/.gitkeep +0 -0
  140. package/dist/workspace/workspace/smartdocs/audits/.gitkeep +0 -0
  141. package/dist/workspace/workspace/smartdocs/decisions/.gitkeep +0 -0
  142. package/dist/workspace/workspace/smartdocs/doctrine/active/.gitkeep +0 -0
  143. package/dist/workspace/workspace/smartdocs/runtime/.gitkeep +0 -0
  144. package/dist/workspace/workspace/smartdocs/specs/active/.gitkeep +0 -0
  145. package/dist/workspace/workspace/smartdocs/specs/archive/.gitkeep +0 -0
  146. /package/dist/workspace/{workspace/.polaris → .polaris}/skills/docs-review/chain.md +0 -0
@@ -1,75 +0,0 @@
1
- ---
2
- name: polaris-run-step-04-execute-child
3
- description: Implement the current child issue with the smallest scoped change possible.
4
- ---
5
-
6
- # Step 04 — Execute child
7
-
8
- ## Purpose
9
-
10
- Execute only the selected child worker scope. In interactive-agent mode this step belongs inside the worker session dispatched by the execution adapter; the parent/orchestrator must not perform child implementation inline.
11
-
12
- ## Scope declarations
13
-
14
- ```yaml
15
- allowed_files:
16
- - files explicitly named by selected Linear child
17
- - nearest POLARIS.md or INSTRUCTIONS.md for each edited path
18
- - source files required by child acceptance criteria
19
- - .taskchain_artifacts/polaris-run/current-state.json
20
- allowed_routes:
21
- - CLAUDE.md
22
- - docs/Polaris/spec/polaris-implementation-plan.md
23
- - .polaris/skills/polaris-run/chain.md
24
- allowed_skills:
25
- - repo-analysis
26
- expected_evidence:
27
- - child acceptance criteria implemented
28
- - touched paths match child scope
29
- - no files outside child scope modified
30
- stop_rules:
31
- - requested edit conflicts with existing architecture or doctrine
32
- - implementation requires cross-cluster work
33
- - same approach failed twice — stop and ask
34
- - no edit made within 10 minutes — stop and ask
35
- ```
36
-
37
- ## Actions
38
-
39
- 1. Confirm this is a worker execution context for the selected child. If this is a parent/orchestrator context with another open child to dispatch, return to step 07 and use the execution adapter instead of implementing inline.
40
- 2. Re-fetch the current child issue from the issue tracker to confirm latest state, requirements, and any new blocking relationships.
41
- 3. Identify the files relevant to this child. Inspect only those files.
42
- 4. If a repo-analysis provider is configured and available: use it for targeted file or symbol lookup only. Otherwise use `polaris map query` and direct file inspection. Do not perform broad repo analysis regardless of which path is used.
43
- 5. Make the smallest scoped change that satisfies the child's acceptance criteria.
44
- 6. Do not touch files outside the child's scope.
45
- 7. Do not perform unrelated cleanup.
46
- 8. If a discovery falls outside the child's scope: note it as a follow-up — do not silently expand scope.
47
-
48
- ### Failed Result Packet Detection
49
-
50
- If the worker returns a failed result packet (status: "failure"):
51
- 1. Mark `triage_required: true` in the cluster state
52
- 2. Record the failed result packet for Medic dispatch
53
- 3. The Foreman will dispatch Medic in step 08 before Librarian
54
- 4. Runnable sibling work continues in parallel with Medic dispatch
55
-
56
- ## Blocker protocol
57
-
58
- If the child cannot proceed:
59
-
60
- ```
61
- polaris loop abort "<reason>"
62
- ```
63
-
64
- Halt. Report the unblock condition. Do not skip to later children.
65
-
66
- ## Artifact update
67
-
68
- Update `.taskchain_artifacts/polaris-run/current-state.json`:
69
- - `current_step_id: 04-execute-child`
70
- - `status: executing`
71
- - `updated_at: <timestamp>`
72
-
73
- ## Next step
74
-
75
- 05-validate-child
@@ -1,57 +0,0 @@
1
- ---
2
- name: polaris-run-step-05-validate-child
3
- description: Validate the worker-returned child evidence and validation summary without re-implementing child work in the parent.
4
- ---
5
-
6
- # Step 05 — Validate child
7
-
8
- ## Purpose
9
-
10
- Confirm the worker's returned child evidence is correct without re-implementing child work in the parent.
11
-
12
- ## Scope declarations
13
-
14
- ```yaml
15
- allowed_files:
16
- - changed files from current child
17
- - test, lint, or build config needed for narrow validation
18
- - .taskchain_artifacts/polaris-run/current-state.json
19
- allowed_routes:
20
- - CLAUDE.md
21
- - .polaris/skills/polaris-run/chain.md
22
- expected_evidence:
23
- - narrowest useful validation command recorded
24
- - validation result tied to current child scope
25
- - unvalidated items explicitly listed
26
- stop_rules:
27
- - validation command cannot run for environment reasons
28
- - validation failure is outside child scope
29
- ```
30
-
31
- ## Actions
32
-
33
- 1. Validate the worker return packet for the active child (child ID, status, commit hash when applicable, and validation summary).
34
- 2. Do not implement fixes inline in the parent session. If changes are needed, dispatch a worker for the child scope.
35
- 3. Do not run broad test suites — those belong in step 08.
36
- 4. If validation fails and is within child scope: return to dispatch flow for worker remediation.
37
- 5. If the failure is outside child scope: note it as a follow-up and proceed.
38
- 6. Record the validation result:
39
- - **Status**: `passed` | `failed` | `skipped`
40
- - **Commands run**: names only (e.g., `npm run lint`, `npm test -- <file>`)
41
- - **Count**: N passed / M failed
42
- - **First error**: first failing check name only, if failed
43
- - **Maximum**: 5–10 lines total — no raw stdout/stderr
44
-
45
- ## Artifact update
46
-
47
- Update `.taskchain_artifacts/polaris-run/current-state.json`:
48
- - `validation_status: <passed | failed | skipped>`
49
- - `current_step_id: 05-validate-child`
50
- - `status: validating`
51
- - `updated_at: <timestamp>`
52
-
53
- Telemetry remains checkpoint-only. Do not emit per-step `step-complete` events.
54
-
55
- ## Next step
56
-
57
- 06-commit-and-update-linear
@@ -1,74 +0,0 @@
1
- ---
2
- name: polaris-run-step-06-commit-and-update-linear
3
- description: Record worker return outcomes for the active child and update Linear completion state without inline parent implementation.
4
- ---
5
-
6
- # Step 06 — Record completion and update Linear
7
-
8
- ## Purpose
9
-
10
- Record worker-returned completion state, update Linear, and prepare for continuation decisions.
11
-
12
- ## Scope declarations
13
-
14
- ```yaml
15
- allowed_files:
16
- - changed files from current child
17
- - .taskchain_artifacts/polaris-run/current-state.json
18
- - .taskchain_artifacts/polaris-run/runs/*.jsonl
19
- allowed_routes:
20
- - CLAUDE.md
21
- - .polaris/skills/polaris-run/chain.md
22
- expected_evidence:
23
- - worker return includes commit hash or explicit no-commit status
24
- - parent completion record written only after return validation
25
- - Linear evidence comment added with run_id
26
- - child marked Done only after criteria pass
27
- stop_rules:
28
- - unexpected files appear in diff
29
- - Linear update or commit fails
30
- - child acceptance criteria not met
31
- ```
32
-
33
- ## Actions
34
-
35
- 1. Read the worker return for the active child and verify completion evidence (status, commit hash when applicable, and validation summary).
36
- 2. Re-fetch the current child issue from Linear to get latest acceptance criteria.
37
- 3. Add a concise evidence comment to the Linear child issue. The comment must open with:
38
- ```yaml
39
- run_id: <run_id>
40
- skill: polaris-run
41
- ```
42
- Followed by: what was done, commit hash, validation result from step 05.
43
- 4. Mark the child Done in Linear **only if** its acceptance criteria are satisfied.
44
- - If criteria are not met: leave the child open, add a comment with the gap, treat as blocked.
45
- 5. Do not run `npm run polaris -- map update --changed` per child. Map update belongs at final delivery/session end unless runtime requirements explicitly override this.
46
-
47
- ## Blocker escalation
48
-
49
- If the child cannot be marked Done:
50
- - Run `npm run polaris -- loop abort "<reason>"`.
51
- - Add a comment with the unblock condition.
52
- - Halt. Do not continue to the next child.
53
-
54
- ## Artifact update
55
-
56
- If no blocker:
57
-
58
- Update `.taskchain_artifacts/polaris-run/current-state.json`:
59
- - `current_step_id: 06-commit-and-update-linear`
60
- - `last_commit: <hash>`
61
- - `active_child` moved to `completed_children`
62
- - `context_budget.children_completed` incremented
63
- - `updated_at: <timestamp>`
64
-
65
- Telemetry remains checkpoint-only. Do not emit per-step `step-complete` events.
66
-
67
- If blocker escalation:
68
- - `status: blocked`
69
- - `current_step_id: halted`
70
- - `updated_at: <timestamp>`
71
-
72
- ## Next step
73
-
74
- 07-decide-continuation (or halted if blocker escalation triggered)
@@ -1,89 +0,0 @@
1
- ---
2
- name: polaris-run-step-07-decide-continuation
3
- description: Run all eligible children via loop run, then decide continuation (DISPATCH / STOP / DELIVER).
4
- ---
5
-
6
- # Step 07 — Decide continuation
7
-
8
- ## Purpose
9
-
10
- Execute the cluster's remaining children via the runtime's batch dispatch loop, then determine
11
- whether to continue, halt, or proceed to delivery.
12
-
13
- ## Scope declarations
14
-
15
- ```yaml
16
- allowed_files:
17
- - .taskchain_artifacts/polaris-run/current-state.json
18
- - .taskchain_artifacts/polaris-run/runs/*.jsonl
19
- - .polaris/runs/current-state.json
20
- allowed_routes:
21
- - CLAUDE.md
22
- - .polaris/skills/polaris-run/chain.md
23
- expected_evidence:
24
- - npm run polaris -- loop run executed
25
- - RUNNING <child-id> (N/M) signal emitted per child
26
- - COMPLETE <child-id> (commit: <sha>) signal emitted per child
27
- - COMPLETE (cluster-complete) or blocked exit recorded
28
- stop_rules:
29
- - loop run exits non-zero (blocked or error)
30
- - budget exhausted in fixed-cap mode (children_completed >= budget.max_children from polaris.config.json)
31
- - all children Done but delivery not yet requested
32
- ```
33
-
34
- ## Actions
35
-
36
- Run the batch dispatch loop:
37
-
38
- ```bash
39
- npm run polaris -- loop run <cluster-id>
40
- ```
41
-
42
- The runtime manages everything internally: child selection, packet compilation, provider dispatch
43
- (with automatic fallback through `providerPolicy.worker.providers`), CompactReturn validation,
44
- and state checkpointing. The Foreman must not call `loop dispatch` or `loop continue` individually.
45
-
46
- Monitor the subprocess output for progress signals:
47
- - `[POLARIS] RUNNING <child-id> (N/M)` — child dispatch started
48
- - `[POLARIS] COMPLETE <child-id> (commit: <sha>)` — child finished and checkpointed
49
- - `[POLARIS] COMPLETE (cluster-complete)` — all children done, subprocess exits 0
50
-
51
- Evaluate the exit to determine the decision:
52
-
53
- ### DISPATCH (all remaining children) — default
54
-
55
- `loop run` dispatches all eligible children serially and exits when done. No per-child handling
56
- by the Foreman is needed. When `loop run` exits 0 with `cluster-complete`, proceed to STOP
57
- (all-done) or DELIVER.
58
-
59
- ### STOP (blocked)
60
-
61
- If `loop run` exits non-zero:
62
- - Report the blocker and unblock condition from the output.
63
- - Do not push. Do not create a PR.
64
- - Resume instruction: resolve the blocker then run `npm run polaris -- loop run <cluster-id>`.
65
-
66
- ### STOP (all-done, awaiting delivery)
67
-
68
- If `loop run` exits 0 and all children are Done but delivery was not explicitly requested:
69
- - Halt cleanly.
70
- - Report: all children Done, branch name, last commit.
71
- - Provide delivery command: `Use polaris-run on <PARENT-ID>. Finalize delivery.`
72
- - Do not push. Do not create a PR.
73
-
74
- ### DELIVER
75
-
76
- Proceed to step 08 only if:
77
- - All children are Done (confirmed via runtime state).
78
- - The user explicitly requested delivery in this session invocation.
79
-
80
- ## Artifact update
81
-
82
- Update `.taskchain_artifacts/polaris-run/current-state.json`:
83
- - `status: stopped`
84
- - `current_step_id: 07-decide-continuation`
85
- - `updated_at: <timestamp>`
86
-
87
- ## Next step
88
-
89
- halted (STOP) or 08-closeout-librarian (DELIVER)
@@ -1,146 +0,0 @@
1
- ---
2
- name: polaris-run-step-08-closeout-librarian
3
- description: Dispatch the Closeout Librarian exactly once after cluster-complete. PR creation is blocked until the Librarian result is validated.
4
- ---
5
-
6
- # Step 08 — Closeout Librarian
7
-
8
- ## Purpose
9
-
10
- The Closeout Librarian reconciles completed cluster work into project cognition and documentation.
11
- It runs exactly once per cluster, after all children complete and before PR creation.
12
-
13
- PR creation MUST NOT occur until this step succeeds.
14
-
15
- ## Preconditions
16
-
17
- - All children in this cluster are confirmed Done.
18
- - The cluster state is `cluster-complete`.
19
- - The delivery branch is clean (no uncommitted worker changes).
20
-
21
- If any precondition fails: stop and report. Do not proceed.
22
-
23
- ## Librarian Dispatch Model
24
-
25
- The Closeout Librarian is dispatched as a bounded session, separate from worker sessions.
26
- The Foreman:
27
- 1. Generates the Librarian packet.
28
- 2. Dispatches the Librarian as a subagent (same dispatch model as workers).
29
- 3. Waits for the Librarian to write its sealed result JSON.
30
- 4. Validates the result before proceeding to step 09.
31
-
32
- The Foreman does NOT:
33
- - Read the Librarian's session transcript.
34
- - Observe the Librarian's execution in detail.
35
- - Repair the Librarian's output manually.
36
- - Skip this step because the Librarian appears slow.
37
-
38
- ## Actions
39
-
40
- ### 8.1 Generate Librarian Packet
41
-
42
- Run:
43
- ```bash
44
- npm run polaris -- librarian packet <cluster-id>
45
- ```
46
-
47
- This generates a `CloseoutLibrarianPacket` at:
48
- `.polaris/clusters/<cluster-id>/librarian-packet-<dispatch-id>.json`
49
-
50
- The packet includes:
51
- - All completed child IDs, commit SHAs, changed files
52
- - All affected folder POLARIS.md and SUMMARY.md paths
53
- - All pending cognition note paths
54
- - SmartDocs raw paths for ingestion consideration
55
- - Run report path
56
- - Result path: `.polaris/clusters/<cluster-id>/librarian-result-<dispatch-id>.json`
57
- - Prohibited and allowed write paths
58
-
59
- If packet generation fails: stop and report. Do not dispatch.
60
-
61
- ### 8.2 Dispatch Librarian Session
62
-
63
- Dispatch the Librarian as a bounded subagent session:
64
- ```text
65
- Packet path: .polaris/clusters/<cluster-id>/librarian-packet-<dispatch-id>.json
66
- Role: closeout-librarian
67
- Skill: .polaris/skills/closeout-librarian/SKILL.md
68
- ```
69
-
70
- The Librarian session prompt must contain ONLY the packet path. Do not add implementation
71
- instructions or context. The packet is the complete and authoritative instruction source.
72
-
73
- Dispatch boundary enforcement:
74
- - The Foreman does not inline the Librarian's work.
75
- - The Foreman waits for the sealed result file to appear at the packet's `result_path`.
76
- - The Foreman does not read the Librarian's transcript.
77
-
78
- ### 8.3 Wait for Sealed Result
79
-
80
- Wait for the Librarian to write the sealed result JSON to `packet.result_path`.
81
-
82
- Timeout: 10 minutes (600 seconds). If timeout exceeded:
83
- 1. Record blocker: `librarian-timeout`
84
- 2. Escalate to operator with options:
85
- - Re-dispatch Librarian
86
- - Halt run
87
-
88
- ### 8.4 Validate Librarian Result
89
-
90
- Read the sealed result JSON from `packet.result_path`.
91
-
92
- Validate:
93
- 1. `result.role` must be `"closeout-librarian"`
94
- 2. `result.run_id` must match the active run
95
- 3. `result.dispatch_id` must match the dispatch
96
- 4. `result.status` must be `"success"` or `"partial"` to proceed
97
- 5. If `result.commit_sha` is non-null: verify the commit is in the current git log
98
- 6. `result.files_committed` must not contain any path from `prohibited_write_paths`
99
-
100
- ### 8.5 Decision
101
-
102
- | Result Status | Action |
103
- |---|---|
104
- | `"success"` | Proceed to step 09 |
105
- | `"partial"` | Proceed to step 09; record partial result in run state |
106
- | `"blocked"` | Halt; escalate to operator with blocker descriptions |
107
- | `"failure"` | Halt; escalate to operator with failure details |
108
- | Result file missing | Halt; escalate: librarian did not produce output |
109
-
110
- ### 8.6 Record Librarian Result in State
111
-
112
- Update run state with the Librarian dispatch record:
113
- ```json
114
- {
115
- "librarian_dispatch_id": "<dispatch-id>",
116
- "librarian_commit": "<commit_sha or null>",
117
- "librarian_status": "<status>",
118
- "librarian_completed_at": "<ISO timestamp>"
119
- }
120
- ```
121
-
122
- ## Scope Declarations
123
-
124
- ```yaml
125
- allowed_files:
126
- - .polaris/clusters/<cluster-id>/librarian-packet-*.json
127
- - .polaris/clusters/<cluster-id>/librarian-result-*.json
128
- - .taskchain_artifacts/polaris-run/current-state.json
129
- allowed_routes:
130
- - .polaris/skills/closeout-librarian/SKILL.md
131
- - .polaris/skills/closeout-librarian/chain.md
132
- expected_evidence:
133
- - librarian packet generated
134
- - librarian session dispatched
135
- - sealed result written and validated
136
- - librarian result recorded in run state
137
- stop_rules:
138
- - preconditions not met
139
- - packet generation fails
140
- - librarian result status is "blocked" or "failure"
141
- - result validation fails
142
- ```
143
-
144
- ## Next Step
145
-
146
- Proceed to step 09 (final delivery) only when librarian result status is `"success"` or `"partial"`.
@@ -1,91 +0,0 @@
1
- ---
2
- name: polaris-run-step-08-final-delivery
3
- description: Run polaris finalize to push, open the draft PR, emit JSONL closeout events, and archive the run snapshot.
4
- ---
5
-
6
- # Step 08 — Final delivery
7
-
8
- ## Purpose
9
-
10
- Complete the parent cluster via `polaris finalize run` — the Polaris runtime handles push, PR, telemetry, and archive.
11
-
12
- ## Preconditions (verify before proceeding)
13
-
14
- - All children in this parent cluster are marked Done in Linear.
15
- - The branch is clean (no uncommitted changes).
16
-
17
- If any precondition fails: stop and report the gap.
18
-
19
- ## Scope declarations
20
-
21
- ```yaml
22
- allowed_files:
23
- - .taskchain_artifacts/polaris-run/current-state.json
24
- - .taskchain_artifacts/polaris-run/runs/*.jsonl
25
- - .taskchain_artifacts/polaris-run/run-report.md
26
- - git log and branch metadata
27
- allowed_routes:
28
- - CLAUDE.md
29
- - .polaris/skills/polaris-run/chain.md
30
- expected_evidence:
31
- - all children Done in Linear
32
- - polaris finalize executed successfully
33
- - PR URL recorded
34
- - run-complete event in telemetry JSONL
35
- stop_rules:
36
- - any child is not Done
37
- - branch has uncommitted changes
38
- - polaris finalize fails
39
- ```
40
-
41
- ## Actions
42
-
43
- 1. Verify all children are Done in Linear (re-fetch, do not assume).
44
- 2. Verify the working tree is clean.
45
- 3. Run:
46
- ```bash
47
- npm run polaris -- finalize run
48
- ```
49
- `npm run polaris -- finalize run` executes the full 12-step sequence:
50
- - Validates the Polaris map
51
- - Validates `current-state.json` schema
52
- - Runs targeted checks
53
- - Generates `run-report.md`
54
- - Commits any pending artifacts
55
- - Pushes the branch
56
- - Opens a draft PR targeting `main`
57
- - Updates `current-state.json` to `status: complete`
58
- - Appends `pr-opened` and `run-complete` events to telemetry JSONL
59
- - Updates Linear parent with PR URL
60
- - Archives the run snapshot to `.polaris/runs/<run-id>/`
61
-
62
- 4. Add a final evidence comment to the Linear parent issue including the PR URL and `run_id`.
63
-
64
- ## PR body requirements (handled by polaris finalize — verify the generated PR includes)
65
-
66
- - Completed child issue IDs and titles
67
- - Summary of files changed
68
- - Validation result
69
- - Residual risks (if any)
70
- - Run metadata footer:
71
- ```text
72
- ---
73
- Run-ID: <run_id>
74
- Skill: polaris-run
75
- Tracker: linear / <parent_issue_id>
76
- Related-Run-ID: <related_run_id or omit if null>
77
- ```
78
-
79
- ## Artifact update
80
-
81
- `polaris finalize` handles all artifact updates. Verify afterward:
82
-
83
- - `.taskchain_artifacts/polaris-run/current-state.json`: `status: complete`
84
- - `.taskchain_artifacts/polaris-run/run-report.md`: exists and complete
85
- - Telemetry JSONL: ends with `run-complete` event
86
-
87
- Do not report completion until these are verified.
88
-
89
- ## Session end
90
-
91
- This is the terminal step.
@@ -1,104 +0,0 @@
1
- ---
2
- name: polaris-run-step-09-final-delivery
3
- description: Run polaris finalize to push, open the PR, emit JSONL closeout events, and archive the run snapshot. Proceeds only after Closeout Librarian succeeds.
4
- ---
5
-
6
- # Step 09 — Final Delivery
7
-
8
- ## Purpose
9
-
10
- Complete the parent cluster via `polaris finalize run` — the Polaris runtime handles push,
11
- PR, telemetry, and archive.
12
-
13
- This step runs ONLY after the Closeout Librarian in step 08 has completed successfully
14
- (status: `"success"` or `"partial"`).
15
-
16
- ## Preconditions (verify before proceeding)
17
-
18
- - All children in this parent cluster are marked Done in Linear.
19
- - Closeout Librarian completed (step 08) with status `"success"` or `"partial"`.
20
- - The branch is clean (no uncommitted changes beyond the librarian commit).
21
-
22
- If any precondition fails: stop and report the gap.
23
-
24
- ## Scope Declarations
25
-
26
- ```yaml
27
- allowed_files:
28
- - .taskchain_artifacts/polaris-run/current-state.json
29
- - .taskchain_artifacts/polaris-run/runs/*.jsonl
30
- - .taskchain_artifacts/polaris-run/run-report.md
31
- - git log and branch metadata
32
- allowed_routes:
33
- - CLAUDE.md
34
- - .polaris/skills/polaris-run/chain.md
35
- expected_evidence:
36
- - closeout librarian completed (step 08)
37
- - all children Done in Linear
38
- - polaris finalize executed successfully
39
- - PR URL recorded
40
- - run-complete event in telemetry JSONL
41
- stop_rules:
42
- - closeout librarian not completed or failed
43
- - any child is not Done
44
- - branch has uncommitted changes
45
- - polaris finalize fails
46
- ```
47
-
48
- ## Actions
49
-
50
- 1. Verify step 08 (Closeout Librarian) completed with `"success"` or `"partial"` status.
51
- 2. Verify all children are Done in Linear (re-fetch, do not assume).
52
- 3. Verify the working tree is clean.
53
- 4. Run:
54
- ```bash
55
- npm run polaris -- map index && npm run polaris -- finalize run --state-file .taskchain_artifacts/polaris-run/current-state.json
56
- ```
57
-
58
- `map index` rebuilds the atlas so finalize has accurate route data. `finalize run` then executes the full finalize sequence:
59
- - Validates the Polaris map
60
- - Validates `current-state.json` schema
61
- - Runs targeted checks
62
- - Generates `run-report.md`
63
- - Commits any pending artifacts
64
- - Pushes the branch (including the librarian commit)
65
- - Opens a draft PR targeting `main`
66
- - Updates `current-state.json` to `status: complete`
67
- - Appends `pr-opened` and `run-complete` events to telemetry JSONL
68
- - Updates Linear parent with PR URL
69
- - Archives the run snapshot to `.polaris/runs/<run-id>/`
70
-
71
- 5. Add a final evidence comment to the Linear parent issue including the PR URL, `run_id`,
72
- and `librarian_commit` SHA (from step 08).
73
-
74
- ## PR Body Requirements (handled by polaris finalize — verify the generated PR includes)
75
-
76
- - Completed child issue IDs and titles
77
- - Summary of files changed
78
- - Validation result
79
- - Librarian commit SHA and summary (from step 08 result)
80
- - Residual risks (if any)
81
- - Run metadata footer:
82
- ```text
83
- ---
84
- Run-ID: <run_id>
85
- Skill: polaris-run
86
- Tracker: linear / <parent_issue_id>
87
- Librarian-Commit: <commit_sha or none>
88
- Librarian-Status: <status>
89
- Related-Run-ID: <related_run_id or omit if null>
90
- ```
91
-
92
- ## Artifact Update
93
-
94
- `polaris finalize` handles all artifact updates. Verify afterward:
95
-
96
- - `.taskchain_artifacts/polaris-run/current-state.json`: `status: complete`
97
- - `.taskchain_artifacts/polaris-run/run-report.md`: exists and complete
98
- - Telemetry JSONL: ends with `run-complete` event
99
-
100
- Do not report completion until these are verified.
101
-
102
- ## Session End
103
-
104
- This is the terminal step.