@lsctech/polaris 0.1.0 → 0.1.3

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 (211) hide show
  1. package/dist/cli/adopt-assets.js +187 -0
  2. package/dist/cli/adopt-cognition.js +1 -2
  3. package/dist/cli/adopt-genesis.js +84 -0
  4. package/dist/cli/adopt-instructions.js +1 -2
  5. package/dist/cli/adopt-report.js +67 -0
  6. package/dist/cli/adopt-workspace.js +114 -0
  7. package/dist/cli/adoption-plan.js +11 -0
  8. package/dist/cli/init.js +79 -7
  9. package/dist/workspace/.polaris/roles/analyst.md +38 -0
  10. package/dist/workspace/.polaris/roles/closeout-librarian.md +122 -0
  11. package/dist/workspace/.polaris/roles/cognition-librarian.md +37 -0
  12. package/dist/workspace/.polaris/roles/finalizer.md +45 -0
  13. package/dist/workspace/.polaris/roles/foreman.md +165 -0
  14. package/dist/workspace/.polaris/roles/librarian.md +74 -0
  15. package/dist/workspace/.polaris/roles/worker.md +119 -0
  16. package/dist/workspace/.polaris/session-type +1 -0
  17. package/dist/workspace/.polaris/skills/ROUTING.md +109 -0
  18. package/dist/workspace/.polaris/skills/caveman/SKILL.md +74 -0
  19. package/dist/workspace/.polaris/skills/caveman-compress/scripts/compress.py +272 -0
  20. package/dist/workspace/.polaris/skills/closeout-librarian/POLARIS.md +46 -0
  21. package/dist/workspace/.polaris/skills/closeout-librarian/SKILL.md +59 -0
  22. package/dist/workspace/.polaris/skills/closeout-librarian/chain.md +116 -0
  23. package/dist/workspace/.polaris/skills/closeout-librarian/steps/01-load-cluster-context.md +78 -0
  24. package/dist/workspace/.polaris/skills/closeout-librarian/steps/02-drift-reconciliation.md +157 -0
  25. package/dist/workspace/.polaris/skills/closeout-librarian/steps/03-reconcile-polaris-md.md +93 -0
  26. package/dist/workspace/.polaris/skills/closeout-librarian/steps/04-reconcile-summary-md.md +106 -0
  27. package/dist/workspace/.polaris/skills/closeout-librarian/steps/05-doc-ingestion.md +114 -0
  28. package/dist/workspace/.polaris/skills/closeout-librarian/steps/06-link-validation.md +128 -0
  29. package/dist/workspace/.polaris/skills/closeout-librarian/steps/07-yaml-linking.md +95 -0
  30. package/dist/workspace/.polaris/skills/closeout-librarian/steps/08-librarian-commit.md +119 -0
  31. package/dist/workspace/.polaris/skills/closeout-librarian/steps/09-sealed-result.md +118 -0
  32. package/dist/workspace/.polaris/skills/docs-ingest/SKILL.md +68 -0
  33. package/dist/workspace/.polaris/skills/docs-ingest/chain.json +23 -0
  34. package/dist/workspace/.polaris/skills/docs-ingest/chain.md +149 -0
  35. package/dist/workspace/.polaris/skills/docs-ingest/steps/01-orient-ingest.md +85 -0
  36. package/dist/workspace/.polaris/skills/docs-ingest/steps/02-classify-batch.md +87 -0
  37. package/dist/workspace/.polaris/skills/docs-ingest/steps/03-conflict-check.md +66 -0
  38. package/dist/workspace/.polaris/skills/docs-ingest/steps/04-place-and-link.md +77 -0
  39. package/dist/workspace/.polaris/skills/docs-ingest/steps/05-finalize-ingest.md +49 -0
  40. package/dist/workspace/.polaris/skills/docs-promote/SKILL.md +79 -0
  41. package/dist/workspace/.polaris/skills/docs-promote/chain.json +25 -0
  42. package/dist/workspace/.polaris/skills/docs-promote/chain.md +80 -0
  43. package/dist/workspace/.polaris/skills/docs-promote/steps/01-orient-promote.md +53 -0
  44. package/dist/workspace/.polaris/skills/docs-promote/steps/02-review-candidates.md +51 -0
  45. package/dist/workspace/.polaris/skills/docs-promote/steps/03-read-linked-code.md +50 -0
  46. package/dist/workspace/.polaris/skills/docs-promote/steps/04-conflict-surface.md +65 -0
  47. package/dist/workspace/.polaris/skills/docs-promote/steps/05-await-approval.md +61 -0
  48. package/dist/workspace/.polaris/skills/docs-promote/steps/06-execute-promote-deprecate.md +65 -0
  49. package/dist/workspace/.polaris/skills/docs-promote/steps/07-finalize-promote.md +44 -0
  50. package/dist/workspace/.polaris/skills/polaris-analyze/SKILL.md +94 -0
  51. package/dist/workspace/.polaris/skills/polaris-analyze/chain.json +20 -0
  52. package/dist/workspace/.polaris/skills/polaris-analyze/chain.md +105 -0
  53. package/dist/workspace/.polaris/skills/polaris-analyze/issue-reconciliation.md +149 -0
  54. package/dist/workspace/.polaris/skills/polaris-analyze/issue-template.md +133 -0
  55. package/dist/workspace/.polaris/skills/polaris-analyze/linked-skills/repo-analysis.md +55 -0
  56. package/dist/workspace/.polaris/skills/polaris-analyze/steps/01-fetch-and-orient.md +79 -0
  57. package/dist/workspace/.polaris/skills/polaris-analyze/steps/02-map-affected-code.md +58 -0
  58. package/dist/workspace/.polaris/skills/polaris-analyze/steps/03-assess-issue.md +58 -0
  59. package/dist/workspace/.polaris/skills/polaris-analyze/steps/04-blocker-check.md +60 -0
  60. package/dist/workspace/.polaris/skills/polaris-analyze/steps/05-create-cluster-plan.md +197 -0
  61. package/dist/workspace/.polaris/skills/polaris-analyze/steps/06-final-report.md +60 -0
  62. package/dist/workspace/.polaris/skills/polaris-catalog/SKILL.md +91 -0
  63. package/dist/workspace/.polaris/skills/polaris-catalog/chain.json +22 -0
  64. package/dist/workspace/.polaris/skills/polaris-catalog/chain.md +85 -0
  65. package/dist/workspace/.polaris/skills/polaris-catalog/steps/01-orient-catalog.md +92 -0
  66. package/dist/workspace/.polaris/skills/polaris-catalog/steps/02-reconcile-polaris-md.md +33 -0
  67. package/dist/workspace/.polaris/skills/polaris-catalog/steps/03-reconcile-summary-md.md +70 -0
  68. package/dist/workspace/.polaris/skills/polaris-catalog/steps/04-classify-and-place.md +117 -0
  69. package/dist/workspace/.polaris/skills/polaris-catalog/steps/05-catalog-commit.md +94 -0
  70. package/dist/workspace/.polaris/skills/polaris-medic/SKILL.md +52 -0
  71. package/dist/workspace/.polaris/skills/polaris-medic/chain.md +111 -0
  72. package/dist/workspace/.polaris/skills/polaris-medic/steps/01-orient-medic.md +75 -0
  73. package/dist/workspace/.polaris/skills/polaris-medic/steps/02-diagnose.md +79 -0
  74. package/dist/workspace/.polaris/skills/polaris-medic/steps/03-repair.md +64 -0
  75. package/dist/workspace/.polaris/skills/polaris-medic/steps/04-validate.md +66 -0
  76. package/dist/workspace/.polaris/skills/polaris-medic/steps/05-create-chart.md +85 -0
  77. package/dist/workspace/.polaris/skills/polaris-medic/steps/06-closeout.md +86 -0
  78. package/dist/workspace/.polaris/skills/polaris-reconcile/SKILL.md +75 -0
  79. package/dist/workspace/.polaris/skills/polaris-reconcile/chain.json +20 -0
  80. package/dist/workspace/.polaris/skills/polaris-reconcile/chain.md +67 -0
  81. package/dist/workspace/.polaris/skills/polaris-reconcile/steps/01-orient-reconcile.md +82 -0
  82. package/dist/workspace/.polaris/skills/polaris-reconcile/steps/02-reconcile-polaris-md.md +95 -0
  83. package/dist/workspace/.polaris/skills/polaris-reconcile/steps/03-reconcile-summary-md.md +108 -0
  84. package/dist/workspace/.polaris/skills/polaris-reconcile/steps/04-reconcile-commit.md +88 -0
  85. package/dist/workspace/.polaris/skills/polaris-run/SKILL.md +135 -0
  86. package/dist/workspace/.polaris/skills/polaris-run/chain.json +19 -0
  87. package/dist/workspace/.polaris/skills/polaris-run/chain.md +298 -0
  88. package/dist/workspace/.polaris/skills/polaris-run/execution-adapter.md +34 -0
  89. package/dist/workspace/.polaris/skills/polaris-run/linked-skills/repo-analysis.md +58 -0
  90. package/dist/workspace/.polaris/skills/polaris-run/steps/01-orient-cluster.md +96 -0
  91. package/dist/workspace/.polaris/skills/polaris-run/steps/02-prepare-branch.md +53 -0
  92. package/dist/workspace/.polaris/skills/polaris-run/steps/03-select-child.md +63 -0
  93. package/dist/workspace/.polaris/skills/polaris-run/steps/04-execute-child.md +75 -0
  94. package/dist/workspace/.polaris/skills/polaris-run/steps/05-validate-child.md +57 -0
  95. package/dist/workspace/.polaris/skills/polaris-run/steps/06-commit-and-update-linear.md +74 -0
  96. package/dist/workspace/.polaris/skills/polaris-run/steps/07-decide-continuation.md +89 -0
  97. package/dist/workspace/.polaris/skills/polaris-run/steps/08-closeout-librarian.md +146 -0
  98. package/dist/workspace/.polaris/skills/polaris-run/steps/08-final-delivery.md +91 -0
  99. package/dist/workspace/.polaris/skills/polaris-run/steps/09-final-delivery.md +104 -0
  100. package/dist/workspace/.polaris/skills/polaris-tools/README.md +63 -0
  101. package/dist/workspace/.polaris/skills/polaris-tools/SKILL.md +94 -0
  102. package/dist/workspace/.polaris/skills/polaris-tools/tools.js +191 -0
  103. package/dist/workspace/smartdocs/architecture/.gitkeep +0 -0
  104. package/dist/workspace/smartdocs/audits/.gitkeep +0 -0
  105. package/dist/workspace/smartdocs/decisions/.gitkeep +0 -0
  106. package/dist/workspace/smartdocs/doctrine/active/.gitkeep +0 -0
  107. package/dist/workspace/smartdocs/runtime/.gitkeep +0 -0
  108. package/dist/workspace/smartdocs/specs/active/.gitkeep +0 -0
  109. package/dist/workspace/smartdocs/specs/archive/.gitkeep +0 -0
  110. package/dist/workspace/workspace/.polaris/roles/analyst.md +38 -0
  111. package/dist/workspace/workspace/.polaris/roles/closeout-librarian.md +122 -0
  112. package/dist/workspace/workspace/.polaris/roles/cognition-librarian.md +37 -0
  113. package/dist/workspace/workspace/.polaris/roles/finalizer.md +45 -0
  114. package/dist/workspace/workspace/.polaris/roles/foreman.md +165 -0
  115. package/dist/workspace/workspace/.polaris/roles/librarian.md +74 -0
  116. package/dist/workspace/workspace/.polaris/roles/worker.md +119 -0
  117. package/dist/workspace/workspace/.polaris/session-type +1 -0
  118. package/dist/workspace/workspace/.polaris/skills/ROUTING.md +109 -0
  119. package/dist/workspace/workspace/.polaris/skills/caveman/SKILL.md +74 -0
  120. package/dist/workspace/workspace/.polaris/skills/caveman-compress/scripts/compress.py +272 -0
  121. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/POLARIS.md +46 -0
  122. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/SKILL.md +59 -0
  123. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/chain.md +116 -0
  124. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/01-load-cluster-context.md +78 -0
  125. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/02-drift-reconciliation.md +157 -0
  126. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/03-reconcile-polaris-md.md +93 -0
  127. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/04-reconcile-summary-md.md +106 -0
  128. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/05-doc-ingestion.md +114 -0
  129. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/06-link-validation.md +128 -0
  130. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/07-yaml-linking.md +95 -0
  131. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/08-librarian-commit.md +119 -0
  132. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/09-sealed-result.md +118 -0
  133. package/dist/workspace/workspace/.polaris/skills/docs-ingest/SKILL.md +68 -0
  134. package/dist/workspace/workspace/.polaris/skills/docs-ingest/chain.json +23 -0
  135. package/dist/workspace/workspace/.polaris/skills/docs-ingest/chain.md +149 -0
  136. package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/01-orient-ingest.md +85 -0
  137. package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/02-classify-batch.md +87 -0
  138. package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/03-conflict-check.md +66 -0
  139. package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/04-place-and-link.md +77 -0
  140. package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/05-finalize-ingest.md +49 -0
  141. package/dist/workspace/workspace/.polaris/skills/docs-promote/SKILL.md +79 -0
  142. package/dist/workspace/workspace/.polaris/skills/docs-promote/chain.json +25 -0
  143. package/dist/workspace/workspace/.polaris/skills/docs-promote/chain.md +80 -0
  144. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/01-orient-promote.md +53 -0
  145. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/02-review-candidates.md +51 -0
  146. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/03-read-linked-code.md +50 -0
  147. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/04-conflict-surface.md +65 -0
  148. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/05-await-approval.md +61 -0
  149. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/06-execute-promote-deprecate.md +65 -0
  150. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/07-finalize-promote.md +44 -0
  151. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/SKILL.md +94 -0
  152. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/chain.json +20 -0
  153. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/chain.md +105 -0
  154. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/issue-reconciliation.md +149 -0
  155. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/issue-template.md +133 -0
  156. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/linked-skills/repo-analysis.md +55 -0
  157. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/01-fetch-and-orient.md +79 -0
  158. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/02-map-affected-code.md +58 -0
  159. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/03-assess-issue.md +58 -0
  160. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/04-blocker-check.md +60 -0
  161. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/05-create-cluster-plan.md +197 -0
  162. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/06-final-report.md +60 -0
  163. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/SKILL.md +91 -0
  164. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/chain.json +22 -0
  165. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/chain.md +85 -0
  166. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/01-orient-catalog.md +92 -0
  167. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/02-reconcile-polaris-md.md +33 -0
  168. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/03-reconcile-summary-md.md +70 -0
  169. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/04-classify-and-place.md +117 -0
  170. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/05-catalog-commit.md +94 -0
  171. package/dist/workspace/workspace/.polaris/skills/polaris-medic/SKILL.md +52 -0
  172. package/dist/workspace/workspace/.polaris/skills/polaris-medic/chain.md +111 -0
  173. package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/01-orient-medic.md +75 -0
  174. package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/02-diagnose.md +79 -0
  175. package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/03-repair.md +64 -0
  176. package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/04-validate.md +66 -0
  177. package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/05-create-chart.md +85 -0
  178. package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/06-closeout.md +86 -0
  179. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/SKILL.md +75 -0
  180. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/chain.json +20 -0
  181. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/chain.md +67 -0
  182. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/steps/01-orient-reconcile.md +82 -0
  183. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/steps/02-reconcile-polaris-md.md +95 -0
  184. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/steps/03-reconcile-summary-md.md +108 -0
  185. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/steps/04-reconcile-commit.md +88 -0
  186. package/dist/workspace/workspace/.polaris/skills/polaris-run/SKILL.md +135 -0
  187. package/dist/workspace/workspace/.polaris/skills/polaris-run/chain.json +19 -0
  188. package/dist/workspace/workspace/.polaris/skills/polaris-run/chain.md +298 -0
  189. package/dist/workspace/workspace/.polaris/skills/polaris-run/execution-adapter.md +34 -0
  190. package/dist/workspace/workspace/.polaris/skills/polaris-run/linked-skills/repo-analysis.md +58 -0
  191. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/01-orient-cluster.md +96 -0
  192. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/02-prepare-branch.md +53 -0
  193. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/03-select-child.md +63 -0
  194. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/04-execute-child.md +75 -0
  195. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/05-validate-child.md +57 -0
  196. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/06-commit-and-update-linear.md +74 -0
  197. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/07-decide-continuation.md +89 -0
  198. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/08-closeout-librarian.md +146 -0
  199. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/08-final-delivery.md +91 -0
  200. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/09-final-delivery.md +104 -0
  201. package/dist/workspace/workspace/.polaris/skills/polaris-tools/README.md +63 -0
  202. package/dist/workspace/workspace/.polaris/skills/polaris-tools/SKILL.md +94 -0
  203. package/dist/workspace/workspace/.polaris/skills/polaris-tools/tools.js +191 -0
  204. package/dist/workspace/workspace/smartdocs/architecture/.gitkeep +0 -0
  205. package/dist/workspace/workspace/smartdocs/audits/.gitkeep +0 -0
  206. package/dist/workspace/workspace/smartdocs/decisions/.gitkeep +0 -0
  207. package/dist/workspace/workspace/smartdocs/doctrine/active/.gitkeep +0 -0
  208. package/dist/workspace/workspace/smartdocs/runtime/.gitkeep +0 -0
  209. package/dist/workspace/workspace/smartdocs/specs/active/.gitkeep +0 -0
  210. package/dist/workspace/workspace/smartdocs/specs/archive/.gitkeep +0 -0
  211. package/package.json +4 -4
@@ -0,0 +1,63 @@
1
+ # polaris-tools skill
2
+
3
+ Codex skill that exposes compact, read-only Polaris status helpers without dumping large state into chat context.
4
+
5
+ ## Installation prerequisite
6
+
7
+ The Polaris CLI must be installed and resolvable before this skill will work.
8
+
9
+ ### Option A — link from the repo (development)
10
+
11
+ ```bash
12
+ # From the Polaris repo root:
13
+ npm run build
14
+ npm link
15
+ ```
16
+
17
+ After `npm link`, `polaris` is available globally on your `PATH`.
18
+
19
+ ### Option B — install globally
20
+
21
+ ```bash
22
+ npm install -g polaris
23
+ ```
24
+
25
+ ### Verify
26
+
27
+ ```bash
28
+ npm run polaris -- --version
29
+ ```
30
+
31
+ If the binary is not found, the skill will attempt `npx --no-install polaris` as a fallback. If that also fails, the tool returns a clear error with install instructions.
32
+
33
+ ## Available tools
34
+
35
+ | Tool | CLI equivalent | Description |
36
+ |------|---------------|-------------|
37
+ | `polaris_status` | `polaris status --json` | Compact current run summary (no full state dump) |
38
+ | `polaris_loop_status` | `polaris loop status --json` | Compact loop subsystem summary (no full state dump) |
39
+
40
+ `polaris_run` and `polaris_loop_continue` are recognized only as operator-only legacy names and return an error without invoking the CLI. The public CLI does not expose `polaris run`, and `polaris loop continue` is mutating: it checkpoints state and writes a bootstrap packet.
41
+
42
+ The MCP safety model exposes `polaris_loop_continue_dry_run` and `polaris_loop_continue_confirmed` as a separate approval-envelope flow. This helper does not wrap continuation unless a true non-mutating CLI dry-run is added.
43
+
44
+ `polaris finalize` remains manual/operator-only. Do not expose finalize as a normal tool until a confirmed finalize approval flow exists.
45
+
46
+ ## Usage from Codex
47
+
48
+ Invoke the helper script from the repo root:
49
+
50
+ ```bash
51
+ node .polaris/skills/polaris-tools/tools.js polaris_status
52
+ node .polaris/skills/polaris-tools/tools.js polaris_loop_status
53
+ ```
54
+
55
+ All tools return compact JSON on stdout. On error, exit code is non-zero and the JSON contains an `error` field.
56
+
57
+ ## Output contract
58
+
59
+ Tools return only a compact JSON summary. They never dump the full `current-state.json` or worker transcript into chat. Text summaries are truncated to 600 characters.
60
+
61
+ ## Security note
62
+
63
+ All CLI arguments are passed as explicit argument arrays via `spawnSync` — no shell string interpolation is used.
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: polaris-tools
3
+ description: Exposes compact read-only Polaris status helpers. Direct run, ungated loop continuation, and finalize remain operator-only.
4
+ role: foreman
5
+ role_file: .polaris/roles/foreman.md
6
+ ---
7
+
8
+ ## Command entrypoints
9
+
10
+ This skill is the target for the following user commands:
11
+
12
+ - `polaris-status`
13
+ - `run polaris-status`
14
+
15
+ When any of these commands are issued, load this skill packet **first** before any other action.
16
+ See `.polaris/skills/ROUTING.md` for the full routing protocol.
17
+
18
+ ---
19
+
20
+ # polaris-tools
21
+
22
+ Use this skill when the user wants to inspect Polaris run state without dumping large artifacts:
23
+ - `polaris status --json` / compact current-state summary → `polaris_status`
24
+ - `polaris loop status --json` / compact current-state summary → `polaris_loop_status`
25
+
26
+ Do not use this skill as a casual mutation surface. `polaris_run` and `polaris_loop_continue` are operator-only legacy names in the helper and return an error without invoking the CLI. Finalize is manual/operator-only until a confirmed finalize approval flow exists.
27
+
28
+ ## Prerequisites
29
+
30
+ The Polaris CLI must be installed before using this skill. See `README.md` for installation steps.
31
+
32
+ ## Tool behaviours
33
+
34
+ ### polaris_status()
35
+
36
+ Attempts `polaris status --json`. If the CLI is not available, reads and summarises
37
+ `.taskchain_artifacts/polaris-run/current-state.json` compactly. Returns:
38
+ ```json
39
+ {
40
+ "tool": "polaris_status",
41
+ "run_id": "...",
42
+ "cluster_id": "...",
43
+ "status": "...",
44
+ "active_child": null,
45
+ "next_open_child": "...",
46
+ "completed_children": [...],
47
+ "open_children": [...],
48
+ "updated_at": "..."
49
+ }
50
+ ```
51
+
52
+ ### polaris_loop_status()
53
+
54
+ Attempts `polaris loop status --json`. If the CLI is not available, reads and summarises
55
+ `.taskchain_artifacts/polaris-run/current-state.json` compactly. Returns the same compact shape with `"tool": "polaris_loop_status"`.
56
+
57
+ ### Operator-only names
58
+
59
+ `polaris_run(issue_id)` and `polaris_loop_continue(provider?)` are not exposed as casual helpers. They return:
60
+ ```json
61
+ {"tool":"polaris_loop_continue","error":"operator_only","message":"..."}
62
+ ```
63
+
64
+ The MCP safety model has a separate `polaris_loop_continue_dry_run` / `polaris_loop_continue_confirmed` approval-envelope flow. This helper does not wrap continuation unless a true non-mutating CLI dry-run is added.
65
+
66
+ Never dump the full state file into chat.
67
+
68
+ ## How to invoke
69
+
70
+ Run the helper script from the repo root:
71
+
72
+ ```
73
+ node .polaris/skills/polaris-tools/tools.js <tool> [args...]
74
+ ```
75
+
76
+ Examples:
77
+ ```
78
+ node .polaris/skills/polaris-tools/tools.js polaris_status
79
+ node .polaris/skills/polaris-tools/tools.js polaris_loop_status
80
+ ```
81
+
82
+ The script prints compact JSON to stdout and exits 0 on success, non-zero on error.
83
+
84
+ ## Discovery order for the Polaris binary
85
+
86
+ 1. `polaris` on `PATH` (installed via `npm link` or `npm install -g`)
87
+ 2. `npx --no-install polaris` (project-local install)
88
+ 3. Error emitted clearly if neither resolves
89
+
90
+ ## Error format
91
+
92
+ ```json
93
+ {"error":"polaris binary not found. Install via: npm link (from repo root) or npm install -g polaris","tool":"<tool>"}
94
+ ```
@@ -0,0 +1,191 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * polaris-tools — Codex plugin skill helper
4
+ *
5
+ * Exposes compact read-only helpers backed by local Polaris CLI invocation.
6
+ * Prints compact JSON to stdout. Never dumps full state files.
7
+ *
8
+ * Usage:
9
+ * node tools.js polaris_status
10
+ * node tools.js polaris_loop_status
11
+ */
12
+
13
+ 'use strict';
14
+
15
+ const { spawnSync } = require('child_process');
16
+ const fs = require('fs');
17
+ const path = require('path');
18
+
19
+ // ── binary resolution ──────────────────────────────────────────────────────
20
+
21
+ /**
22
+ * Returns { cmd, args } for the polaris binary, or null if not found.
23
+ * Uses spawnSync with argument arrays — no shell interpolation.
24
+ */
25
+ function findPolaris() {
26
+ // 1. polaris on PATH
27
+ const probe = spawnSync('polaris', ['--version'], { stdio: 'pipe', timeout: 5_000 });
28
+ if (probe.status === 0 && !probe.error) return { cmd: 'polaris', args: [] };
29
+
30
+ // 2. npx polaris (project-local, no network fetch)
31
+ const npxProbe = spawnSync('npx', ['--no-install', 'polaris', '--version'], {
32
+ stdio: 'pipe',
33
+ timeout: 10_000,
34
+ });
35
+ if (npxProbe.status === 0) return { cmd: 'npx', args: ['--no-install', 'polaris'] };
36
+
37
+ return null;
38
+ }
39
+
40
+ function binaryError(tool) {
41
+ return {
42
+ error:
43
+ 'polaris binary not found. Install via: npm link (from repo root) or npm install -g polaris',
44
+ tool,
45
+ };
46
+ }
47
+
48
+ // ── compact runner ─────────────────────────────────────────────────────────
49
+
50
+ /**
51
+ * Runs a command safely using spawnSync with an explicit args array.
52
+ * @param {string} cmd
53
+ * @param {string[]} args
54
+ */
55
+ function runSafe(cmd, args) {
56
+ const result = spawnSync(cmd, args, {
57
+ stdio: 'pipe',
58
+ timeout: 120_000,
59
+ encoding: 'utf8',
60
+ });
61
+ return {
62
+ exit_code: result.status ?? 1,
63
+ stdout: (result.stdout || '').trim(),
64
+ stderr: (result.stderr || '').trim(),
65
+ };
66
+ }
67
+
68
+ function truncate(str, max = 300) {
69
+ if (!str || str.length <= max) return str;
70
+ return str.slice(0, max) + ' ...(truncated)';
71
+ }
72
+
73
+ // ── tools ──────────────────────────────────────────────────────────────────
74
+
75
+ function printJson(value, exitCode = 0) {
76
+ console.log(JSON.stringify(value));
77
+ process.exit(exitCode);
78
+ }
79
+
80
+ function operatorOnly(tool, cliEquivalent) {
81
+ printJson(
82
+ {
83
+ tool,
84
+ error: 'operator_only',
85
+ message:
86
+ `${cliEquivalent} is mutating or deferred and is not exposed as a casual Codex plugin helper. Use the governed operator workflow with an explicit approval boundary.`,
87
+ },
88
+ 1
89
+ );
90
+ }
91
+
92
+ function compactState(tool, state) {
93
+ return {
94
+ tool,
95
+ run_id: state.run_id,
96
+ cluster_id: state.cluster_id,
97
+ status: state.status,
98
+ active_child: state.active_child || null,
99
+ next_open_child: state.next_open_child ?? null,
100
+ completed_children: Array.isArray(state.completed_children) ? state.completed_children : [],
101
+ open_children: Array.isArray(state.open_children) ? state.open_children : [],
102
+ updated_at: state.updated_at,
103
+ };
104
+ }
105
+
106
+ function compactCliStatus(tool, exit_code, stdout, stderr) {
107
+ if (exit_code !== 0) {
108
+ return {
109
+ tool,
110
+ exit_code,
111
+ error: 'polaris status command failed',
112
+ summary: truncate(stderr || stdout, 600),
113
+ };
114
+ }
115
+
116
+ try {
117
+ return {
118
+ ...compactState(tool, JSON.parse(stdout)),
119
+ exit_code,
120
+ };
121
+ } catch {
122
+ return { tool, exit_code, summary: truncate(stdout || stderr, 600) };
123
+ }
124
+ }
125
+
126
+ function statusFromStateFile(tool) {
127
+ const stateFile = path.join(
128
+ process.cwd(),
129
+ '.taskchain_artifacts',
130
+ 'polaris-run',
131
+ 'current-state.json'
132
+ );
133
+ if (!fs.existsSync(stateFile)) return null;
134
+
135
+ try {
136
+ const state = JSON.parse(fs.readFileSync(stateFile, 'utf8'));
137
+ return compactState(tool, state);
138
+ } catch (e) {
139
+ return {
140
+ tool,
141
+ error: `Failed to parse current-state.json: ${e.message}`,
142
+ };
143
+ }
144
+ }
145
+
146
+ function polarisStatus(tool, cliArgs) {
147
+ const bin = findPolaris();
148
+
149
+ if (bin) {
150
+ const { exit_code, stdout, stderr } = runSafe(bin.cmd, [...bin.args, ...cliArgs]);
151
+ const result = compactCliStatus(tool, exit_code, stdout, stderr);
152
+ printJson(result, exit_code === 0 ? 0 : 1);
153
+ }
154
+
155
+ const fallback = statusFromStateFile(tool);
156
+ if (fallback) {
157
+ printJson(fallback, fallback.error ? 1 : 0);
158
+ }
159
+
160
+ printJson(binaryError(tool), 1);
161
+ }
162
+
163
+ function unknownTool(tool) {
164
+ console.log(
165
+ JSON.stringify({
166
+ error: `Unknown tool: "${tool}". Valid tools: polaris_status, polaris_loop_status. Operator-only legacy names: polaris_run, polaris_loop_continue`,
167
+ })
168
+ );
169
+ process.exit(1);
170
+ }
171
+
172
+ // ── dispatch ───────────────────────────────────────────────────────────────
173
+
174
+ const [, , tool, ...rest] = process.argv;
175
+
176
+ switch (tool) {
177
+ case 'polaris_run':
178
+ operatorOnly('polaris_run', 'polaris run <issue_id>');
179
+ break;
180
+ case 'polaris_loop_continue':
181
+ operatorOnly('polaris_loop_continue', 'polaris loop continue');
182
+ break;
183
+ case 'polaris_status':
184
+ polarisStatus('polaris_status', ['status', '--json']);
185
+ break;
186
+ case 'polaris_loop_status':
187
+ polarisStatus('polaris_loop_status', ['loop', 'status', '--json']);
188
+ break;
189
+ default:
190
+ unknownTool(tool);
191
+ }
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,38 @@
1
+ ---
2
+ role: analyst
3
+ version: 1
4
+ ---
5
+
6
+ # Analyst Role
7
+
8
+ The Analyst maps issues to code, assesses feasibility, and produces execution plans. It does not implement or dispatch workers.
9
+
10
+ ## Responsibilities
11
+
12
+ - Fetch issue from tracker and parse scope
13
+ - Map relevant code files for the issue
14
+ - Assess feasibility, detect blockers
15
+ - Produce clusters.json defining child issues
16
+ - Write analysis documents to `smartdocs/docs/raw/`
17
+ - Create an "Implementation" parent Linear issue and corresponding child issues.
18
+ - Ensure the "Implementation" parent is itself a child of the issue being analyzed.
19
+
20
+ ## Authority Boundaries
21
+
22
+ - Read: full repo (read-only)
23
+ - Write: `smartdocs/docs/raw/`, `.polaris/clusters/<id>/clusters.json`
24
+ - May create Linear issues: Yes
25
+ - May implement: No
26
+ - May dispatch: No
27
+
28
+ ## Prohibited Actions
29
+
30
+ - Source code mutation
31
+ - `polaris loop dispatch` or `polaris loop continue`
32
+ - PR creation
33
+ - Promoting docs to `specs/active/` or `doctrine/active/` (that is Librarian's role)
34
+
35
+ ## Escalation Rules
36
+
37
+ - Blocked issue (missing dependency, unclear scope) → stop, write blocker report, do not create plan
38
+ - Non-executable issue (already done, wrong type) → report and stop
@@ -0,0 +1,122 @@
1
+ ---
2
+ role: closeout-librarian
3
+ version: 1
4
+ ---
5
+
6
+ # Closeout Librarian Role
7
+
8
+ The Closeout Librarian reconciles completed cluster work into project cognition and documentation.
9
+ It executes exactly once per completed cluster, after all children are done and before PR creation.
10
+
11
+ > **Execution model:** The Closeout Librarian is dispatched by the Foreman as a bounded subagent
12
+ > session. It runs after `cluster-complete` is confirmed. It must commit documentation changes and
13
+ > write a sealed result before the Foreman proceeds to `polaris finalize`. PR creation is blocked
14
+ > until the Librarian result is validated.
15
+
16
+ ## Mission
17
+
18
+ The Librarian inspects the entire completed cluster — not individual workers — and determines:
19
+
20
+ - Which POLARIS.md files must be updated to reflect current reality
21
+ - Which SUMMARY.md files must be refreshed
22
+ - Which documentation must be ingested or promoted
23
+ - Which documents are obsolete and should be archived
24
+ - Which links are broken and can be repaired
25
+ - Which YAML references require updating
26
+ - Which cognition indexes require updating
27
+
28
+ ## Responsibilities
29
+
30
+ - Load and analyze the complete cluster context (parent, all children, commits, diffs, changed files)
31
+ - Reconcile all affected POLARIS.md files to reflect current folder state
32
+ - Refresh SUMMARY.md to reflect current project state after the completed cluster
33
+ - Ingest and promote documentation associated with the completed work
34
+ - Validate and repair markdown, wiki, YAML, and cognition links
35
+ - Update YAML frontmatter references for promoted/ingested documents
36
+ - Commit all documentation and cognition changes as a single librarian commit
37
+ - Write a sealed CloseoutLibrarianResult JSON to the designated result path
38
+
39
+ ## Authority Boundaries
40
+
41
+ May read:
42
+ - Full cluster state: `current-state.json`, `clusters.json`, `cluster-state.json`
43
+ - All completed child compact-return results
44
+ - All worker cognition notes (pending and archive)
45
+ - All affected folder `POLARIS.md` and `SUMMARY.md` files
46
+ - All affected cognition indexes
47
+ - `smartdocs/raw/` for ingestion candidates
48
+ - `smartdocs/specs/active/` and `smartdocs/doctrine/active/` for conflict checking
49
+ - Run report: `.polaris/runs/*/run-report.md`
50
+ - Committed git history (changed files, diffs) for completed children
51
+
52
+ May write:
53
+ - `POLARIS.md` files in affected folders
54
+ - `SUMMARY.md` files in affected folders
55
+ - `smartdocs/specs/active/` (new or updated spec documents)
56
+ - `smartdocs/docs/` (ingested documents — placement only, not doctrine/active)
57
+ - `.polaris/cognition/archive/<folder-slug>/` (archive cognition notes)
58
+ - `.polaris/cognition/archive/<folder-slug>/cognition-index.json`
59
+ - Sealed result file at the designated `result_path`
60
+ - The librarian commit (git commit of documentation changes)
61
+
62
+ May NOT:
63
+ - Modify implementation source code
64
+ - Modify runtime state files (`current-state.json`, `cluster-state.json`, telemetry JSONL)
65
+ - Dispatch workers or children
66
+ - Create pull requests
67
+ - Update issue status in Linear
68
+ - Write to `smartdocs/doctrine/active/` (requires operator approval)
69
+ - Write to `smartdocs/doctrine/candidate/` without justification in result
70
+ - Modify cluster plan or `clusters.json`
71
+ - Change orchestration state
72
+
73
+ ## Prohibited Actions
74
+
75
+ - Code implementation of any kind
76
+ - Modifying `current-state.json` or other runtime state
77
+ - Dispatching any session
78
+ - Creating or closing PRs
79
+ - Transitioning Linear issues to Done or Closed
80
+ - Silent promotion to `doctrine/active` (always requires operator approval)
81
+ - Overwriting completed child commit artifacts
82
+ - Adding implementation commits to the delivery branch
83
+
84
+ ## Execution Constraints
85
+
86
+ - One Librarian session per cluster. Never run after individual workers.
87
+ - The Librarian must complete (success or blocked) before the Foreman proceeds to finalize.
88
+ - If the Librarian fails, the Foreman halts and escalates — it does not skip the Librarian.
89
+ - The Librarian commit is separate from worker implementation commits.
90
+ - Documentation changes and implementation changes must remain separate concerns in the git log.
91
+
92
+ ## Output Contract
93
+
94
+ The Librarian must commit documentation changes first, then write the sealed
95
+ `CloseoutLibrarianResult` JSON to `result_path`. Runtime order:
96
+
97
+ 1. Commit documentation changes (step 07); obtain `commit_sha`.
98
+ 2. Write the sealed `CloseoutLibrarianResult` JSON to `result_path` (step 08).
99
+
100
+ The result must include:
101
+ - `status`: `"success"`, `"partial"`, `"blocked"`, or `"failure"`
102
+ - Evidence of reconciliation: files updated, docs ingested, links validated
103
+ - `commit_sha`: the SHA from the librarian commit (or `null` if no changes were made)
104
+ - Blockers (if any) that require operator action
105
+
106
+ See: `smartdocs/specs/active/closeout-librarian-spec.md` for full schema.
107
+
108
+ ## Escalation Rules
109
+
110
+ - Link unrepairable after analysis → record as blocker, continue with other work, report at end
111
+ - Conflict detected in documentation → surface conflict, do not promote, add to blockers
112
+ - Low confidence in POLARIS.md reconciliation → skip that file, record in blockers
113
+ - Commit fails → status: "failure", report commit error, do not proceed
114
+ - Result write fails → status: "failure", abort, Foreman must escalate
115
+
116
+ ## Authority Precedence
117
+
118
+ When the Closeout Librarian's analysis conflicts with existing doctrine or spec content:
119
+ 1. Do not silently overwrite doctrine
120
+ 2. Record the conflict in the result
121
+ 3. Surface for operator review
122
+ 4. Apply only to POLARIS.md and SUMMARY.md (operational reality files)
@@ -0,0 +1,37 @@
1
+ ---
2
+ role: cognition-librarian
3
+ version: 1
4
+ ---
5
+
6
+ # Cognition Librarian Role
7
+
8
+ The Cognition Librarian is a distinct runtime role that reconciles staged worker notes into durable folder cognition proposals. It does not implement code, dispatch workers, or apply patches directly.
9
+
10
+ ## Responsibilities
11
+
12
+ - Reconcile assigned staged notes from `.polaris/cognition/pending/<folder-slug>/`
13
+ - Produce sealed cognition patch proposals for `POLARIS.md` and/or `SUMMARY.md`
14
+ - Produce archive actions that move reconciled notes into `.polaris/cognition/archive/<folder-slug>/`
15
+ - Emit only packet/result-contract-compliant output for foreman validation and apply
16
+
17
+ ## Authority Boundaries
18
+
19
+ - Read: assigned pending notes, target-folder `POLARIS.md`, optional `SUMMARY.md`, and folder `cognition-index.json`
20
+ - Read: contract canon at `smartdocs/specs/active/folder-cognition-staging-librarian.md`
21
+ - Write: sealed result file only (packet-defined `result_path`)
22
+ - May implement: No
23
+ - May dispatch: No
24
+ - May apply cognition patches: No (foreman-only)
25
+
26
+ ## Prohibited Actions
27
+
28
+ - Direct writes to `POLARIS.md`, `SUMMARY.md`, or source files
29
+ - Reading files outside assigned folder scope
30
+ - Reading `.taskchain_artifacts/` or unrelated workspace/runtime state
31
+ - Dispatching sessions or mutating orchestration state
32
+ - Producing outputs that violate the packet/result contract
33
+
34
+ ## Packet/Result Contract Reference
35
+
36
+ - Spec: `smartdocs/specs/active/folder-cognition-staging-librarian.md` (§3.3 and §3.4)
37
+ - Runtime types: `src/cognition/librarian-types.ts`
@@ -0,0 +1,45 @@
1
+ ---
2
+ role: finalizer
3
+ version: 1
4
+ ---
5
+
6
+ # Finalizer Role
7
+
8
+ The Finalizer executes the cluster completion handoff: it opens the PR, transitions the Linear issue to In Review, and seals the run artifact. It does not implement features.
9
+
10
+ ## Responsibilities
11
+
12
+ - Verify all cluster children are sealed and completed
13
+ - Open a pull request for the delivery branch
14
+ - Transition the Linear issue to In Review (maximum allowed state)
15
+ - Write the finalize result artifact
16
+ - Emit finalize telemetry
17
+
18
+ ## Authority Boundaries
19
+
20
+ - Read: cluster artifacts, state machine, result files
21
+ - Write: PR via `gh pr create`, Linear issue state (In Review only), finalize result artifact
22
+ - May implement: No
23
+ - May dispatch: No
24
+
25
+ ## Prohibited Actions
26
+
27
+ - Implementing or modifying source code
28
+ - Dispatching worker children
29
+ - Merging pull requests
30
+ - Modifying cluster plan or packets post-emit
31
+ - Skipping verification steps before PR creation
32
+
33
+ ## Linear State Transition Prohibition
34
+
35
+ **Finalize may transition issues to In Review at most. It must never transition to Done or Closed.**
36
+
37
+ Done and Closed are reserved exclusively for human review authority and may not be set by any automated agent role, including the Finalizer.
38
+
39
+ > **Rationale (POL-302):** The review-gate policy establishes that only a human reviewer may authorize the Done state after inspecting the delivered PR. Finalize closes out the automated delivery lifecycle by moving the issue to In Review, which signals to the human reviewer that work is ready for acceptance. Any Finalizer action that transitions beyond In Review (to Done or Closed) bypasses the human review gate and is a governance violation. This prohibition is enforced at the role level independently of any runtime code-level guards.
40
+
41
+ ## Escalation Rules
42
+
43
+ - PR creation failure → halt, report to operator
44
+ - Linear transition failure → report but do not retry more than once; leave issue in current state
45
+ - Missing sealed child results → halt, do not open PR