@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,95 +0,0 @@
1
- ---
2
- name: closeout-librarian-step-07
3
- description: Update YAML frontmatter references, SUMMARY.md cognition mappings, and cognition index entries for promoted or ingested documents.
4
- ---
5
-
6
- # Step 07 — YAML Linking
7
-
8
- ## Purpose
9
-
10
- When documents are promoted or ingested, the project's internal reference graph must
11
- be updated so promoted documents can be discovered through cognition and summary artifacts.
12
-
13
- ## What Must Be Updated
14
-
15
- ### 7.1 Promoted Document YAML Frontmatter
16
-
17
- For each document promoted to `smartdocs/specs/active/` in step 05:
18
- - Ensure `status: active` in frontmatter (set if missing).
19
- - Ensure `created` date is present (set if missing).
20
- - Add `promoted_by: closeout-librarian` metadata if not present.
21
- - Do NOT modify the document body beyond frontmatter.
22
-
23
- ### 7.2 SUMMARY.md Cognition References
24
-
25
- When SUMMARY.md files were updated in step 04 and reference cognition indexes or spec
26
- documents, ensure those references use the post-promotion canonical paths.
27
-
28
- Specifically: if step 05 promoted a document from `raw/` to `specs/active/`, any
29
- SUMMARY.md reference to the old raw path should be updated to the new canonical path.
30
-
31
- This is a targeted fixup following the broader link validation in step 06. Step 06 handles
32
- structural link repair; step 07 handles the semantic reference graph.
33
-
34
- ### 7.3 Cognition Index Updates
35
-
36
- For each folder that had cognition notes archived in step 05:
37
- 1. Read the existing `cognition-index.json` (or initialize if not present).
38
- 2. Add a reconciliation record:
39
- ```json
40
- {
41
- "run_id": "<packet.run_id>",
42
- "reconciled_at": "<ISO timestamp>",
43
- "notes_archived": ["<filename>", ...],
44
- "patches_applied": ["<polaris.md path>", ...],
45
- "librarian_confidence": <average confidence from step 03>,
46
- "status": "applied" | "no-change" | "rejected",
47
- "librarian_role": "closeout-librarian"
48
- }
49
- ```
50
- 3. Write the updated `cognition-index.json`.
51
-
52
- ### 7.4 SmartDocs Reference Discovery
53
-
54
- If any SUMMARY.md references `smartdocs/specs/active/*.md` files, verify those files
55
- were not renamed or moved during this session. If they were, update the reference.
56
-
57
- ## Write Constraints
58
-
59
- All YAML updates must:
60
- 1. Preserve the rest of the file content unchanged.
61
- 2. Stay within `packet.allowed_write_paths`.
62
- 3. Not modify document bodies (only frontmatter and frontmatter-level metadata files).
63
-
64
- ## Actions
65
-
66
- ### 7.1 Frontmatter Updates
67
-
68
- For each promoted document (from step 05 `docs_ingested` list):
69
- - Update `status`, `created`, `promoted_by` fields.
70
- - Write the updated frontmatter block.
71
-
72
- ### 7.2 Summary Reference Updates
73
-
74
- For each SUMMARY.md written in step 04:
75
- - Find references to documents promoted in step 05.
76
- - Update raw→canonical path.
77
-
78
- ### 7.3 Cognition Index Write
79
-
80
- For each folder with archived cognition notes (from step 05):
81
- - Load or initialize `cognition-index.json`.
82
- - Append the reconciliation record.
83
- - Write the file.
84
-
85
- ## Output
86
-
87
- Running list for step 09:
88
- ```yaml
89
- yaml_updates: [
90
- { file: "<path>", action: "update", change_summary: "<≤50 words>" },
91
- ...
92
- ]
93
- ```
94
-
95
- Proceed to step 08.
@@ -1,119 +0,0 @@
1
- ---
2
- name: closeout-librarian-step-08
3
- description: Commit all documentation and cognition changes as a single sealed librarian commit.
4
- ---
5
-
6
- # Step 08 — Librarian Commit
7
-
8
- ## Purpose
9
-
10
- All documentation changes produced by steps 03–07 must be committed as a single commit
11
- before the Foreman proceeds to finalize. This separates implementation commits (from workers)
12
- from documentation reconciliation commits (from the Librarian).
13
-
14
- ## Commit Constraints
15
-
16
- The Librarian commit MUST:
17
- - Contain only files from `packet.allowed_write_paths`
18
- - Contain no implementation source code
19
- - Contain no runtime state files (`current-state.json`, telemetry JSONL, cluster-state)
20
- - Be a distinct commit from any worker implementation commit
21
- - Use the canonical commit message format (see below)
22
-
23
- If any staged file would violate these constraints, unstage it and record as a blocker.
24
-
25
- ## Pre-Commit Validation
26
-
27
- Before staging, verify:
28
- 1. Every file to be committed exists at a path within `packet.allowed_write_paths`.
29
- 2. No file is at a path matching `packet.prohibited_write_paths`.
30
- 3. At least one non-empty change exists (if no changes, skip commit and record no-op).
31
-
32
- If prohibited files are staged: `git reset HEAD <file>` before committing.
33
-
34
- ## No-Change Case
35
-
36
- If steps 03–07 produced no file changes (everything was already current), step 08 is a
37
- no-op. Record `commit_sha: null` in the result. The Foreman will accept a null commit SHA
38
- from the Librarian result.
39
-
40
- ## Commit Message Format
41
-
42
- ```text
43
- docs(closeout): reconcile cognition for cluster <cluster_id>
44
-
45
- Run: <run_id>
46
- Cluster: <cluster_id>
47
- Children: <comma-separated completed child IDs>
48
- Files updated:
49
- - POLARIS.md: <count> files
50
- - SUMMARY.md: <count> files
51
- - docs ingested: <count>
52
- - links repaired: <count>
53
- ```
54
-
55
- Example:
56
- ```text
57
- docs(closeout): reconcile cognition for cluster POL-303
58
-
59
- Run: polaris-run-closeout-librarian-2026-06-03-001
60
- Cluster: POL-303
61
- Children: POL-304, POL-305, POL-306, POL-307
62
- Files updated:
63
- - POLARIS.md: 3 files
64
- - SUMMARY.md: 2 files
65
- - docs ingested: 1
66
- - links repaired: 2
67
- ```
68
-
69
- ## Actions
70
-
71
- ### 8.1 Stage Changed Files
72
-
73
- Stage all files that were written in steps 03–07:
74
- ```bash
75
- git add <polaris_md_updates[*].file>
76
- git add <summary_md_updates[*].file>
77
- git add <docs_ingested[*].target_path>
78
- git add <yaml_updates[*].file>
79
- git add <cognition archive paths>
80
- git add <cognition-index.json paths>
81
- ```
82
-
83
- ### 8.2 Verify Staged Files
84
-
85
- Run `git diff --cached --name-only` and verify:
86
- - All staged files are in `packet.allowed_write_paths`
87
- - None are in `packet.prohibited_write_paths`
88
-
89
- If any violation: unstage the offending file, record as blocker.
90
-
91
- ### 8.3 Commit
92
-
93
- If staged files exist:
94
- ```bash
95
- git commit -m "<commit message>"
96
- ```
97
-
98
- Capture the resulting commit SHA.
99
-
100
- ### 8.4 Record
101
-
102
- Record the commit SHA and list of committed files for step 09.
103
-
104
- ## Failure Handling
105
-
106
- If `git commit` fails:
107
- - Record `status: "failure"` in the running result state.
108
- - Record the commit error in `blockers`.
109
- - Proceed to step 09 (write failure result).
110
-
111
- If no files were staged (no-change case):
112
- - Record `commit_sha: null`.
113
- - Proceed to step 09.
114
-
115
- ## Emit Telemetry
116
-
117
- Emit `librarian-commit` event with `commit_sha` and `files_changed` count.
118
-
119
- Proceed to step 09.
@@ -1,118 +0,0 @@
1
- ---
2
- name: closeout-librarian-step-09
3
- description: Write the sealed CloseoutLibrarianResult JSON to result_path and terminate.
4
- ---
5
-
6
- # Step 09 — Sealed Result
7
-
8
- ## Purpose
9
-
10
- The Librarian's sole communication channel with the Foreman is the sealed result JSON.
11
- This step assembles the result from all prior steps and writes it to `packet.result_path`.
12
-
13
- After writing the result, the Librarian session terminates. No further writes are permitted.
14
-
15
- ## Result Schema
16
-
17
- ```typescript
18
- interface CloseoutLibrarianResult {
19
- schema_version: "1.0";
20
- role: "closeout-librarian";
21
- run_id: string;
22
- dispatch_id: string;
23
- cluster_id: string;
24
- status: "success" | "partial" | "blocked" | "failure";
25
- commit_sha: string | null;
26
- commit_message: string;
27
- files_committed: string[];
28
- drift_reconciliation: DriftReconciliationResult;
29
- polaris_md_updates: FileUpdate[];
30
- summary_md_updates: FileUpdate[];
31
- docs_ingested: DocAction[];
32
- docs_archived: DocAction[];
33
- yaml_updates: FileUpdate[];
34
- cognition_archived: CognitionArchiveEntry[];
35
- link_validation: LinkValidationReport;
36
- blockers: LibrarianBlocker[];
37
- reconciled_at: string; // ISO8601
38
- evidence_summary: string; // ≤200 words
39
- }
40
- ```
41
-
42
- ## Status Determination
43
-
44
- | Condition | Status |
45
- |---|---|
46
- | Commit succeeded, no blockers | `"success"` |
47
- | Commit succeeded, informational blockers only | `"success"` |
48
- | Commit succeeded, some work could not be done (recoverable blockers) | `"partial"` |
49
- | No changes needed (everything already current) | `"success"` (commit_sha: null) |
50
- | Some work attempted but blocked before commit | `"blocked"` |
51
- | Commit failed | `"failure"` |
52
- | Packet unreadable or invalid | `"failure"` |
53
-
54
- ## Evidence Summary
55
-
56
- The `evidence_summary` field must be ≤200 words. It should describe:
57
- - What was reconciled (POLARIS.md updated, docs ingested, etc.)
58
- - What was left as-is (already current)
59
- - Any blockers that require operator attention
60
- - What a future session needs to know
61
-
62
- Write it for a human operator or Foreman, not for a technical log.
63
-
64
- ## Foreman Validation (Foreman Reads This)
65
-
66
- The Foreman validates the result before proceeding to `polaris finalize`:
67
- 1. `status` must be `"success"` or `"partial"` to proceed.
68
- 2. `"blocked"` or `"failure"` halts finalize and escalates to the operator.
69
- 3. `commit_sha` (if non-null) must be reachable in the current git log.
70
- 4. `files_committed` must not include any path from `prohibited_write_paths`.
71
-
72
- ## Actions
73
-
74
- ### 9.1 Assemble Result
75
-
76
- Collect from all prior steps:
77
- - `drift_reconciliation` (step 02)
78
- - `polaris_md_updates` (step 03)
79
- - `summary_md_updates` (step 04)
80
- - `docs_ingested`, `docs_archived`, `cognition_archived` (step 05)
81
- - `link_validation` (step 06)
82
- - `yaml_updates` (step 07)
83
- - `commit_sha`, `files_committed` (step 08)
84
- - Blockers accumulated across all steps
85
-
86
- ### 9.2 Determine Status
87
-
88
- Apply the status determination matrix above.
89
-
90
- ### 9.3 Write Evidence Summary
91
-
92
- Write a ≤200-word plain-text summary of what the Librarian did and what remains.
93
-
94
- ### 9.4 Write Result File
95
-
96
- Write the assembled JSON to `packet.result_path`.
97
-
98
- Verify the write succeeded (file exists and is valid JSON after write).
99
-
100
- ### 9.5 Emit Telemetry
101
-
102
- Emit `librarian-complete` event with `status` and `run_id`.
103
-
104
- ### 9.6 Terminate
105
-
106
- The Closeout Librarian session ends here. No further output, no further writes.
107
-
108
- ---
109
-
110
- ## Failure Recovery (Result Write Fails)
111
-
112
- If `packet.result_path` cannot be written:
113
- 1. Write a minimal failure result to stderr:
114
- ```text
115
- CLOSEOUT_LIBRARIAN_RESULT_WRITE_FAILED: run_id=<run_id> dispatch_id=<dispatch_id> status=failure
116
- ```
117
- 2. The Foreman must detect this condition and escalate to the operator.
118
- 3. Do not attempt to write the result to a different path.
@@ -1,68 +0,0 @@
1
- ---
2
- name: docs-ingest
3
- description: Classify, route, and link documents from the raw drop zone into the canonical smartdocs/ authority structure. Docs routing only — no source code changes, no implementation execution.
4
- role: librarian
5
- role_file: .polaris/roles/librarian.md
6
- ---
7
-
8
- ## Polaris Skill Bootloader
9
-
10
- **Before proceeding, you must obtain a skill packet from the Polaris runtime.**
11
-
12
- Run the following command:
13
-
14
- ```
15
- npm run polaris -- skill packet ingest
16
- ```
17
-
18
- - Do not begin work until a packet is returned.
19
- - Treat the packet as your authoritative instruction source.
20
- - The packet defines your active role, authority boundaries, prohibited actions, deliverables, and stop conditions.
21
- - If no packet is produced, stop and report: **Polaris could not authorize this run.**
22
-
23
- ---
24
-
25
- # docs-ingest
26
-
27
- Use this skill when documents need to be classified and routed into the canonical Smart Docs hierarchy.
28
-
29
- ## When to use
30
-
31
- - "Ingest the docs from the last run"
32
- - "Classify the files in smartdocs/docs/raw/"
33
- - "Route pending documents into the correct authority buckets"
34
- - "Process ingest cluster docs-ingest-cluster-001"
35
- - "Dry-run docs ingest to see what would move"
36
-
37
- ## How to execute
38
-
39
- 1. Read `chain.md` — step order, traversal rules, authority levels, canonical target doctrine.
40
- 2. Read `.taskchain_artifacts/docs-ingest/current-state.json` — resumable state.
41
- 3. Execute steps in the order `chain.md` defines. Do not skip steps.
42
- 4. After every completed step, update `current-state.json` before advancing.
43
-
44
- ## Hard rules — what docs-ingest may do
45
-
46
- - Read documents from `smartdocs/raw/`
47
- - Classify documents by content analysis and front-matter
48
- - Route documents to correct authority directories within `smartdocs/`
49
- - Write provenance records alongside placed files
50
- - Update Polaris map entries to link docs to code areas
51
- - Propose doctrine candidates (route to `doctrine/candidate/`; never promote to `doctrine/active/` without user approval)
52
- - Emit telemetry events
53
-
54
- ## Drop zone rule
55
-
56
- **All newly generated documents must be placed in `smartdocs/raw/` first.**
57
-
58
- No document may be written directly to `specs/active/`, `doctrine/active/`, `architecture/`, or `decisions/`. Every document enters through `raw/` and is promoted only after classification and approval.
59
-
60
- ## Hard rules — what docs-ingest must NOT do
61
-
62
- - Write new Smart Docs to root `docs/` — `smartdocs/` is the canonical target
63
- - Silently promote documents to `doctrine/active/`, `specs/active/`, `architecture/`, or `decisions/`
64
- - Mutate source files (`src/`, tests, config)
65
- - Call `npm run polaris -- loop continue` or `npm run polaris -- finalize`
66
- - Suppress detected conflicts
67
-
68
- **Docs-ingest routes and classifies. It does not implement or promote without explicit approval.**
@@ -1,23 +0,0 @@
1
- {
2
- "name": "docs-ingest-chain",
3
- "steps": [
4
- "01-orient-ingest",
5
- "02-classify-batch",
6
- "03-conflict-check",
7
- "04-place-and-link",
8
- "05-finalize-ingest"
9
- ],
10
- "terminal_steps": ["05-finalize-ingest"],
11
- "scope": "docs-ingest-only",
12
- "forbidden_actions": [
13
- "src file mutations",
14
- "polaris loop continue",
15
- "polaris finalize",
16
- "git push",
17
- "pr creation",
18
- "doctrine/active/ writes without user approval",
19
- "architecture/ writes without user approval",
20
- "decisions/ writes without user approval",
21
- "root docs/ writes for new Smart Docs"
22
- ]
23
- }
@@ -1,149 +0,0 @@
1
- ---
2
- name: docs-ingest-chain
3
- description: Route map for docs-ingest — step order, stop conditions, authority levels, canonical target doctrine, and artifact requirements.
4
- ---
5
-
6
- # docs-ingest 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 ingest scope or prior progress from conversation context.
13
-
14
- ## CLI
15
-
16
- Always use the repo-local Polaris CLI:
17
-
18
- ```
19
- npm run polaris -- docs ingest [--file <path>] [--batch <cluster-id>] [--dry-run]
20
- ```
21
-
22
- Drop zone: `smartdocs/raw/` — this is the single ingest entry point.
23
-
24
- Never assume a globally linked `polaris` command exists.
25
-
26
- ## Canonical Smart Docs target
27
-
28
- `smartdocs/` is the authoritative Smart Docs ingest target. There is one drop zone: `smartdocs/raw/`.
29
-
30
- - Root `docs/` is legacy/non-canonical — do not write new Smart Docs there.
31
- - There are no sub-raw folders (`specs/raw/`, `doctrine/raw/`, `audits/raw/` do not exist). All drops land in `smartdocs/raw/` and are routed from there.
32
-
33
- **Architectural intent:** Smart Docs exist to reduce repo-understanding token burn. Agents should move from:
34
-
35
- ```
36
- read many files → infer architecture
37
- ```
38
-
39
- to:
40
-
41
- ```
42
- read Smart Docs router → read local POLARIS.md → open only necessary files
43
- ```
44
-
45
- Smart Docs function as architectural compression, routing context, local subsystem summaries, and implementation guidance boundaries — without replacing canonical source files.
46
-
47
- ## Step traversal order
48
-
49
- ```text
50
- 01-orient-ingest ← generate run_id, emit telemetry, load batch, confirm canonical target
51
- 02-classify-batch ← content analysis + front-matter, assign classification per file
52
- 03-conflict-check ← compare against doctrine/active/ and specs/active/; halt on contradiction
53
- 04-place-and-link ← move files to authority buckets, write provenance, update map
54
- 05-finalize-ingest ← emit completion telemetry, update state, report placement summary
55
- ```
56
-
57
- ## Stop conditions
58
-
59
- **Any step:**
60
- - Conflict directly contradicts active doctrine → halt, report, require user resolution
61
- - High-authority placement attempted (`doctrine/active/`, `architecture/`, `decisions/`) without explicit approval → halt and surface for review
62
- - `smartdocs/` not found → halt, report missing canonical target
63
- - `run-start` telemetry write fails → halt
64
-
65
- **Step 03 (conflict check):**
66
- - Direct doctrine contradiction → halt with conflict report
67
- - Overlapping spec scope → flag as candidate supersede; continue with warning
68
-
69
- ## Authority levels
70
-
71
- | Area | Authority | Who may write | Promotion path |
72
- |---|---|---|---|
73
- | `smartdocs/raw/` | none | any agent freely | `polaris doctrine draft` → `doctrine/candidate/` or `polaris doctrine spec-promote` → `specs/active/` |
74
- | `smartdocs/runtime/` | low | polaris-run, polaris-finalize | no promotion; informational only |
75
- | `smartdocs/specs/active/` | medium | `polaris doctrine spec-promote --approve` only | moved to `implemented/` or `superseded/` |
76
- | `smartdocs/doctrine/candidate/` | low | docs ingest + `polaris doctrine draft` | `polaris doctrine promote` (user-approved) |
77
- | `smartdocs/doctrine/active/` | high | `polaris doctrine promote` (user-approved) | `polaris doctrine deprecate` (user-approved) |
78
- | `smartdocs/architecture/` | high | user-approved only | explicit ADR process |
79
- | `smartdocs/decisions/` | high | user-approved only | explicit ADR process |
80
-
81
- ## Run ID format
82
-
83
- Format: `docs-ingest-<slug>-<date>-<seq>`
84
- - `<slug>`: 2–4 lowercase hyphenated words from the ingest context. No issue IDs.
85
- - `<date>`: `YYYY-MM-DD`
86
- - `<seq>`: zero-padded sequential number per day (`001`, `002`, …)
87
-
88
- Example: `docs-ingest-compact-contracts-2026-05-26-001`
89
-
90
- ## Telemetry
91
-
92
- Telemetry file: `.taskchain_artifacts/docs-ingest/runs/<run-id>/telemetry.jsonl` (append-only).
93
-
94
- | Event | Trigger |
95
- |---|---|
96
- | `run-start` | Begin processing |
97
- | `step-complete` | End of every step |
98
- | `docs-ingest-classified` | Each file classified |
99
- | `docs-ingest-conflict-detected` | Conflict found against active doctrine or spec |
100
- | `doctrine-candidate-proposed` | Doc routed to `doctrine/candidate/` |
101
- | `docs-ingest-stale-assumption` | Stale assumption annotated in front-matter |
102
- | `docs-ingest-complete` | Batch done |
103
-
104
- Required fields on every event: `event`, `run_id`, `timestamp`. Add `file` where applicable.
105
-
106
- ## Context budget
107
-
108
- One ingest cluster per session. Default batch: 10 files. Configurable:
109
-
110
- ```json
111
- { "docs": { "ingestBatchSize": 10 } }
112
- ```
113
-
114
- Stop after completing one cluster. Bootstrap packet guidance directs the next session to the next pending cluster.
115
-
116
- ## Artifact authority
117
-
118
- `.taskchain_artifacts/docs-ingest/current-state.json` is the sole authoritative live state surface.
119
-
120
- - Update after every completed step — before advancing.
121
- - A step is NOT complete until the state update succeeds.
122
- - If the update fails: stop and report the persistence failure.
123
-
124
- ## Linked-skill invocation boundaries
125
-
126
- | Skill | Allowed steps | Condition |
127
- |---|---|---|
128
- | repo-analysis | 01, 02 | targeted lookup only; for code-area linking |
129
-
130
- ## Execution reporting
131
-
132
- After each completed step, emit a checkpoint:
133
-
134
- ```text
135
- **[step-name]** done | blocked | needs-input
136
- Changed: <files moved / provenance records written / map entries updated> or none
137
- Validated: <conflict checks / authority checks passed> or none
138
- Blockers: none | <explicit blocker>
139
- ```
140
-
141
- ### Never compressed
142
-
143
- Always write in full:
144
- - Conflict reports and resolution requirements
145
-
146
- - Doctrine candidate proposals
147
- - Stale-assumption annotations
148
- - Authority violation warnings
149
- - Final placement summary
@@ -1,85 +0,0 @@
1
- ---
2
- name: docs-ingest-step-01-orient-ingest
3
- description: Generate run_id, emit run-start telemetry, confirm provider status, load batch file list, and confirm canonical ingest target.
4
- ---
5
-
6
- # Step 01 — Orient ingest
7
-
8
- ## Purpose
9
-
10
- Establish bounded ingest context before touching any files. Confirm what to process, confirm the canonical target exists, and confirm provider status.
11
-
12
- ## Scope declarations
13
-
14
- ```yaml
15
- allowed_files:
16
- - .polaris/skills/docs-ingest/SKILL.md
17
- - .polaris/skills/docs-ingest/chain.md
18
- - .taskchain_artifacts/docs-ingest/current-state.json
19
- - .polaris/docs-ingest/<cluster-id>.json
20
- - polaris.config.json
21
- - .polaris/map/index.json
22
- allowed_routes:
23
- - CLAUDE.md
24
- - smartdocs/specs/active/docs-authority-model.md
25
- - .polaris/skills/docs-ingest/chain.md
26
- allowed_skills:
27
- - repo-analysis
28
- expected_evidence:
29
- - run_id generated
30
- - run-start telemetry emitted
31
- - batch file list loaded
32
- - smartdocs/ confirmed present
33
- - canonical target doctrine stated
34
- stop_rules:
35
- - run-start telemetry write fails
36
- - smartdocs/ not found
37
- - batch cluster file missing or empty
38
- - no pending clusters and no --file/--batch flags
39
- ```
40
-
41
- ## Actions
42
-
43
- 0. **Generate `run_id`**:
44
- - Fresh runs: `docs-ingest-<slug>-<date>-<seq>` (see `chain.md` for format rules).
45
- - Resumed runs: generate new `run_id` first, emit run-start telemetry immediately (with `prior_run_id: null`), then read `current-state.json` to retrieve prior `run_id` for state continuity.
46
-
47
- 1. **Emit `run-start` telemetry** — first I/O action, before any file access:
48
- ```bash
49
- mkdir -p .taskchain_artifacts/docs-ingest/runs/<run-id>
50
- echo '{"event":"run-start","run_id":"<run-id>","prior_run_id":"<prior or null>","timestamp":"<ISO>"}' \
51
- >> .taskchain_artifacts/docs-ingest/runs/<run-id>/telemetry.jsonl
52
- ```
53
- If this write fails: halt. Do not continue. For resumed runs, the `prior_run_id` is obtained after this emit by reading `current-state.json`.
54
-
55
- 2. **Determine ingest source**:
56
- - `--file <path>`: single file mode. Treat as a batch of one.
57
- - `--batch <cluster-id>`: read `.polaris/docs-ingest/<cluster-id>.json` for file list.
58
- - No flags: read `current-state.json` for the next pending cluster ID. If none: halt with "no pending ingest clusters — use --file or --batch, or register clusters first."
59
-
60
- 3. **Confirm canonical target** — verify `smartdocs/` exists in the repo root.
61
- - If not found: halt and report. Do not attempt to create it.
62
- - Assert doctrine: `smartdocs/` is the only valid ingest target. Root `docs/` is legacy. New Smart Docs must not be placed there.
63
- - Drop zone is `smartdocs/raw/` — the single ingest entry point. There are no sub-raw folders.
64
- - If any source file already lives in `smartdocs/raw/`: reclassification only — no file move needed in step 04.
65
-
66
- 4. **Load Polaris map** — read `.polaris/map/index.json` for code-area linking in step 04. If absent, note and proceed (map linking will be skipped in step 04).
67
-
68
- 5. **Restate working context** in under 8 bullets:
69
- - `run_id` and fresh/resumed
70
- - Ingest mode (`--file` / `--batch` / pending-cluster)
71
- - File list to process
72
- - Canonical target confirmed: `smartdocs/`
73
- - Provider status
74
-
75
- ## Artifact update
76
-
77
- Update `.taskchain_artifacts/docs-ingest/current-state.json` (artifact path unchanged — skill identity is `docs-ingest`):
78
- - `run_id`, `status: orienting`, `current_step_id: 01-orient-ingest`
79
- - `files_to_process: [...]`, `updated_at: <timestamp>`
80
-
81
- Emit `step-complete` for `01-orient-ingest` to telemetry JSONL.
82
-
83
- ## Next step
84
-
85
- 02-classify-batch