@lsctech/polaris 0.3.21 → 0.3.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/dist/cli/adopt-assets.js +13 -0
  2. package/dist/cli/adopt-canon.js +1 -0
  3. package/dist/cli/adopt-genesis.js +85 -4
  4. package/dist/cli/adopt-instructions.js +3 -3
  5. package/dist/cli/adopt-report.js +15 -1
  6. package/dist/cli/adopt-rules.js +44 -8
  7. package/dist/cli/adopt-workspace.js +2 -2
  8. package/dist/cli/adoption-inventory.js +5 -2
  9. package/dist/cli/init.js +5 -4
  10. package/dist/config/provider-detect.js +19 -2
  11. package/dist/workspace/.polaris/skills/ROUTING.md +4 -0
  12. package/dist/workspace/.polaris/skills/closeout-librarian/POLARIS.md +9 -8
  13. package/dist/workspace/.polaris/skills/docs-ingest/SKILL.md +2 -2
  14. package/dist/workspace/.polaris/skills/docs-ingest/chain.md +1 -1
  15. package/dist/workspace/.polaris/skills/docs-ingest/steps/04-place-and-link.md +5 -5
  16. package/dist/workspace/.polaris/skills/docs-ingest/steps/05-finalize-ingest.md +1 -1
  17. package/dist/workspace/.polaris/skills/docs-promote/SKILL.md +6 -6
  18. package/dist/workspace/.polaris/skills/docs-promote/chain.md +5 -5
  19. package/dist/workspace/.polaris/skills/docs-promote/steps/04-conflict-surface.md +1 -1
  20. package/dist/workspace/.polaris/skills/docs-promote/steps/06-execute-promote-deprecate.md +3 -3
  21. package/dist/workspace/{workspace/.polaris → .polaris}/skills/docs-review/SKILL.md +1 -1
  22. package/dist/workspace/{workspace/.polaris → .polaris}/skills/docs-triage/SKILL.md +1 -1
  23. package/dist/workspace/{workspace/.polaris → .polaris}/skills/docs-triage/chain.md +1 -1
  24. package/dist/workspace/.polaris/skills/polaris-analyze/SKILL.md +1 -1
  25. package/dist/workspace/.polaris/skills/polaris-analyze/chain.md +2 -2
  26. package/dist/workspace/.polaris/skills/polaris-analyze/issue-reconciliation.md +1 -1
  27. package/dist/workspace/.polaris/skills/polaris-analyze/linked-skills/repo-analysis.md +3 -4
  28. package/dist/workspace/.polaris/skills/polaris-analyze/steps/02-map-affected-code.md +2 -2
  29. package/dist/workspace/.polaris/skills/polaris-catalog/SKILL.md +5 -5
  30. package/dist/workspace/.polaris/skills/polaris-catalog/chain.md +3 -3
  31. package/dist/workspace/.polaris/skills/polaris-catalog/steps/04-classify-and-place.md +3 -3
  32. package/dist/workspace/.polaris/skills/polaris-reconcile/SKILL.md +2 -2
  33. package/dist/workspace/.polaris/skills/polaris-run/SKILL.md +1 -1
  34. package/dist/workspace/.polaris/skills/polaris-run/chain.md +17 -17
  35. package/dist/workspace/.polaris/skills/polaris-run/linked-skills/repo-analysis.md +3 -4
  36. package/dist/workspace/.polaris/skills/polaris-run/steps/01-orient-cluster.md +3 -3
  37. package/dist/workspace/.polaris/skills/polaris-run/steps/03-select-child.md +1 -1
  38. package/dist/workspace/.polaris/skills/polaris-run/steps/06-commit-and-update-linear.md +2 -2
  39. package/dist/workspace/.polaris/skills/polaris-run/steps/07-decide-continuation.md +3 -3
  40. package/dist/workspace/.polaris/skills/polaris-run/steps/08-closeout-librarian.md +1 -1
  41. package/dist/workspace/.polaris/skills/polaris-run/steps/08-final-delivery.md +2 -2
  42. package/dist/workspace/.polaris/skills/polaris-run/steps/09-final-delivery.md +1 -1
  43. package/dist/workspace/.polaris/skills/polaris-tools/README.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,78 +0,0 @@
1
- ---
2
- name: closeout-librarian-step-01
3
- description: Read packet, load cluster evidence, and build the work inventory for this reconciliation session.
4
- ---
5
-
6
- # Step 01 — Load Cluster Context
7
-
8
- ## Purpose
9
-
10
- Build a complete picture of what the cluster accomplished. This is the foundation for all
11
- subsequent reconciliation steps. Nothing is written in this step.
12
-
13
- ## Actions
14
-
15
- ### 1.1 Read and Validate Packet
16
-
17
- Read the packet from the path provided in the dispatch prompt.
18
-
19
- Validate required fields:
20
- - `role` must be `"closeout-librarian"`
21
- - `run_id`, `dispatch_id`, `cluster_id` must be present and non-empty
22
- - `completed_children` must be a non-empty array
23
- - `result_path` must be present
24
- - `allowed_write_paths` must be present
25
-
26
- If validation fails: write a minimal failure result to `result_path` and terminate.
27
-
28
- ### 1.2 Load Child Summaries
29
-
30
- For each entry in `packet.child_summaries`:
31
- 1. Read the compact-return result at `child_summary.compact_return_path` (if present)
32
- 2. Read the cognition note at `child_summary.cognition_note_path` (if present)
33
- 3. Note `child_summary.changed_files` — the primary file inventory for this cluster
34
-
35
- Build a combined `all_changed_files` list (deduplicated) across all children.
36
-
37
- ### 1.3 Load Folder Cognition Context
38
-
39
- For each entry in `packet.polaris_md_paths`:
40
- 1. Read `polaris_md` (current POLARIS.md for this folder)
41
- 2. Read `summary_md` (current SUMMARY.md, if path provided and file exists)
42
- 3. Read `cognition_index` (archive index, if path provided and file exists)
43
-
44
- Note which folders have pending cognition notes (from `packet.cognition_notes`).
45
-
46
- ### 1.4 Build Work Inventory
47
-
48
- Produce an internal inventory (not written to disk):
49
-
50
- ```yaml
51
- work_inventory:
52
- cluster_id: <from packet>
53
- completed_children: [<ids>]
54
- all_changed_files: [<deduplicated list>]
55
- affected_folders: [<from packet.affected_folders>]
56
- pending_cognition_notes: [<paths>]
57
- docs_candidate_for_ingestion: [<from packet.smartdocs_raw_paths>]
58
- polaris_md_files: { <folder>: <current content> }
59
- summary_md_files: { <folder>: <current content or null> }
60
- ```
61
-
62
- ### 1.5 Load Run Report
63
-
64
- Read the run report at `packet.run_report_path` (if present). This provides a structured
65
- summary of what work was done.
66
-
67
- ### 1.6 Emit Telemetry
68
-
69
- Emit `librarian-start` event (if telemetry path provided).
70
-
71
- ## Completion Criteria
72
-
73
- - Packet validated
74
- - All available child summaries loaded
75
- - All available folder cognition loaded
76
- - Work inventory built
77
-
78
- Proceed to step 02.
@@ -1,157 +0,0 @@
1
- ---
2
- name: closeout-librarian-step-02
3
- description: Run formal drift reconciliation checklist to detect and record repository memory drift.
4
- ---
5
-
6
- # Step 02 — Drift Reconciliation
7
-
8
- ## Purpose
9
-
10
- Implementation complete does not equal run complete. After every completed run, the Librarian
11
- must perform a formal drift reconciliation to ensure repository memory accurately reflects
12
- the current state of the route.
13
-
14
- This step detects and records drift observations. It does not resolve drift inline —
15
- resolution is a separate task if needed.
16
-
17
- ## Drift Observation Types
18
-
19
- The following drift observation types are recognized:
20
-
21
- | Type | Description |
22
- |---|---|
23
- | `summary_outdated` | SUMMARY.md no longer describes current reality |
24
- | `canon_mismatch` | POLARIS.md does not match actual route structure or behavior |
25
- | `route_guidance_outdated` | Worker guidance or constraints in POLARIS.md are stale |
26
- | `missing_documentation` | Required documentation is absent for changed code |
27
- | `invalid_reference` | Links or canonical references point to non-existent or moved content |
28
-
29
- ## Checklist
30
-
31
- Run this checklist in order. For each item, assess whether drift exists and record observations.
32
-
33
- ### 2.1 Review Worker Results
34
-
35
- Review the work inventory from step 01:
36
-
37
- 1. Examine `work_inventory.all_changed_files` — what code actually changed
38
- 2. Review child summaries for behavioral changes, dependency changes, or architectural shifts
39
- 3. Compare actual changes against existing POLARIS.md and SUMMARY.md descriptions
40
-
41
- **Questions:**
42
- - Did behavior change in a way not reflected in POLARIS.md?
43
- - Did dependencies change (added, removed, updated)?
44
- - Did architecture or responsibilities shift?
45
- - Are there new capabilities not documented?
46
-
47
- **If drift detected:** Record observation type (`canon_mismatch`, `route_guidance_outdated`, or `missing_documentation`).
48
-
49
- ### 2.2 Review Medic Results (if applicable)
50
-
51
- If Medic ran in this cluster:
52
-
53
- 1. Read all Medic charts created in this run (from `packet.medic_chart_paths`)
54
- 2. Review drift observations recorded in chart metadata (`drift_observations` field)
55
- 3. Note any reusable knowledge revealed by the charts
56
-
57
- **Questions:**
58
- - Did Medic detect drift not visible from worker results alone?
59
- - Did a chart reveal a pattern that should be captured in route cognition?
60
- - Are there chart relationships that indicate recurring issues?
61
-
62
- **If drift detected:** Medic already recorded observations in the chart. Librarian must address
63
- these in subsequent reconciliation steps (03–04).
64
-
65
- **If Medic did not run:** Skip this section.
66
-
67
- ### 2.3 Review POLARIS.md Accuracy
68
-
69
- For each affected folder in `work_inventory.affected_folders`:
70
-
71
- 1. Read the current POLARIS.md content
72
- 2. Compare against the actual state of the folder after cluster changes
73
- 3. Verify: route purpose, responsibilities, architecture, constraints, guidance
74
-
75
- **Questions:**
76
- - Does POLARIS.md still describe the route accurately?
77
- - Are there stale statements about removed capabilities?
78
- - Are new capabilities or constraints missing?
79
- - Is the architecture description current?
80
-
81
- **If drift detected:** Record observation type (`canon_mismatch` or `route_guidance_outdated`).
82
-
83
- ### 2.4 Review SUMMARY.md Currency
84
-
85
- For each affected folder with a SUMMARY.md:
86
-
87
- 1. Read the current SUMMARY.md content
88
- 2. Verify the Current State and Route Health sections reflect reality
89
- 3. Check if Recent Treatments needs updating
90
-
91
- **Questions:**
92
- - Does SUMMARY.md still describe the current state?
93
- - Is the Route Health status accurate?
94
- - Are there known issues or improvement opportunities not captured?
95
-
96
- **If drift detected:** Record observation type (`summary_outdated`).
97
-
98
- ### 2.5 Review Canonical References
99
-
100
- For each SUMMARY.md with a `canonical_docs` block:
101
-
102
- 1. Verify each referenced path exists
103
- 2. Confirm references are still relevant to the route
104
- 3. Check for missing important references
105
-
106
- **Questions:**
107
- - Do any canonical references point to non-existent files?
108
- - Are there important docs missing from the canonical list?
109
- - Are references still navigation-relevant or have they become obsolete?
110
-
111
- **If drift detected:** Record observation type (`invalid_reference` or `missing_documentation`).
112
-
113
- ### 2.6 Chart Linking Requirement (when Medic ran)
114
-
115
- If Medic ran in this cluster:
116
-
117
- 1. Identify all charts created in this run (from `packet.medic_chart_paths`)
118
- 2. For each chart, create a concise entry in the affected folder's SUMMARY.md under `## Recent Treatments`
119
- 3. Format: `CHART-YYYY-MM-DD-NNN — <brief one-line summary of treatment>`
120
-
121
- **This is a required action when Medic ran.**
122
-
123
- Example:
124
- ```markdown
125
- ## Recent Treatments
126
-
127
- CHART-2026-06-04-001 — Worker result validation failure repaired and verified.
128
- CHART-2026-06-05-003 — Chart schema validation failure fixed and regression test added.
129
- ```
130
-
131
- **If Medic did not run:** Skip this section.
132
-
133
- ## Output
134
-
135
- Build the following internal structure for use in subsequent steps:
136
-
137
- ```yaml
138
- drift_reconciliation:
139
- medic_ran: <true|false>
140
- charts_created: [<chart_ids>]
141
- drift_observations: [
142
- { type: "<observation_type>", target: "<file or description>", severity: "<low|medium|high>" },
143
- ...
144
- ]
145
- chart_links_required: <true if Medic ran>
146
- charts_linked: [<chart_ids linked in SUMMARY.md>]
147
- ```
148
-
149
- This structure is passed to steps 03–04 for reconciliation action.
150
-
151
- ## Completion Criteria
152
-
153
- - All checklist items completed
154
- - Drift observations recorded (if any)
155
- - Chart linking requirement acknowledged (if Medic ran)
156
-
157
- Proceed to step 03.
@@ -1,93 +0,0 @@
1
- ---
2
- name: closeout-librarian-step-03
3
- description: Update affected POLARIS.md files to accurately reflect the current state of each folder after the completed cluster.
4
- ---
5
-
6
- # Step 03 — Reconcile POLARIS.md
7
-
8
- ## Purpose
9
-
10
- Each affected folder's POLARIS.md must accurately describe the current reality of that folder.
11
- This step performs actual reconciliation — not append-only notes.
12
-
13
- ## What POLARIS.md Represents
14
-
15
- A folder's POLARIS.md is a living operational guide. It should describe:
16
- - Current capabilities (what this folder does now)
17
- - Current architecture (how it is structured now)
18
- - Current responsibilities (what owns what)
19
- - Current constraints (what is forbidden)
20
- - Current folder state (what is present and what is not)
21
-
22
- POLARIS.md is NOT a changelog. Do not append "added in cluster POL-123". Replace stale
23
- statements with current truth.
24
-
25
- ## When to Update
26
-
27
- Update a folder's POLARIS.md when ALL of the following are true:
28
- 1. Files in that folder were changed by the completed cluster.
29
- 2. The changes materially affect the folder's responsibilities, architecture, or constraints.
30
- 3. The current POLARIS.md content is factually wrong or incomplete as a result.
31
-
32
- Do NOT update for: formatting fixes, test additions without behavior change,
33
- internal refactors that leave operational guidance still accurate.
34
-
35
- ## When NOT to Update
36
-
37
- - The folder was not touched by any child in this cluster.
38
- - The changes are in sub-packages that have their own POLARIS.md.
39
- - The existing POLARIS.md correctly describes the outcome of the changes.
40
-
41
- ## Actions
42
-
43
- For each folder in `work_inventory.affected_folders`:
44
-
45
- ### 3.1 Assess the Impact
46
-
47
- 1. Identify which files in this folder were changed (from `work_inventory.all_changed_files`).
48
- 2. Read the current POLARIS.md content for this folder (from `work_inventory.polaris_md_files`).
49
- 3. Read the cognition notes for this folder (from `work_inventory.pending_cognition_notes`).
50
- 4. Cross-reference with child summaries and run report to understand what changed.
51
-
52
- ### 3.2 Determine Required Changes
53
-
54
- For each stale or missing statement in POLARIS.md:
55
- - If a capability was added: add it to the appropriate section.
56
- - If a capability was changed: update the statement in place.
57
- - If a capability was removed: remove the statement.
58
- - If a constraint was added: add to constraints section.
59
- - If a constraint was lifted: remove it.
60
- - If architecture changed: update the architecture description.
61
-
62
- **Reconciliation principle:** The resulting POLARIS.md must describe the folder as it
63
- exists AFTER the cluster completed. Read the code if necessary to confirm the current state.
64
-
65
- ### 3.3 Confidence Threshold
66
-
67
- Assess confidence (0.0–1.0) in the proposed update:
68
- - `≥ 0.85`: Apply the update.
69
- - `0.70–0.84`: Apply with a note in the result that confidence was moderate.
70
- - `< 0.70`: Skip the update for this folder, record as a blocker in the result.
71
-
72
- Low confidence triggers: ambiguous changed_files, contradictory notes, minimal diff context.
73
-
74
- ### 3.4 Write
75
-
76
- If the assessment confirms an update is needed and confidence is sufficient:
77
- 1. Verify the POLARIS.md path is in `packet.allowed_write_paths`.
78
- 2. Write the full updated content (not a patch — full file replacement).
79
- 3. Record in the running `polaris_md_updates` list for the result.
80
-
81
- If the path is in `packet.prohibited_write_paths`, record as a blocker and skip.
82
-
83
- ## Output
84
-
85
- Running list for step 09:
86
- ```yaml
87
- polaris_md_updates: [
88
- { file: "<path>", action: "update", change_summary: "<≤50 words>" },
89
- ...
90
- ]
91
- ```
92
-
93
- Proceed to step 04.
@@ -1,106 +0,0 @@
1
- ---
2
- name: closeout-librarian-step-04
3
- description: Refresh SUMMARY.md to reflect current project state after the completed cluster.
4
- ---
5
-
6
- # Step 04 — Reconcile SUMMARY.md
7
-
8
- ## Purpose
9
-
10
- SUMMARY.md files serve as continuation artifacts, project snapshots, and handoff documents.
11
- A future session loading SUMMARY.md must be able to continue work immediately without
12
- replaying history.
13
-
14
- The goal is that SUMMARY.md reflects the current state of the project AFTER this cluster,
15
- not a log of what happened.
16
-
17
- ## What SUMMARY.md Represents
18
-
19
- - Current understanding of the system (what is true now)
20
- - Canonical references to active specs and doctrine
21
- - Architecture snapshots that are no longer in flux
22
- - Handoff context for continuation sessions
23
-
24
- SUMMARY.md is NOT:
25
- - A changelog
26
- - A history of execution events
27
- - A list of completed issues
28
-
29
- ## When to Update
30
-
31
- Update a folder's SUMMARY.md when:
32
- - Linked specs or doctrine changed significantly (new authoritative documents promoted)
33
- - Canon relationships changed (new spec supersedes old; architecture changed)
34
- - Architecture meaning changed in ways not captured by POLARIS.md
35
- - Current understanding described in SUMMARY.md is now stale or contradicted by completed work
36
-
37
- Do NOT update for: ephemeral execution events, minor bug fixes, test additions without
38
- behavior change, changes that do not affect the reader's understanding.
39
-
40
- ## Reconciliation Principles
41
-
42
- ### Remove Stale Information
43
-
44
- Identify statements in SUMMARY.md that are contradicted by the completed work.
45
- Remove or replace them. Do not preserve stale content by appending "as of cluster X".
46
-
47
- ### Replace Superseded Information
48
-
49
- When a spec or decision that SUMMARY.md references has been superseded, update the reference
50
- to point to the current authority.
51
-
52
- ### Preserve Current Understanding
53
-
54
- Retain content that accurately describes current reality. Preservation is not append — it is
55
- selection of what remains true.
56
-
57
- ### Root-level SUMMARY.md
58
-
59
- The root-level SUMMARY.md (if in `packet.affected_folders`) must reflect the overall project
60
- state after this cluster. This is the primary continuation artifact for the whole project.
61
- Give it higher priority than folder-level SUMMARY.md files.
62
-
63
- ## Actions
64
-
65
- For each folder in `work_inventory.affected_folders` that has a SUMMARY.md:
66
-
67
- ### 4.1 Assess Staleness
68
-
69
- 1. Read the current SUMMARY.md (from `work_inventory.summary_md_files`).
70
- 2. Cross-reference with completed work: changed specs, new capabilities, new constraints.
71
- 3. Identify sections that are stale, contradicted, or superseded.
72
- 4. Identify new information that should be captured (architecture snapshots, spec promotions).
73
-
74
- ### 4.2 Refresh
75
-
76
- Produce the updated SUMMARY.md content:
77
- 1. Remove sections that are no longer accurate.
78
- 2. Update references to specs and doctrine that changed.
79
- 3. Add brief architecture notes for significant new capabilities (if they help future sessions).
80
- 4. Ensure the document still reads as a coherent current-state snapshot, not a list of events.
81
-
82
- **Constraint:** SUMMARY.md updates must not exceed `packet.constraints.max_summary_addition_lines`
83
- net new lines per folder (default: 50 lines). "Net new" means final line count minus original line count. Replacements (same or fewer lines) do not count toward this limit.
84
-
85
- ### 4.3 Write
86
-
87
- 1. Verify the SUMMARY.md path is in `packet.allowed_write_paths`.
88
- If not allowed, skip this file and record in `summary_md_updates` with `action: "path_not_allowed"`.
89
- 2. Write the full updated content.
90
- 3. Record in the running `summary_md_updates` list.
91
-
92
- If no update is needed, record no-change for this folder using `action: "no_change"`.
93
-
94
- ## Output
95
-
96
- Running list for step 09:
97
- ```yaml
98
- summary_md_updates: [
99
- { file: "<path>", action: "update", change_summary: "<≤50 words>" },
100
- { file: "<path>", action: "no_change" },
101
- { file: "<path>", action: "path_not_allowed" },
102
- ...
103
- ]
104
- ```
105
-
106
- Proceed to step 05.
@@ -1,114 +0,0 @@
1
- ---
2
- name: closeout-librarian-step-05
3
- description: Inspect documentation associated with completed work. Ingest, promote, archive, or skip.
4
- ---
5
-
6
- # Step 05 — Documentation Ingestion
7
-
8
- ## Purpose
9
-
10
- The Librarian inspects documentation associated with the completed cluster and determines
11
- what action each document requires. Implementation work frequently produces accompanying
12
- documentation that has not yet been formally ingested into the SmartDocs authority hierarchy.
13
-
14
- ## Document Sources to Inspect
15
-
16
- 1. **`packet.smartdocs_raw_paths`** — raw documents in `smartdocs/raw/` that may be
17
- related to completed work
18
- 2. **Documents referenced in child summaries** — specs, analyses, or plans linked by children
19
- 3. **Documents referenced in run report** — related planning/analysis docs
20
- 4. **Cognition notes** (`packet.cognition_notes`) — worker notes from this cluster
21
-
22
- ## Ingestion Decision Matrix
23
-
24
- For each candidate document:
25
-
26
- | Condition | Action |
27
- |---|---|
28
- | Document is a spec for implemented behavior, not yet in `specs/active/` | Ingest → `smartdocs/specs/active/` |
29
- | Document is a one-time analysis, no ongoing authority | Archive → `smartdocs/raw/` (keep in place, mark as analyzed) |
30
- | Document is a postmortem or lessons-learned | Keep raw, record in result |
31
- | Document is obsolete (superseded by newer spec) | Archive or deprecate |
32
- | Document is doctrine candidate (stable, widely applicable) | Ingest → `smartdocs/doctrine/candidate/` (NOT `doctrine/active/` — requires operator) |
33
- | Document is unrelated to completed work | Skip |
34
- | Document already promoted (in `specs/active/` or `doctrine/active/`) | Skip |
35
-
36
- ## Promotion Boundaries
37
-
38
- **The Closeout Librarian may promote to:**
39
- - `smartdocs/specs/active/` (specifications for implemented behavior)
40
- - `smartdocs/` classification tiers (raw → candidate)
41
-
42
- **The Closeout Librarian may NOT promote to:**
43
- - `smartdocs/doctrine/active/` — requires explicit operator approval
44
- - `smartdocs/architecture/` — requires explicit operator approval
45
-
46
- When a document warrants `doctrine/active` promotion, record it in the result as a
47
- promotion recommendation for operator review.
48
-
49
- ## Frontmatter Requirements
50
-
51
- When ingesting a document into `smartdocs/specs/active/`:
52
- 1. Ensure the document has valid YAML frontmatter.
53
- 2. Required fields: `kind`, `status`, `source`, `created`.
54
- 3. Add or update: `status: active`, `created: <ISO date>`.
55
- 4. Do not modify the document body.
56
-
57
- When creating a provenance file (`.provenance.json`):
58
- ```json
59
- {
60
- "promoted_from": "<source path>",
61
- "promoted_at": "<ISO date>",
62
- "promoted_by": "closeout-librarian",
63
- "run_id": "<packet.run_id>",
64
- "cluster_id": "<packet.cluster_id>"
65
- }
66
- ```
67
-
68
- ## Cognition Note Archival
69
-
70
- After POLARIS.md, drift reconciliation, and SUMMARY.md reconciliation is complete, move all resolved pending
71
- cognition notes from `packet.cognition_notes` to archive:
72
- - Source: `.polaris/cognition/pending/<folder-slug>/<file>`
73
- - Destination: `.polaris/cognition/archive/<folder-slug>/<file>`
74
- - Update `cognition-index.json` for the folder
75
-
76
- ## Actions
77
-
78
- ### 5.1 Enumerate Candidates
79
-
80
- Build a list of candidate documents from all sources (raw paths, child summaries, run report).
81
- Deduplicate. Exclude already-promoted documents.
82
-
83
- ### 5.2 Classify Each Candidate
84
-
85
- Apply the decision matrix above. Assign one of: `ingest`, `promote`, `archive`, `skip`.
86
-
87
- ### 5.3 Execute Ingestion
88
-
89
- For each document classified as `ingest` or `promote`:
90
- 1. Verify target path is in `packet.allowed_write_paths`.
91
- 2. Copy/move to target location.
92
- 3. Update or add frontmatter.
93
- 4. Create provenance file.
94
- 5. Record in `docs_ingested` list.
95
-
96
- For each document classified as `archive`:
97
- 1. No file move required (raw docs stay in place).
98
- 2. Record in `docs_archived` list with reason.
99
-
100
- ### 5.4 Archive Cognition Notes
101
-
102
- Move all pending cognition notes in `packet.cognition_notes` to archive.
103
- Update `cognition-index.json` for each affected folder.
104
-
105
- ## Output
106
-
107
- Running lists for step 09:
108
- ```yaml
109
- docs_ingested: [{ source_path, target_path, action: "ingest"|"promote", reason }]
110
- docs_archived: [{ source_path, target_path: null, action: "archive", reason }]
111
- cognition_archived: [{ note_path, archive_path }]
112
- ```
113
-
114
- Proceed to step 06.
@@ -1,128 +0,0 @@
1
- ---
2
- name: closeout-librarian-step-06
3
- description: Validate markdown links, YAML references, and cognition references. Repair where possible.
4
- ---
5
-
6
- # Step 06 — Link Validation
7
-
8
- ## Purpose
9
-
10
- Documentation changes and promotions in steps 03–05 may create or expose broken links.
11
- This step validates references across affected documentation and repairs them where possible.
12
-
13
- ## Scope of Validation
14
-
15
- Validate links only in files that were written or affected during this session:
16
- - POLARIS.md files updated in step 03
17
- - SUMMARY.md files updated in step 04
18
- - Documents ingested in step 05
19
- - Provenance files created in step 05
20
-
21
- Do NOT validate the entire repository. Scope is limited to files touched by this session.
22
-
23
- ## Link Types to Validate
24
-
25
- ### Markdown Links
26
-
27
- ```markdown
28
- [text](path)
29
- [text](path#anchor)
30
- ```
31
-
32
- Validate that the target path exists relative to the document location.
33
-
34
- ### Wiki-style Links
35
-
36
- ```markdown
37
- [[document-name]]
38
- [[folder/document]]
39
- ```
40
-
41
- Validate that the referenced document exists in `smartdocs/`.
42
-
43
- ### YAML Frontmatter References
44
-
45
- ```yaml
46
- depends_on:
47
- - foreman-worker-architecture.md
48
- supersedes: old-spec.md
49
- related:
50
- - worker-session-contract.md
51
- ```
52
-
53
- Validate that referenced files exist in their expected locations.
54
-
55
- ### Promotion References
56
-
57
- When a document was promoted from `smartdocs/raw/` to `smartdocs/specs/active/`, any
58
- existing references to the raw location (in files written this session) should be updated
59
- to point to the new canonical location.
60
-
61
- ### Cognition References
62
-
63
- In SUMMARY.md files, references to cognition notes or archive entries should resolve
64
- correctly after archival in step 05.
65
-
66
- ## Repair Heuristics
67
-
68
- ### Broken Relative Path
69
-
70
- If a relative path is wrong but the target file exists at a different relative path:
71
- 1. Compute the correct relative path.
72
- 2. Update the link.
73
- 3. Record as repaired.
74
-
75
- ### Promoted Document Reference
76
-
77
- If a link points to `smartdocs/raw/<file>` and the file was promoted to
78
- `smartdocs/specs/active/<file>` in step 05:
79
- 1. Update the link to the new canonical path.
80
- 2. Record as repaired.
81
-
82
- ### Unrepairable Links
83
-
84
- A link is unrepairable when:
85
- - The target file does not exist anywhere in the repository.
86
- - The link is ambiguous (multiple matching targets).
87
- - The link is to an external URL (do not modify external links).
88
-
89
- Record unrepairable links in the result and continue. Do not fail the session over
90
- unrepairable links.
91
-
92
- ## Actions
93
-
94
- ### 6.1 Collect Links
95
-
96
- For each file written in steps 03–05, extract all link references (markdown, YAML, wiki).
97
-
98
- ### 6.2 Validate Each Link
99
-
100
- Check whether the target exists. Classify as: valid, broken-repairable, broken-unrepairable,
101
- external (skip).
102
-
103
- ### 6.3 Repair
104
-
105
- For each broken-repairable link:
106
- 1. Verify the source file is in `packet.allowed_write_paths`.
107
- 2. Apply the repair (update the link in the file).
108
- 3. Record in `links_repaired`.
109
-
110
- ### 6.4 Record Results
111
-
112
- Build the link validation report for step 09.
113
-
114
- ## Output
115
-
116
- ```yaml
117
- link_validation_report:
118
- total_checked: <n>
119
- valid: <n>
120
- broken: <n>
121
- repaired: <n>
122
- unrepairable: ["<path>: <description>", ...]
123
- ```
124
-
125
- Unrepairable links are added to the session blockers list with `resolution_required: false`
126
- (informational only — they do not block the Librarian commit).
127
-
128
- Proceed to step 07.