@lsctech/polaris 0.3.0 → 0.3.1
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.
|
@@ -8,6 +8,7 @@ exports.SKILL_ROLE_MAP = {
|
|
|
8
8
|
run: "Foreman",
|
|
9
9
|
ingest: "Librarian",
|
|
10
10
|
promote: "Librarian",
|
|
11
|
+
triage: "Librarian",
|
|
11
12
|
};
|
|
12
13
|
const ROLE_SUMMARIES = {
|
|
13
14
|
Analyst: "The Analyst gathers evidence, assesses feasibility, and produces implementation-ready plans. The Analyst shapes work but never executes it.",
|
|
@@ -187,6 +188,39 @@ function buildPromotePacket() {
|
|
|
187
188
|
],
|
|
188
189
|
};
|
|
189
190
|
}
|
|
191
|
+
function buildTriagePacket() {
|
|
192
|
+
return {
|
|
193
|
+
authority_boundaries: [
|
|
194
|
+
"Read smartdocs/doctrine/active/ to load canonicals for comparison",
|
|
195
|
+
"Read smartdocs/doctrine/candidate/ to load candidates for triage",
|
|
196
|
+
"Call polaris docs triage [--dry-run] [--batch-size N] [--resume] to run the triage pipeline",
|
|
197
|
+
"Read smartdocs/raw/_triage-queue.json and _triage-report.md produced by triage",
|
|
198
|
+
"Emit telemetry events",
|
|
199
|
+
],
|
|
200
|
+
prohibited_actions: [
|
|
201
|
+
"Move, promote, or delete any document — triage flags only, never decides",
|
|
202
|
+
"Mutate source files (src/, tests, config)",
|
|
203
|
+
"Call polaris loop continue or polaris finalize",
|
|
204
|
+
"Suppress or ignore detected flags",
|
|
205
|
+
"Auto-approve or auto-reject any triage flag without user review",
|
|
206
|
+
],
|
|
207
|
+
allowed_outputs: [
|
|
208
|
+
"smartdocs/raw/_triage-queue.json — machine-readable flag list for polaris docs review",
|
|
209
|
+
"smartdocs/raw/_triage-report.md — human-readable summary",
|
|
210
|
+
"Telemetry events",
|
|
211
|
+
],
|
|
212
|
+
deliverables: [
|
|
213
|
+
"_triage-queue.json written with all flags from Phase 1 (doc-vs-doc) and Phase 2 (doc-vs-code)",
|
|
214
|
+
"_triage-report.md written summarising flag counts by type",
|
|
215
|
+
"Checkpoint deleted on successful completion",
|
|
216
|
+
],
|
|
217
|
+
stop_conditions: [
|
|
218
|
+
"Triage pipeline completes and outputs written",
|
|
219
|
+
"API key not available — report and wait for instruction",
|
|
220
|
+
"Graph coverage below threshold — Phase 2 skipped with warning",
|
|
221
|
+
],
|
|
222
|
+
};
|
|
223
|
+
}
|
|
190
224
|
function generateSkillPacket(skillName, config) {
|
|
191
225
|
const active_role = exports.SKILL_ROLE_MAP[skillName];
|
|
192
226
|
const role_summary = ROLE_SUMMARIES[active_role];
|
|
@@ -211,6 +245,9 @@ function generateSkillPacket(skillName, config) {
|
|
|
211
245
|
case "promote":
|
|
212
246
|
body = buildPromotePacket();
|
|
213
247
|
break;
|
|
248
|
+
case "triage":
|
|
249
|
+
body = buildTriagePacket();
|
|
250
|
+
break;
|
|
214
251
|
}
|
|
215
252
|
return {
|
|
216
253
|
packet_id,
|
|
@@ -222,4 +259,4 @@ function generateSkillPacket(skillName, config) {
|
|
|
222
259
|
generated_at,
|
|
223
260
|
};
|
|
224
261
|
}
|
|
225
|
-
exports.SUPPORTED_SKILLS = ["analyze", "run", "ingest", "promote"];
|
|
262
|
+
exports.SUPPORTED_SKILLS = ["analyze", "run", "ingest", "promote", "triage"];
|
|
@@ -33,6 +33,8 @@ message whose primary instruction is to invoke a named Polaris skill.
|
|
|
33
33
|
| `run polaris-status` | polaris-tools | `.polaris/skills/polaris-tools/` |
|
|
34
34
|
| `docs-ingest` | docs-ingest | `.polaris/skills/docs-ingest/` |
|
|
35
35
|
| `run docs-ingest` | docs-ingest | `.polaris/skills/docs-ingest/` |
|
|
36
|
+
| `docs-triage` | docs-triage | `.polaris/skills/docs-triage/` |
|
|
37
|
+
| `run docs-triage` | docs-triage | `.polaris/skills/docs-triage/` |
|
|
36
38
|
| `polaris-reconcile <CLUSTER-ID>` | polaris-reconcile | `.polaris/skills/polaris-reconcile/` |
|
|
37
39
|
| `run polaris-reconcile on [issue] <CLUSTER-ID>` | polaris-reconcile | `.polaris/skills/polaris-reconcile/` |
|
|
38
40
|
| `polaris-catalog <CLUSTER-ID>` | polaris-catalog | `.polaris/skills/polaris-catalog/` |
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: docs-triage
|
|
3
|
+
description: Detect contradictions, duplicates, and stale code references among candidate docs by comparing them against canonicals via LLM batch calls and graph symbol lookup. Writes a triage queue for human review via polaris docs review.
|
|
4
|
+
role: librarian
|
|
5
|
+
role_file: .polaris/roles/librarian.md
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Polaris Skill Bootloader
|
|
9
|
+
|
|
10
|
+
**Before proceeding, you must obtain a skill packet from the Polaris runtime.**
|
|
11
|
+
|
|
12
|
+
Run the following command:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
npm run polaris -- skill packet triage
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
- Do not begin work until a packet is returned.
|
|
19
|
+
- Treat the packet as your authoritative instruction source.
|
|
20
|
+
- The packet defines your active role, authority boundaries, prohibited actions, deliverables, and stop conditions.
|
|
21
|
+
- If no packet is produced, stop and report: **Polaris could not authorize this run.**
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
# docs-triage
|
|
26
|
+
|
|
27
|
+
Use this skill when candidate docs need to be screened for conflicts, duplicates, and stale symbol references before human review.
|
|
28
|
+
|
|
29
|
+
## When to use
|
|
30
|
+
|
|
31
|
+
- "Run docs triage"
|
|
32
|
+
- "Triage the candidate docs"
|
|
33
|
+
- "Find contradictions among the candidates"
|
|
34
|
+
- "Check for stale code references in candidates"
|
|
35
|
+
- "Run a dry-run triage to see the estimate"
|
|
36
|
+
|
|
37
|
+
## How to execute
|
|
38
|
+
|
|
39
|
+
1. Read `chain.md` — step order, traversal rules, output contract.
|
|
40
|
+
2. Execute steps in the order `chain.md` defines. Do not skip steps.
|
|
41
|
+
3. After triage completes, hand off to `polaris docs review` for human decisions.
|
|
42
|
+
|
|
43
|
+
## Hard rules — what docs-triage may do
|
|
44
|
+
|
|
45
|
+
- Read canonicals from `smartdocs/doctrine/active/`
|
|
46
|
+
- Read candidates from `smartdocs/doctrine/candidate/`
|
|
47
|
+
- Call `polaris docs triage [--dry-run] [--batch-size N] [--resume]`
|
|
48
|
+
- Read `smartdocs/raw/_triage-queue.json` and `_triage-report.md`
|
|
49
|
+
- Emit telemetry events
|
|
50
|
+
|
|
51
|
+
## Hard rules — what docs-triage must NOT do
|
|
52
|
+
|
|
53
|
+
- Move, promote, or delete any document — triage produces flags only
|
|
54
|
+
- Mutate source files (`src/`, tests, config)
|
|
55
|
+
- Call `polaris loop continue` or `polaris finalize`
|
|
56
|
+
- Auto-approve or auto-reject any triage flag without human review
|
|
57
|
+
|
|
58
|
+
**Docs-triage flags. It does not decide.**
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: docs-triage-chain
|
|
3
|
+
description: Route map for docs-triage — step order, stop conditions, output contract, and CLI reference.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# docs-triage 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 triage scope or prior progress from conversation context.
|
|
13
|
+
|
|
14
|
+
## CLI
|
|
15
|
+
|
|
16
|
+
Always use the repo-local Polaris CLI:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
npm run polaris -- docs triage [--dry-run] [--batch-size <n>] [--resume] [--repo-root <path>]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- `--dry-run`: prints cluster count, estimated batches, estimated tokens, and model — no LLM calls
|
|
23
|
+
- `--batch-size <n>`: docs per LLM call (default: 10)
|
|
24
|
+
- `--resume`: resume from last checkpoint (auto-detected if checkpoint exists)
|
|
25
|
+
|
|
26
|
+
Never assume a globally linked `polaris` command exists.
|
|
27
|
+
|
|
28
|
+
## Output contract
|
|
29
|
+
|
|
30
|
+
All outputs written to `smartdocs/raw/`:
|
|
31
|
+
|
|
32
|
+
| File | Purpose |
|
|
33
|
+
|------|---------|
|
|
34
|
+
| `_triage-queue.json` | Machine-readable flag list — fed directly into `polaris docs review` |
|
|
35
|
+
| `_triage-report.md` | Human-readable summary — display only, never parsed |
|
|
36
|
+
| `_triage-checkpoint.json` | Resume state — deleted automatically on completion |
|
|
37
|
+
|
|
38
|
+
## Step traversal order
|
|
39
|
+
|
|
40
|
+
```text
|
|
41
|
+
01-orient-triage ← dry-run first to confirm cluster count and cost estimate; emit telemetry
|
|
42
|
+
02-run-triage ← polaris docs triage (with --resume if checkpoint exists)
|
|
43
|
+
03-verify-outputs ← confirm _triage-queue.json and _triage-report.md written; read summary
|
|
44
|
+
04-hand-off ← report flag counts by type; instruct user to run polaris docs review
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Stop conditions
|
|
48
|
+
|
|
49
|
+
**Any step:**
|
|
50
|
+
- `ANTHROPIC_API_KEY` not available → halt, report: "Set ANTHROPIC_API_KEY and re-run"
|
|
51
|
+
- `smartdocs/doctrine/active/` or `smartdocs/doctrine/candidate/` not found → halt, report
|
|
52
|
+
- `_triage-queue.json` not written after pipeline completes → halt, report
|
|
53
|
+
|
|
54
|
+
**Step 01 (dry-run):**
|
|
55
|
+
- Estimated batches > 500 → pause and surface cost estimate to user before proceeding
|
|
56
|
+
|
|
57
|
+
**Step 02 (run-triage):**
|
|
58
|
+
- Checkpoint detected → pass `--resume` automatically
|
|
59
|
+
- Graph symbol count < 1000 → Phase 2 skipped (this is expected — log and continue)
|
|
60
|
+
|
|
61
|
+
## Run ID format
|
|
62
|
+
|
|
63
|
+
Format: `docs-triage-<date>-<seq>`
|
|
64
|
+
- `<date>`: `YYYY-MM-DD`
|
|
65
|
+
- `<seq>`: zero-padded sequential number per day (`001`, `002`, …)
|
|
66
|
+
|
|
67
|
+
Example: `docs-triage-2026-06-14-001`
|
|
68
|
+
|
|
69
|
+
## Telemetry
|
|
70
|
+
|
|
71
|
+
Telemetry file: `.taskchain_artifacts/docs-triage/runs/<run-id>/telemetry.jsonl` (append-only).
|
|
72
|
+
|
|
73
|
+
| Event | Trigger |
|
|
74
|
+
|-------|---------|
|
|
75
|
+
| `run-start` | Begin step 01 |
|
|
76
|
+
| `step-complete` | End of every step |
|
|
77
|
+
| `triage-dry-run-complete` | Dry-run summary printed |
|
|
78
|
+
| `triage-complete` | Pipeline finished, outputs written |
|
|
79
|
+
|
|
80
|
+
Required fields on every event: `event`, `run_id`, `timestamp`.
|
|
81
|
+
|
|
82
|
+
## Execution reporting
|
|
83
|
+
|
|
84
|
+
After each completed step, emit a checkpoint:
|
|
85
|
+
|
|
86
|
+
```text
|
|
87
|
+
**[step-name]** done | blocked | needs-input
|
|
88
|
+
Changed: <outputs written> or none
|
|
89
|
+
Validated: <checks passed> or none
|
|
90
|
+
Blockers: none | <explicit blocker>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Never compressed
|
|
94
|
+
|
|
95
|
+
Always write in full:
|
|
96
|
+
- Flag count summary (contradictions / duplicates / stale-references)
|
|
97
|
+
- Any batches skipped due to API errors
|
|
98
|
+
- Phase 2 skip warning if graph coverage is low
|
|
99
|
+
- Hand-off instructions for `polaris docs review`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lsctech/polaris",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Polaris — standalone taskchain orchestration framework for governed AI agent workflows",
|
|
5
5
|
"bin": {
|
|
6
6
|
"polaris-cli": "dist/cli/index.js"
|
|
@@ -71,5 +71,8 @@
|
|
|
71
71
|
"@types/node": "^25.9.1",
|
|
72
72
|
"typescript": "^5.4.2",
|
|
73
73
|
"vitest": "^3.0.5"
|
|
74
|
+
},
|
|
75
|
+
"optionalDependencies": {
|
|
76
|
+
"@anthropic-ai/sdk": "^0.104.1"
|
|
74
77
|
}
|
|
75
78
|
}
|