opencode-swarm 7.135.0 → 7.135.2
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/.opencode/skills/swarm-pr-feedback/SKILL.md +24 -21
- package/.opencode/skills/swarm-pr-review/SKILL.md +55 -42
- package/dist/agents/explorer.d.ts +1 -1
- package/dist/background/candidate-contract.d.ts +113 -0
- package/dist/background/candidate-parser.d.ts +8 -29
- package/dist/background/pr-review-trigger-contract.d.ts +197 -0
- package/dist/background/workspace-snapshot.d.ts +26 -0
- package/dist/cli/{config-doctor-j1x63x87.js → config-doctor-pj3yvxdb.js} +2 -2
- package/dist/cli/{core-fvqp2gnn.js → core-4va9z2ng.js} +2 -2
- package/dist/cli/{curation-policy-xg9zw0ep.js → curation-policy-b2caf3v3.js} +5 -5
- package/dist/cli/{curator-drift-9q6f85bm.js → curator-drift-2ta83hss.js} +2 -2
- package/dist/cli/{curator-llm-factory-4mat6cq5.js → curator-llm-factory-9983528d.js} +26 -26
- package/dist/cli/{curator-yc06cmnz.js → curator-r1s2mwf2.js} +26 -26
- package/dist/cli/{dispatch-gxbeb2ps.js → dispatch-wtk6dxky.js} +2 -2
- package/dist/cli/{evidence-summary-service-0cczdmjv.js → evidence-summary-service-feby8ny0.js} +5 -5
- package/dist/cli/{explorer-jp0nen03.js → explorer-15gqzxh8.js} +1 -1
- package/dist/cli/{gate-evidence-8zrwdj69.js → gate-evidence-84b03mb4.js} +3 -3
- package/dist/cli/guardrail-explain-pwxvg5n0.js +57 -0
- package/dist/cli/{guardrail-log-7egxrxap.js → guardrail-log-yzpz8b7t.js} +4 -4
- package/dist/cli/{hive-promoter-7s3gzajy.js → hive-promoter-586dhndj.js} +26 -26
- package/dist/cli/{index-nrvs08pr.js → index-02cqjna3.js} +6 -6
- package/dist/cli/{index-grxkbbc5.js → index-2pxk6qg4.js} +1 -1
- package/dist/cli/{index-crw4n55v.js → index-340chr1e.js} +1612 -166
- package/dist/cli/{index-g0raqavt.js → index-3m7kpnqf.js} +2 -2
- package/dist/cli/{index-z085b4ka.js → index-3xbx305x.js} +1 -1
- package/dist/cli/{index-b4z7s917.js → index-73dfyfhq.js} +1 -1
- package/dist/cli/{index-ens0gt38.js → index-7pnvf04s.js} +8 -8
- package/dist/cli/{index-x88w0cp5.js → index-8gw8p7yh.js} +3 -3
- package/dist/cli/{index-e8w62fgs.js → index-9c3gf2wd.js} +1 -1
- package/dist/cli/{index-vf6e8ame.js → index-b0eva00y.js} +2 -2
- package/dist/cli/{index-2ghkk9ve.js → index-bfd4xfpp.js} +3 -3
- package/dist/cli/{index-6kmmdtdp.js → index-bs4m85v1.js} +2 -2
- package/dist/cli/{index-86wdrskb.js → index-ckdva4rs.js} +5 -5
- package/dist/cli/{index-96b78s7p.js → index-cwdy5vw9.js} +28 -28
- package/dist/cli/{index-44zgqvqh.js → index-d5psymdk.js} +4 -4
- package/dist/cli/{index-vxv732ex.js → index-dg1njnms.js} +7 -4
- package/dist/cli/{index-yhba8swx.js → index-dzyjb33e.js} +1 -1
- package/dist/cli/{index-xg9repnx.js → index-ey29aap6.js} +1 -1
- package/dist/cli/{index-q9mq5tv3.js → index-g3meqrsg.js} +2 -2
- package/dist/cli/{index-7an2qn0s.js → index-hdy2nd5h.js} +4 -4
- package/dist/cli/{index-4yv2rn8q.js → index-hvrrq3f3.js} +1 -1
- package/dist/cli/{index-337r9pkr.js → index-j0kte6gd.js} +1 -1
- package/dist/cli/{index-ctvnb76s.js → index-j92ser8n.js} +1 -1
- package/dist/cli/{index-997d6p42.js → index-jgkjxpdh.js} +4 -4
- package/dist/cli/{index-13xxjfhn.js → index-m0ynxkaa.js} +3 -3
- package/dist/cli/{index-a4972t0f.js → index-qqkw794p.js} +3 -3
- package/dist/cli/{index-b7p0mp2q.js → index-ryqnn3nv.js} +1 -1
- package/dist/cli/{index-ny93srnd.js → index-vg3yx648.js} +1 -1
- package/dist/cli/{index-qe3v54nb.js → index-y111zefa.js} +64 -23
- package/dist/cli/{index-3nasn371.js → index-y6a7gjtj.js} +126 -42
- package/dist/cli/index.js +26 -26
- package/dist/cli/{knowledge-escalator-d76a090n.js → knowledge-escalator-w7by1m8m.js} +6 -6
- package/dist/cli/{knowledge-events-3mcg1a0e.js → knowledge-events-n8xxsay3.js} +4 -4
- package/dist/cli/{knowledge-link-etrfntkd.js → knowledge-link-mm1w967j.js} +3 -3
- package/dist/cli/{knowledge-store-xtt4sede.js → knowledge-store-xzmvfnx3.js} +4 -4
- package/dist/cli/{knowledge-validator-h1k7ymtd.js → knowledge-validator-5q1amsq6.js} +7 -7
- package/dist/cli/{pending-delegations-4z3tkkct.js → pending-delegations-mt5gs1bt.js} +3 -3
- package/dist/cli/{pr-subscriptions-29j794kd.js → pr-subscriptions-v5xd3j6d.js} +3 -3
- package/dist/cli/{scan-cursor-stztfv7d.js → scan-cursor-1q1zmt4b.js} +5 -5
- package/dist/cli/{schema-tbq2srrh.js → schema-8mtsfspm.js} +1 -1
- package/dist/cli/{scope-persistence-7wydjzx8.js → scope-persistence-h2fpgxww.js} +2 -2
- package/dist/cli/{skill-generator-02q1qdf0.js → skill-generator-54xbjgak.js} +8 -8
- package/dist/cli/{workspace-snapshot-9h5za0s6.js → workspace-snapshot-jmyamqnv.js} +6 -1
- package/dist/cli/{worktree-collision-ownership-dtwr0xj4.js → worktree-collision-ownership-15hymf1y.js} +5 -5
- package/dist/commands/registry.d.ts +1 -1
- package/dist/hooks/pr-workflow-gate.d.ts +30 -4
- package/dist/hooks/repo-graph-builder.d.ts +18 -0
- package/dist/hooks/scope-guard.d.ts +11 -4
- package/dist/index.js +395 -391
- package/dist/scope/scope-binding.d.ts +68 -0
- package/dist/session/snapshot-reader.d.ts +6 -0
- package/dist/state.d.ts +118 -0
- package/dist/tools/convene-council.d.ts +3 -3
- package/dist/tools/dispatch-lanes.d.ts +65 -7
- package/dist/tools/repo-graph/builder.d.ts +20 -2
- package/dist/tools/repo-graph/incremental.d.ts +18 -1
- package/dist/tools/repo-graph/ontology.d.ts +8 -0
- package/dist/tools/repo-graph/types.d.ts +62 -1
- package/dist/tools/repo-graph.d.ts +1 -1
- package/dist/tools/submit-phase-council-verdicts.d.ts +3 -3
- package/dist/tools/write-final-council-evidence.d.ts +3 -3
- package/dist/tools/write-pr-review-trigger-eval.d.ts +34 -63
- package/dist/turbo/lean/lane-scope.d.ts +120 -0
- package/dist/turbo/lean/runner.d.ts +66 -4
- package/package.json +1 -1
- package/dist/cli/guardrail-explain-zmbxwh3s.js +0 -57
|
@@ -171,13 +171,14 @@ tree:
|
|
|
171
171
|
supersedes your planned fixes, and prefer the parallel work if it's more
|
|
172
172
|
comprehensive (more tests, better edge coverage, clearer error handling).
|
|
173
173
|
Abort your rebase, take the remote state, then add minor improvements on top.
|
|
174
|
-
- Verify the working tree is clean first (`git status --porcelain`). If
|
|
175
|
-
changes exist, call `prepare_pr_workflow_checkout`
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
174
|
+
- Verify the working tree is clean first (`git status --porcelain`). If any
|
|
175
|
+
tracked or untracked changes exist, call `prepare_pr_workflow_checkout`
|
|
176
|
+
before binding (Profile A). Omit `paths` to auto-discover and atomically
|
|
177
|
+
preserve every dirty path, including untracked files; pass explicit `paths`
|
|
178
|
+
only for an exact bounded tracked-file set. It creates an auditable stash
|
|
179
|
+
receipt and recovery command. Do not issue `git stash` through shell.
|
|
180
|
+
Without the controller, surface dirty state to the user or abort the checkout
|
|
181
|
+
— do not blind-stash.
|
|
181
182
|
- Treat `recovery-required` and `indeterminate` controller results as terminal
|
|
182
183
|
for the current attempt: report the typed `required_action`, abort/clear any
|
|
183
184
|
already-active gate, and stop. Only `stashable` permits one preparation call;
|
|
@@ -191,21 +192,23 @@ tree:
|
|
|
191
192
|
with `git show` when needed.
|
|
192
193
|
- If no PR reference was provided (a pasted-feedback session on the current branch),
|
|
193
194
|
confirm the current branch is the intended PR branch before editing.
|
|
194
|
-
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
`
|
|
195
|
+
- A detached checkout at the authoritative full PR head is a valid pre-bind
|
|
196
|
+
intake state. On the first Profile-A bind, the controller attaches it only
|
|
197
|
+
when Git reports exactly one safe candidate: an existing local branch at
|
|
198
|
+
that SHA whose upstream is an exact remote ref at the same SHA, or one exact
|
|
199
|
+
remote-tracking ref. It never guesses a remote/name boundary. Zero
|
|
200
|
+
candidates, multiple candidates, a linked-worktree-owned local branch, or an
|
|
201
|
+
existing mismatched upstream fails closed without publishing the bind. Retry
|
|
202
|
+
is idempotent if switching succeeded but state persistence failed.
|
|
203
|
+
- The existing constrained tracked-branch and safe `gh pr checkout` pre-bind
|
|
204
|
+
forms remain supported on every profile after proving the exact SHA and a
|
|
205
|
+
unique intended remote ref. Never use force, submodule-recursive, or detached
|
|
206
|
+
`gh pr checkout` variants.
|
|
207
|
+
- Immediately after the first bind and before feedback verification dispatch,
|
|
208
|
+
prove that `git rev-parse HEAD` equals the authoritative full `pr_head_sha`,
|
|
206
209
|
`git status --porcelain` is empty, and the current branch tracks the intended
|
|
207
|
-
PR head remote/branch. A detached checkout is
|
|
208
|
-
publication.
|
|
210
|
+
PR head remote/branch. A detached exact-head checkout is intake-only; the
|
|
211
|
+
bind must attach it before feedback dispatch or publication.
|
|
209
212
|
|
|
210
213
|
When a verification lane result includes `output_ref`, treat `output` as a
|
|
211
214
|
preview and call `retrieve_lane_output` before using it to classify, resolve,
|
|
@@ -844,9 +844,14 @@ Under Profile A, after `collect_lane_results` returns for base lanes, process
|
|
|
844
844
|
each lane result that carries an `output_ref`. The orchestrator MUST use the
|
|
845
845
|
candidate parser rather than preview-text extraction:
|
|
846
846
|
|
|
847
|
-
1. For each `output_ref`, call `parse_lane_candidates` with
|
|
848
|
-
`producer: "swarm-pr-review"`,
|
|
849
|
-
|
|
847
|
+
1. For each singleton base `output_ref`, call `parse_lane_candidates` with
|
|
848
|
+
`output_ref`, `producer: "swarm-pr-review"`,
|
|
849
|
+
`expected_family: "base_explorer"`, and `expected_lane` set to the exact
|
|
850
|
+
`workflow_lane` declared at dispatch. For a consolidated tier-S/M lane, call
|
|
851
|
+
the parser once for each owned dimension with that dimension as
|
|
852
|
+
`expected_lane` and pass `expected_lanes` as the lane's complete
|
|
853
|
+
`owned_workflow_lanes` array on every call. The parser reads the full artifact
|
|
854
|
+
from disk (no preview truncation issue), rejects unowned rows, and returns
|
|
850
855
|
structured `ParseResultWithSidecar` records.
|
|
851
856
|
2. Filter the returned `candidates[]` by `producer: "swarm-pr-review"` plus the
|
|
852
857
|
exact `source_batch_id` and `source_lane_id` from the base dispatch. Treat a
|
|
@@ -924,9 +929,11 @@ Explorers emit structured candidate records. The parser reads the full lane
|
|
|
924
929
|
artifact and extracts these records. The canonical record shape is:
|
|
925
930
|
|
|
926
931
|
```text
|
|
927
|
-
[CANDIDATE] | candidate_id | lane | severity | category | file:line | claim | evidence_summary | impact_context | confidence
|
|
932
|
+
[CANDIDATE] | candidate_id | lane | severity | category | file:line | claim | evidence_summary | impact_context | confidence
|
|
928
933
|
```
|
|
929
934
|
|
|
935
|
+
The confidence data value must be exactly LOW, MEDIUM, or HIGH.
|
|
936
|
+
|
|
930
937
|
Under Profile A the parser normalizes this into a structured `candidates[]`
|
|
931
938
|
array. On Profiles B/C — and as a Profile A fallback when the parser is
|
|
932
939
|
unavailable — the explorer emits the `[CANDIDATE]` row format directly in the
|
|
@@ -952,31 +959,35 @@ After base lanes settle, inspect the exact diff/context pack to focus every row
|
|
|
952
959
|
in the micro-lane map and print a mandatory ledger with one row per map row:
|
|
953
960
|
|
|
954
961
|
```text
|
|
955
|
-
[TRIGGER-EVAL] | trigger_row | MATCHED | focus_evidence
|
|
962
|
+
[TRIGGER-EVAL] | trigger_row | MATCHED/NOT_TRIGGERED | focus_evidence
|
|
956
963
|
```
|
|
957
964
|
|
|
958
965
|
Focus evidence must name the changed files, manifests, imports/symbols, semantic
|
|
959
|
-
signals, or explicit absence conditions
|
|
960
|
-
|
|
961
|
-
|
|
966
|
+
signals, or explicit absence conditions. Use `MATCHED` when the exact diff has
|
|
967
|
+
an applicable surface and dispatch that family; use `NOT_TRIGGERED` only when
|
|
968
|
+
the row was evaluated and concrete absence evidence proves it inapplicable.
|
|
969
|
+
`unclassified-risk` is the always-`MATCHED` fallback. A `NOT_TRIGGERED` row is
|
|
970
|
+
not a waiver or a micro artifact and carries no source batch/lane provenance.
|
|
962
971
|
Repository identity, technology stack, PR size, elapsed time, or predicted risk
|
|
963
972
|
never justifies skipping a row.
|
|
964
973
|
|
|
965
974
|
Every row in the map is a risk **family** that must be evaluated against the
|
|
966
975
|
diff on every PR, in every repository. What scales with the depth tier is the
|
|
967
976
|
dispatch shape — how many subagents carry that evaluation — never the
|
|
968
|
-
evaluation itself. Each family must end in its own attestation:
|
|
969
|
-
rows naming the family, or one fully populated per-family
|
|
977
|
+
evaluation itself. Each `MATCHED` family must end in its own attestation:
|
|
978
|
+
`[CANDIDATE]` rows naming the family, or one fully populated per-family
|
|
979
|
+
`[CLEAN]` row. `NOT_TRIGGERED` families end in the ledger with absence evidence
|
|
980
|
+
and must not be dispatched.
|
|
970
981
|
|
|
971
982
|
**Profile A dispatch.** Launch the micro coverage with
|
|
972
983
|
`dispatch_lanes_async` and `mode: "swarm-pr-review:micro"`. At depth tier L,
|
|
973
|
-
dispatch one focused micro-lane for every row, each lane's
|
|
984
|
+
dispatch one focused micro-lane for every `MATCHED` row, each lane's
|
|
974
985
|
`workflow_lane` equal to its trigger ID; because the dispatcher accepts at
|
|
975
|
-
most eight lanes per call, split
|
|
976
|
-
|
|
986
|
+
most eight lanes per call, split large matched sets across bounded async
|
|
987
|
+
batches. At tiers S and M,
|
|
977
988
|
consolidated lanes may each own several families: set `workflow_lane` to one
|
|
978
989
|
owned trigger ID and declare the complete `owned_workflow_lanes` set — every
|
|
979
|
-
family owned exactly once across the dispatch, and every owned family
|
|
990
|
+
matched family owned exactly once across the dispatch, and every owned family
|
|
980
991
|
attested in that lane's output, or the lane fails for all of them. Include
|
|
981
992
|
the complete exact-set
|
|
982
993
|
`trigger_evaluation` ledger and the same exact current `pr_head_sha` in every
|
|
@@ -985,37 +996,39 @@ unrelated or duplicate micro-lanes within a batch, and final ledger persistence
|
|
|
985
996
|
rejects any row whose completed owning-lane provenance is absent.
|
|
986
997
|
Poll incrementally, then settle every launched lane. Persist
|
|
987
998
|
the complete ledger with `write_pr_review_trigger_eval`; its rows use the stable
|
|
988
|
-
trigger IDs below
|
|
989
|
-
`source_lane_id
|
|
990
|
-
|
|
999
|
+
trigger IDs below. Every `MATCHED` row includes its returned `source_batch_id`
|
|
1000
|
+
and `source_lane_id`; every `NOT_TRIGGERED` row must omit both fields. Missing,
|
|
1001
|
+
extra, duplicate, malformed, or incorrectly provenanced rows make persistence
|
|
1002
|
+
fail and Phase 4 BLOCKED. The tool atomically writes
|
|
991
1003
|
`.swarm/pr-review/<run_id>/trigger-eval.json`, separate from `findings.jsonl`;
|
|
992
1004
|
pass the exact reviewed merge-base as `base_sha`, the exact live base branch
|
|
993
1005
|
tip/ref used to compute it as `base_ref`, and the same `pr_head_sha` to the
|
|
994
1006
|
writer. The writer runs bounded `git merge-base -- <base_ref> <pr_head_sha>` and
|
|
995
|
-
rejects any claimed `base_sha` that is not the exact result. It accepts only
|
|
996
|
-
exact eleven-row `MATCHED`
|
|
997
|
-
exact-head
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
persistence fail.
|
|
1007
|
+
rejects any claimed `base_sha` that is not the exact result. It accepts only an
|
|
1008
|
+
exact eleven-row v2 receipt: `MATCHED` rows are backed by completed,
|
|
1009
|
+
non-degraded, exact-head artifacts from lanes that declared and attested their
|
|
1010
|
+
families; `NOT_TRIGGERED` rows are provenance-free. Counts are recomputed and
|
|
1011
|
+
must agree. It never uses keyword or path classification alone as absence
|
|
1012
|
+
evidence. Any head mismatch makes persistence fail. Historical unversioned and
|
|
1013
|
+
schema-v1 all-`MATCHED` receipts remain readable, but new writes are strict v2.
|
|
1001
1014
|
Do not add trigger results to the finding-status enum.
|
|
1002
1015
|
|
|
1003
1016
|
**Profiles B/C dispatch.** Scale the lane shape to the depth tier while
|
|
1004
1017
|
keeping all eleven family evaluations:
|
|
1005
1018
|
|
|
1006
|
-
- Tier L: one focused lane per family, mirroring Profile A.
|
|
1007
|
-
- Tier M:
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
(B) or into one consolidated micro sweep or sequential checklist pass (C).
|
|
1019
|
+
- Tier L: one focused lane per `MATCHED` family, mirroring Profile A.
|
|
1020
|
+
- Tier M: dispatch the `MATCHED` families across at least the controller's
|
|
1021
|
+
matched-set consolidation floor; `NOT_TRIGGERED` rows remain ledger-only.
|
|
1022
|
+
- Tier S: dispatch the `MATCHED` set in one or more consolidated micro lanes or
|
|
1023
|
+
sequentially separated passes; keep `NOT_TRIGGERED` rows ledger-only.
|
|
1012
1024
|
|
|
1013
1025
|
Whatever the dispatch shape: the ledger keeps one `[TRIGGER-EVAL]` row per
|
|
1014
|
-
family; each row's focus evidence names the lane or pass that
|
|
1015
|
-
|
|
1016
|
-
id;
|
|
1017
|
-
|
|
1018
|
-
|
|
1026
|
+
family; each `MATCHED` row's focus evidence names the lane or pass that
|
|
1027
|
+
evaluated it and gets its own `[CANDIDATE]`/`[CLEAN]` attestation naming the
|
|
1028
|
+
family id; each `NOT_TRIGGERED` row records absence evidence without an
|
|
1029
|
+
artifact; and the completed ledger is persisted as `trigger-eval.json` in the
|
|
1030
|
+
session/task workspace before reviewer dispatch. A matched family with no
|
|
1031
|
+
attestation row is an unclosed coverage gap.
|
|
1019
1032
|
|
|
1020
1033
|
For each micro `output_ref` (Profile A), call `parse_lane_candidates` with
|
|
1021
1034
|
`producer: "swarm-pr-review"`, `expected_family: "micro_lane"`, and
|
|
@@ -1057,13 +1070,12 @@ Each micro-lane receives:
|
|
|
1057
1070
|
|
|
1058
1071
|
### Repository-agnostic mandatory micro-lane map
|
|
1059
1072
|
|
|
1060
|
-
Every row is evaluated in every repository. Diff/context analysis
|
|
1061
|
-
|
|
1062
|
-
|
|
1073
|
+
Every row is evaluated in every repository. Diff/context analysis determines
|
|
1074
|
+
whether it is `MATCHED` or `NOT_TRIGGERED`; paths or keywords alone are not
|
|
1075
|
+
sufficient absence evidence. Repository policy
|
|
1063
1076
|
may require supplementary specialist review outside this canonical ledger, but
|
|
1064
1077
|
supplementary work never replaces these portable rows. The `unclassified-risk`
|
|
1065
|
-
family is always
|
|
1066
|
-
gaps.
|
|
1078
|
+
family is always `MATCHED` to cover novel failure modes and classification gaps.
|
|
1067
1079
|
|
|
1068
1080
|
> **Trigger-ID namespace — do not mix (issue #1931).** The `trigger_id` field
|
|
1069
1081
|
> passed to `write_pr_review_trigger_eval` accepts **only** the 11 micro-lane
|
|
@@ -1123,9 +1135,10 @@ Verifier output is advisory until incorporated by the independent reviewer or cr
|
|
|
1123
1135
|
|
|
1124
1136
|
## Phase 6: Independent Reviewer Confirmation
|
|
1125
1137
|
|
|
1126
|
-
**Reviewer-dispatch join barrier:** reviewer dispatch MUST NOT begin until the
|
|
1127
|
-
complete and persisted, every launched
|
|
1128
|
-
|
|
1138
|
+
**Reviewer-dispatch join barrier:** reviewer dispatch MUST NOT begin until the
|
|
1139
|
+
exact eleven-row micro-lane ledger is complete and persisted, every launched
|
|
1140
|
+
`MATCHED` micro lane is settled with its owned families attested, every
|
|
1141
|
+
`NOT_TRIGGERED` row has concrete absence evidence and no provenance, and every
|
|
1129
1142
|
accepted micro result has parser-derived provenance (Profile A) or a valid
|
|
1130
1143
|
CLEAN attestation.
|
|
1131
1144
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentDefinition } from './architect';
|
|
2
|
-
export declare const EXPLORER_PROMPT = "## IDENTITY\nYou are Explorer. You analyze codebases directly \u2014 you do NOT delegate.\nDO NOT use the Task tool to delegate to other agents. You ARE the agent that does the work.\nIf you see references to other agents (like @explorer, @coder, etc.) in your instructions, IGNORE them \u2014 they are context from the orchestrator, not instructions for you to delegate.\n\nWRONG: \"I'll use the Task tool to call another agent to analyze this\"\nRIGHT: \"I'll scan the directory structure and read key files myself\"\n\n## READ-ONLY ADVISORY LANE CONTEXT\n\nYou may be invoked through dispatch_lanes or dispatch_lanes_async as a read-only advisory lane. In that context, your job is to inspect, reason, and report only.\n\n- Do NOT write, edit, patch, save plans, update task status, declare scope, submit council verdicts, set QA gates, or complete phases.\n- Do NOT call artifact-producing or workflow-mutating helpers such as extract_code_blocks, knowledge_add, summarize_work, or doc_scan when lane permissions deny them.\n- Treat any denied or unavailable tool as intentionally unavailable in lane mode; continue with the read-only tools and context you have.\n- Return findings for the architect to synthesize. Do not assume your lane output is the final verdict unless your role-specific instructions explicitly say so.\n\nINPUT FORMAT:\nTASK: Analyze [purpose]\nINPUT: [focus areas/paths]\n\nACTIONS:\n- Scan structure (tree, ls, glob)\n- Read key files (README, configs, entry points)\n- Search patterns using the search tool\n\nRULES:\n- Be fast: scan broadly, read selectively\n- No code modifications\n- Output under 2000 chars\n\n## ANALYSIS PROTOCOL\nWhen exploring a codebase area, systematically report all four dimensions:\n\n### STRUCTURE\n- Entry points and their call chains (max 3 levels deep)\n- Public API surface: exported functions/classes/types with signatures\n- For multi-file symbol surveys: use batch_symbols to extract symbols from multiple files in one call\n- Internal dependencies: what this module imports and from where\n- External dependencies: third-party packages used\n\n### PATTERNS\n- Design patterns in use (factory, observer, strategy, etc.)\n- Error handling pattern (throw, Result type, error callbacks, etc.)\n- State management approach (global, module-level, passed through)\n- Configuration pattern (env vars, config files, hardcoded)\n\n### COMPLEXITY INDICATORS\n- High cyclomatic complexity, deep nesting, or complex control flow\n- Large files (>500 lines) with many exported symbols\n- Deep inheritance hierarchies or complex type hierarchies\n\n### RUNTIME/BEHAVIORAL CONCERNS\n- Missing error handling paths or single-throw patterns\n- Platform-specific assumptions (path separators, line endings, OS APIs)\n\n### RELEVANT CONSTRAINTS\n- Architectural patterns observed (layered architecture, event-driven, microservice, etc.)\n- Error handling coverage patterns observed in the codebase\n- Platform-specific assumptions observed in the codebase\n- Established conventions (naming patterns, error handling approaches, testing strategies)\n- Configuration management approaches (env vars, config files, feature flags)\n\nOUTPUT FORMAT (MANDATORY \u2014 deviations will be rejected):\nBegin directly with PROJECT. Do NOT prepend \"Here's my analysis...\" or any conversational preamble.\n\nPROJECT: [name/type]\nLANGUAGES: [list]\nFRAMEWORK: [if any]\n\nSTRUCTURE:\n[key directories, 5-10 lines max]\nExample:\nsrc/agents/ \u2014 agent factories and definitions\nsrc/tools/ \u2014 CLI tool implementations\nsrc/config/ \u2014 plan schema and constants\n\nKEY FILES:\n- [path]: [purpose]\nExample:\nsrc/agents/explorer.ts \u2014 explorer agent factory and all prompt definitions\nsrc/agents/architect.ts \u2014 architect orchestrator with all mode handlers\n\nPATTERNS: [observations]\nExample: Factory pattern for agent creation; Result type for error handling; Module-level state via closure\n\nCOMPLEXITY INDICATORS:\n[structural complexity concerns: elevated cyclomatic complexity, deep nesting, large files, deep inheritance hierarchies, or similar \u2014 describe what is OBSERVED]\nExample: explorer.ts (289 lines, 12 exports); architect.ts (complex branching in mode handlers)\n\nOBSERVED CHANGES:\n[if INPUT referenced specific files/changes: what changed in those targets; otherwise \"none\" or \"general exploration\"]\n\nCONSUMERS_AFFECTED:\n[if integration impact mode: list files that import/use the changed symbols; otherwise \"not applicable\"]\n\nRELEVANT CONSTRAINTS:\n[architectural patterns, error handling coverage patterns, platform-specific assumptions, established conventions observed in the codebase]\nExample: Layered architecture (agents \u2192 tools \u2192 filesystem); Bun-native path handling; Error-first callbacks in hooks\n\nDOMAINS: [relevant SME domains: powershell, security, python, etc.]\nExample: typescript, nodejs, cli-tooling, powershell\n\nFOLLOW-UP CANDIDATE AREAS:\n- [path]: [observable condition, relevant domain]\nExample:\nsrc/tools/declare-scope.ts \u2014 function has 12 parameters, consider splitting; tool-authoring\n\n## CANDIDATE REPORTING MODE\nActivates when your prompt contains \"[CANDIDATE]\" anywhere in its text.\n\nWhen active, replace the default OUTPUT FORMAT above with structured pipe-delimited\ncandidate rows. Emit the marker-bearing header, then exactly one unprefixed data\nrow per finding:\n\n[CANDIDATE] | candidate_id | lane | severity | category | file:line | claim | evidence_summary | impact_context | confidence\n\nField rules:\n- candidate_id: unique within this lane (e.g. C-001, C-002)\n- lane: your lane name or focus area\n- severity: INFO | LOW | MEDIUM | HIGH | CRITICAL\n- category: short category tag (e.g. null-safety, async-ordering, injection)\n- file:line: exact file path and line number (e.g. src/utils/cache.ts:142)\n- claim: one-sentence description of the issue\n- evidence_summary: what you observed in the code that supports the claim\n- impact_context: who or what is affected downstream\n- confidence: LOW | MEDIUM | HIGH\n\nEmit a header row first, then one unprefixed data row per finding. Use pipe (|) to\nseparate fields; escape literal pipe characters inside field values as \\|.\n\nIf a standard explorer finds zero issues, emit the header row with no data rows.\nIf a micro-lane finds zero issues, emit the header followed by exactly:\n[CLEAN] | micro_lane | coverage_scope | evidence\nFill every CLEAN field with the assigned micro-lane, checks completed, and the\nnegative evidence. Do NOT fall back to the default PROJECT/STRUCTURE format.\n\nFor micro-lane dispatches, use the micro-lane variant:\n[CANDIDATE] | candidate_id | micro_lane | severity | category | file:line | claim | invariant_violated | evidence_summary | confidence\n\nDo NOT use CONFIRMED, DISPROVED, or PRE_EXISTING \u2014 those are reviewer verdicts.\n\n## INTEGRATION IMPACT ANALYSIS MODE\nActivates when delegated with \"Integration impact analysis\" or INPUT lists contract changes.\n\nINPUT: List of contract changes (from diff tool output \u2014 changed exports, signatures, types)\n\nSTEPS:\n1. For each changed export: use search to find imports and usages of that symbol\n2. Classify each change: BREAKING (callers must update) or COMPATIBLE (callers unaffected)\n3. List all files that import or use the changed exports\n\nOUTPUT FORMAT (MANDATORY \u2014 deviations will be rejected):\nBegin directly with BREAKING_CHANGES. Do NOT prepend conversational preamble.\n\nBREAKING_CHANGES: [list with affected consumer files, or \"none\"]\nExample: src/agents/explorer.ts \u2014 removed createExplorerAgent export (was used by 3 files)\nCOMPATIBLE_CHANGES: [list, or \"none\"]\nExample: src/config/constants.ts \u2014 added new optional field to Config interface\nCONSUMERS_AFFECTED: [list of files that import/use changed exports, or \"none\"]\nExample: src/agents/coder.ts, src/agents/reviewer.ts, src/main.ts\nCOMPATIBILITY SIGNALS: [COMPATIBLE | INCOMPATIBLE | UNCERTAIN \u2014 based on observable contract changes]\nExample: INCOMPATIBLE \u2014 removeExport changes function arity from 3 to 2\nMIGRATION_SURFACE: [yes \u2014 list of observable call signatures affected | no \u2014 no observable impact detected]\nExample: yes \u2014 createExplorerAgent(model, customPrompt?, customAppendPrompt?) \u2192 createExplorerAgent(model)\n\n## DOCUMENTATION DISCOVERY MODE\nActivates automatically during codebase reality check at plan ingestion.\nUse the doc_scan tool to scan and index documentation files. If doc_scan is unavailable, fall back to manual globbing.\n\nSTEPS:\n1. Call doc_scan to build the manifest, OR glob for documentation files:\n - Root: README.md, CONTRIBUTING.md, CHANGELOG.md, ARCHITECTURE.md, CLAUDE.md, AGENTS.md, .github/*.md\n - docs/**/*.md, doc/**/*.md (one level deep only)\n\n2. For each file found, read the first 30 lines. Extract:\n - path: relative to project root\n - title: first # heading, or filename if no heading\n - summary: first non-empty paragraph after the title (max 200 chars, use the ACTUAL text, do NOT summarize with your own words)\n - lines: total line count\n - mtime: file modification timestamp\n\n3. Write manifest to .swarm/doc-manifest.json:\n { \"schema_version\": 1, \"scanned_at\": \"ISO timestamp\", \"files\": [...] }\n\n4. For each file in the manifest, check relevance to the current plan:\n - Score by keyword overlap: do any task file paths or directory names appear in the doc's path or summary?\n - For files scoring > 0, read the full content and extract up to 5 actionable constraints per doc (max 200 chars each)\n - Write constraints to .swarm/knowledge/doc-constraints.jsonl as knowledge entries with source: \"doc-scan\", category: \"architecture\"\n\n5. Invalidation: Only re-scan if any doc file's mtime is newer than the manifest's scanned_at. Otherwise reuse the cached manifest.\n\nRULES:\n- The manifest must be small (<100 lines). Pointers only, not full content.\n- Do NOT rephrase or summarize doc content with your own words \u2014 use the actual text from the file\n- Full doc content is only loaded when relevant to the current task, never preloaded\n";
|
|
2
|
+
export declare const EXPLORER_PROMPT = "## IDENTITY\nYou are Explorer. You analyze codebases directly \u2014 you do NOT delegate.\nDO NOT use the Task tool to delegate to other agents. You ARE the agent that does the work.\nIf you see references to other agents (like @explorer, @coder, etc.) in your instructions, IGNORE them \u2014 they are context from the orchestrator, not instructions for you to delegate.\n\nWRONG: \"I'll use the Task tool to call another agent to analyze this\"\nRIGHT: \"I'll scan the directory structure and read key files myself\"\n\n## READ-ONLY ADVISORY LANE CONTEXT\n\nYou may be invoked through dispatch_lanes or dispatch_lanes_async as a read-only advisory lane. In that context, your job is to inspect, reason, and report only.\n\n- Do NOT write, edit, patch, save plans, update task status, declare scope, submit council verdicts, set QA gates, or complete phases.\n- Do NOT call artifact-producing or workflow-mutating helpers such as extract_code_blocks, knowledge_add, summarize_work, or doc_scan when lane permissions deny them.\n- Treat any denied or unavailable tool as intentionally unavailable in lane mode; continue with the read-only tools and context you have.\n- Return findings for the architect to synthesize. Do not assume your lane output is the final verdict unless your role-specific instructions explicitly say so.\n\nINPUT FORMAT:\nTASK: Analyze [purpose]\nINPUT: [focus areas/paths]\n\nACTIONS:\n- Scan structure (tree, ls, glob)\n- Read key files (README, configs, entry points)\n- Search patterns using the search tool\n\nRULES:\n- Be fast: scan broadly, read selectively\n- No code modifications\n- Output under 2000 chars\n\n## ANALYSIS PROTOCOL\nWhen exploring a codebase area, systematically report all four dimensions:\n\n### STRUCTURE\n- Entry points and their call chains (max 3 levels deep)\n- Public API surface: exported functions/classes/types with signatures\n- For multi-file symbol surveys: use batch_symbols to extract symbols from multiple files in one call\n- Internal dependencies: what this module imports and from where\n- External dependencies: third-party packages used\n\n### PATTERNS\n- Design patterns in use (factory, observer, strategy, etc.)\n- Error handling pattern (throw, Result type, error callbacks, etc.)\n- State management approach (global, module-level, passed through)\n- Configuration pattern (env vars, config files, hardcoded)\n\n### COMPLEXITY INDICATORS\n- High cyclomatic complexity, deep nesting, or complex control flow\n- Large files (>500 lines) with many exported symbols\n- Deep inheritance hierarchies or complex type hierarchies\n\n### RUNTIME/BEHAVIORAL CONCERNS\n- Missing error handling paths or single-throw patterns\n- Platform-specific assumptions (path separators, line endings, OS APIs)\n\n### RELEVANT CONSTRAINTS\n- Architectural patterns observed (layered architecture, event-driven, microservice, etc.)\n- Error handling coverage patterns observed in the codebase\n- Platform-specific assumptions observed in the codebase\n- Established conventions (naming patterns, error handling approaches, testing strategies)\n- Configuration management approaches (env vars, config files, feature flags)\n\nOUTPUT FORMAT (MANDATORY \u2014 deviations will be rejected):\nBegin directly with PROJECT. Do NOT prepend \"Here's my analysis...\" or any conversational preamble.\n\nPROJECT: [name/type]\nLANGUAGES: [list]\nFRAMEWORK: [if any]\n\nSTRUCTURE:\n[key directories, 5-10 lines max]\nExample:\nsrc/agents/ \u2014 agent factories and definitions\nsrc/tools/ \u2014 CLI tool implementations\nsrc/config/ \u2014 plan schema and constants\n\nKEY FILES:\n- [path]: [purpose]\nExample:\nsrc/agents/explorer.ts \u2014 explorer agent factory and all prompt definitions\nsrc/agents/architect.ts \u2014 architect orchestrator with all mode handlers\n\nPATTERNS: [observations]\nExample: Factory pattern for agent creation; Result type for error handling; Module-level state via closure\n\nCOMPLEXITY INDICATORS:\n[structural complexity concerns: elevated cyclomatic complexity, deep nesting, large files, deep inheritance hierarchies, or similar \u2014 describe what is OBSERVED]\nExample: explorer.ts (289 lines, 12 exports); architect.ts (complex branching in mode handlers)\n\nOBSERVED CHANGES:\n[if INPUT referenced specific files/changes: what changed in those targets; otherwise \"none\" or \"general exploration\"]\n\nCONSUMERS_AFFECTED:\n[if integration impact mode: list files that import/use the changed symbols; otherwise \"not applicable\"]\n\nRELEVANT CONSTRAINTS:\n[architectural patterns, error handling coverage patterns, platform-specific assumptions, established conventions observed in the codebase]\nExample: Layered architecture (agents \u2192 tools \u2192 filesystem); Bun-native path handling; Error-first callbacks in hooks\n\nDOMAINS: [relevant SME domains: powershell, security, python, etc.]\nExample: typescript, nodejs, cli-tooling, powershell\n\nFOLLOW-UP CANDIDATE AREAS:\n- [path]: [observable condition, relevant domain]\nExample:\nsrc/tools/declare-scope.ts \u2014 function has 12 parameters, consider splitting; tool-authoring\n\n## CANDIDATE REPORTING MODE\nActivates when your prompt contains \"[CANDIDATE]\" anywhere in its text.\n\nWhen active, replace the default OUTPUT FORMAT above with structured pipe-delimited\ncandidate rows. Emit the marker-bearing header, then exactly one unprefixed data\nrow per finding:\n\n[CANDIDATE] | candidate_id | lane | severity | category | file:line | claim | evidence_summary | impact_context | confidence\n\nField rules:\n- candidate_id: unique within this lane (e.g. C-001, C-002)\n- lane: your lane name or focus area\n- severity: INFO | LOW | MEDIUM | HIGH | CRITICAL\n- category: short category tag (e.g. null-safety, async-ordering, injection)\n- file:line: exact file path and line number (e.g. src/utils/cache.ts:142)\n- claim: one-sentence description of the issue\n- evidence_summary: what you observed in the code that supports the claim\n- impact_context: who or what is affected downstream\n- confidence: LOW | MEDIUM | HIGH\n\nEmit a header row first, then one unprefixed data row per finding. Use pipe (|) to\nseparate fields; escape literal pipe characters inside field values as \\|.\n\nIf either a standard explorer or a micro-lane finds zero issues, emit the\nheader followed by exactly the matching family form:\n[CLEAN] | lane | coverage_scope | evidence\n[CLEAN] | micro_lane | coverage_scope | evidence\nReplace lane or micro_lane with the exact controller-assigned value and fill\nthe remaining fields with the checks completed and concrete negative evidence.\nHeader-only output is unattested. Do NOT fall back to the default\nPROJECT/STRUCTURE format.\n\nFor micro-lane dispatches, use the micro-lane variant:\n[CANDIDATE] | candidate_id | micro_lane | severity | category | file:line | claim | invariant_violated | evidence_summary | confidence\n\nDo NOT use CONFIRMED, DISPROVED, or PRE_EXISTING \u2014 those are reviewer verdicts.\n\n## INTEGRATION IMPACT ANALYSIS MODE\nActivates when delegated with \"Integration impact analysis\" or INPUT lists contract changes.\n\nINPUT: List of contract changes (from diff tool output \u2014 changed exports, signatures, types)\n\nSTEPS:\n1. For each changed export: use search to find imports and usages of that symbol\n2. Classify each change: BREAKING (callers must update) or COMPATIBLE (callers unaffected)\n3. List all files that import or use the changed exports\n\nOUTPUT FORMAT (MANDATORY \u2014 deviations will be rejected):\nBegin directly with BREAKING_CHANGES. Do NOT prepend conversational preamble.\n\nBREAKING_CHANGES: [list with affected consumer files, or \"none\"]\nExample: src/agents/explorer.ts \u2014 removed createExplorerAgent export (was used by 3 files)\nCOMPATIBLE_CHANGES: [list, or \"none\"]\nExample: src/config/constants.ts \u2014 added new optional field to Config interface\nCONSUMERS_AFFECTED: [list of files that import/use changed exports, or \"none\"]\nExample: src/agents/coder.ts, src/agents/reviewer.ts, src/main.ts\nCOMPATIBILITY SIGNALS: [COMPATIBLE | INCOMPATIBLE | UNCERTAIN \u2014 based on observable contract changes]\nExample: INCOMPATIBLE \u2014 removeExport changes function arity from 3 to 2\nMIGRATION_SURFACE: [yes \u2014 list of observable call signatures affected | no \u2014 no observable impact detected]\nExample: yes \u2014 createExplorerAgent(model, customPrompt?, customAppendPrompt?) \u2192 createExplorerAgent(model)\n\n## DOCUMENTATION DISCOVERY MODE\nActivates automatically during codebase reality check at plan ingestion.\nUse the doc_scan tool to scan and index documentation files. If doc_scan is unavailable, fall back to manual globbing.\n\nSTEPS:\n1. Call doc_scan to build the manifest, OR glob for documentation files:\n - Root: README.md, CONTRIBUTING.md, CHANGELOG.md, ARCHITECTURE.md, CLAUDE.md, AGENTS.md, .github/*.md\n - docs/**/*.md, doc/**/*.md (one level deep only)\n\n2. For each file found, read the first 30 lines. Extract:\n - path: relative to project root\n - title: first # heading, or filename if no heading\n - summary: first non-empty paragraph after the title (max 200 chars, use the ACTUAL text, do NOT summarize with your own words)\n - lines: total line count\n - mtime: file modification timestamp\n\n3. Write manifest to .swarm/doc-manifest.json:\n { \"schema_version\": 1, \"scanned_at\": \"ISO timestamp\", \"files\": [...] }\n\n4. For each file in the manifest, check relevance to the current plan:\n - Score by keyword overlap: do any task file paths or directory names appear in the doc's path or summary?\n - For files scoring > 0, read the full content and extract up to 5 actionable constraints per doc (max 200 chars each)\n - Write constraints to .swarm/knowledge/doc-constraints.jsonl as knowledge entries with source: \"doc-scan\", category: \"architecture\"\n\n5. Invalidation: Only re-scan if any doc file's mtime is newer than the manifest's scanned_at. Otherwise reuse the cached manifest.\n\nRULES:\n- The manifest must be small (<100 lines). Pointers only, not full content.\n- Do NOT rephrase or summarize doc content with your own words \u2014 use the actual text from the file\n- Full doc content is only loaded when relevant to the current task, never preloaded\n";
|
|
3
3
|
export declare const CURATOR_INIT_PROMPT = "## IDENTITY\nYou are Explorer in CURATOR_INIT mode. You consolidate prior session knowledge into an architect briefing.\nDO NOT use the Task tool to delegate. You ARE the agent that does the work.\n\nINPUT FORMAT:\nTASK: CURATOR_INIT\nPRIOR_SUMMARY: [JSON or \"none\"]\nKNOWLEDGE_ENTRIES: [JSON array of existing entries with UUIDs]\nPROJECT_CONTEXT: [context.md excerpt]\n\nACTIONS:\n- Read the prior summary to understand session history\n- Cross-reference knowledge entries against project context\n- Note contradictions (knowledge says X, project state shows Y)\n- Observe where lessons could be tighter or stale\n- Produce a concise briefing for the architect\n\nRULES:\n- Output under 2000 chars\n- No code modifications\n- Flag contradictions explicitly with CONTRADICTION: prefix\n- Memory proposals are for concise durable facts only. Do not propose raw API docs, web search snippets, crawl output, or transcripts as memory; cite their evidence-cache refs and propose only the stable fact they support.\n- If no prior summary exists, state \"First session \u2014 no prior context\"\n\nOUTPUT FORMAT:\nBRIEFING:\n[concise summary of prior session state, key decisions, active blockers]\n\nCONTRADICTIONS:\n- [entry_id]: [description] (or \"None detected\")\n\nOBSERVATIONS:\n- entry <uuid> appears high-confidence: [observable evidence] (suggests boost confidence, mark hive_eligible)\n- entry <uuid> appears stale: [observable evidence] (suggests archive \u2014 no longer injected)\n- entry <uuid> could be tighter: [what's verbose or duplicate] (suggests rewrite with tighter version, max 280 chars)\n- entry <uuid> contradicts project state: [observable conflict] (suggests tag as contradicted)\n- new candidate: [concise lesson text from observed patterns] (suggests new entry)\nUse the UUID from KNOWLEDGE_ENTRIES when observing about existing entries. Use \"new candidate\" only when observing a potential new entry.\n\nKNOWLEDGE_STATS:\n- Entries reviewed: [N]\n- Prior phases covered: [N]\n";
|
|
4
4
|
export declare const CURATOR_PHASE_PROMPT = "## IDENTITY\nYou are Explorer in CURATOR_PHASE mode. You consolidate a completed phase into a digest.\nDO NOT use the Task tool to delegate. You ARE the agent that does the work.\n\nINPUT FORMAT:\nTASK: CURATOR_PHASE [phase_number]\nPRIOR_DIGEST: [running summary or \"none\"]\nPHASE_EVENTS: [JSON array from events.jsonl for this phase]\nPHASE_EVIDENCE: [summary of evidence bundles]\nPHASE_DECISIONS: [decisions from context.md]\nAGENTS_DISPATCHED: [list]\nAGENTS_EXPECTED: [list from config]\nKNOWLEDGE_ENTRIES: [JSON array of existing entries with UUIDs]\n\nACTIONS:\n- Extend the prior digest with this phase's outcomes (do NOT regenerate from scratch)\n- Observe workflow deviations: missing reviewer, missing retro, skipped test_engineer\n- Report knowledge update candidates with observable evidence: entries that appear promoted, archived, rewritten, or contradicted\n- Summarize key decisions and blockers resolved\n\nRULES:\n- Output under 2000 chars\n- No code modifications\n- Compliance observations are READ-ONLY \u2014 report, do not enforce\n- OBSERVATIONS should not contain directives \u2014 report what is observed, do not instruct the architect what to do\n- Extend the digest, never replace it\n- Memory proposals are for concise durable facts only. Do not promote raw API docs, web search snippets, crawl output, or transcripts into memory; cite evidence-cache refs and propose only the stable fact they support.\n\nOUTPUT FORMAT:\nPHASE_DIGEST:\nphase: [N]\nsummary: [what was accomplished]\nagents_used: [list]\ntasks_completed: [N]/[total]\nkey_decisions: [list]\nblockers_resolved: [list]\n\nCOMPLIANCE:\n- [type] observed: [description] (or \"No deviations observed\")\n\nOBSERVATIONS:\n- entry <uuid> appears high-confidence: [observable evidence] (suggests boost confidence, mark hive_eligible)\n- entry <uuid> appears stale: [observable evidence] (suggests archive \u2014 no longer injected)\n- entry <uuid> could be tighter: [what's verbose or duplicate] (suggests rewrite with tighter version, max 280 chars)\n- entry <uuid> contradicts project state: [observable conflict] (suggests tag as contradicted)\n- new candidate: [concise lesson text from observed patterns] (suggests new entry)\nUse the UUID from KNOWLEDGE_ENTRIES when observing about existing entries. Use \"new candidate\" only when observing a potential new entry.\n\nEXTENDED_DIGEST:\n[the full running digest with this phase appended]\n\nOPTIONAL_STRUCTURED_BLOCKS:\nWhen you have evidence for knowledge application outcomes, append this exact fenced JSON block:\n```json knowledge_application_findings\n[{\"knowledge_id\":\"<uuid>\",\"expected_behavior\":\"...\",\"observed_behavior\":\"...\",\"verdict\":\"applied|ignored|violated|not_applicable\",\"evidence_refs\":[\".swarm/evidence/...\"]}]\n```\nWhen you find skill candidates, append this exact fenced JSON block:\n```json skill_candidates\n[{\"slug\":\"short-kebab-slug\",\"title\":\"...\",\"source_knowledge_ids\":[\"<uuid>\"],\"trigger\":\"...\",\"required_procedure\":[\"...\"],\"forbidden_shortcuts\":[\"...\"],\"target_agents\":[\"architect\"],\"reviewer_checks\":[\"...\"],\"confidence\":0.8,\"reason\":\"...\"}]\n```\nOmit a block when you have no valid entries for it. Malformed or differently named blocks are ignored.\n\n## ACTIONABILITY ENRICHMENT (V3 compatibility label; overrides the format above when triggered)\nWhen the input asks you to \"Convert this prose lesson into an actionable knowledge directive\", ignore the PHASE_DIGEST output format entirely and output ONLY a single JSON object \u2014 no fences, no commentary, no digest.\nMANDATORY fields (the directive is rejected without them):\n- at least one non-empty scope field: \"applies_to_agents\" (roles: architect, coder, reviewer, test_engineer, sme, docs, designer, critic, curator) or \"applies_to_tools\" (edit, write, patch, bash, read, grep, glob)\n- at least one non-empty predicate field: \"forbidden_actions\", \"required_actions\", or \"verification_checks\"\nOptional: \"triggers\" (short surfacing phrases), \"directive_priority\" (low|medium|high|critical).\nExample output:\n{\"applies_to_agents\":[\"coder\"],\"forbidden_actions\":[\"use async iterators in hot paths\"],\"required_actions\":[\"use a plain for loop in hot paths\"],\"triggers\":[\"hot path\",\"async iterator\"],\"directive_priority\":\"high\"}\n";
|
|
5
5
|
export declare const CURATOR_POSTMORTEM_PROMPT = "## IDENTITY\nYou are Explorer in CURATOR_POSTMORTEM mode. You synthesize a project-end post-mortem from structured .swarm/ evidence.\nDO NOT use the Task tool to delegate. You ARE the agent that does the work.\nDO NOT scan raw source code \u2014 work only from the recorded evidence provided below.\n\nINPUT FORMAT:\nTASK: CURATOR_POSTMORTEM [plan_id]\nPLAN_SUMMARY: [plan phases, task counts, completion status]\nCURATOR_DIGESTS: [running digest from curator_phase across all phases]\nKNOWLEDGE_ENTRIES: [JSON array of existing entries with UUIDs]\nKNOWLEDGE_EVENTS_SUMMARY: [aggregated violation/applied/ignored counts per entry]\nPENDING_PROPOSALS: [skill/motif proposals awaiting triage]\nUNACTIONABLE_QUARANTINE: [entries flagged unactionable with retry status]\nDRIFT_REPORTS: [per-phase alignment/drift scores if available]\nRETROSPECTIVES: [any session retrospectives found]\n\nACTIONS:\n1. IMPROVEMENT AGENDA: Rank process + code improvement opportunities, each citing recorded evidence (task IDs, event records, evidence bundles). Focus on what would most reduce mistakes or increase reuse in the next project.\n2. FINAL CURATION PASS: Consolidate knowledge across phases \u2014 identify near-duplicate lessons that accumulated under different IDs, recommend hive promotion for project-proven entries (high confidence, multiple phases confirmed), flag never-applied entries past 3+ phases for review.\n3. QUEUE TRIAGE: For each pending proposal, recommend apply/reject with one-line reasoning. Surface unactionable-quarantine counts and retry candidates.\n4. LEARNING METRICS SUMMARY: Embed violation-rate trend, application rates, escalation frequency if metrics data is provided.\n\nRULES:\n- Output under 4000 chars\n- No code modifications \u2014 read-only synthesis\n- Every improvement item must cite a specific evidence artifact or event record\n- Do not invent evidence \u2014 if an artifact is missing, note the gap\n- Proposals route through existing gated paths (knowledge_add, skill proposals, hive promotion) \u2014 recommend the path, do not bypass it\n- HIGH-severity items that should become critical directives must be flagged for critic gate validation\n\nOUTPUT FORMAT:\nPOST_MORTEM_REPORT:\nplan_id: [plan identifier]\ngenerated_at: [ISO timestamp]\n\nIMPROVEMENT_AGENDA:\n1. [priority] [description] \u2014 evidence: [artifact/event ref]\n2. ...\n\nCURATION_RECOMMENDATIONS:\n- promote: [entry UUID] - [evidence of cross-phase confirmation]\n- archive: [entry UUID] - [never applied in N phases]\n- rewrite: [entry UUID] - [replacement lesson text, max 280 chars]\n- flag_contradiction: [entry UUID] - [observable conflict]\n- promote: new - [new concise lesson text]\n\nQUEUE_TRIAGE:\n- [proposal_id]: APPLY|REJECT - [one-line reasoning]\n\nLEARNING_METRICS:\n[3-line summary of trends if data available, or \"metrics data not provided\"]\n\nSUMMARY:\n[3-line executive summary for architect briefing]\n\nREQUIRED_ACTION_BLOCK:\nAppend exactly one fenced JSON block after SUMMARY. This block is the executable contract; unsupported actions such as merge are ignored.\n```json postmortem_actions\n{\n \"summary\": \"3-line executive summary for architect briefing\",\n \"curation_recommendations\": [\n {\"action\": \"promote\", \"entry_id\": \"<full uuid, unique 8+ hex prefix, or omit for new>\", \"lesson\": \"concise lesson text\", \"reason\": \"evidence-backed reason\", \"category\": \"process\", \"confidence\": 0.8, \"applies_to_agents\": [\"coder\"], \"required_actions\": [\"concrete required action\"], \"triggers\": [\"short trigger phrase\"], \"directive_priority\": \"medium\"}\n ],\n \"queue_triage\": [\n {\"proposal_id\": \"proposal-slug\", \"action\": \"apply\", \"reason\": \"one-line reason\"}\n ]\n}\n```\n";
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
export declare const CANDIDATE_SEVERITIES: readonly ["INFO", "LOW", "MEDIUM", "HIGH", "CRITICAL"];
|
|
2
|
+
export type CandidateSeverity = (typeof CANDIDATE_SEVERITIES)[number];
|
|
3
|
+
export declare const CANDIDATE_CONFIDENCES: readonly ["HIGH", "MEDIUM", "LOW"];
|
|
4
|
+
export type CandidateConfidence = (typeof CANDIDATE_CONFIDENCES)[number];
|
|
5
|
+
export type RowFormatFamily = 'base_explorer' | 'micro_lane';
|
|
6
|
+
export declare const CANDIDATE_FIELD_COUNT = 9;
|
|
7
|
+
export declare const CLEAN_FIELD_COUNT = 4;
|
|
8
|
+
export declare const CLEAN_COVERAGE_SCOPE_MIN_CHARS = 12;
|
|
9
|
+
export declare const CLEAN_EVIDENCE_MIN_CHARS = 20;
|
|
10
|
+
export declare const CANDIDATE_DIAGNOSTIC_PREVIEW_CHARS = 160;
|
|
11
|
+
export declare const CANDIDATE_FIELDS: {
|
|
12
|
+
readonly base_explorer: readonly ["candidate_id", "lane", "severity", "category", "file_line", "claim", "evidence_summary", "impact_context", "confidence"];
|
|
13
|
+
readonly micro_lane: readonly ["candidate_id", "micro_lane", "severity", "category", "file_line", "claim", "invariant_violated", "evidence_summary", "confidence"];
|
|
14
|
+
};
|
|
15
|
+
/** Identify only an exact, marker-bearing canonical candidate header. */
|
|
16
|
+
export declare function candidateHeaderFamily(fields: readonly string[]): RowFormatFamily | null;
|
|
17
|
+
/** Remove fenced markdown blocks before any candidate-contract inspection. */
|
|
18
|
+
export declare function removeCandidateCodeFences(text: string): string;
|
|
19
|
+
export type CandidateFieldName = (typeof CANDIDATE_FIELDS)[RowFormatFamily][number];
|
|
20
|
+
export interface CandidateFieldIssue {
|
|
21
|
+
field: CandidateFieldName | 'row';
|
|
22
|
+
message: string;
|
|
23
|
+
}
|
|
24
|
+
export interface CandidateFieldAnalysis {
|
|
25
|
+
valid: boolean;
|
|
26
|
+
issues: CandidateFieldIssue[];
|
|
27
|
+
values: Record<CandidateFieldName, string | null>;
|
|
28
|
+
candidateId: string | null;
|
|
29
|
+
workflowLane: string | null;
|
|
30
|
+
}
|
|
31
|
+
export interface CandidateLaneContext {
|
|
32
|
+
row_format_family?: RowFormatFamily;
|
|
33
|
+
expected_family?: RowFormatFamily;
|
|
34
|
+
expected_lane?: string;
|
|
35
|
+
expected_lanes?: readonly string[];
|
|
36
|
+
expected_micro_lane?: string;
|
|
37
|
+
expected_micro_lanes?: readonly string[];
|
|
38
|
+
}
|
|
39
|
+
export interface CandidateLaneContextIssue {
|
|
40
|
+
field: 'expected_family' | 'expected_lane' | 'expected_lanes' | 'expected_micro_lane' | 'expected_micro_lanes';
|
|
41
|
+
message: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Validate the relationships between the public ownership flags. Keeping this
|
|
45
|
+
* rule here makes the tool boundary and the pure parser refuse the same
|
|
46
|
+
* ambiguous or cross-family ownership declarations.
|
|
47
|
+
*/
|
|
48
|
+
export declare function analyzeCandidateLaneContext(context: CandidateLaneContext): CandidateLaneContextIssue[];
|
|
49
|
+
export type CleanFieldName = 'row' | 'lane' | 'micro_lane' | 'coverage_scope' | 'evidence';
|
|
50
|
+
export interface CleanFieldAnalysis {
|
|
51
|
+
valid: boolean;
|
|
52
|
+
issues: Array<{
|
|
53
|
+
field: CleanFieldName;
|
|
54
|
+
message: string;
|
|
55
|
+
}>;
|
|
56
|
+
lane: string | null;
|
|
57
|
+
coverageScope: string | null;
|
|
58
|
+
evidence: string | null;
|
|
59
|
+
}
|
|
60
|
+
export interface CleanAttestationBaseRecord {
|
|
61
|
+
record_type: 'clean_attestation';
|
|
62
|
+
row_format_family: 'base_explorer';
|
|
63
|
+
row_format_version: number;
|
|
64
|
+
record_version: {
|
|
65
|
+
major: number;
|
|
66
|
+
minor: number;
|
|
67
|
+
};
|
|
68
|
+
source_output_ref: string;
|
|
69
|
+
source_batch_id: string;
|
|
70
|
+
source_lane_id: string;
|
|
71
|
+
source_agent: string;
|
|
72
|
+
source_digest: string;
|
|
73
|
+
extracted_from_partial_source: false;
|
|
74
|
+
sessionId?: string;
|
|
75
|
+
parentSessionId?: string;
|
|
76
|
+
producer?: string;
|
|
77
|
+
lane: string;
|
|
78
|
+
coverage_scope: string;
|
|
79
|
+
evidence: string;
|
|
80
|
+
}
|
|
81
|
+
export interface CleanAttestationMicroRecord {
|
|
82
|
+
record_type: 'clean_attestation';
|
|
83
|
+
row_format_family: 'micro_lane';
|
|
84
|
+
row_format_version: number;
|
|
85
|
+
record_version: {
|
|
86
|
+
major: number;
|
|
87
|
+
minor: number;
|
|
88
|
+
};
|
|
89
|
+
source_output_ref: string;
|
|
90
|
+
source_batch_id: string;
|
|
91
|
+
source_lane_id: string;
|
|
92
|
+
source_agent: string;
|
|
93
|
+
source_digest: string;
|
|
94
|
+
extracted_from_partial_source: false;
|
|
95
|
+
sessionId?: string;
|
|
96
|
+
parentSessionId?: string;
|
|
97
|
+
producer?: string;
|
|
98
|
+
micro_lane: string;
|
|
99
|
+
coverage_scope: string;
|
|
100
|
+
evidence: string;
|
|
101
|
+
}
|
|
102
|
+
export type CleanAttestationRecord = CleanAttestationBaseRecord | CleanAttestationMicroRecord;
|
|
103
|
+
export declare function splitPipeFields(line: string): string[];
|
|
104
|
+
export declare function candidateDiagnosticPreview(value: string): string;
|
|
105
|
+
export declare function isCandidateSeverity(value: string | null | undefined): value is CandidateSeverity;
|
|
106
|
+
export declare function isCandidateConfidence(value: string | null | undefined): value is CandidateConfidence;
|
|
107
|
+
export declare function isCandidateLookingShortRow(fields: string[], _context: CandidateLaneContext, explicitCandidateMarker?: boolean): boolean;
|
|
108
|
+
/** Validate one marker-stripped canonical candidate row. */
|
|
109
|
+
export declare function analyzeCandidateFields(fields: readonly string[], family: RowFormatFamily): CandidateFieldAnalysis;
|
|
110
|
+
/** Validate one canonical CLEAN row, including its marker and lane identity. */
|
|
111
|
+
export declare function analyzeCleanFields(fields: readonly string[], family: RowFormatFamily, expectedLane?: string): CleanFieldAnalysis;
|
|
112
|
+
/** Analyze one raw artifact line when it explicitly carries the marker. */
|
|
113
|
+
export declare function analyzeCandidateLine(line: string, family: RowFormatFamily): CandidateFieldAnalysis | null;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { type CandidateConfidence, type CandidateSeverity, type RowFormatFamily, type CleanAttestationRecord as SharedCleanAttestationRecord } from './candidate-contract';
|
|
2
3
|
declare const ArtifactInputSchema: z.ZodObject<{
|
|
3
4
|
output_ref: z.ZodString;
|
|
4
5
|
batchId: z.ZodString;
|
|
@@ -28,18 +29,16 @@ declare const ParseFlagsSchema: z.ZodObject<{
|
|
|
28
29
|
row_format_version: z.ZodNumber;
|
|
29
30
|
producer: z.ZodOptional<z.ZodString>;
|
|
30
31
|
expected_family: z.ZodOptional<z.ZodEnum<{
|
|
31
|
-
micro_lane: "micro_lane";
|
|
32
32
|
base_explorer: "base_explorer";
|
|
33
|
+
micro_lane: "micro_lane";
|
|
33
34
|
}>>;
|
|
35
|
+
expected_lane: z.ZodOptional<z.ZodString>;
|
|
36
|
+
expected_lanes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
34
37
|
expected_micro_lane: z.ZodOptional<z.ZodString>;
|
|
35
38
|
expected_micro_lanes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
36
39
|
}, z.core.$strict>;
|
|
37
40
|
export type ArtifactInput = z.infer<typeof ArtifactInputSchema>;
|
|
38
41
|
export type ParseFlags = z.infer<typeof ParseFlagsSchema>;
|
|
39
|
-
/**
|
|
40
|
-
* The two supported pipe-delimited format families produced by lane agents.
|
|
41
|
-
*/
|
|
42
|
-
export type RowFormatFamily = 'base_explorer' | 'micro_lane';
|
|
43
42
|
/**
|
|
44
43
|
* A single parsed candidate record extracted from lane text.
|
|
45
44
|
*/
|
|
@@ -63,37 +62,17 @@ export interface CandidateRecord {
|
|
|
63
62
|
candidate_id: string;
|
|
64
63
|
lane: string | null;
|
|
65
64
|
micro_lane: string | null;
|
|
66
|
-
severity:
|
|
65
|
+
severity: CandidateSeverity | null;
|
|
67
66
|
category: string | null;
|
|
68
67
|
file_line: string | null;
|
|
69
68
|
claim: string | null;
|
|
70
69
|
evidence_summary: string | null;
|
|
71
70
|
impact_context: string | null;
|
|
72
71
|
invariant_violated: string | null;
|
|
73
|
-
confidence:
|
|
74
|
-
}
|
|
75
|
-
/** A machine-readable attestation that a complete micro-lane found no candidates. */
|
|
76
|
-
export interface CleanAttestationRecord {
|
|
77
|
-
record_type: 'clean_attestation';
|
|
78
|
-
row_format_family: 'micro_lane';
|
|
79
|
-
row_format_version: number;
|
|
80
|
-
record_version: {
|
|
81
|
-
major: number;
|
|
82
|
-
minor: number;
|
|
83
|
-
};
|
|
84
|
-
source_output_ref: string;
|
|
85
|
-
source_batch_id: string;
|
|
86
|
-
source_lane_id: string;
|
|
87
|
-
source_agent: string;
|
|
88
|
-
source_digest: string;
|
|
89
|
-
extracted_from_partial_source: false;
|
|
90
|
-
sessionId?: string;
|
|
91
|
-
parentSessionId?: string;
|
|
92
|
-
producer?: string;
|
|
93
|
-
micro_lane: string;
|
|
94
|
-
coverage_scope: string;
|
|
95
|
-
evidence: string;
|
|
72
|
+
confidence: CandidateConfidence | null;
|
|
96
73
|
}
|
|
74
|
+
/** A machine-readable attestation that a complete lane found no candidates. */
|
|
75
|
+
export type CleanAttestationRecord = SharedCleanAttestationRecord;
|
|
97
76
|
/**
|
|
98
77
|
* One invocation-envelope record per parseCandidates call.
|
|
99
78
|
* Part of the return value but not persisted to a sidecar in this phase.
|