@lsctech/polaris 0.1.1 → 0.2.0

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 (218) 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/governance/authority-risk.js +56 -0
  10. package/dist/governance/index.js +12 -0
  11. package/dist/governance/review-packet.js +114 -0
  12. package/dist/governance/routing.js +63 -0
  13. package/dist/governance/types.js +8 -0
  14. package/dist/smartdocs-engine/index.js +16 -2
  15. package/dist/smartdocs-engine/ingest.js +146 -13
  16. package/dist/workspace/.polaris/roles/analyst.md +38 -0
  17. package/dist/workspace/.polaris/roles/closeout-librarian.md +122 -0
  18. package/dist/workspace/.polaris/roles/cognition-librarian.md +37 -0
  19. package/dist/workspace/.polaris/roles/finalizer.md +45 -0
  20. package/dist/workspace/.polaris/roles/foreman.md +165 -0
  21. package/dist/workspace/.polaris/roles/librarian.md +74 -0
  22. package/dist/workspace/.polaris/roles/worker.md +119 -0
  23. package/dist/workspace/.polaris/session-type +1 -0
  24. package/dist/workspace/.polaris/skills/ROUTING.md +109 -0
  25. package/dist/workspace/.polaris/skills/caveman/SKILL.md +74 -0
  26. package/dist/workspace/.polaris/skills/caveman-compress/scripts/compress.py +272 -0
  27. package/dist/workspace/.polaris/skills/closeout-librarian/POLARIS.md +46 -0
  28. package/dist/workspace/.polaris/skills/closeout-librarian/SKILL.md +59 -0
  29. package/dist/workspace/.polaris/skills/closeout-librarian/chain.md +116 -0
  30. package/dist/workspace/.polaris/skills/closeout-librarian/steps/01-load-cluster-context.md +78 -0
  31. package/dist/workspace/.polaris/skills/closeout-librarian/steps/02-drift-reconciliation.md +157 -0
  32. package/dist/workspace/.polaris/skills/closeout-librarian/steps/03-reconcile-polaris-md.md +93 -0
  33. package/dist/workspace/.polaris/skills/closeout-librarian/steps/04-reconcile-summary-md.md +106 -0
  34. package/dist/workspace/.polaris/skills/closeout-librarian/steps/05-doc-ingestion.md +114 -0
  35. package/dist/workspace/.polaris/skills/closeout-librarian/steps/06-link-validation.md +128 -0
  36. package/dist/workspace/.polaris/skills/closeout-librarian/steps/07-yaml-linking.md +95 -0
  37. package/dist/workspace/.polaris/skills/closeout-librarian/steps/08-librarian-commit.md +119 -0
  38. package/dist/workspace/.polaris/skills/closeout-librarian/steps/09-sealed-result.md +118 -0
  39. package/dist/workspace/.polaris/skills/docs-ingest/SKILL.md +68 -0
  40. package/dist/workspace/.polaris/skills/docs-ingest/chain.json +23 -0
  41. package/dist/workspace/.polaris/skills/docs-ingest/chain.md +149 -0
  42. package/dist/workspace/.polaris/skills/docs-ingest/steps/01-orient-ingest.md +85 -0
  43. package/dist/workspace/.polaris/skills/docs-ingest/steps/02-classify-batch.md +87 -0
  44. package/dist/workspace/.polaris/skills/docs-ingest/steps/03-conflict-check.md +66 -0
  45. package/dist/workspace/.polaris/skills/docs-ingest/steps/04-place-and-link.md +77 -0
  46. package/dist/workspace/.polaris/skills/docs-ingest/steps/05-finalize-ingest.md +49 -0
  47. package/dist/workspace/.polaris/skills/docs-promote/SKILL.md +79 -0
  48. package/dist/workspace/.polaris/skills/docs-promote/chain.json +25 -0
  49. package/dist/workspace/.polaris/skills/docs-promote/chain.md +80 -0
  50. package/dist/workspace/.polaris/skills/docs-promote/steps/01-orient-promote.md +53 -0
  51. package/dist/workspace/.polaris/skills/docs-promote/steps/02-review-candidates.md +51 -0
  52. package/dist/workspace/.polaris/skills/docs-promote/steps/03-read-linked-code.md +50 -0
  53. package/dist/workspace/.polaris/skills/docs-promote/steps/04-conflict-surface.md +65 -0
  54. package/dist/workspace/.polaris/skills/docs-promote/steps/05-await-approval.md +61 -0
  55. package/dist/workspace/.polaris/skills/docs-promote/steps/06-execute-promote-deprecate.md +65 -0
  56. package/dist/workspace/.polaris/skills/docs-promote/steps/07-finalize-promote.md +44 -0
  57. package/dist/workspace/.polaris/skills/polaris-analyze/SKILL.md +94 -0
  58. package/dist/workspace/.polaris/skills/polaris-analyze/chain.json +20 -0
  59. package/dist/workspace/.polaris/skills/polaris-analyze/chain.md +105 -0
  60. package/dist/workspace/.polaris/skills/polaris-analyze/issue-reconciliation.md +149 -0
  61. package/dist/workspace/.polaris/skills/polaris-analyze/issue-template.md +133 -0
  62. package/dist/workspace/.polaris/skills/polaris-analyze/linked-skills/repo-analysis.md +55 -0
  63. package/dist/workspace/.polaris/skills/polaris-analyze/steps/01-fetch-and-orient.md +79 -0
  64. package/dist/workspace/.polaris/skills/polaris-analyze/steps/02-map-affected-code.md +58 -0
  65. package/dist/workspace/.polaris/skills/polaris-analyze/steps/03-assess-issue.md +58 -0
  66. package/dist/workspace/.polaris/skills/polaris-analyze/steps/04-blocker-check.md +60 -0
  67. package/dist/workspace/.polaris/skills/polaris-analyze/steps/05-create-cluster-plan.md +197 -0
  68. package/dist/workspace/.polaris/skills/polaris-analyze/steps/06-final-report.md +60 -0
  69. package/dist/workspace/.polaris/skills/polaris-catalog/SKILL.md +91 -0
  70. package/dist/workspace/.polaris/skills/polaris-catalog/chain.json +22 -0
  71. package/dist/workspace/.polaris/skills/polaris-catalog/chain.md +85 -0
  72. package/dist/workspace/.polaris/skills/polaris-catalog/steps/01-orient-catalog.md +92 -0
  73. package/dist/workspace/.polaris/skills/polaris-catalog/steps/02-reconcile-polaris-md.md +33 -0
  74. package/dist/workspace/.polaris/skills/polaris-catalog/steps/03-reconcile-summary-md.md +70 -0
  75. package/dist/workspace/.polaris/skills/polaris-catalog/steps/04-classify-and-place.md +117 -0
  76. package/dist/workspace/.polaris/skills/polaris-catalog/steps/05-catalog-commit.md +94 -0
  77. package/dist/workspace/.polaris/skills/polaris-medic/SKILL.md +52 -0
  78. package/dist/workspace/.polaris/skills/polaris-medic/chain.md +111 -0
  79. package/dist/workspace/.polaris/skills/polaris-medic/steps/01-orient-medic.md +75 -0
  80. package/dist/workspace/.polaris/skills/polaris-medic/steps/02-diagnose.md +79 -0
  81. package/dist/workspace/.polaris/skills/polaris-medic/steps/03-repair.md +64 -0
  82. package/dist/workspace/.polaris/skills/polaris-medic/steps/04-validate.md +66 -0
  83. package/dist/workspace/.polaris/skills/polaris-medic/steps/05-create-chart.md +85 -0
  84. package/dist/workspace/.polaris/skills/polaris-medic/steps/06-closeout.md +86 -0
  85. package/dist/workspace/.polaris/skills/polaris-reconcile/SKILL.md +75 -0
  86. package/dist/workspace/.polaris/skills/polaris-reconcile/chain.json +20 -0
  87. package/dist/workspace/.polaris/skills/polaris-reconcile/chain.md +67 -0
  88. package/dist/workspace/.polaris/skills/polaris-reconcile/steps/01-orient-reconcile.md +82 -0
  89. package/dist/workspace/.polaris/skills/polaris-reconcile/steps/02-reconcile-polaris-md.md +95 -0
  90. package/dist/workspace/.polaris/skills/polaris-reconcile/steps/03-reconcile-summary-md.md +108 -0
  91. package/dist/workspace/.polaris/skills/polaris-reconcile/steps/04-reconcile-commit.md +88 -0
  92. package/dist/workspace/.polaris/skills/polaris-run/SKILL.md +135 -0
  93. package/dist/workspace/.polaris/skills/polaris-run/chain.json +19 -0
  94. package/dist/workspace/.polaris/skills/polaris-run/chain.md +298 -0
  95. package/dist/workspace/.polaris/skills/polaris-run/execution-adapter.md +34 -0
  96. package/dist/workspace/.polaris/skills/polaris-run/linked-skills/repo-analysis.md +58 -0
  97. package/dist/workspace/.polaris/skills/polaris-run/steps/01-orient-cluster.md +96 -0
  98. package/dist/workspace/.polaris/skills/polaris-run/steps/02-prepare-branch.md +53 -0
  99. package/dist/workspace/.polaris/skills/polaris-run/steps/03-select-child.md +63 -0
  100. package/dist/workspace/.polaris/skills/polaris-run/steps/04-execute-child.md +75 -0
  101. package/dist/workspace/.polaris/skills/polaris-run/steps/05-validate-child.md +57 -0
  102. package/dist/workspace/.polaris/skills/polaris-run/steps/06-commit-and-update-linear.md +74 -0
  103. package/dist/workspace/.polaris/skills/polaris-run/steps/07-decide-continuation.md +89 -0
  104. package/dist/workspace/.polaris/skills/polaris-run/steps/08-closeout-librarian.md +146 -0
  105. package/dist/workspace/.polaris/skills/polaris-run/steps/08-final-delivery.md +91 -0
  106. package/dist/workspace/.polaris/skills/polaris-run/steps/09-final-delivery.md +104 -0
  107. package/dist/workspace/.polaris/skills/polaris-tools/README.md +63 -0
  108. package/dist/workspace/.polaris/skills/polaris-tools/SKILL.md +94 -0
  109. package/dist/workspace/.polaris/skills/polaris-tools/tools.js +191 -0
  110. package/dist/workspace/smartdocs/architecture/.gitkeep +0 -0
  111. package/dist/workspace/smartdocs/audits/.gitkeep +0 -0
  112. package/dist/workspace/smartdocs/decisions/.gitkeep +0 -0
  113. package/dist/workspace/smartdocs/doctrine/active/.gitkeep +0 -0
  114. package/dist/workspace/smartdocs/runtime/.gitkeep +0 -0
  115. package/dist/workspace/smartdocs/specs/active/.gitkeep +0 -0
  116. package/dist/workspace/smartdocs/specs/archive/.gitkeep +0 -0
  117. package/dist/workspace/workspace/.polaris/roles/analyst.md +38 -0
  118. package/dist/workspace/workspace/.polaris/roles/closeout-librarian.md +122 -0
  119. package/dist/workspace/workspace/.polaris/roles/cognition-librarian.md +37 -0
  120. package/dist/workspace/workspace/.polaris/roles/finalizer.md +45 -0
  121. package/dist/workspace/workspace/.polaris/roles/foreman.md +165 -0
  122. package/dist/workspace/workspace/.polaris/roles/librarian.md +74 -0
  123. package/dist/workspace/workspace/.polaris/roles/worker.md +119 -0
  124. package/dist/workspace/workspace/.polaris/session-type +1 -0
  125. package/dist/workspace/workspace/.polaris/skills/ROUTING.md +109 -0
  126. package/dist/workspace/workspace/.polaris/skills/caveman/SKILL.md +74 -0
  127. package/dist/workspace/workspace/.polaris/skills/caveman-compress/scripts/compress.py +272 -0
  128. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/POLARIS.md +46 -0
  129. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/SKILL.md +59 -0
  130. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/chain.md +116 -0
  131. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/01-load-cluster-context.md +78 -0
  132. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/02-drift-reconciliation.md +157 -0
  133. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/03-reconcile-polaris-md.md +93 -0
  134. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/04-reconcile-summary-md.md +106 -0
  135. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/05-doc-ingestion.md +114 -0
  136. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/06-link-validation.md +128 -0
  137. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/07-yaml-linking.md +95 -0
  138. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/08-librarian-commit.md +119 -0
  139. package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/09-sealed-result.md +118 -0
  140. package/dist/workspace/workspace/.polaris/skills/docs-ingest/SKILL.md +68 -0
  141. package/dist/workspace/workspace/.polaris/skills/docs-ingest/chain.json +23 -0
  142. package/dist/workspace/workspace/.polaris/skills/docs-ingest/chain.md +149 -0
  143. package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/01-orient-ingest.md +85 -0
  144. package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/02-classify-batch.md +87 -0
  145. package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/03-conflict-check.md +66 -0
  146. package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/04-place-and-link.md +77 -0
  147. package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/05-finalize-ingest.md +49 -0
  148. package/dist/workspace/workspace/.polaris/skills/docs-promote/SKILL.md +79 -0
  149. package/dist/workspace/workspace/.polaris/skills/docs-promote/chain.json +25 -0
  150. package/dist/workspace/workspace/.polaris/skills/docs-promote/chain.md +80 -0
  151. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/01-orient-promote.md +53 -0
  152. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/02-review-candidates.md +51 -0
  153. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/03-read-linked-code.md +50 -0
  154. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/04-conflict-surface.md +65 -0
  155. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/05-await-approval.md +61 -0
  156. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/06-execute-promote-deprecate.md +65 -0
  157. package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/07-finalize-promote.md +44 -0
  158. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/SKILL.md +94 -0
  159. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/chain.json +20 -0
  160. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/chain.md +105 -0
  161. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/issue-reconciliation.md +149 -0
  162. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/issue-template.md +133 -0
  163. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/linked-skills/repo-analysis.md +55 -0
  164. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/01-fetch-and-orient.md +79 -0
  165. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/02-map-affected-code.md +58 -0
  166. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/03-assess-issue.md +58 -0
  167. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/04-blocker-check.md +60 -0
  168. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/05-create-cluster-plan.md +197 -0
  169. package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/06-final-report.md +60 -0
  170. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/SKILL.md +91 -0
  171. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/chain.json +22 -0
  172. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/chain.md +85 -0
  173. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/01-orient-catalog.md +92 -0
  174. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/02-reconcile-polaris-md.md +33 -0
  175. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/03-reconcile-summary-md.md +70 -0
  176. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/04-classify-and-place.md +117 -0
  177. package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/05-catalog-commit.md +94 -0
  178. package/dist/workspace/workspace/.polaris/skills/polaris-medic/SKILL.md +52 -0
  179. package/dist/workspace/workspace/.polaris/skills/polaris-medic/chain.md +111 -0
  180. package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/01-orient-medic.md +75 -0
  181. package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/02-diagnose.md +79 -0
  182. package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/03-repair.md +64 -0
  183. package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/04-validate.md +66 -0
  184. package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/05-create-chart.md +85 -0
  185. package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/06-closeout.md +86 -0
  186. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/SKILL.md +75 -0
  187. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/chain.json +20 -0
  188. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/chain.md +67 -0
  189. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/steps/01-orient-reconcile.md +82 -0
  190. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/steps/02-reconcile-polaris-md.md +95 -0
  191. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/steps/03-reconcile-summary-md.md +108 -0
  192. package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/steps/04-reconcile-commit.md +88 -0
  193. package/dist/workspace/workspace/.polaris/skills/polaris-run/SKILL.md +135 -0
  194. package/dist/workspace/workspace/.polaris/skills/polaris-run/chain.json +19 -0
  195. package/dist/workspace/workspace/.polaris/skills/polaris-run/chain.md +298 -0
  196. package/dist/workspace/workspace/.polaris/skills/polaris-run/execution-adapter.md +34 -0
  197. package/dist/workspace/workspace/.polaris/skills/polaris-run/linked-skills/repo-analysis.md +58 -0
  198. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/01-orient-cluster.md +96 -0
  199. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/02-prepare-branch.md +53 -0
  200. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/03-select-child.md +63 -0
  201. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/04-execute-child.md +75 -0
  202. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/05-validate-child.md +57 -0
  203. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/06-commit-and-update-linear.md +74 -0
  204. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/07-decide-continuation.md +89 -0
  205. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/08-closeout-librarian.md +146 -0
  206. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/08-final-delivery.md +91 -0
  207. package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/09-final-delivery.md +104 -0
  208. package/dist/workspace/workspace/.polaris/skills/polaris-tools/README.md +63 -0
  209. package/dist/workspace/workspace/.polaris/skills/polaris-tools/SKILL.md +94 -0
  210. package/dist/workspace/workspace/.polaris/skills/polaris-tools/tools.js +191 -0
  211. package/dist/workspace/workspace/smartdocs/architecture/.gitkeep +0 -0
  212. package/dist/workspace/workspace/smartdocs/audits/.gitkeep +0 -0
  213. package/dist/workspace/workspace/smartdocs/decisions/.gitkeep +0 -0
  214. package/dist/workspace/workspace/smartdocs/doctrine/active/.gitkeep +0 -0
  215. package/dist/workspace/workspace/smartdocs/runtime/.gitkeep +0 -0
  216. package/dist/workspace/workspace/smartdocs/specs/active/.gitkeep +0 -0
  217. package/dist/workspace/workspace/smartdocs/specs/archive/.gitkeep +0 -0
  218. package/package.json +2 -2
@@ -0,0 +1,79 @@
1
+ ---
2
+ name: polaris-analyze-step-01-fetch-and-orient
3
+ description: Generate run_id, emit run-start telemetry, fetch the Linear issue and check repo-analysis provider availability in parallel.
4
+ ---
5
+
6
+ # Step 01 — Fetch and orient
7
+
8
+ ## Purpose
9
+
10
+ Load the issue state, confirm the repo index is current, and establish governed session context before any inspection.
11
+
12
+ ## Scope declarations
13
+
14
+ ```yaml
15
+ allowed_files:
16
+ - .polaris/skills/polaris-analyze/SKILL.md
17
+ - .polaris/skills/polaris-analyze/chain.md
18
+ - .taskchain_artifacts/polaris-analyze/current-state.json
19
+ allowed_routes:
20
+ - CLAUDE.md
21
+ - docs/Polaris/spec/polaris-implementation-plan.md
22
+ - .polaris/skills/polaris-analyze/chain.md
23
+ allowed_skills:
24
+ - repo-analysis
25
+ expected_evidence:
26
+ - run_id generated
27
+ - run-start telemetry emitted
28
+ - Linear issue fetched
29
+ - repo-analysis provider status checked
30
+ - analysis target and context recorded
31
+ stop_rules:
32
+ - run-start telemetry write fails
33
+ - issue missing or inaccessible
34
+ - issue is already Done or Cancelled
35
+ ```
36
+
37
+ ## Actions
38
+
39
+ 0. **Generate `run_id`** — pure local computation:
40
+ - Format: `polaris-analyze-<slug>-<date>-<seq>` (see `chain.md` for format rules)
41
+ - For resumed sessions, read the prior `run_id` from current-state.json first.
42
+
43
+ 1. **Emit `run-start` telemetry** — first I/O action:
44
+ ```bash
45
+ mkdir -p .taskchain_artifacts/polaris-analyze/runs/<run-id>
46
+ echo '{"event":"run-start","run_id":"<run-id>","prior_run_id":"<prior or null>","timestamp":"<ISO>"}' \
47
+ >> .taskchain_artifacts/polaris-analyze/runs/<run-id>/telemetry.jsonl
48
+ ```
49
+ If this write fails: halt.
50
+
51
+ 2. Run both of the following **in the same turn** (independent, parallelizable):
52
+ - Fetch the Linear issue by ID. Read: title, description, labels, state, priority, existing child issues, blocking relationships.
53
+ - If already Done or Cancelled: report and stop.
54
+ - Check `polaris.config.json` for `providers.repoAnalysis.preferred`.
55
+ - If a provider is configured and available in the session environment:
56
+ - Check provider index freshness. If stale: attempt refresh per provider's documented mechanism.
57
+ - Record `repo_analysis_status: available` in artifact.
58
+ - If not configured or unavailable:
59
+ - Note: no repo-analysis provider available — polaris map query + direct inspection will be used in step 02.
60
+ - Record `repo_analysis_status: not-configured` or `unavailable` accordingly.
61
+
62
+ ## Artifact update
63
+
64
+ Update `.taskchain_artifacts/polaris-analyze/current-state.json`:
65
+ - `run_id: <generated>`
66
+ - `cluster_id: <issue ID>`
67
+ - `skill: polaris-analyze`
68
+ - `artifact_dir: ".taskchain_artifacts/polaris-analyze"`
69
+ - `status: running`
70
+ - `parent_issue: <ID — title>`
71
+ - `repo_analysis_status: available | unavailable | not-configured`
72
+ - `current_step_id: 01-fetch-and-orient`
73
+ - `started_at: <timestamp>`
74
+
75
+ Emit `step-complete` for `01-fetch-and-orient` to telemetry JSONL.
76
+
77
+ ## Next step
78
+
79
+ 02-map-affected-code
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: polaris-analyze-step-02-map-affected-code
3
+ description: Use the configured repo-analysis provider (if available) or the fallback path to map the files, symbols, and execution flows affected by the issue scope.
4
+ ---
5
+
6
+ # Step 02 — Map affected code
7
+
8
+ ## Purpose
9
+
10
+ Identify the files, symbols, and execution flows relevant to the issue before assessing feasibility or decomposition.
11
+
12
+ ## Scope declarations
13
+
14
+ ```yaml
15
+ allowed_files:
16
+ - files named in Linear issue
17
+ - nearest POLARIS.md or INSTRUCTIONS.md for named paths
18
+ - repo-analysis provider query results for issue concepts (when provider is available)
19
+ allowed_routes:
20
+ - CLAUDE.md
21
+ - .polaris/skills/polaris-analyze/chain.md
22
+ allowed_skills:
23
+ - repo-analysis
24
+ expected_evidence:
25
+ - affected files and symbols listed
26
+ - impact and execution-flow evidence recorded
27
+ - unknown surfaces called out
28
+ stop_rules:
29
+ - issue has no mappable code surface
30
+ - repo-analysis provider result is stale and cannot be refreshed (only when provider is in use; if unavailable use fallback)
31
+ - mapping requires broad unrelated traversal
32
+ ```
33
+
34
+ ## Actions
35
+
36
+ 1. Check `repo_analysis_status` from the step 01 artifact.
37
+ 2. **If provider is available:** use it for targeted inspection only — query concepts relevant to the issue scope. Use impact analysis and context queries for specific symbols mentioned in the issue. Do not summarize the whole repo.
38
+ 3. **If provider is unavailable (fallback path):**
39
+ - Use `npm run polaris -- map query <path>` for route/domain/taskchain context on affected files
40
+ - Use `rg <symbol>` for symbol and pattern location across the repo
41
+ - Use direct file inspection for implementation details
42
+ - The fallback path is always sufficient to complete the analysis.
43
+ 4. Always run `npm run polaris -- map query <path>` for each affected file — it provides Polaris-specific routing context regardless of whether a provider is also in use.
44
+ 5. Inspect only files relevant to the issue scope.
45
+ 6. Record the files and execution flows inspected.
46
+
47
+ ## Artifact update
48
+
49
+ Update `.taskchain_artifacts/polaris-analyze/current-state.json`:
50
+ - `files_inspected: [<list of files/flows>]`
51
+ - `current_step_id: 02-map-affected-code`
52
+ - `updated_at: <timestamp>`
53
+
54
+ Emit `step-complete` for `02-map-affected-code` to telemetry JSONL.
55
+
56
+ ## Next step
57
+
58
+ 03-assess-issue
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: polaris-analyze-step-03-assess-issue
3
+ description: Classify the issue into one of five outcomes based on Linear state and repo inspection results.
4
+ ---
5
+
6
+ # Step 03 — Assess issue
7
+
8
+ ## Purpose
9
+
10
+ Determine whether the issue is executable, already satisfied, blocked, ambiguous, or needs splitting before planning clusters.
11
+
12
+ ## Scope declarations
13
+
14
+ ```yaml
15
+ allowed_files:
16
+ - Linear issue description and comments
17
+ - affected-code map from step 02
18
+ - direct file snippets needed to verify claims
19
+ allowed_routes:
20
+ - CLAUDE.md
21
+ - docs/Polaris/spec/polaris-implementation-plan.md
22
+ - .polaris/skills/polaris-analyze/chain.md
23
+ expected_evidence:
24
+ - issue classified as one of five outcomes
25
+ - evidence supports classification
26
+ - recommended next action recorded
27
+ stop_rules:
28
+ - claims cannot be verified
29
+ - acceptance criteria are ambiguous without user input
30
+ - assessment depends on external state unavailable to this run
31
+ ```
32
+
33
+ ## Actions
34
+
35
+ Determine one of the following outcomes:
36
+
37
+ | Outcome | Condition |
38
+ |---|---|
39
+ | **Already satisfied** | Repo already implements what the issue describes |
40
+ | **Needs cluster plan** | Clear implementation work can be decomposed into executable clusters |
41
+ | **Needs doctrine clarification** | Issue is ambiguous or conflicts with existing architecture |
42
+ | **Blocked** | A prerequisite issue or condition is unmet |
43
+ | **Should be split** | Issue spans multiple unrelated concerns |
44
+
45
+ Report the outcome with evidence before advancing to step 04.
46
+
47
+ ## Artifact update
48
+
49
+ Update `.taskchain_artifacts/polaris-analyze/current-state.json`:
50
+ - `outcome: <already-satisfied | needs-cluster-plan | needs-doctrine-clarification | blocked | should-be-split>`
51
+ - `current_step_id: 03-assess-issue`
52
+ - `updated_at: <timestamp>`
53
+
54
+ Emit `step-complete` for `03-assess-issue` to telemetry JSONL.
55
+
56
+ ## Next step
57
+
58
+ 04-blocker-check
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: polaris-analyze-step-04-blocker-check
3
+ description: Halt if the issue is blocked or non-executable; advance to cluster planning only if outcome is needs-cluster-plan.
4
+ ---
5
+
6
+ # Step 04 — Blocker check
7
+
8
+ ## Purpose
9
+
10
+ Stop forward execution if the issue cannot proceed. Only `needs-cluster-plan` advances to step 05.
11
+
12
+ ## Scope declarations
13
+
14
+ ```yaml
15
+ allowed_files:
16
+ - Linear issue relations and labels
17
+ - assessment output from step 03
18
+ allowed_routes:
19
+ - CLAUDE.md
20
+ - .polaris/skills/polaris-analyze/chain.md
21
+ expected_evidence:
22
+ - blockers and unblock conditions listed
23
+ - safe continuation decision recorded
24
+ stop_rules:
25
+ - blocking dependency exists
26
+ - outcome is not needs-cluster-plan
27
+ ```
28
+
29
+ ## Actions
30
+
31
+ **If outcome is `blocked`:**
32
+ 1. Add a comment to the parent issue explaining the unblock condition.
33
+ 2. Apply a blocked label if available.
34
+ 3. Halt. Do not advance to step 05.
35
+
36
+ **If outcome is `already-satisfied`, `needs-doctrine-clarification`, or `should-be-split`:**
37
+ 1. Produce the appropriate report describing the finding and recommended next action.
38
+ 2. Do not create cluster plans or child issues.
39
+ 3. Halt.
40
+
41
+ **If outcome is `needs-cluster-plan`:** advance to step 05.
42
+
43
+ ## Artifact update
44
+
45
+ If halting:
46
+ - `status: blocked | halted`
47
+ - `current_step_id: 04-blocker-check`
48
+ - `next_step: halted`
49
+ - `updated_at: <timestamp>`
50
+
51
+ If advancing:
52
+ - `current_step_id: 04-blocker-check`
53
+ - `next_step: 05-create-cluster-plan`
54
+ - `updated_at: <timestamp>`
55
+
56
+ Emit `step-complete` for `04-blocker-check` to telemetry JSONL.
57
+
58
+ ## Next step
59
+
60
+ 05-create-cluster-plan (if `needs-cluster-plan`), or halted
@@ -0,0 +1,197 @@
1
+ ---
2
+ name: polaris-analyze-step-05-create-cluster-plan
3
+ description: Create ordered child issues in the tracker (if tracker-backed) and generate a local clusters.json artifact for polaris-run to consume.
4
+ ---
5
+
6
+ # Step 05 — Create cluster plan
7
+
8
+ ## Purpose
9
+
10
+ Produce an ordered execution plan that polaris-run can execute without ambiguity. Always generate a local `clusters.json` artifact. For tracker-backed workflows, also create Linear child issues.
11
+
12
+ ## Scope declarations
13
+
14
+ ```yaml
15
+ allowed_files:
16
+ - assessment output from steps 03-04
17
+ - .polaris/clusters/<source-id>/clusters.json
18
+ - docs/ (for any analysis docs produced)
19
+ - Linear project/team metadata
20
+ allowed_routes:
21
+ - CLAUDE.md
22
+ - docs/Polaris/spec/polaris-implementation-plan.md
23
+ - .polaris/skills/polaris-analyze/chain.md
24
+ expected_evidence:
25
+ - clusters.json written to .polaris/clusters/<implement-parent-id>/clusters.json
26
+ - Linear IMPLEMENT parent issue created under the ANALYZE issue (tracker-backed)
27
+ - Linear child issues created under the IMPLEMENT parent (tracker-backed) or task list updated (trackerless)
28
+ - execution ordering is unambiguous
29
+ - no source code changes made
30
+ stop_rules:
31
+ - cluster boundary is not evidence-backed
32
+ - would require source code changes to produce the plan
33
+ - blocked parent should not receive cluster plan
34
+ ```
35
+
36
+ ## Hard rules
37
+
38
+ - No source code (`src/`, tests, config) may be created or modified in this step.
39
+ - Cluster plans are analysis artifacts only.
40
+ - If source code changes are needed to plan: note them as findings in the plan — do not make them.
41
+
42
+ ## Actions
43
+
44
+ ### 1. Design execution clusters
45
+
46
+ Group the work into executable clusters. Each cluster maps to one polaris-run session.
47
+
48
+ Ordering rules:
49
+ - Clusters with no dependencies execute first.
50
+ - No forward dependencies within a cluster.
51
+ - Children within a cluster execute in ascending numeric/dependency order.
52
+ - Analyze-type children must precede implement-type children in mixed clusters.
53
+
54
+ Each child must have:
55
+ - `session_type`: `analyze` | `implement`
56
+ - `blockedBy`: list of child IDs that must be Done first (empty list if none)
57
+ - A well-scoped Linear issue body (see below) for tracker-backed workflows
58
+
59
+ ### 2. Create Linear IMPLEMENT parent issue (tracker-backed only)
60
+
61
+ Before creating any child issue, create or reuse a separate Linear IMPLEMENT parent issue:
62
+ - Title: `IMPLEMENT: <slug>`
63
+ - Parent: the ANALYZE source issue that produced this cluster plan
64
+ - Purpose: hold executable implementation children for `polaris-run`
65
+
66
+ If a matching IMPLEMENT parent already exists under the ANALYZE issue, update/refine it instead of duplicating it.
67
+
68
+ Children must be created under the IMPLEMENT parent, not under the ANALYZE issue.
69
+
70
+ **The IMPLEMENT parent MUST have a full body using the canonical format.** Title-only stubs are not allowed. Use:
71
+
72
+ ```text
73
+ ## Objective
74
+ One sentence. What this cluster accomplishes when complete.
75
+
76
+ ## Context
77
+ Why this cluster was created. Link to ANALYZE source issue.
78
+
79
+ ## Goal
80
+ The specific implementation outcome for the entire cluster.
81
+
82
+ ## Scope
83
+ Cluster-wide allowed paths or globs for documentation purposes. Each child must include its own explicit ## Scope.
84
+ - <path-or-glob>
85
+ - ...
86
+
87
+ ## Acceptance Criteria
88
+ - Verifiable conditions for the cluster as a whole.
89
+
90
+ ## Validation
91
+ - <command>
92
+ - ...
93
+
94
+ ## Ordering
95
+ Dependencies relative to other IMPLEMENT clusters, if any.
96
+
97
+ ## Non-goals
98
+ What the cluster must not change.
99
+ ```
100
+
101
+ ### 3. Write clusters.json
102
+
103
+ Always write to `.polaris/clusters/<implement-parent-id>/clusters.json`.
104
+
105
+ Set `clusters.json` `source_id` to the IMPLEMENT parent issue ID, not the ANALYZE issue ID. Set `analyze_source_id` to the ANALYZE issue ID for traceability.
106
+
107
+ ```json
108
+ {
109
+ "source_id": "<Linear IMPLEMENT parent issue ID>",
110
+ "analyze_source_id": "<Linear ANALYZE issue ID>",
111
+ "source_type": "linear",
112
+ "created_at": "<ISO timestamp>",
113
+ "clusters": [
114
+ {
115
+ "cluster_id": "cluster-01",
116
+ "children": [
117
+ {
118
+ "id": "<Linear child issue ID or planned ID>",
119
+ "title": "<child title>",
120
+ "session_type": "analyze | implement",
121
+ "blockedBy": []
122
+ }
123
+ ]
124
+ }
125
+ ]
126
+ }
127
+ ```
128
+
129
+ For trackerless workflows (`source_type: "local"`), IDs are locally generated slugs. polaris-run reads from clusters.json rather than Linear.
130
+
131
+ ### 4. Create Linear child issues (tracker-backed only)
132
+
133
+ **Before creating any child:**
134
+ - Check all existing child issues.
135
+ - If a matching child already exists, update/refine it — do not duplicate.
136
+ - Confirm the child parent is the IMPLEMENT parent issue.
137
+
138
+ **Every child issue MUST have a full body. Title-only stubs are not allowed.**
139
+
140
+ **Canonical child issue body format (use this exactly):**
141
+
142
+ ```text
143
+ ## Objective
144
+ One sentence. What this child achieves when complete.
145
+
146
+ ## Context
147
+ Why this child exists. Include relevant bug, PR, cluster, or doctrine context.
148
+
149
+ ## Goal
150
+ Specific implementation outcome for this child.
151
+
152
+ ## Scope
153
+ Machine-readable list of allowed paths or globs. Use explicit repo paths.
154
+ - src/loop/**
155
+ - src/finalize/**
156
+
157
+ ## Acceptance Criteria
158
+ - Verifiable condition 1
159
+ - Verifiable condition 2
160
+
161
+ ## Validation
162
+ - npm run build
163
+ - npm test
164
+ - npx vitest run <relevant paths>
165
+
166
+ ## Ordering
167
+ - List of sibling child IDs this child depends on (or "None").
168
+
169
+ ## Non-goals
170
+ - What this child must not change.
171
+ ```
172
+
173
+ **Critical rules for `## Scope`:**
174
+
175
+ - Use the header `## Scope` exactly — not "Implementation scope", "Expected code areas", "Files", or any other variant. Aliases exist for backward compatibility only; new issues must use `## Scope`.
176
+ - List explicit repo paths or globs, one per bullet.
177
+ - If scope is not yet determinable, write:
178
+ ```markdown
179
+ ## Scope
180
+ - TBD — BLOCKED: scope missing
181
+ ```
182
+ and mark the Linear issue as **Blocked** status. Do NOT invent paths. A blocked issue will not be dispatched by polaris-run.
183
+ - Do not omit the `## Scope` section. A missing scope section causes a hard preflight failure at dispatch time.
184
+
185
+ ## Artifact update
186
+
187
+ Update `.taskchain_artifacts/polaris-analyze/current-state.json`:
188
+ - `clusters_file: ".polaris/clusters/<implement-parent-id>/clusters.json"`
189
+ - `child_issues: [<ID — title>, ...]`
190
+ - `current_step_id: 05-create-cluster-plan`
191
+ - `updated_at: <timestamp>`
192
+
193
+ Emit `step-complete` for `05-create-cluster-plan` to telemetry JSONL.
194
+
195
+ ## Next step
196
+
197
+ 06-final-report
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: polaris-analyze-step-06-final-report
3
+ description: Produce the structured analysis summary, cluster plan, and recommended polaris-run command.
4
+ ---
5
+
6
+ # Step 06 — Final report
7
+
8
+ ## Purpose
9
+
10
+ Deliver the complete analysis result and the command the operator needs to begin implementation.
11
+
12
+ ## Scope declarations
13
+
14
+ ```yaml
15
+ allowed_files:
16
+ - artifacts from steps 01-05
17
+ - .taskchain_artifacts/polaris-analyze/current-state.json
18
+ allowed_routes:
19
+ - CLAUDE.md
20
+ - .polaris/skills/polaris-analyze/chain.md
21
+ expected_evidence:
22
+ - analysis decision summarized
23
+ - clusters.json path confirmed
24
+ - created or updated child issues listed
25
+ - blockers and next action reported
26
+ - recommended run command provided
27
+ stop_rules:
28
+ - artifact state is incomplete
29
+ - analysis has unresolved blocker
30
+ ```
31
+
32
+ ## Actions
33
+
34
+ Return a structured summary containing:
35
+
36
+ 1. **Parent issue audited** — ID, title, state
37
+ 2. **Repo-analysis provider status** — `available` / `unavailable` / `not-configured` (if available: provider name and index freshness)
38
+ 3. **Files / systems inspected** — list (max 10; summarize remainder as "N additional files")
39
+ 4. **Findings** — outcome assessment with evidence (max 5–10 lines; no raw command output)
40
+ 5. **Clusters plan** — cluster IDs, child issues per cluster, session_types, and dependency order
41
+ 6. **clusters.json location** — `.polaris/clusters/<source-id>/clusters.json`
42
+ 7. **Recommended run command**:
43
+ ```bash
44
+ polaris-run <PARENT-ID>
45
+ ```
46
+ 8. **Remaining risks** — anything uncertain, out of scope, or requiring follow-up
47
+
48
+ ## Artifact update
49
+
50
+ Update `.taskchain_artifacts/polaris-analyze/current-state.json`:
51
+ - `status: complete`
52
+ - `current_step_id: 06-final-report`
53
+ - `completed_at: <timestamp>`
54
+ - `updated_at: <timestamp>`
55
+
56
+ Emit `step-complete` for `06-final-report` to telemetry JSONL.
57
+
58
+ ## Session end
59
+
60
+ This is the terminal step. Do not continue to polaris-run or any other implementation skill.
@@ -0,0 +1,91 @@
1
+ ---
2
+ name: polaris-catalog
3
+ description: Combined cognition reconciliation and document classification. Updates POLARIS.md and SUMMARY.md from the packet, then classifies documents in smartdocs/raw/ — auto-placing high-confidence files and asking the user (or leaving in raw when unattended) for low-confidence ones.
4
+ role: librarian
5
+ ---
6
+
7
+ ## Polaris Skill Bootloader
8
+
9
+ **Before proceeding, you must obtain a skill packet from the Polaris runtime.**
10
+
11
+ Run the following command:
12
+
13
+ ```bash
14
+ npm run polaris -- skill packet catalog
15
+ ```
16
+
17
+ - Do not begin work until a packet is returned.
18
+ - Treat the packet as your authoritative instruction source.
19
+ - If no packet is produced, stop and report: **Polaris could not authorize this run.**
20
+
21
+ ---
22
+
23
+ # polaris-catalog
24
+
25
+ Use this skill to perform a full cognition and documentation pass after completed work.
26
+ It combines the cognition reconciliation of `polaris-reconcile` with document classification
27
+ from `smartdocs/raw/`.
28
+
29
+ `polaris-catalog` is the callable-at-will equivalent of what the Closeout Librarian does
30
+ for cognition + ingestion, without requiring a cluster closeout.
31
+
32
+ ## When to use
33
+
34
+ - "Catalog the docs after POL-257"
35
+ - "Run polaris-catalog on POL-303"
36
+ - After a run completes and you want a full cognition + docs pass in one invocation
37
+ - In CI or automated contexts where both reconciliation and doc classification should run together
38
+
39
+ ## How to execute
40
+
41
+ 1. Read `chain.md` — step order and rules.
42
+ 2. Read `.taskchain_artifacts/polaris-catalog/current-state.json` — resumable state.
43
+ 3. Execute steps in the order `chain.md` defines. Do not skip steps.
44
+ 4. After every completed step, update `current-state.json` before advancing.
45
+
46
+ ## Classification behavior
47
+
48
+ - **High confidence** — auto-place via CLI. No pause, no user input required.
49
+ - **Low confidence (interactive)** — surface each file and ask the user where it should go.
50
+ - **Low confidence (unattended/CI)** — leave in `smartdocs/raw/` and include in the final report. Do not block. Do not fail.
51
+
52
+ The `packet.unattended` flag controls which low-confidence behavior applies.
53
+
54
+ ## Hard rules — what polaris-catalog may do
55
+
56
+ - Read packet-specified folders and their POLARIS.md and SUMMARY.md files
57
+ - Write POLARIS.md and SUMMARY.md files within `packet.allowed_write_paths`
58
+ - Read `smartdocs/raw/` to enumerate documents for classification
59
+ - Call `npm run polaris -- docs ingest --file <path>` to place classified documents
60
+ - Call `npm run polaris -- doctrine draft <path>` for doctrine candidates
61
+ - Call `npm run polaris -- map update --changed` after batch placement
62
+ - Create a single sealed git commit of all cognition and doc changes
63
+
64
+ ## Hard rules — what polaris-catalog must NOT do
65
+
66
+ - Modify implementation source code (`src/`, tests, config)
67
+ - Modify runtime state files outside this skill's owned artifacts (cluster-state, other skills' `.taskchain_artifacts/` state, or non-catalog telemetry)
68
+ - Call `npm run polaris -- loop continue` or `npm run polaris -- finalize`
69
+ - Write to `packet.prohibited_write_paths`
70
+ - Git push or create PRs
71
+ - Auto-place low-confidence files (always leave in raw or ask)
72
+ - Move files under `smartdocs/` directly with `mv` or `cp` — use the CLI
73
+
74
+ ## Packet schema
75
+
76
+ The packet is a `CatalogPacket`. Required fields:
77
+
78
+ | Field | Description |
79
+ |---|---|
80
+ | `run_id` | Identifier for this catalog run |
81
+ | `issue_id` | Bound issue (e.g. `POL-257`) |
82
+ | `affected_folders` | Folders whose POLARIS.md and/or SUMMARY.md may need updating |
83
+ | `work_inventory` | Summary of completed work: changed files, child summaries, cognition notes |
84
+ | `unattended` | Boolean — `true` means CI/automated context; low-confidence files left in raw |
85
+ | `allowed_write_paths` | Paths this skill may write |
86
+ | `prohibited_write_paths` | Paths this skill must not write |
87
+ | `constraints.max_summary_addition_lines` | Net new line cap per SUMMARY.md update (default: 50) |
88
+
89
+ ## Execution
90
+
91
+ Read `chain.md` and execute steps in strict order. Do not skip steps. Do not reorder steps.
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "polaris-catalog-chain",
3
+ "steps": [
4
+ "01-orient-catalog",
5
+ "02-reconcile-polaris-md",
6
+ "03-reconcile-summary-md",
7
+ "04-classify-and-place",
8
+ "05-catalog-commit"
9
+ ],
10
+ "terminal_steps": ["05-catalog-commit"],
11
+ "scope": "cognition-and-docs",
12
+ "forbidden_actions": [
13
+ "src file mutations",
14
+ "runtime state file mutations",
15
+ "polaris loop continue",
16
+ "polaris finalize",
17
+ "git push",
18
+ "pr creation",
19
+ "mv/cp on smartdocs/ files",
20
+ "auto-placing low-confidence files"
21
+ ]
22
+ }