@lsctech/polaris 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/adopt-assets.js +187 -0
- package/dist/cli/adopt-cognition.js +1 -2
- package/dist/cli/adopt-genesis.js +84 -0
- package/dist/cli/adopt-instructions.js +1 -2
- package/dist/cli/adopt-report.js +67 -0
- package/dist/cli/adopt-workspace.js +114 -0
- package/dist/cli/adoption-plan.js +11 -0
- package/dist/cli/init.js +79 -7
- package/dist/workspace/.polaris/roles/analyst.md +38 -0
- package/dist/workspace/.polaris/roles/closeout-librarian.md +122 -0
- package/dist/workspace/.polaris/roles/cognition-librarian.md +37 -0
- package/dist/workspace/.polaris/roles/finalizer.md +45 -0
- package/dist/workspace/.polaris/roles/foreman.md +165 -0
- package/dist/workspace/.polaris/roles/librarian.md +74 -0
- package/dist/workspace/.polaris/roles/worker.md +119 -0
- package/dist/workspace/.polaris/session-type +1 -0
- package/dist/workspace/.polaris/skills/ROUTING.md +109 -0
- package/dist/workspace/.polaris/skills/caveman/SKILL.md +74 -0
- package/dist/workspace/.polaris/skills/caveman-compress/scripts/compress.py +272 -0
- package/dist/workspace/.polaris/skills/closeout-librarian/POLARIS.md +46 -0
- package/dist/workspace/.polaris/skills/closeout-librarian/SKILL.md +59 -0
- package/dist/workspace/.polaris/skills/closeout-librarian/chain.md +116 -0
- package/dist/workspace/.polaris/skills/closeout-librarian/steps/01-load-cluster-context.md +78 -0
- package/dist/workspace/.polaris/skills/closeout-librarian/steps/02-drift-reconciliation.md +157 -0
- package/dist/workspace/.polaris/skills/closeout-librarian/steps/03-reconcile-polaris-md.md +93 -0
- package/dist/workspace/.polaris/skills/closeout-librarian/steps/04-reconcile-summary-md.md +106 -0
- package/dist/workspace/.polaris/skills/closeout-librarian/steps/05-doc-ingestion.md +114 -0
- package/dist/workspace/.polaris/skills/closeout-librarian/steps/06-link-validation.md +128 -0
- package/dist/workspace/.polaris/skills/closeout-librarian/steps/07-yaml-linking.md +95 -0
- package/dist/workspace/.polaris/skills/closeout-librarian/steps/08-librarian-commit.md +119 -0
- package/dist/workspace/.polaris/skills/closeout-librarian/steps/09-sealed-result.md +118 -0
- package/dist/workspace/.polaris/skills/docs-ingest/SKILL.md +68 -0
- package/dist/workspace/.polaris/skills/docs-ingest/chain.json +23 -0
- package/dist/workspace/.polaris/skills/docs-ingest/chain.md +149 -0
- package/dist/workspace/.polaris/skills/docs-ingest/steps/01-orient-ingest.md +85 -0
- package/dist/workspace/.polaris/skills/docs-ingest/steps/02-classify-batch.md +87 -0
- package/dist/workspace/.polaris/skills/docs-ingest/steps/03-conflict-check.md +66 -0
- package/dist/workspace/.polaris/skills/docs-ingest/steps/04-place-and-link.md +77 -0
- package/dist/workspace/.polaris/skills/docs-ingest/steps/05-finalize-ingest.md +49 -0
- package/dist/workspace/.polaris/skills/docs-promote/SKILL.md +79 -0
- package/dist/workspace/.polaris/skills/docs-promote/chain.json +25 -0
- package/dist/workspace/.polaris/skills/docs-promote/chain.md +80 -0
- package/dist/workspace/.polaris/skills/docs-promote/steps/01-orient-promote.md +53 -0
- package/dist/workspace/.polaris/skills/docs-promote/steps/02-review-candidates.md +51 -0
- package/dist/workspace/.polaris/skills/docs-promote/steps/03-read-linked-code.md +50 -0
- package/dist/workspace/.polaris/skills/docs-promote/steps/04-conflict-surface.md +65 -0
- package/dist/workspace/.polaris/skills/docs-promote/steps/05-await-approval.md +61 -0
- package/dist/workspace/.polaris/skills/docs-promote/steps/06-execute-promote-deprecate.md +65 -0
- package/dist/workspace/.polaris/skills/docs-promote/steps/07-finalize-promote.md +44 -0
- package/dist/workspace/.polaris/skills/polaris-analyze/SKILL.md +94 -0
- package/dist/workspace/.polaris/skills/polaris-analyze/chain.json +20 -0
- package/dist/workspace/.polaris/skills/polaris-analyze/chain.md +105 -0
- package/dist/workspace/.polaris/skills/polaris-analyze/issue-reconciliation.md +149 -0
- package/dist/workspace/.polaris/skills/polaris-analyze/issue-template.md +133 -0
- package/dist/workspace/.polaris/skills/polaris-analyze/linked-skills/repo-analysis.md +55 -0
- package/dist/workspace/.polaris/skills/polaris-analyze/steps/01-fetch-and-orient.md +79 -0
- package/dist/workspace/.polaris/skills/polaris-analyze/steps/02-map-affected-code.md +58 -0
- package/dist/workspace/.polaris/skills/polaris-analyze/steps/03-assess-issue.md +58 -0
- package/dist/workspace/.polaris/skills/polaris-analyze/steps/04-blocker-check.md +60 -0
- package/dist/workspace/.polaris/skills/polaris-analyze/steps/05-create-cluster-plan.md +197 -0
- package/dist/workspace/.polaris/skills/polaris-analyze/steps/06-final-report.md +60 -0
- package/dist/workspace/.polaris/skills/polaris-catalog/SKILL.md +91 -0
- package/dist/workspace/.polaris/skills/polaris-catalog/chain.json +22 -0
- package/dist/workspace/.polaris/skills/polaris-catalog/chain.md +85 -0
- package/dist/workspace/.polaris/skills/polaris-catalog/steps/01-orient-catalog.md +92 -0
- package/dist/workspace/.polaris/skills/polaris-catalog/steps/02-reconcile-polaris-md.md +33 -0
- package/dist/workspace/.polaris/skills/polaris-catalog/steps/03-reconcile-summary-md.md +70 -0
- package/dist/workspace/.polaris/skills/polaris-catalog/steps/04-classify-and-place.md +117 -0
- package/dist/workspace/.polaris/skills/polaris-catalog/steps/05-catalog-commit.md +94 -0
- package/dist/workspace/.polaris/skills/polaris-medic/SKILL.md +52 -0
- package/dist/workspace/.polaris/skills/polaris-medic/chain.md +111 -0
- package/dist/workspace/.polaris/skills/polaris-medic/steps/01-orient-medic.md +75 -0
- package/dist/workspace/.polaris/skills/polaris-medic/steps/02-diagnose.md +79 -0
- package/dist/workspace/.polaris/skills/polaris-medic/steps/03-repair.md +64 -0
- package/dist/workspace/.polaris/skills/polaris-medic/steps/04-validate.md +66 -0
- package/dist/workspace/.polaris/skills/polaris-medic/steps/05-create-chart.md +85 -0
- package/dist/workspace/.polaris/skills/polaris-medic/steps/06-closeout.md +86 -0
- package/dist/workspace/.polaris/skills/polaris-reconcile/SKILL.md +75 -0
- package/dist/workspace/.polaris/skills/polaris-reconcile/chain.json +20 -0
- package/dist/workspace/.polaris/skills/polaris-reconcile/chain.md +67 -0
- package/dist/workspace/.polaris/skills/polaris-reconcile/steps/01-orient-reconcile.md +82 -0
- package/dist/workspace/.polaris/skills/polaris-reconcile/steps/02-reconcile-polaris-md.md +95 -0
- package/dist/workspace/.polaris/skills/polaris-reconcile/steps/03-reconcile-summary-md.md +108 -0
- package/dist/workspace/.polaris/skills/polaris-reconcile/steps/04-reconcile-commit.md +88 -0
- package/dist/workspace/.polaris/skills/polaris-run/SKILL.md +135 -0
- package/dist/workspace/.polaris/skills/polaris-run/chain.json +19 -0
- package/dist/workspace/.polaris/skills/polaris-run/chain.md +298 -0
- package/dist/workspace/.polaris/skills/polaris-run/execution-adapter.md +34 -0
- package/dist/workspace/.polaris/skills/polaris-run/linked-skills/repo-analysis.md +58 -0
- package/dist/workspace/.polaris/skills/polaris-run/steps/01-orient-cluster.md +96 -0
- package/dist/workspace/.polaris/skills/polaris-run/steps/02-prepare-branch.md +53 -0
- package/dist/workspace/.polaris/skills/polaris-run/steps/03-select-child.md +63 -0
- package/dist/workspace/.polaris/skills/polaris-run/steps/04-execute-child.md +75 -0
- package/dist/workspace/.polaris/skills/polaris-run/steps/05-validate-child.md +57 -0
- package/dist/workspace/.polaris/skills/polaris-run/steps/06-commit-and-update-linear.md +74 -0
- package/dist/workspace/.polaris/skills/polaris-run/steps/07-decide-continuation.md +89 -0
- package/dist/workspace/.polaris/skills/polaris-run/steps/08-closeout-librarian.md +146 -0
- package/dist/workspace/.polaris/skills/polaris-run/steps/08-final-delivery.md +91 -0
- package/dist/workspace/.polaris/skills/polaris-run/steps/09-final-delivery.md +104 -0
- package/dist/workspace/.polaris/skills/polaris-tools/README.md +63 -0
- package/dist/workspace/.polaris/skills/polaris-tools/SKILL.md +94 -0
- package/dist/workspace/.polaris/skills/polaris-tools/tools.js +191 -0
- package/dist/workspace/smartdocs/architecture/.gitkeep +0 -0
- package/dist/workspace/smartdocs/audits/.gitkeep +0 -0
- package/dist/workspace/smartdocs/decisions/.gitkeep +0 -0
- package/dist/workspace/smartdocs/doctrine/active/.gitkeep +0 -0
- package/dist/workspace/smartdocs/runtime/.gitkeep +0 -0
- package/dist/workspace/smartdocs/specs/active/.gitkeep +0 -0
- package/dist/workspace/smartdocs/specs/archive/.gitkeep +0 -0
- package/dist/workspace/workspace/.polaris/roles/analyst.md +38 -0
- package/dist/workspace/workspace/.polaris/roles/closeout-librarian.md +122 -0
- package/dist/workspace/workspace/.polaris/roles/cognition-librarian.md +37 -0
- package/dist/workspace/workspace/.polaris/roles/finalizer.md +45 -0
- package/dist/workspace/workspace/.polaris/roles/foreman.md +165 -0
- package/dist/workspace/workspace/.polaris/roles/librarian.md +74 -0
- package/dist/workspace/workspace/.polaris/roles/worker.md +119 -0
- package/dist/workspace/workspace/.polaris/session-type +1 -0
- package/dist/workspace/workspace/.polaris/skills/ROUTING.md +109 -0
- package/dist/workspace/workspace/.polaris/skills/caveman/SKILL.md +74 -0
- package/dist/workspace/workspace/.polaris/skills/caveman-compress/scripts/compress.py +272 -0
- package/dist/workspace/workspace/.polaris/skills/closeout-librarian/POLARIS.md +46 -0
- package/dist/workspace/workspace/.polaris/skills/closeout-librarian/SKILL.md +59 -0
- package/dist/workspace/workspace/.polaris/skills/closeout-librarian/chain.md +116 -0
- package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/01-load-cluster-context.md +78 -0
- package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/02-drift-reconciliation.md +157 -0
- package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/03-reconcile-polaris-md.md +93 -0
- package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/04-reconcile-summary-md.md +106 -0
- package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/05-doc-ingestion.md +114 -0
- package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/06-link-validation.md +128 -0
- package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/07-yaml-linking.md +95 -0
- package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/08-librarian-commit.md +119 -0
- package/dist/workspace/workspace/.polaris/skills/closeout-librarian/steps/09-sealed-result.md +118 -0
- package/dist/workspace/workspace/.polaris/skills/docs-ingest/SKILL.md +68 -0
- package/dist/workspace/workspace/.polaris/skills/docs-ingest/chain.json +23 -0
- package/dist/workspace/workspace/.polaris/skills/docs-ingest/chain.md +149 -0
- package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/01-orient-ingest.md +85 -0
- package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/02-classify-batch.md +87 -0
- package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/03-conflict-check.md +66 -0
- package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/04-place-and-link.md +77 -0
- package/dist/workspace/workspace/.polaris/skills/docs-ingest/steps/05-finalize-ingest.md +49 -0
- package/dist/workspace/workspace/.polaris/skills/docs-promote/SKILL.md +79 -0
- package/dist/workspace/workspace/.polaris/skills/docs-promote/chain.json +25 -0
- package/dist/workspace/workspace/.polaris/skills/docs-promote/chain.md +80 -0
- package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/01-orient-promote.md +53 -0
- package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/02-review-candidates.md +51 -0
- package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/03-read-linked-code.md +50 -0
- package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/04-conflict-surface.md +65 -0
- package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/05-await-approval.md +61 -0
- package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/06-execute-promote-deprecate.md +65 -0
- package/dist/workspace/workspace/.polaris/skills/docs-promote/steps/07-finalize-promote.md +44 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-analyze/SKILL.md +94 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-analyze/chain.json +20 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-analyze/chain.md +105 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-analyze/issue-reconciliation.md +149 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-analyze/issue-template.md +133 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-analyze/linked-skills/repo-analysis.md +55 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/01-fetch-and-orient.md +79 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/02-map-affected-code.md +58 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/03-assess-issue.md +58 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/04-blocker-check.md +60 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/05-create-cluster-plan.md +197 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-analyze/steps/06-final-report.md +60 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-catalog/SKILL.md +91 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-catalog/chain.json +22 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-catalog/chain.md +85 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/01-orient-catalog.md +92 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/02-reconcile-polaris-md.md +33 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/03-reconcile-summary-md.md +70 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/04-classify-and-place.md +117 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/05-catalog-commit.md +94 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-medic/SKILL.md +52 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-medic/chain.md +111 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/01-orient-medic.md +75 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/02-diagnose.md +79 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/03-repair.md +64 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/04-validate.md +66 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/05-create-chart.md +85 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-medic/steps/06-closeout.md +86 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/SKILL.md +75 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/chain.json +20 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/chain.md +67 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/steps/01-orient-reconcile.md +82 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/steps/02-reconcile-polaris-md.md +95 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/steps/03-reconcile-summary-md.md +108 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-reconcile/steps/04-reconcile-commit.md +88 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-run/SKILL.md +135 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-run/chain.json +19 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-run/chain.md +298 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-run/execution-adapter.md +34 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-run/linked-skills/repo-analysis.md +58 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/01-orient-cluster.md +96 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/02-prepare-branch.md +53 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/03-select-child.md +63 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/04-execute-child.md +75 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/05-validate-child.md +57 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/06-commit-and-update-linear.md +74 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/07-decide-continuation.md +89 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/08-closeout-librarian.md +146 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/08-final-delivery.md +91 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-run/steps/09-final-delivery.md +104 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-tools/README.md +63 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-tools/SKILL.md +94 -0
- package/dist/workspace/workspace/.polaris/skills/polaris-tools/tools.js +191 -0
- package/dist/workspace/workspace/smartdocs/architecture/.gitkeep +0 -0
- package/dist/workspace/workspace/smartdocs/audits/.gitkeep +0 -0
- package/dist/workspace/workspace/smartdocs/decisions/.gitkeep +0 -0
- package/dist/workspace/workspace/smartdocs/doctrine/active/.gitkeep +0 -0
- package/dist/workspace/workspace/smartdocs/runtime/.gitkeep +0 -0
- package/dist/workspace/workspace/smartdocs/specs/active/.gitkeep +0 -0
- package/dist/workspace/workspace/smartdocs/specs/archive/.gitkeep +0 -0
- package/package.json +2 -2
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: polaris-catalog-chain
|
|
3
|
+
description: Step order, CLI reference, canonical paths, run ID format, telemetry, and artifact authority for polaris-catalog.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# polaris-catalog 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 affected folders, doc classifications, or
|
|
13
|
+
change scope from conversation context.
|
|
14
|
+
|
|
15
|
+
## Step traversal order
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
01-orient-catalog
|
|
19
|
+
02-reconcile-polaris-md
|
|
20
|
+
03-reconcile-summary-md
|
|
21
|
+
04-classify-and-place
|
|
22
|
+
05-catalog-commit
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Read the current step's file in `steps/` before acting. Do not read ahead.
|
|
26
|
+
|
|
27
|
+
## CLI
|
|
28
|
+
|
|
29
|
+
Always use the repo-local Polaris CLI:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
npm run polaris -- docs ingest --file <path>
|
|
33
|
+
npm run polaris -- doctrine draft <path>
|
|
34
|
+
npm run polaris -- map update --changed
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Never assume a globally linked `polaris` command exists.
|
|
38
|
+
|
|
39
|
+
## Canonical paths
|
|
40
|
+
|
|
41
|
+
| State | Path |
|
|
42
|
+
|---|---|
|
|
43
|
+
| Doc drop zone | `smartdocs/raw/` |
|
|
44
|
+
| Skill state | `.taskchain_artifacts/polaris-catalog/current-state.json` |
|
|
45
|
+
| Telemetry | `.taskchain_artifacts/polaris-catalog/runs/<run-id>/telemetry.jsonl` |
|
|
46
|
+
|
|
47
|
+
## Run ID format
|
|
48
|
+
|
|
49
|
+
`polaris-catalog-<slug>-<YYYY-MM-DD>-<seq>` — e.g. `polaris-catalog-POL-257-2026-06-04-001`
|
|
50
|
+
|
|
51
|
+
## Telemetry
|
|
52
|
+
|
|
53
|
+
Append-only JSONL. Required fields: `event`, `run_id`, `timestamp`.
|
|
54
|
+
|
|
55
|
+
| Event | Trigger |
|
|
56
|
+
|---|---|
|
|
57
|
+
| `run-start` | Begin orient step |
|
|
58
|
+
| `step-complete` | End of every step |
|
|
59
|
+
| `polaris-md-updated` | POLARIS.md written for a folder |
|
|
60
|
+
| `summary-md-updated` | SUMMARY.md written for a folder |
|
|
61
|
+
| `doc-classified` | Classification assigned per file in raw |
|
|
62
|
+
| `doc-placed` | File moved via CLI |
|
|
63
|
+
| `doc-held` | Low-confidence file left in raw |
|
|
64
|
+
| `catalog-commit` | Commit created |
|
|
65
|
+
| `catalog-complete` | All steps done |
|
|
66
|
+
|
|
67
|
+
## Artifact authority
|
|
68
|
+
|
|
69
|
+
`.taskchain_artifacts/polaris-catalog/current-state.json` is the sole authoritative
|
|
70
|
+
live state surface.
|
|
71
|
+
|
|
72
|
+
- Update after every completed step — before advancing.
|
|
73
|
+
- A step is NOT complete until the state update succeeds.
|
|
74
|
+
- If the update fails: stop and report the persistence failure.
|
|
75
|
+
|
|
76
|
+
## Forbidden actions
|
|
77
|
+
|
|
78
|
+
- src file mutations
|
|
79
|
+
- runtime state file mutations
|
|
80
|
+
- polaris loop continue
|
|
81
|
+
- polaris finalize
|
|
82
|
+
- git push
|
|
83
|
+
- PR creation
|
|
84
|
+
- mv/cp on files under smartdocs/ (use CLI)
|
|
85
|
+
- auto-placing low-confidence files
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: polaris-catalog-step-01
|
|
3
|
+
description: Generate run_id, emit run-start telemetry, validate packet, establish work_inventory, and enumerate smartdocs/raw/ for classification.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Step 01 — Orient catalog
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
Establish bounded execution context before touching any files. Validate the packet,
|
|
11
|
+
confirm cognition scope, and enumerate `smartdocs/raw/` for the classification step.
|
|
12
|
+
|
|
13
|
+
## Actions
|
|
14
|
+
|
|
15
|
+
### 1.1 Generate run_id
|
|
16
|
+
|
|
17
|
+
Format: `polaris-catalog-<issue-slug>-<YYYY-MM-DD>-<seq>`
|
|
18
|
+
Example: `polaris-catalog-POL-257-2026-06-04-001`
|
|
19
|
+
|
|
20
|
+
### 1.2 Emit run-start telemetry
|
|
21
|
+
|
|
22
|
+
First I/O action, before any file access:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
mkdir -p .taskchain_artifacts/polaris-catalog/runs/<run-id>
|
|
26
|
+
echo '{"event":"run-start","run_id":"<run-id>","issue_id":"<issue_id>","unattended":<bool>,"timestamp":"<ISO>"}' \
|
|
27
|
+
>> .taskchain_artifacts/polaris-catalog/runs/<run-id>/telemetry.jsonl
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
If this write fails: halt. Do not continue.
|
|
31
|
+
|
|
32
|
+
### 1.3 Validate packet
|
|
33
|
+
|
|
34
|
+
Confirm required fields are present:
|
|
35
|
+
`run_id`, `issue_id`, `affected_folders`, `work_inventory`, `unattended`,
|
|
36
|
+
`allowed_write_paths`, `prohibited_write_paths`, `constraints`
|
|
37
|
+
|
|
38
|
+
If any required field is missing: halt and report which field is absent.
|
|
39
|
+
|
|
40
|
+
### 1.4 Build work inventory snapshot
|
|
41
|
+
|
|
42
|
+
From `packet.work_inventory`, confirm:
|
|
43
|
+
- `affected_folders` — folders whose cognition may need updating
|
|
44
|
+
- `all_changed_files` — files changed by the completed work
|
|
45
|
+
- `child_summaries` — summaries of completed children (if cluster-based)
|
|
46
|
+
- `pending_cognition_notes` — pending cognition notes per folder
|
|
47
|
+
- `polaris_md_files` — current POLARIS.md paths per folder
|
|
48
|
+
- `summary_md_files` — current SUMMARY.md paths per folder
|
|
49
|
+
|
|
50
|
+
If `affected_folders` is empty: record cognition scope as no-op, continue to step 04 to
|
|
51
|
+
still process any docs in `smartdocs/raw/`.
|
|
52
|
+
|
|
53
|
+
### 1.5 Enumerate smartdocs/raw/
|
|
54
|
+
|
|
55
|
+
List all files currently in `smartdocs/raw/` (excluding `.provenance.json` sidecars and
|
|
56
|
+
hidden files). This is the batch for step 04.
|
|
57
|
+
|
|
58
|
+
If `smartdocs/raw/` is empty or does not exist: record doc classification as no-op.
|
|
59
|
+
Continue — cognition steps may still have work to do.
|
|
60
|
+
|
|
61
|
+
### 1.6 Restate working context
|
|
62
|
+
|
|
63
|
+
Summarize in under 10 bullets:
|
|
64
|
+
- `run_id` and fresh/resumed
|
|
65
|
+
- Bound issue
|
|
66
|
+
- Mode: interactive or unattended
|
|
67
|
+
- Affected folders for cognition (count)
|
|
68
|
+
- Files in `smartdocs/raw/` for classification (count)
|
|
69
|
+
|
|
70
|
+
## Scope declarations
|
|
71
|
+
|
|
72
|
+
```yaml
|
|
73
|
+
allowed_files:
|
|
74
|
+
- .polaris/skills/polaris-catalog/SKILL.md
|
|
75
|
+
- .polaris/skills/polaris-catalog/chain.md
|
|
76
|
+
- .taskchain_artifacts/polaris-catalog/current-state.json
|
|
77
|
+
- smartdocs/raw/ (enumerate only)
|
|
78
|
+
- packet (read only)
|
|
79
|
+
stop_rules:
|
|
80
|
+
- run-start telemetry write fails
|
|
81
|
+
- packet missing required fields
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Artifact update
|
|
85
|
+
|
|
86
|
+
Update `.taskchain_artifacts/polaris-catalog/current-state.json`:
|
|
87
|
+
- `run_id`, `issue_id`, `unattended`, `status: orienting`, `current_step_id: 01-orient-catalog`
|
|
88
|
+
- `affected_folders`, `raw_files: [...]`, `updated_at: <timestamp>`
|
|
89
|
+
|
|
90
|
+
## Next step
|
|
91
|
+
|
|
92
|
+
02-reconcile-polaris-md
|
package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/02-reconcile-polaris-md.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: polaris-catalog-step-02
|
|
3
|
+
description: Update affected POLARIS.md files to accurately reflect the current state of each folder after the completed work.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Step 02 — Reconcile POLARIS.md
|
|
7
|
+
|
|
8
|
+
Identical in behavior to `polaris-reconcile` step 02. See
|
|
9
|
+
`.polaris/skills/polaris-reconcile/steps/02-reconcile-polaris-md.md` for full detail.
|
|
10
|
+
|
|
11
|
+
## Summary
|
|
12
|
+
|
|
13
|
+
For each folder in `work_inventory.affected_folders`:
|
|
14
|
+
1. Assess which files changed and how they affect the folder's operational reality.
|
|
15
|
+
2. Read the current POLARIS.md.
|
|
16
|
+
3. Apply the confidence threshold (≥0.85 write, 0.70–0.84 write with note, <0.70 skip).
|
|
17
|
+
4. Write the full updated POLARIS.md if needed — full replacement, not append.
|
|
18
|
+
5. Record in `polaris_md_updates`.
|
|
19
|
+
|
|
20
|
+
POLARIS.md is NOT a changelog. Replace stale statements with current truth.
|
|
21
|
+
|
|
22
|
+
## Output
|
|
23
|
+
|
|
24
|
+
```yaml
|
|
25
|
+
polaris_md_updates: [
|
|
26
|
+
{ file: "<path>", action: "update", change_summary: "<≤50 words>" },
|
|
27
|
+
...
|
|
28
|
+
]
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Next step
|
|
32
|
+
|
|
33
|
+
03-reconcile-summary-md
|
package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/03-reconcile-summary-md.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: polaris-catalog-step-03
|
|
3
|
+
description: Refresh SUMMARY.md files to reflect current project state after the completed work.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Step 03 — Reconcile SUMMARY.md
|
|
7
|
+
|
|
8
|
+
Identical in behavior to `polaris-reconcile` step 03. See
|
|
9
|
+
`.polaris/skills/polaris-reconcile/steps/03-reconcile-summary-md.md` for full detail.
|
|
10
|
+
|
|
11
|
+
## Summary
|
|
12
|
+
|
|
13
|
+
For each folder in `work_inventory.affected_folders` that has a SUMMARY.md:
|
|
14
|
+
1. Assess staleness against the completed work.
|
|
15
|
+
2. Remove stale information. Replace superseded references. Preserve current understanding.
|
|
16
|
+
3. Write the full updated SUMMARY.md — net new line cap of `packet.constraints.max_summary_addition_lines` (default: 50).
|
|
17
|
+
4. Record in `summary_md_updates`.
|
|
18
|
+
|
|
19
|
+
SUMMARY.md is NOT a changelog. It must read as a coherent current-state snapshot.
|
|
20
|
+
|
|
21
|
+
## Required Structure (per June 5 doctrine)
|
|
22
|
+
|
|
23
|
+
SUMMARY.md must contain the following sections:
|
|
24
|
+
|
|
25
|
+
### Current State
|
|
26
|
+
Brief description of what is implemented, what is not yet, and known gaps.
|
|
27
|
+
|
|
28
|
+
### Route Health
|
|
29
|
+
Current operational condition. Example subsections:
|
|
30
|
+
- Healthy
|
|
31
|
+
- Monitoring
|
|
32
|
+
- Known Issues
|
|
33
|
+
- Recent Treatments
|
|
34
|
+
- Improvement Opportunities
|
|
35
|
+
|
|
36
|
+
Goal: Workers understand route condition in under 10 seconds. Not history, not doctrine, not implementation detail.
|
|
37
|
+
|
|
38
|
+
### Canonical References
|
|
39
|
+
YAML block listing navigation paths (not reading assignments):
|
|
40
|
+
|
|
41
|
+
```yaml
|
|
42
|
+
canonical_docs:
|
|
43
|
+
- smartdocs/active/runtime/worker-packet-contract.md
|
|
44
|
+
- smartdocs/active/runtime/librarian-closeout.md
|
|
45
|
+
- POLARIS.md
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
These are retrieval paths, not preload instructions.
|
|
49
|
+
|
|
50
|
+
## Reconciliation Behavior
|
|
51
|
+
|
|
52
|
+
- Do NOT overwrite an existing Route Health section if it has content
|
|
53
|
+
- Do NOT auto-populate Route Health status from runtime data — scaffold a skeleton only
|
|
54
|
+
- Canonical References block must use the `canonical_docs:` key
|
|
55
|
+
- Preserve any existing valid content; only update stale state sections
|
|
56
|
+
|
|
57
|
+
## Output
|
|
58
|
+
|
|
59
|
+
```yaml
|
|
60
|
+
summary_md_updates: [
|
|
61
|
+
{ file: "<path>", action: "update", change_summary: "<≤50 words>" },
|
|
62
|
+
{ file: "<path>", action: "no_change" },
|
|
63
|
+
{ file: "<path>", action: "path_not_allowed" },
|
|
64
|
+
...
|
|
65
|
+
]
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Next step
|
|
69
|
+
|
|
70
|
+
04-classify-and-place
|
package/dist/workspace/workspace/.polaris/skills/polaris-catalog/steps/04-classify-and-place.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: polaris-catalog-step-04
|
|
3
|
+
description: Classify documents in smartdocs/raw/, auto-place high-confidence files via CLI, and surface or hold low-confidence files based on mode.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Step 04 — Classify and place
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
Process all files enumerated in `current-state.json.raw_files`. Classify each one,
|
|
11
|
+
auto-place high-confidence results via the Polaris CLI, and handle low-confidence files
|
|
12
|
+
according to the session mode (`packet.unattended`).
|
|
13
|
+
|
|
14
|
+
If `raw_files` is empty: record as no-op and proceed to step 05.
|
|
15
|
+
|
|
16
|
+
## Classification table
|
|
17
|
+
|
|
18
|
+
| Class | Target path | Auto-place on high confidence |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| `runtime-summary` | `smartdocs/runtime/summaries/` | yes |
|
|
21
|
+
| `run-report` | `smartdocs/runtime/run-reports/` | yes |
|
|
22
|
+
| `spec-raw` | `smartdocs/raw/` | no-op (already there) |
|
|
23
|
+
| `spec-active` | `smartdocs/specs/active/` | yes |
|
|
24
|
+
| `audit-finding` | `smartdocs/audits/findings/` | yes |
|
|
25
|
+
| `doctrine-candidate` | `smartdocs/doctrine/candidate/` | yes |
|
|
26
|
+
| `architecture` | `smartdocs/architecture/` | yes |
|
|
27
|
+
| `decision` | `smartdocs/decisions/` | yes |
|
|
28
|
+
| `deprecated-noise` | `smartdocs/runtime/generated/` | yes |
|
|
29
|
+
|
|
30
|
+
**Confidence is the only gate.** High confidence → place regardless of authority level.
|
|
31
|
+
Low confidence → ask user (interactive) or leave in raw (unattended).
|
|
32
|
+
|
|
33
|
+
## Classification process (per file)
|
|
34
|
+
|
|
35
|
+
1. Read the document.
|
|
36
|
+
2. Check for explicit Polaris front-matter (`status`, `authority`, `classification`).
|
|
37
|
+
If present and unambiguous → **confidence: high**.
|
|
38
|
+
3. Otherwise infer from content signals:
|
|
39
|
+
- Polaris architectural assertions / "how things should work" → `doctrine-candidate`
|
|
40
|
+
- Structured spec with Spec ID, Status, Purpose headings → `spec-active`
|
|
41
|
+
- Run output, telemetry summaries, session notes → `runtime-summary`
|
|
42
|
+
- Structured run output with metrics → `run-report`
|
|
43
|
+
- `FINDING:` markers or audit-style analysis → `audit-finding`
|
|
44
|
+
- ADR-style decision record → `decision`
|
|
45
|
+
- Architectural diagrams or structural design context → `architecture`
|
|
46
|
+
- Low-signal, transient, or auto-generated → `deprecated-noise`
|
|
47
|
+
- Unclear or multiple signals → low confidence, class remains `spec-raw`
|
|
48
|
+
4. Assign confidence:
|
|
49
|
+
- **high**: explicit front-matter, or exactly one signal matches unambiguously
|
|
50
|
+
- **low**: multiple signals, sparse content, or no clear signal
|
|
51
|
+
|
|
52
|
+
## Placement actions
|
|
53
|
+
|
|
54
|
+
### High confidence
|
|
55
|
+
|
|
56
|
+
Run the appropriate CLI command immediately. Do not pause for user input.
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# All classes except doctrine-candidate:
|
|
60
|
+
npm run polaris -- docs ingest --file <path>
|
|
61
|
+
|
|
62
|
+
# doctrine-candidate:
|
|
63
|
+
npm run polaris -- doctrine draft <path>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Record in `docs_placed`.
|
|
67
|
+
|
|
68
|
+
### Low confidence — interactive mode (`packet.unattended: false`)
|
|
69
|
+
|
|
70
|
+
Surface each file to the user:
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
needs-input: <filename>
|
|
74
|
+
Inferred class: <class> [confidence: low]
|
|
75
|
+
Reason: <why confidence is low>
|
|
76
|
+
Where should this go? Options:
|
|
77
|
+
1. <class> → <target> (inferred)
|
|
78
|
+
2. Leave in smartdocs/raw/
|
|
79
|
+
3. [other class]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Wait for user response before placing. Record the user's decision in `docs_placed` or
|
|
83
|
+
`docs_held` accordingly.
|
|
84
|
+
|
|
85
|
+
### Low confidence — unattended mode (`packet.unattended: true`)
|
|
86
|
+
|
|
87
|
+
Leave the file in `smartdocs/raw/`. Record in `docs_held` with reason. Do not block.
|
|
88
|
+
Do not fail the run.
|
|
89
|
+
|
|
90
|
+
## After batch
|
|
91
|
+
|
|
92
|
+
Run map update:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
npm run polaris -- map update --changed
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Hard rules
|
|
99
|
+
|
|
100
|
+
- Use the CLI for all file moves. Never use `mv` or `cp` directly on `smartdocs/` files.
|
|
101
|
+
- If the CLI rejects a file as ignored (`POLARIS.md`, `SUMMARY.md`, `README.md`): leave in
|
|
102
|
+
raw, record as ineligible in `docs_held`.
|
|
103
|
+
- If a target path collision is detected: record as a blocker for that file. Do not
|
|
104
|
+
overwrite without explicit user approval.
|
|
105
|
+
- Source files already in `smartdocs/` sub-directories other than `raw/` are out of scope
|
|
106
|
+
for this step. Skip them.
|
|
107
|
+
|
|
108
|
+
## Output
|
|
109
|
+
|
|
110
|
+
```yaml
|
|
111
|
+
docs_placed: [{ file: "<source>", target: "<path>", class: "<class>", confidence: "high" }]
|
|
112
|
+
docs_held: [{ file: "<source>", reason: "<low-confidence|ineligible|collision>", detail: "..." }]
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Next step
|
|
116
|
+
|
|
117
|
+
05-catalog-commit
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: polaris-catalog-step-05
|
|
3
|
+
description: Commit all cognition and document changes as a single sealed catalog commit.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Step 05 — Catalog commit
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
All changes produced by steps 02–04 must be committed as a single sealed commit.
|
|
11
|
+
This separates implementation commits from documentation and cognition reconciliation.
|
|
12
|
+
|
|
13
|
+
## Commit constraints
|
|
14
|
+
|
|
15
|
+
The catalog commit MUST:
|
|
16
|
+
- Contain only files from `packet.allowed_write_paths`
|
|
17
|
+
- Contain no implementation source code
|
|
18
|
+
- Contain no runtime state files (`current-state.json`, telemetry JSONL, cluster-state)
|
|
19
|
+
|
|
20
|
+
If any staged file would violate these constraints, unstage it and record as a blocker.
|
|
21
|
+
|
|
22
|
+
## No-change case
|
|
23
|
+
|
|
24
|
+
If steps 02–04 produced no file changes, this step is a no-op. Record `commit_sha: null`.
|
|
25
|
+
Do not create an empty commit.
|
|
26
|
+
|
|
27
|
+
## Commit message format
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
docs(catalog): reconcile cognition and classify docs for <issue_id>
|
|
31
|
+
|
|
32
|
+
Run: <run_id>
|
|
33
|
+
Issue: <issue_id>
|
|
34
|
+
Files updated:
|
|
35
|
+
- POLARIS.md: <count> files
|
|
36
|
+
- SUMMARY.md: <count> files
|
|
37
|
+
- docs placed: <count>
|
|
38
|
+
- docs held in raw: <count>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Actions
|
|
42
|
+
|
|
43
|
+
### 5.1 Pre-commit validation
|
|
44
|
+
|
|
45
|
+
Verify:
|
|
46
|
+
1. Every file to be committed is in `packet.allowed_write_paths`.
|
|
47
|
+
2. No file is in `packet.prohibited_write_paths`.
|
|
48
|
+
3. At least one non-empty change exists.
|
|
49
|
+
|
|
50
|
+
If prohibited files are staged: `git reset HEAD <file>` before committing.
|
|
51
|
+
|
|
52
|
+
### 5.2 Stage changed files
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
git add <polaris_md_updates[*].file where action == "update">
|
|
56
|
+
git add <summary_md_updates[*].file where action == "update">
|
|
57
|
+
git add <docs_placed[*].target>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 5.3 Verify staged files
|
|
61
|
+
|
|
62
|
+
Run `git diff --cached --name-only` and confirm all staged files are in
|
|
63
|
+
`packet.allowed_write_paths` and none are in `packet.prohibited_write_paths`.
|
|
64
|
+
|
|
65
|
+
### 5.4 Commit
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
git commit -m "<commit message>"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Capture the resulting commit SHA.
|
|
72
|
+
|
|
73
|
+
### 5.5 Finalize
|
|
74
|
+
|
|
75
|
+
Update `.taskchain_artifacts/polaris-catalog/current-state.json`:
|
|
76
|
+
- `status: complete`
|
|
77
|
+
- `current_step_id: 05-catalog-commit`
|
|
78
|
+
- `commit_sha: <sha or null>`
|
|
79
|
+
- `completed_at: <ISO timestamp>`
|
|
80
|
+
|
|
81
|
+
Emit `catalog-commit` and `catalog-complete` telemetry events.
|
|
82
|
+
|
|
83
|
+
Report summary:
|
|
84
|
+
```text
|
|
85
|
+
polaris-catalog complete
|
|
86
|
+
Issue: <issue_id>
|
|
87
|
+
Mode: interactive | unattended
|
|
88
|
+
POLARIS.md: <count> files updated
|
|
89
|
+
SUMMARY.md: <count> files updated
|
|
90
|
+
Docs placed: <count>
|
|
91
|
+
Docs held raw: <count> (<filenames if any>)
|
|
92
|
+
Commit: <sha> | no changes
|
|
93
|
+
Blockers: <none | list>
|
|
94
|
+
```
|
|
@@ -0,0 +1,52 @@
|
|
|
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.
|
|
@@ -0,0 +1,111 @@
|
|
|
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 |
|