@lsctech/polaris 0.3.22 → 0.3.24

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 (147) 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 +2 -2
  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/skills/polaris-tools/SKILL.md +1 -1
  44. package/dist/workspace/POLARIS_RULES.md +169 -0
  45. package/package.json +3 -2
  46. package/dist/workspace/workspace/.polaris/roles/analyst.md +0 -38
  47. package/dist/workspace/workspace/.polaris/roles/closeout-librarian.md +0 -122
  48. package/dist/workspace/workspace/.polaris/roles/cognition-librarian.md +0 -37
  49. package/dist/workspace/workspace/.polaris/roles/finalizer.md +0 -45
  50. package/dist/workspace/workspace/.polaris/roles/foreman.md +0 -165
  51. package/dist/workspace/workspace/.polaris/roles/librarian.md +0 -74
  52. package/dist/workspace/workspace/.polaris/roles/worker.md +0 -119
  53. package/dist/workspace/workspace/.polaris/session-type +0 -1
  54. package/dist/workspace/workspace/.polaris/skills/ROUTING.md +0 -113
  55. package/dist/workspace/workspace/.polaris/skills/caveman/SKILL.md +0 -74
  56. package/dist/workspace/workspace/.polaris/skills/caveman-compress/scripts/compress.py +0 -272
  57. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/POLARIS.md +0 -46
  58. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/SKILL.md +0 -59
  59. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/chain.md +0 -116
  60. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/01-load-cluster-context.md +0 -78
  61. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/02-drift-reconciliation.md +0 -157
  62. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/03-reconcile-polaris-md.md +0 -93
  63. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/04-reconcile-summary-md.md +0 -106
  64. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/05-doc-ingestion.md +0 -114
  65. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/06-link-validation.md +0 -128
  66. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/07-yaml-linking.md +0 -95
  67. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/08-librarian-commit.md +0 -119
  68. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/09-sealed-result.md +0 -118
  69. package/dist/workspace/workspace/.polaris/skills/docs-ingest/SKILL.md +0 -68
  70. package/dist/workspace/workspace/.polaris/skills/docs-ingest/chain.json +0 -23
  71. package/dist/workspace/workspace/.polaris/skills/docs-ingest/chain.md +0 -149
  72. package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/01-orient-ingest.md +0 -85
  73. package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/02-classify-batch.md +0 -87
  74. package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/03-conflict-check.md +0 -66
  75. package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/04-place-and-link.md +0 -77
  76. package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/05-finalize-ingest.md +0 -49
  77. package/dist/workspace/workspace/.polaris/skills/docs-promote/SKILL.md +0 -79
  78. package/dist/workspace/workspace/.polaris/skills/docs-promote/chain.json +0 -25
  79. package/dist/workspace/workspace/.polaris/skills/docs-promote/chain.md +0 -80
  80. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/01-orient-promote.md +0 -53
  81. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/02-review-candidates.md +0 -51
  82. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/03-read-linked-code.md +0 -50
  83. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/04-conflict-surface.md +0 -65
  84. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/05-await-approval.md +0 -61
  85. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/06-execute-promote-deprecate.md +0 -65
  86. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/07-finalize-promote.md +0 -44
  87. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/SKILL.md +0 -94
  88. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/chain.json +0 -20
  89. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/chain.md +0 -105
  90. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/issue-reconciliation.md +0 -149
  91. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/issue-template.md +0 -133
  92. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/linked-skills/repo-analysis.md +0 -55
  93. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/01-fetch-and-orient.md +0 -79
  94. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/02-map-affected-code.md +0 -58
  95. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/03-assess-issue.md +0 -58
  96. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/04-blocker-check.md +0 -60
  97. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/05-create-cluster-plan.md +0 -197
  98. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/06-final-report.md +0 -60
  99. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/SKILL.md +0 -91
  100. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/chain.json +0 -22
  101. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/chain.md +0 -85
  102. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/01-orient-catalog.md +0 -92
  103. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/02-reconcile-polaris-md.md +0 -33
  104. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/03-reconcile-summary-md.md +0 -70
  105. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/04-classify-and-place.md +0 -117
  106. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/05-catalog-commit.md +0 -94
  107. package/dist/workspace/workspace/.polaris/skills/polaris-medic/SKILL.md +0 -52
  108. package/dist/workspace/workspace/.polaris/skills/polaris-medic/chain.md +0 -111
  109. package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/01-orient-medic.md +0 -75
  110. package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/02-diagnose.md +0 -79
  111. package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/03-repair.md +0 -64
  112. package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/04-validate.md +0 -66
  113. package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/05-create-chart.md +0 -85
  114. package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/06-closeout.md +0 -86
  115. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/SKILL.md +0 -75
  116. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/chain.json +0 -20
  117. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/chain.md +0 -67
  118. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/steps/01-orient-reconcile.md +0 -82
  119. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/steps/02-reconcile-polaris-md.md +0 -95
  120. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/steps/03-reconcile-summary-md.md +0 -108
  121. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/steps/04-reconcile-commit.md +0 -88
  122. package/dist/workspace/workspace/.polaris/skills/polaris-run/SKILL.md +0 -135
  123. package/dist/workspace/workspace/.polaris/skills/polaris-run/chain.json +0 -19
  124. package/dist/workspace/workspace/.polaris/skills/polaris-run/chain.md +0 -298
  125. package/dist/workspace/workspace/.polaris/skills/polaris-run/execution-adapter.md +0 -34
  126. package/dist/workspace/workspace/.polaris/skills/polaris-run/linked-skills/repo-analysis.md +0 -58
  127. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/01-orient-cluster.md +0 -96
  128. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/02-prepare-branch.md +0 -53
  129. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/03-select-child.md +0 -63
  130. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/04-execute-child.md +0 -75
  131. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/05-validate-child.md +0 -57
  132. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/06-commit-and-update-linear.md +0 -74
  133. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/07-decide-continuation.md +0 -89
  134. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/08-closeout-librarian.md +0 -146
  135. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/08-final-delivery.md +0 -91
  136. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/09-final-delivery.md +0 -104
  137. package/dist/workspace/workspace/.polaris/skills/polaris-tools/README.md +0 -63
  138. package/dist/workspace/workspace/.polaris/skills/polaris-tools/SKILL.md +0 -94
  139. package/dist/workspace/workspace/.polaris/skills/polaris-tools/tools.js +0 -191
  140. package/dist/workspace/workspace/smartdocs/architecture/.gitkeep +0 -0
  141. package/dist/workspace/workspace/smartdocs/audits/.gitkeep +0 -0
  142. package/dist/workspace/workspace/smartdocs/decisions/.gitkeep +0 -0
  143. package/dist/workspace/workspace/smartdocs/doctrine/active/.gitkeep +0 -0
  144. package/dist/workspace/workspace/smartdocs/runtime/.gitkeep +0 -0
  145. package/dist/workspace/workspace/smartdocs/specs/active/.gitkeep +0 -0
  146. package/dist/workspace/workspace/smartdocs/specs/archive/.gitkeep +0 -0
  147. /package/dist/workspace/{workspace/.polaris → .polaris}/skills/docs-review/chain.md +0 -0
@@ -1,298 +0,0 @@
1
- ---
2
- name: polaris-run-chain
3
- description: Route map for polaris-run — step order, continuation rules, Polaris runtime integration, and artifact update requirements.
4
- ---
5
-
6
- # polaris-run chain
7
-
8
- ## Authority
9
-
10
- **Polaris runtime state is authoritative. Chat reasoning is not authoritative.**
11
-
12
- Query runtime state before acting. Do not infer cluster scope or progress from conversation context.
13
-
14
- ## Thin-Parent Orchestration
15
-
16
- This skill operates under a **thin-parent** model. The agent running this `chain.md` is an orchestrator, not an implementer.
17
-
18
- **Core principles:**
19
- - **The orchestrator does not write code.** All implementation is delegated to workers via `polaris loop dispatch`.
20
- - **The orchestrator does not narrate implementation details.** Its communication should be concise and focused on the orchestration state (dispatching, checkpointing, blocked, complete).
21
- - **The orchestrator does not reason about the repository.** All repository-level cognition belongs to the worker.
22
-
23
- ### Narration Suppression
24
-
25
- To enforce the thin-parent model, the orchestrator's narration is strictly suppressed.
26
-
27
- **Allowed narration:**
28
- - Announcing the start of a run.
29
- - Announcing the dispatch of a child.
30
- - Announcing the completion of a child and the next step (continue, finalize, or stop).
31
- - Announcing a blocker.
32
-
33
- **Forbidden narration:**
34
- - Summarizing code changes made by a worker.
35
- - Explaining implementation details.
36
- - Speculating on architecture or design.
37
- - Any form of "thinking out loud" about the repository content.
38
-
39
- The `polaris loop run` command may provide terse, single-line status updates for headless/SSH execution. The agent should not add any extra narration around these.
40
-
41
- ## CHECKPOINT gate
42
-
43
- **The Foreman must discard worker output except the CompactReturn JSON object.**
44
-
45
- When `loop run` exits, the only content the Foreman may retain from the worker subprocess is:
46
- - The final `[POLARIS] COMPLETE <child-id> (commit: <sha>)` signal
47
- - The CompactReturn JSON emitted as the last line of worker stdout
48
-
49
- The Foreman must NOT:
50
- - Read, store, or summarize raw worker output or transcripts
51
- - Inspect worker tool-call history
52
- - Ingest implementation details from worker stderr
53
-
54
- This gate enforces the thin-parent model: the Foreman is a scheduler, not a consumer of implementation content.
55
-
56
- **Preserve the existing step order.** Do not reorder, skip, or merge steps. Each step has a defined entry condition and exit artifact.
57
-
58
- ## CLI
59
-
60
- Always use the repo-local Polaris CLI:
61
-
62
- ```
63
- npm run polaris -- <command>
64
- ```
65
-
66
- Never assume a globally linked `polaris` command exists.
67
-
68
- ## Step traversal order
69
-
70
- ```text
71
- 01-orient-cluster
72
- 02-prepare-branch
73
- 03-select-child
74
- 04-execute-child ← worker/adapter-owned execution phase
75
- 05-validate-child ← worker-owned validation phase
76
- 06-commit-and-update-linear ← worker-return validation and completion recording
77
- 07-decide-continuation → DISPATCH boundary | CHECKPOINT after worker return | STOP (blocked/all-done) | DELIVER: go to 08
78
- 08-medic-dispatch ← dispatch Medic if triage required (before Librarian)
79
- 09-closeout-librarian ← dispatched once per cluster; PR creation blocked until result validated
80
- 10-final-delivery ← reached only after closeout librarian succeeds
81
- ```
82
-
83
- ## CHECKPOINT gate
84
-
85
- At each worker return boundary (step 07), apply the CHECKPOINT gate before proceeding:
86
-
87
- 1. Accept and discard worker output except the CompactReturn JSON object — all other session content is discarded.
88
- 2. Parse the CompactReturn JSON. If it is missing or malformed, treat as a blocker and stop.
89
- 3. Pass the CompactReturn JSON to `npm run polaris -- loop continue` for state persistence.
90
- 4. Preserve the existing step order — do not reorder, skip, or repeat steps based on worker output content.
91
-
92
- ## Continuation rules
93
-
94
- After step 07 evaluates the session:
95
-
96
- - **DISPATCH (all remaining children)**: run `npm run polaris -- loop run <cluster-id>`. The runtime dispatches all eligible children serially, enforcing dispatch boundaries internally. The Foreman waits for the subprocess to exit. Progress signals are emitted as `[POLARIS] RUNNING <child-id> (N/M)` and `[POLARIS] COMPLETE <child-id> (commit: <sha>)`. No per-child CompactReturn handling or state repair is needed — the runtime owns that boundary.
97
- - **STOP (blocked)**: halt immediately on blocker. Report unblock condition.
98
- - **STOP (all-done, awaiting delivery)**: `loop run` exits when all children are done. Report branch and last commit. Provide delivery command: `Use polaris-run on <PARENT-ID>. Finalize delivery.`
99
- - **DELIVER**: proceed to step 08 (Closeout Librarian) only when all children are Done and the user explicitly requests delivery in this session invocation.
100
-
101
- ## Closeout Librarian boundary
102
-
103
- **The Closeout Librarian runs exactly once per cluster, between all-children-done and PR creation.**
104
-
105
- Step 08 dispatches the Librarian as a bounded session (same model as worker dispatch).
106
- The Foreman waits for the Librarian's sealed result before proceeding to step 09.
107
- PR creation (step 09) is blocked until the Librarian result status is `"success"` or `"partial"`.
108
-
109
- **Librarian dispatch message template:**
110
-
111
- When dispatching the Closeout Librarian, pass this full message — NOT just the packet path. Replace `<cluster-id>`, `<packet_path>`, `<run_id>`, and `<dispatch_id>` with values from the packet file:
112
-
113
- ```
114
- You are the Closeout Librarian for cluster <cluster-id>.
115
-
116
- Your sealed packet is at: <packet_path>
117
-
118
- Read the packet. Follow the closeout-librarian skill chain. Write your sealed result to the path in the packet's `result_path` field. Return only compact JSON: {"role":"closeout-librarian","status":"done","run_id":"<run_id>","cluster_id":"<cluster-id>","dispatch_id":"<dispatch_id>","commit":"<sha>"}.
119
- ```
120
-
121
- Never dispatch the librarian with only the packet path as the message.
122
-
123
- The Foreman must NOT:
124
- - Read the Librarian's session transcript
125
- - Inline the Librarian's work
126
- - Skip step 08 because it appears slow
127
- - Repair the Librarian's output manually
128
- - Run the Librarian after individual workers (cluster-complete only)
129
-
130
- ## Medic Dispatch Boundary
131
-
132
- **Medic is dispatched when a worker returns a failed result packet and triage is required.**
133
-
134
- Step 08 dispatches Medic as a bounded session (same model as worker dispatch) when:
135
- - A worker result packet has `status: "failure"`
136
- - The Foreman marks `triage_required: true` in the cluster state
137
- - Runnable sibling work continues in parallel with Medic dispatch
138
-
139
- **Medic dispatch message template:**
140
-
141
- When dispatching Medic, pass this full message — NOT just the packet path. Replace `<cluster-id>`, `<packet_path>`, `<run_id>`, and `<dispatch_id>` with values from the packet file:
142
-
143
- ```
144
- You are the Medic for cluster <cluster-id>.
145
-
146
- Your sealed packet is at: <packet_path>
147
-
148
- Read the packet. Follow the polaris-medic skill chain. Write your sealed result to the path in the packet's `result_path` field. Return only compact JSON: {"role":"medic","status":"done","run_id":"<run_id>","cluster_id":"<cluster-id>","dispatch_id":"<dispatch_id>","commit":"<sha>","chart_id":"<chart_id>"}.
149
- ```
150
-
151
- Never dispatch Medic with only the packet path as the message.
152
-
153
- The Foreman must NOT:
154
- - Read the Medic's session transcript
155
- - Inline the Medic's work
156
- - Skip Medic dispatch when triage is required
157
- - Repair the Medic's output manually
158
- - Dispatch Medic for successful worker results
159
-
160
- **Medic and Foreman parallelism:**
161
-
162
- When Medic is dispatched, the Foreman continues dispatching runnable sibling work in parallel. Medic does not block other children from executing. Medic runs independently and reports its result when complete. The Librarian waits for both all children and any Medic dispatches to complete before reconciliation.
163
-
164
- ## Dispatch boundary enforcement (runtime-owned)
165
-
166
- **The runtime enforces dispatch boundaries. Parent/orchestrator inline implementation is forbidden.**
167
-
168
- This is not advisory. The runtime will hard-fail with `process.exit(1)` on violations.
169
-
170
- `loop run` owns the full dispatch→checkpoint loop internally. The Foreman must not call `loop dispatch` or `loop continue` individually — doing so bypasses the boundary enforcement that `loop run` manages.
171
-
172
- ### Allowed transition (only legal path)
173
-
174
- ```
175
- Foreman → npm run polaris -- loop run <cluster-id>
176
- ↓ (subprocess)
177
- runtime selects child
178
- runtime dispatches worker externally
179
- runtime receives CompactReturn → checkpoints → next child
180
- runtime emits: [POLARIS] RUNNING <child> (N/M)
181
- runtime emits: [POLARIS] COMPLETE <child> (commit: <sha>)
182
- (repeat for each child)
183
- runtime emits: [POLARIS] COMPLETE (cluster-complete)
184
- subprocess exits 0
185
- Foreman proceeds to step 07 STOP/DELIVER
186
- ```
187
-
188
- ### Hard failures (illegal transitions)
189
-
190
- | Attempt | Runtime response |
191
- |---|---|
192
- | Parent calling `loop dispatch` manually | Bypasses `loop run` — governance violation |
193
- | Parent calling `loop continue` manually | Bypasses `loop run` — governance violation |
194
- | Parent completing child without dispatch record | `exit(1)` + `illegal-state-transition` telemetry event |
195
- | `selected → completed` (no dispatch in path) | Hard failure — never allowed |
196
-
197
- **When `execution.providerPolicy.worker.allowNativeSubagent: false` or `execution.providerPolicy.orchestrator.allowNativeSubagent: false`, never use any native subagent or parallel-task mechanism** (applies to all providers: Claude, Codex, Copilot, etc.). `loop run` via `terminal-cli` is the only supported dispatch path.
198
-
199
- ## Polaris runtime integration
200
-
201
- polaris-run uses these Polaris CLI calls:
202
-
203
- | Step | Polaris call | Purpose |
204
- |---|---|---|
205
- | 07 | `npm run polaris -- loop run <cluster-id>` | Run all eligible children serially; emits `[POLARIS] RUNNING <child> (N/M)` per child and `[POLARIS] COMPLETE <child> (commit: <sha>)` on completion; exits when cluster-complete or blocked |
206
- | 08 | `npm run polaris -- medic packet <cluster-id>` | Generate Medic packet for failed worker result (if triage required) |
207
- | 08 | Medic subagent dispatch | Dispatch Medic; wait for sealed result; validate result before proceeding |
208
- | 09 | `npm run polaris -- librarian packet <cluster-id>` | Generate Closeout Librarian packet for the completed cluster |
209
- | 09 | Librarian subagent dispatch | Dispatch Closeout Librarian; wait for sealed result; validate result before proceeding |
210
- | 10 | `npm run polaris -- finalize` | Push branch (including librarian commit), open PR, append JSONL closeout events, archive run snapshot |
211
-
212
- `npm run polaris -- loop run <cluster-id>` is the standard execution command. It internally manages the dispatch→checkpoint loop for all children, emitting terse progress signals the Foreman can monitor. The Foreman does not call `loop dispatch` or `loop continue` — those boundaries are owned by `loop run`.
213
-
214
- ## Context budget
215
-
216
- Track in `.taskchain_artifacts/polaris-run/current-state.json` under `context_budget`. Update after each child.
217
-
218
- | Counter | Meaning | Stop threshold |
219
- |---------|---------|----------------|
220
- | `children_completed` | Children fully Done this session | `fixed-cap` mode only: ≥ `budget.max_children` from `polaris.config.json` (default 6) → STOP (budget exhausted); no count cap in `run-until-done`/`stop-on-fail` modes; the CLI runtime enforces this |
221
- | `files_touched_total` | Total files changed this session | > 50 → STOP (safety) |
222
- | `last_child_files_touched` | Files changed by last child | > 20 → STOP (safety) |
223
-
224
- ## Run ID format
225
-
226
- Format: `polaris-run-<slug>-<date>-<seq>`
227
- - `<slug>`: 2–4 lowercase hyphenated words from the cluster title. No Linear IDs.
228
- - `<date>`: `YYYY-MM-DD`
229
- - `<seq>`: zero-padded sequential number per day (`001`, `002`, …)
230
-
231
- Example: `polaris-run-loop-boundary-2026-05-23-001`
232
-
233
- Resumed sessions generate a new `run_id`. Record the prior in `related_run_id`.
234
-
235
- ## Telemetry enforcement
236
-
237
- Telemetry file: `.taskchain_artifacts/polaris-run/runs/<run-id>/telemetry.jsonl` (append-only).
238
-
239
- | Event | Emitted by | Step |
240
- |---|---|---|
241
- | `run-start` | agent | 01 — before any Linear access |
242
- | `child-dispatched` | `npm run polaris -- loop dispatch` | 07 — when one child is accepted by the execution adapter |
243
- | `child-complete` | parent runtime | 07 — after worker return validation and completion recording |
244
- | `loop-checkpoint` | `npm run polaris -- loop continue` | 07 — after each child |
245
- | `analyze-impl-boundary-enforced` | `npm run polaris -- loop continue` | 07 — blocker/state-repair boundary event only |
246
- | `loop-aborted` | `npm run polaris -- loop abort` | any blocker halt |
247
- | `medic-dispatched` | parent runtime | 08 — when Medic is dispatched for failed worker |
248
- | `medic-complete` | parent runtime | 08 — after Medic returns sealed result |
249
- | `pr-opened` | `npm run polaris -- finalize` | 10 |
250
- | `run-complete` | `npm run polaris -- finalize` | 10 |
251
-
252
- Required fields on every event: `event`, `run_id`, `timestamp`.
253
-
254
- ## Artifact authority
255
-
256
- `.taskchain_artifacts/polaris-run/current-state.json` is the sole authoritative live state surface.
257
-
258
- - Update only at explicit checkpoint boundaries via `npm run polaris -- loop continue` after worker returns, or when DISPATCH boundaries mandate bootstrapping.
259
- - Parent agents must not update state inline between steps.
260
- - If the checkpoint fails: stop and report the persistence failure.
261
-
262
- ## Machine snapshot
263
-
264
- - **Path**: `.taskchain_artifacts/polaris-run/current-state.json`
265
- - **Update requirement**: only at checkpoint boundaries (via `npm run polaris -- loop continue`)
266
- - **Purpose**: fast agent resume without replaying JSONL or markdown history
267
-
268
- ## Completion rule
269
-
270
- Do not report workflow completion until `.taskchain_artifacts/polaris-run/current-state.json` has `status: complete`.
271
-
272
- ## Linked-skill invocation boundaries
273
-
274
- | Skill | Allowed steps | Condition |
275
- |---|---|---|
276
- | repo-analysis | 01, 02, 03, 04 | targeted lookup only; conditional on provider availability |
277
- | execution-adapter | 07 | required when a completed child has a next open child |
278
- | polaris-medic | 08 | required when a worker returns a failed result packet and triage is required |
279
-
280
- ## Execution reporting
281
-
282
- At checkpoint boundaries (worker returns), emit a checkpoint report:
283
-
284
- ```text
285
- **[step-name]** done | blocked | needs-input
286
- Changed: <files / artifacts / branches / issues> or none
287
- Validated: <commands / checks passed> or none
288
- Blockers: none | <explicit blocker>
289
- ```
290
-
291
- ### Never compressed
292
-
293
- Always write in full:
294
- - Generated code
295
- - Safety warnings
296
- - Blocker descriptions
297
- - Acceptance-criteria gap explanations
298
- - Irreversible-action confirmations
@@ -1,34 +0,0 @@
1
- ---
2
- name: polaris-run-execution-adapter
3
- description: Adapter boundary for dispatching Polaris child worker sessions without coupling orchestration to a specific agent runtime.
4
- ---
5
-
6
- # Execution Adapter Boundary
7
-
8
- Polaris orchestration is adapter-agnostic. The parent session selects the next child and uses `polaris loop dispatch` as the dispatch trigger for the configured adapter. The worker session performs implementation and returns only compact state: child ID, status, commit hash, validation summary, and next action. After that return, the parent may run `polaris loop continue` as the post-child checkpoint.
9
-
10
- The adapter boundary is the token boundary. Parent/orchestrator context must not accumulate child implementation transcripts.
11
-
12
- ## Adapter Modes
13
-
14
- | Mode | Use | Dispatch |
15
- |---|---|---|
16
- | `agent-subtask` | Interactive agent sessions (requires `allowNativeSubagent: true`) | Use the host agent's subtask/agent dispatch capability. |
17
- | `terminal-cli` | Terminal, cron, CI wrapper; **required when the active polaris-run dispatch role sets `allowNativeSubagent: false`** | Use `scripts/polaris-run.sh` or equivalent shell subprocess with an explicitly configured CLI worker. |
18
-
19
- > **Prohibition (polaris-run worker and orchestrator dispatch only)**
20
- >
21
- > - When the active polaris-run dispatch role sets `execution.providerPolicy.worker.allowNativeSubagent: false` or `execution.providerPolicy.orchestrator.allowNativeSubagent: false`, the `agent-subtask` mode is forbidden for that role.
22
- > - This applies across host CLIs and providers: Claude, Codex, Copilot, and other agent runtimes all expose native subagent or parallel-task mechanisms that are disallowed under this flag for worker/orchestrator dispatch.
23
- > - Other roles (e.g., `analyst`) may independently permit native subagents via their own `allowNativeSubagent` setting.
24
- > - The Foreman must not search for, load, or invoke any native subagent mechanism when dispatching workers.
25
- > - The current runtime adapter registry supports only `terminal-cli` and `agent-subtask`, so when the active role disallows native subagents the legal dispatch path is `terminal-cli`.
26
-
27
- ## Contract
28
-
29
- 1. Parent reads `.taskchain_artifacts/polaris-run/current-state.json`.
30
- 2. Parent runs `polaris loop dispatch`, which dispatches the next child through the selected adapter.
31
- 3. Worker updates current-state and telemetry.
32
- 4. Parent reads current-state after worker completion.
33
- 5. Parent does not ingest worker transcript content.
34
- 6. Parent runs `polaris loop continue` only after the worker has returned.
@@ -1,58 +0,0 @@
1
- ---
2
- title: repo-analysis provider linkage
3
- description: Provide targeted code intelligence and impact checks when a repo-analysis provider is configured and available in the session environment.
4
- version: "1.0"
5
- ---
6
-
7
- # repo-analysis provider linkage
8
-
9
- ---
10
-
11
- ## Allowed steps
12
-
13
- - 01-orient-cluster
14
- - 02-prepare-branch
15
- - 03-select-child
16
- - 04-execute-child
17
-
18
- ---
19
-
20
- ## Purpose
21
-
22
- Provide targeted code intelligence and impact checks when polaris-run needs repository graph context.
23
-
24
- This linked-skill governs use of the configured repo-analysis provider (e.g., GitNexus). If no provider is available, the fallback path (polaris map query + ripgrep + direct file inspection) is authoritative. See `docs/Polaris/spec/provider-capabilities.md` for the full provider model.
25
-
26
- ---
27
-
28
- ## Allowed scope
29
-
30
- - Check configured provider availability at session start
31
- - Query specific files, symbols, or concepts relevant to the current child
32
- - Run impact analysis before modifying significant symbols
33
- - Run targeted context checks to locate implementation surfaces
34
- - Report stale-index warnings and pair them with direct inspection
35
-
36
- ---
37
-
38
- ## Forbidden scope
39
-
40
- - Do not perform broad graph dumps or full-repo reports
41
- - Do not replace direct repository inspection
42
- - Do not expand implementation beyond the selected child
43
- - Do not invoke outside allowed steps
44
- - Do not assume a specific provider product is present — check availability first
45
-
46
- ---
47
-
48
- ## Provider detection
49
-
50
- At step 01, check `polaris.config.json` for `providers.repoAnalysis.preferred`.
51
- If a provider is configured and available in the session environment: use it.
52
- If unavailable or not configured: note `repo_analysis_status: not-configured` in artifact and proceed with fallback.
53
-
54
- ---
55
-
56
- ## Invocation note
57
-
58
- Conditional. Invoke only when a child requires code intelligence, symbol impact, or change-scope verification. When the provider is unavailable, the fallback path runs instead — execution continues.
@@ -1,96 +0,0 @@
1
- ---
2
- name: polaris-run-step-01-orient-cluster
3
- description: Query runtime state, generate run_id if needed, emit run-start telemetry, fetch the parent cluster from Linear, and restate bounded session context.
4
- ---
5
-
6
- # Step 01 — Orient cluster
7
-
8
- ## Purpose
9
-
10
- Establish the bounded working context for this session before touching any code. Runtime state is authoritative — query it first, do not reconstruct it from chat reasoning.
11
-
12
- ## Scope declarations
13
-
14
- ```yaml
15
- allowed_files:
16
- - .polaris/skills/polaris-run/SKILL.md
17
- - .polaris/skills/polaris-run/chain.md
18
- - .taskchain_artifacts/polaris-run/current-state.json
19
- - .polaris/clusters/<cluster-id>/clusters.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
- - runtime state queried via npm run polaris -- loop status
28
- - run_id generated or read from prior state
29
- - run-start telemetry emitted
30
- - Linear parent and children fetched
31
- - cluster is valid and executable
32
- - bounded session context restated
33
- stop_rules:
34
- - run-start telemetry write fails
35
- - parent issue missing or inaccessible
36
- - parent or selected child is blocked
37
- - cluster has no children and issue is not standalone
38
- ```
39
-
40
- ## Actions
41
-
42
- 0. **Query runtime state**:
43
- Run `npm run polaris -- loop status` to check for existing session state.
44
- - **Follow-up run** (state exists and is active for this cluster): read `cluster_id` and step context from runtime output. Mint a new `run_id` in `polaris-run-<slug>-<date>-<seq>` format (see `chain.md` for format rules) — do not reuse the prior `run_id`. Set `related_run_id` to the prior `run_id` read from runtime output. Runtime state is authoritative — do not infer session context from chat history.
45
- - **Fresh run** (no state file, or state belongs to a different cluster): generate new `run_id` in format `polaris-run-<slug>-<date>-<seq>` (see `chain.md` for format rules). `related_run_id` is `null`.
46
-
47
- 1. **Emit `run-start` telemetry** — first write action, before any Linear access or branch work:
48
- ```bash
49
- mkdir -p .taskchain_artifacts/polaris-run/runs/<run-id>
50
- echo '{"event":"run-start","run_id":"<run-id>","prior_run_id":"<prior or null>","timestamp":"<ISO>"}' \
51
- >> .taskchain_artifacts/polaris-run/runs/<run-id>/telemetry.jsonl
52
- ```
53
- No runtime CLI command exists for run-start telemetry; direct file append is the standard path.
54
- If this write fails: halt. Do not continue.
55
-
56
- 2. Fetch the **parent issue AND all child issues** from Linear in two sequential calls (get parent, then list children by parent ID).
57
-
58
- 3. Confirm the cluster is valid and executable:
59
- - Has children (or is a standalone issue).
60
- - Not blocked at the parent level.
61
- - Not Done or Cancelled.
62
- - Parent is an IMPLEMENT root, not an ANALYZE root. If the parent title starts with `ANALYZE:` or has the `analyze` label, halt before branch work or child dispatch with exactly:
63
- `polaris-run targets IMPLEMENT parents, not ANALYZE issues. Run polaris-analyze first to create an IMPLEMENT parent.`
64
- - If ambiguous or not executable: stop and recommend running polaris-analyze first.
65
-
66
- 4. Check `.polaris/clusters/<cluster-id>/clusters.json` if it exists — it provides execution ordering and dependency metadata produced by polaris-analyze. If absent, use the child issue ordering from Linear as the fallback (see step 03).
67
-
68
- 5. Restate the working context in under 10 bullets:
69
- - `run_id` and whether this is fresh or resumed
70
- - Parent issue ID and title
71
- - Branch name (create or reuse)
72
- - Total children count
73
- - Open children (IDs and titles, dependency order)
74
- - Any blockers visible at this stage
75
- - Execution boundary (one parent cluster, this session)
76
-
77
- 6. Invoke `npm run polaris -- loop status` to confirm runtime state is consistent before advancing to the next step.
78
-
79
- ## Artifact update
80
-
81
- Update `.taskchain_artifacts/polaris-run/current-state.json`:
82
-
83
- - `run_id: <generated>`
84
- - `related_run_id: <prior run_id or null>`
85
- - `cluster_id: <parent issue ID>`
86
- - `skill: polaris-run`
87
- - `artifact_dir: ".taskchain_artifacts/polaris-run"`
88
- - `status: orienting`
89
- - `current_step_id: 01-orient-cluster`
90
- - `updated_at: <timestamp>`
91
-
92
- Do not emit per-step `step-complete` telemetry. Telemetry is checkpoint-only (`run-start`, `child-dispatched`, child completion/checkpoint events, session end, and blocker/state-repair events).
93
-
94
- ## Next step
95
-
96
- 02-prepare-branch
@@ -1,53 +0,0 @@
1
- ---
2
- name: polaris-run-step-02-prepare-branch
3
- description: Create or reuse the parent-scoped git branch from the Linear issue's gitBranchName and verify a clean execution state.
4
- ---
5
-
6
- # Step 02 — Prepare branch
7
-
8
- ## Purpose
9
-
10
- Establish a clean, parent-scoped git branch before child execution begins.
11
-
12
- ## Scope declarations
13
-
14
- ```yaml
15
- allowed_files:
16
- - .taskchain_artifacts/polaris-run/current-state.json
17
- - git branch and worktree metadata only
18
- allowed_routes:
19
- - CLAUDE.md
20
- - .polaris/skills/polaris-run/chain.md
21
- allowed_skills:
22
- - repo-analysis
23
- expected_evidence:
24
- - target branch identified or created from main
25
- - dirty checkout policy applied
26
- - Linear issue branch name used
27
- stop_rules:
28
- - unrelated dirty checkout cannot be isolated
29
- - target branch conflicts with existing delivery branch
30
- - branch cannot be created from main
31
- ```
32
-
33
- ## Actions
34
-
35
- 1. Use the branch name from the Linear parent issue's `gitBranchName` field as the authoritative branch name. This field provides the exact branch name to use (typically formatted like `philmeaux/<pol-id>-<slug>`, though format may vary). Do not invent or modify the branch name.
36
- 2. If the branch already exists: check it out and verify the working tree is clean. If dirty: halt and instruct the user to commit or stash changes before continuing.
37
- 3. If the branch does not exist: create it from `main`.
38
- 4. Confirm no uncommitted changes from a different parent cluster exist. If `.taskchain_artifacts/polaris-run/current-state.json` records a different `cluster_id`, halt and report.
39
- 5. Do not commit anything at this step.
40
-
41
- ## Artifact update
42
-
43
- Update `.taskchain_artifacts/polaris-run/current-state.json`:
44
- - `status: ready`
45
- - `branch: <branch-name>`
46
- - `current_step_id: 02-prepare-branch`
47
- - `updated_at: <timestamp>`
48
-
49
- Do not emit per-step `step-complete` telemetry. Telemetry is checkpoint-only (`run-start`, `child-dispatched`, child completion/checkpoint events, session end, and blocker/state-repair events).
50
-
51
- ## Next step
52
-
53
- 03-select-child
@@ -1,63 +0,0 @@
1
- ---
2
- name: polaris-run-step-03-select-child
3
- description: Re-fetch the child list from Linear, identify the next unblocked child, and halt on blockers or all-done.
4
- ---
5
-
6
- # Step 03 — Select child
7
-
8
- ## Purpose
9
-
10
- Identify the correct next child to execute without skipping or misordering.
11
-
12
- ## Scope declarations
13
-
14
- ```yaml
15
- allowed_files:
16
- - .taskchain_artifacts/polaris-run/current-state.json
17
- - .polaris/clusters/<cluster-id>/clusters.json
18
- allowed_routes:
19
- - CLAUDE.md
20
- - .polaris/skills/polaris-run/chain.md
21
- allowed_skills:
22
- - repo-analysis
23
- expected_evidence:
24
- - fresh child list fetched from Linear
25
- - lowest-ordered open child selected
26
- - blocked child state checked
27
- stop_rules:
28
- - next child is blocked
29
- - child ordering is ambiguous
30
- - all children are Done (route to DELIVER)
31
- ```
32
-
33
- ## Actions
34
-
35
- 1. **First child of the session**: use the child list fetched in step 01 — do not re-fetch.
36
- 2. **Second child and beyond**: re-fetch the full child list from Linear to catch state changes from the prior child.
37
- 3. Filter to open children only (exclude Done and Cancelled).
38
- 4. If no open children remain:
39
- - Update artifact: `status: all-children-complete`.
40
- - End the session. Report: all children Done. Provide the delivery command: `Use polaris-run on <PARENT-ID>. Finalize delivery.`
41
- - Do not push. Do not create a PR.
42
- 5. If clusters.json exists, use it to determine execution order and dependencies. If absent, use the child issue ordering from Linear (lowest-numbered first) as a last-resort fallback — do not improvise ordering from chat reasoning or assumptions.
43
- 6. Verify the selected child is not blocked in Linear. If blocked:
44
- - Run `npm run polaris -- loop abort "<reason>"`.
45
- - Report blocked state and halt. Do not skip to a later child.
46
- 7. Set the selected child as `active_child`.
47
-
48
- ## Artifact update
49
-
50
- Update `.taskchain_artifacts/polaris-run/current-state.json`:
51
- - `current_step_id: 03-select-child`
52
- - `active_child: <ID>`
53
- - `updated_at: <timestamp>`
54
-
55
- If all children complete:
56
- - `status: all-children-complete`
57
- - `current_step_id: awaiting-delivery-request`
58
-
59
- Do not emit per-step `step-complete` telemetry. Telemetry is checkpoint-only (`run-start`, `child-dispatched`, child completion/checkpoint events, session end, and blocker/state-repair events).
60
-
61
- ## Next step
62
-
63
- 04-execute-child (or halt if all children complete or blocked)