@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,52 +0,0 @@
1
- ---
2
- name: polaris-medic
3
- description: Diagnose and repair failed worker executions, create medical charts, and prepare for Librarian reconciliation.
4
- role: medic
5
- role_file: .polaris/roles/medic.md
6
- ---
7
-
8
- ## Entry Points
9
-
10
- This skill is invoked by the Foreman as a dispatched session when a worker returns a failed result packet.
11
-
12
- Invocation: The Foreman dispatches Medic after detecting a failed result packet and marking triage required. The packet path is passed as the session prompt.
13
-
14
- ---
15
-
16
- ## Polaris Skill Bootloader
17
-
18
- This skill does NOT use the standard Polaris skill bootloader. The Medic receives its packet directly from the Foreman — the packet is the sole authoritative instruction source for this session.
19
-
20
- The Medic MUST:
21
- 1. Read the packet at the path provided in the dispatch prompt.
22
- 2. Validate the packet schema (role must be `"medic"`).
23
- 3. Execute `chain.md` in strict step order.
24
- 4. Write the sealed result to `packet.result_path` before the session ends.
25
-
26
- If the packet cannot be read or fails schema validation, write a failure result immediately and terminate. Do not attempt to reconstruct the packet from context.
27
-
28
- ---
29
-
30
- ## Authority Reminder
31
-
32
- The Medic may modify implementation code to repair failures. The Medic may create charts in `smartdocs/medic/charts/`. The Medic does NOT modify runtime state, dispatch workers, or perform normal implementation work.
33
-
34
- Full authority boundaries: `.polaris/roles/medic.md`
35
-
36
- ---
37
-
38
- ## Packet Schema
39
-
40
- The packet is a `MedicPacket`. See:
41
- - `src/types/result-packet.ts` for TypeScript types
42
- - This packet includes the failed worker result packet and cluster context
43
-
44
- Required packet fields: `role`, `run_id`, `dispatch_id`, `cluster_id`, `failed_result_packet`, `cluster_context`, `result_path`, `allowed_write_paths`, `prohibited_write_paths`.
45
-
46
- ---
47
-
48
- ## Execution
49
-
50
- Read `chain.md` and execute steps in strict order.
51
-
52
- Do not skip steps. Do not reorder steps.
@@ -1,111 +0,0 @@
1
- ---
2
- name: polaris-medic-chain
3
- description: Step-order execution map for the Medic role. Dispatched when worker execution fails.
4
- ---
5
-
6
- # Medic Chain
7
-
8
- ## Authority
9
-
10
- **The packet is authoritative. Do not infer cluster scope or conversation context.**
11
-
12
- Read the packet before any analysis. Execute steps in strict order.
13
-
14
- ## Scope Contract
15
-
16
- The Medic operates on implementation repair and chart creation only.
17
-
18
- **Allowed writes:** Implementation code (repair only), `smartdocs/medic/charts/` (chart creation), sealed result JSON, medic commit.
19
-
20
- **Prohibited writes:** Runtime state files, telemetry JSONL, cluster plan, issue tracker status, POLARIS.md, SUMMARY.md (Librarian responsibility).
21
-
22
- ---
23
-
24
- ## Step Traversal Order
25
-
26
- ```text
27
- 01-orient-medic ← Read packet, load failed result, build diagnosis inventory
28
- 02-diagnose ← Analyze failure, identify root cause, determine repair strategy
29
- 03-repair ← Execute repair changes to implementation code
30
- 04-validate ← Verify repair resolves the failure
31
- 05-create-chart ← Create medical chart documenting the failure and treatment
32
- 06-closeout ← Commit repair changes, write sealed result, terminate
33
- ```
34
-
35
- All steps must complete in order. Termination after step 06 is mandatory.
36
-
37
- ---
38
-
39
- ## Execution Rules
40
-
41
- ### Step Gate Behavior
42
-
43
- - Each step must complete before the next begins.
44
- - If a step encounters a recoverable error (e.g., diagnosis uncertain), record the blocker and continue with best-effort repair.
45
- - If a step encounters a fatal error (e.g., packet unreadable, commit fails), record `status: "failure"` in the result and proceed to step 06 (sealed result write).
46
- - Do not skip to step 06 for recoverable errors — complete the remaining steps.
47
-
48
- ### Write Discipline
49
-
50
- Before writing any file, verify it is in `packet.allowed_write_paths`.
51
- If the target file is in `packet.prohibited_write_paths`, skip and record as blocker.
52
-
53
- ### Commit Timing
54
-
55
- All repair writes occur during step 03. Chart creation occurs during step 05.
56
- Step 06 creates exactly one git commit containing all changes from this session.
57
- If no repair or chart was created (e.g., diagnosis deferred), step 06 makes no commit.
58
- The result records `commit_sha: null` in this case — do not create an empty commit.
59
-
60
- ### Result Timing
61
-
62
- Step 06 writes the sealed result JSON and terminates. No further writes are permitted after the sealed result is written.
63
-
64
- ---
65
-
66
- ## Narration Rules
67
-
68
- The Medic does NOT produce user-facing narration during normal execution.
69
-
70
- **Allowed output:**
71
- - The sealed result JSON written to `result_path` (step 06)
72
- - Escalation output if blocked on a decision that requires operator input
73
-
74
- **Prohibited output:**
75
- - Step-by-step progress narration
76
- - Summary of diagnosis or repair
77
- - Interim status updates
78
-
79
- All communication with the Foreman occurs through the sealed result and the commit record.
80
-
81
- ---
82
-
83
- ## Telemetry Events
84
-
85
- Emit the following structured events to the telemetry file (if path provided in packet):
86
-
87
- | Event | Step | Fields |
88
- |---|---|---|
89
- | `medic-start` | 01 | `run_id`, `cluster_id`, `dispatch_id`, `timestamp` |
90
- | `medic-step-complete` | each step | `step`, `run_id`, `timestamp`, `outcome` |
91
- | `medic-commit` | 06 | `commit_sha`, `files_changed`, `timestamp` |
92
- | `medic-complete` | 06 | `status`, `run_id`, `timestamp` |
93
-
94
- If no telemetry file is specified in the packet, skip telemetry events silently.
95
-
96
- ---
97
-
98
- ## Failure Handling
99
-
100
- | Condition | Action |
101
- |---|---|
102
- | Packet unreadable | Write failure result to `result_path` if possible, otherwise stderr. Terminate. |
103
- | Packet schema invalid | Write failure result, terminate |
104
- | Diagnosis uncertain | Record blocker, proceed to repair with best-effort or deferred treatment |
105
- | Repair fails | Status: failure, record repair error, proceed to step 06 |
106
- | Validation fails | Status: partial, record validation failure, proceed to chart creation |
107
- | Chart creation fails | Status: partial, record chart error, proceed to step 06 |
108
- | Commit fails | Status: failure, record commit error, proceed to step 06 |
109
- | Result write fails | Stderr only. Cannot recover. |
110
- | All blockers, no writes | Status: `"blocked"`, list blockers, commit nothing |
111
- | Some work done, some blocked | Status: `"partial"`, describe both |
@@ -1,75 +0,0 @@
1
- ---
2
- name: polaris-medic-step-01
3
- description: Read packet, load failed result, and build the diagnosis inventory for this session.
4
- ---
5
-
6
- # Step 01 — Orient Medic
7
-
8
- ## Purpose
9
-
10
- Build a complete picture of the failure event. This is the foundation for all subsequent diagnosis and repair steps. Nothing is written in this step.
11
-
12
- ## Actions
13
-
14
- ### 1.1 Read and Validate Packet
15
-
16
- Read the packet from the path provided in the dispatch prompt.
17
-
18
- Validate required fields:
19
- - `role` must be `"medic"`
20
- - `run_id`, `dispatch_id`, `cluster_id` must be present and non-empty
21
- - `failed_result_packet` must be present
22
- - `result_path` must be present
23
- - `allowed_write_paths` must be present
24
-
25
- If validation fails: write a minimal failure result to `result_path` and terminate.
26
-
27
- ### 1.2 Load Failed Result Packet
28
-
29
- Read the failed result packet from `packet.failed_result_packet`.
30
-
31
- Extract:
32
- - Child ID that failed
33
- - Error message
34
- - Files that were changed (if any)
35
- - Validation failures (if any)
36
- - Execution context (if any)
37
-
38
- ### 1.3 Load Cluster Context
39
-
40
- Load cluster context from `packet.cluster_context`.
41
-
42
- Extract:
43
- - Cluster ID
44
- - Branch name
45
- - Related work items
46
- - Route information (if available)
47
-
48
- ### 1.4 Build Diagnosis Inventory
49
-
50
- Produce an internal inventory (not written to disk):
51
-
52
- ```yaml
53
- diagnosis_inventory:
54
- cluster_id: <from packet>
55
- failed_child_id: <from failed_result_packet>
56
- error_message: <from failed_result_packet>
57
- changed_files: <from failed_result_packet>
58
- validation_failures: <from failed_result_packet>
59
- execution_context: <from failed_result_packet>
60
- route: <from cluster_context>
61
- branch: <from cluster_context>
62
- ```
63
-
64
- ### 1.5 Emit Telemetry
65
-
66
- Emit `medic-start` event (if telemetry path provided).
67
-
68
- ## Completion Criteria
69
-
70
- - Packet validated
71
- - Failed result packet loaded
72
- - Cluster context loaded
73
- - Diagnosis inventory built
74
-
75
- Proceed to step 02.
@@ -1,79 +0,0 @@
1
- ---
2
- name: polaris-medic-step-02
3
- description: Analyze the failure, identify root cause, and determine repair strategy.
4
- ---
5
-
6
- # Step 02 — Diagnose
7
-
8
- ## Purpose
9
-
10
- Analyze the failure event to understand what went wrong and determine a repair strategy. This step does not make any changes to the codebase.
11
-
12
- ## Actions
13
-
14
- ### 2.1 Analyze Error Message
15
-
16
- Examine the error message from the failed result packet:
17
- - What type of error occurred?
18
- - Which file or component is implicated?
19
- - Is this a syntax error, runtime error, validation error, or test failure?
20
-
21
- ### 2.2 Examine Changed Files
22
-
23
- Review the files that were changed by the failed worker:
24
- - Do the changes introduce syntax errors?
25
- - Do the changes break existing functionality?
26
- - Are there missing dependencies or imports?
27
- - Are there type mismatches?
28
-
29
- ### 2.3 Identify Root Cause
30
-
31
- Based on the error analysis and file examination, identify the root cause:
32
-
33
- Common root causes:
34
- - Syntax error in introduced code
35
- - Missing or incorrect dependency
36
- - Type mismatch or type error
37
- - Logic error in implementation
38
- - Test failure due to incorrect expectations
39
- - Configuration error
40
- - Environment mismatch
41
-
42
- ### 2.4 Determine Repair Strategy
43
-
44
- Based on the root cause, determine the appropriate repair strategy:
45
-
46
- Repair strategies:
47
- - Fix syntax errors
48
- - Add missing dependencies
49
- - Correct type annotations
50
- - Adjust logic implementation
51
- - Update test expectations
52
- - Fix configuration
53
- - Document environment requirements
54
-
55
- If the root cause is unclear or the repair strategy is uncertain, record this as a blocker and proceed with best-effort repair or defer treatment.
56
-
57
- ### 2.5 Record Diagnosis
58
-
59
- Record the diagnosis internally (not written to disk):
60
-
61
- ```yaml
62
- diagnosis:
63
- root_cause: <identified root cause>
64
- repair_strategy: <chosen repair strategy>
65
- uncertainty: <any doubts or blockers>
66
- deferred: <true if treatment deferred>
67
- ```
68
-
69
- ### 2.6 Emit Telemetry
70
-
71
- Emit `medic-step-complete` event for step 02 (if telemetry path provided).
72
-
73
- ## Completion Criteria
74
-
75
- - Error analyzed
76
- - Root cause identified (or uncertainty recorded)
77
- - Repair strategy determined (or deferred)
78
-
79
- Proceed to step 03.
@@ -1,64 +0,0 @@
1
- ---
2
- name: polaris-medic-step-03
3
- description: Execute repair changes to implementation code based on diagnosis.
4
- ---
5
-
6
- # Step 03 — Repair
7
-
8
- ## Purpose
9
-
10
- Execute the repair strategy identified in step 02 to fix the failure. This step makes changes to implementation code only.
11
-
12
- ## Actions
13
-
14
- ### 3.1 Verify Write Permissions
15
-
16
- Before making any changes, verify that the target files are in `packet.allowed_write_paths` and not in `packet.prohibited_write_paths`.
17
-
18
- If a target file is prohibited, skip and record as a blocker.
19
-
20
- ### 3.2 Execute Repair Strategy
21
-
22
- Apply the repair strategy determined in step 02:
23
-
24
- - **Syntax errors**: Fix syntax in the identified files
25
- - **Missing dependencies**: Add missing imports or dependencies
26
- - **Type mismatches**: Correct type annotations
27
- - **Logic errors**: Adjust the implementation logic
28
- - **Test failures**: Update test expectations or fix implementation
29
- - **Configuration errors**: Fix configuration files
30
- - **Environment issues**: Document requirements (do not change environment)
31
-
32
- Make the smallest scoped change that addresses the root cause.
33
-
34
- ### 3.3 Verify Repair Completeness
35
-
36
- After applying the repair, verify:
37
- - The identified root cause is addressed
38
- - No new syntax errors are introduced
39
- - Changes are within the scope of the failed child's work
40
-
41
- If the repair cannot be completed (e.g., root cause unclear, changes too broad), record this as a blocker.
42
-
43
- ### 3.4 Record Changes
44
-
45
- Record the changes made internally (not written to disk):
46
-
47
- ```yaml
48
- repair_changes:
49
- files_modified: [<list of files>]
50
- changes_summary: <brief description of changes>
51
- blockers: [<any blockers encountered>]
52
- ```
53
-
54
- ### 3.5 Emit Telemetry
55
-
56
- Emit `medic-step-complete` event for step 03 (if telemetry path provided).
57
-
58
- ## Completion Criteria
59
-
60
- - Repair strategy executed (or blocked)
61
- - Changes made are minimal and scoped
62
- - No prohibited files were modified
63
-
64
- Proceed to step 04.
@@ -1,66 +0,0 @@
1
- ---
2
- name: polaris-medic-step-04
3
- description: Verify that the repair resolves the failure.
4
- ---
5
-
6
- # Step 04 — Validate
7
-
8
- ## Purpose
9
-
10
- Verify that the repair changes successfully resolve the original failure. This step runs validation to confirm the fix works.
11
-
12
- ## Actions
13
-
14
- ### 4.1 Run Validation Commands
15
-
16
- Run the validation commands specified in the failed result packet or cluster context:
17
-
18
- Common validation commands:
19
- - `npm run build` — verify TypeScript compilation
20
- - `npm test` — verify test suite passes
21
- - Specific test commands for the affected route
22
-
23
- If no validation commands are specified, run:
24
- - `npm run build`
25
- - `npm test`
26
-
27
- ### 4.2 Analyze Validation Results
28
-
29
- Examine the validation output:
30
- - Did the build succeed?
31
- - Did the tests pass?
32
- - Are there any remaining errors related to the original failure?
33
-
34
- ### 4.3 Determine Validation Outcome
35
-
36
- Based on the validation results, determine the outcome:
37
-
38
- - **Success**: All validation passes, original failure resolved
39
- - **Partial**: Some validation passes, but issues remain
40
- - **Failure**: Validation still fails, repair unsuccessful
41
-
42
- If validation fails, record this as a blocker. The Medic may proceed to chart creation to document the partial treatment.
43
-
44
- ### 4.4 Record Validation Result
45
-
46
- Record the validation result internally (not written to disk):
47
-
48
- ```yaml
49
- validation_result:
50
- outcome: <success | partial | failure>
51
- build_passed: <true | false>
52
- tests_passed: <true | false>
53
- remaining_errors: [<any remaining errors>]
54
- ```
55
-
56
- ### 4.5 Emit Telemetry
57
-
58
- Emit `medic-step-complete` event for step 04 (if telemetry path provided).
59
-
60
- ## Completion Criteria
61
-
62
- - Validation commands executed
63
- - Validation outcome determined
64
- - Result recorded
65
-
66
- Proceed to step 05.
@@ -1,85 +0,0 @@
1
- ---
2
- name: polaris-medic-step-05
3
- description: Create a medical chart documenting the failure and treatment.
4
- ---
5
-
6
- # Step 05 — Create Chart
7
-
8
- ## Purpose
9
-
10
- Create a medical chart in `smartdocs/medic/charts/` documenting the failure event, diagnosis, treatment, and validation outcome. This chart becomes part of the repository's medical history.
11
-
12
- ## Actions
13
-
14
- ### 5.1 Generate Chart ID
15
-
16
- Use the chart ID generator from the Chart system (POL-327):
17
- - Import `generateNextChartId` from `src/medic/chart-id.ts`
18
- - Generate the next chart ID for today
19
- - Charts directory: `smartdocs/medic/charts/`
20
-
21
- ### 5.2 Prepare Chart Front-Matter
22
-
23
- Prepare the YAML front-matter for the chart:
24
-
25
- ```yaml
26
- ---
27
- chart_id: <generated chart ID>
28
- cluster_id: <from packet>
29
- route: <from cluster context>
30
- status: <open | resolved | deferred>
31
- related_charts: []
32
- created: <ISO8601 timestamp>
33
- updated: <ISO8601 timestamp>
34
- drift_observations: []
35
- ---
36
- ```
37
-
38
- Set status based on validation outcome:
39
- - `resolved` if validation succeeded
40
- - `deferred` if validation failed or repair was incomplete
41
- - `open` if diagnosis was uncertain
42
-
43
- ### 5.3 Prepare Chart Sections
44
-
45
- Write the required chart sections:
46
-
47
- - **Problem**: Description of the original failure
48
- - **Symptoms**: Error messages, validation failures, observable behavior
49
- - **Root Cause**: Identified root cause from step 02
50
- - **Affected Files**: List of files involved in the failure and repair
51
- - **Treatment**: Description of repair changes made in step 03
52
- - **Validation**: Validation outcome from step 04
53
- - **Prevention**: Recommendations to prevent similar failures
54
- - **When To Read This Chart**: Conditions under which this chart is relevant
55
-
56
- ### 5.4 Write Chart File
57
-
58
- Write the chart to `smartdocs/medic/charts/<chart_id>.md`
59
-
60
- Verify the chart passes schema validation using the Chart system (POL-327):
61
- - Front-matter must match `ChartFrontMatter` schema
62
- - All required sections must be present
63
-
64
- ### 5.5 Record Chart Creation
65
-
66
- Record the chart creation internally (not written to disk):
67
-
68
- ```yaml
69
- chart_created:
70
- chart_id: <generated chart ID>
71
- file_path: <path to chart file>
72
- validation_passed: <true | false>
73
- ```
74
-
75
- ### 5.6 Emit Telemetry
76
-
77
- Emit `medic-step-complete` event for step 05 (if telemetry path provided).
78
-
79
- ## Completion Criteria
80
-
81
- - Chart ID generated
82
- - Chart file created with valid front-matter and sections
83
- - Chart passes schema validation
84
-
85
- Proceed to step 06.
@@ -1,86 +0,0 @@
1
- ---
2
- name: polaris-medic-step-06
3
- description: Commit repair changes, write sealed result, and terminate.
4
- ---
5
-
6
- # Step 06 — Closeout
7
-
8
- ## Purpose
9
-
10
- Commit all changes from this session (repairs and chart), write the sealed result, and terminate. This is the final step.
11
-
12
- ## Actions
13
-
14
- ### 6.1 Determine Commit Strategy
15
-
16
- Based on the work completed:
17
- - If repairs were made and/or chart was created: create a commit
18
- - If no changes were made (e.g., diagnosis deferred): do not create a commit
19
-
20
- ### 6.2 Create Commit (if changes exist)
21
-
22
- If changes were made:
23
- 1. Stage all modified files
24
- 2. Create a commit with message:
25
-
26
- ```
27
- [POL-326] Medic: <brief description of repair>
28
-
29
- Generated with [Devin](https://cli.devin.ai/docs)
30
-
31
- Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
32
- ```
33
-
34
- 3. Record the commit SHA
35
-
36
- If no changes were made, set `commit_sha: null`.
37
-
38
- ### 6.3 Prepare Sealed Result
39
-
40
- Prepare the sealed result JSON:
41
-
42
- ```json
43
- {
44
- "run_id": "<from packet>",
45
- "dispatch_id": "<from packet>",
46
- "cluster_id": "<from packet>",
47
- "status": "<success | partial | failure | blocked>",
48
- "commit_sha": "<commit SHA or null>",
49
- "chart_id": "<chart ID or null>",
50
- "diagnosis": {
51
- "root_cause": "<root cause>",
52
- "repair_strategy": "<repair strategy>"
53
- },
54
- "validation": {
55
- "outcome": "<success | partial | failure>",
56
- "build_passed": <true | false>,
57
- "tests_passed": <true | false>
58
- },
59
- "blockers": [<any blockers encountered>],
60
- "timestamp": "<ISO8601 timestamp>"
61
- }
62
- ```
63
-
64
- Set status based on overall outcome:
65
- - `success`: Repair completed, validation passed, chart created
66
- - `partial`: Some work done, but blockers remain
67
- - `failure`: Fatal error encountered
68
- - `blocked`: All work blocked
69
-
70
- ### 6.4 Write Sealed Result
71
-
72
- Write the sealed result JSON to `packet.result_path`.
73
-
74
- If the write fails, output to stderr and terminate (cannot recover).
75
-
76
- ### 6.5 Emit Telemetry
77
-
78
- Emit `medic-commit` event (if commit created) and `medic-complete` event (if telemetry path provided).
79
-
80
- ## Completion Criteria
81
-
82
- - Commit created (if changes were made)
83
- - Sealed result written to result_path
84
- - Telemetry events emitted
85
-
86
- Terminate session. No further steps.
@@ -1,75 +0,0 @@
1
- ---
2
- name: polaris-reconcile
3
- description: Update POLARIS.md and SUMMARY.md files to reflect completed work. Callable at will — does not require a cluster closeout. Uses the Polaris packet for work context.
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 reconcile
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-reconcile
24
-
25
- Use this skill to reconcile project cognition after completed work — updating POLARIS.md and
26
- SUMMARY.md files to reflect current reality. This is the standalone form of the cognition
27
- reconciliation steps performed by the Closeout Librarian, callable at will rather than only
28
- at cluster closeout.
29
-
30
- ## When to use
31
-
32
- - "Reconcile the docs after POL-257"
33
- - "Update POLARIS.md and SUMMARY.md for this run"
34
- - "Run polaris-reconcile on POL-303"
35
- - After a run completes and you want cognition updated without waiting for full closeout
36
-
37
- ## How to execute
38
-
39
- 1. Read `chain.md` — step order and rules.
40
- 2. Read `.taskchain_artifacts/polaris-reconcile/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 polaris-reconcile may do
45
-
46
- - Read packet-specified folders and their POLARIS.md and SUMMARY.md files
47
- - Write POLARIS.md and SUMMARY.md files within `packet.allowed_write_paths`
48
- - Create a single sealed git commit of all cognition changes
49
-
50
- ## Hard rules — what polaris-reconcile must NOT do
51
-
52
- - Modify implementation source code (`src/`, tests, config)
53
- - Modify runtime state files outside this skill's owned artifacts (cluster-state, other skills' `.taskchain_artifacts/` state, or non-reconcile telemetry)
54
- - Move, ingest, classify, or promote documents
55
- - Call `npm run polaris -- loop continue` or `npm run polaris -- finalize`
56
- - Write to `packet.prohibited_write_paths`
57
- - Git push or create PRs
58
-
59
- ## Packet schema
60
-
61
- The packet is a `ReconcilePacket`. Required fields:
62
-
63
- | Field | Description |
64
- |---|---|
65
- | `run_id` | Identifier for this reconcile run |
66
- | `issue_id` | Bound issue (e.g. `POL-257`) |
67
- | `affected_folders` | Folders whose POLARIS.md and/or SUMMARY.md may need updating |
68
- | `work_inventory` | Summary of completed work: changed files, child summaries, cognition notes |
69
- | `allowed_write_paths` | Paths this skill may write |
70
- | `prohibited_write_paths` | Paths this skill must not write |
71
- | `constraints.max_summary_addition_lines` | Net new line cap per SUMMARY.md update (default: 50) |
72
-
73
- ## Execution
74
-
75
- Read `chain.md` and execute steps in strict order. Do not skip steps. Do not reorder steps.