@squadrules/mcp 5.3.0 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +33 -78
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/config/mem-boot.d.ts +3 -0
  4. package/dist/config/mem-boot.d.ts.map +1 -0
  5. package/dist/config/mem-boot.js +21 -0
  6. package/dist/config/mem-boot.js.map +1 -0
  7. package/dist/embed-docs/mem/README.md +13 -6
  8. package/dist/embed-docs/mem/adapter-migration.md +20 -19
  9. package/dist/embed-docs/mem/bulk-insert-adapters-via-cli.md +9 -8
  10. package/dist/embed-docs/mem/challenge-type-guide.md +4 -4
  11. package/dist/embed-docs/mem/create-new-protocol.md +42 -33
  12. package/dist/embed-docs/mem/critic-loop-guide.md +263 -0
  13. package/dist/embed-docs/mem/{phase-critic.md → critic-loop.md} +46 -22
  14. package/dist/embed-docs/mem/protocol-linking-guide.md +4 -4
  15. package/dist/embed-docs/mem/refine-search.md +1 -1
  16. package/dist/embed-docs/mem/skill-format-guide.md +2 -2
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +6 -3
  19. package/dist/index.js.map +1 -1
  20. package/dist/resources/embedded-mcp-resources.d.ts +2 -2
  21. package/dist/resources/embedded-mcp-resources.js +12 -12
  22. package/dist/resources/embedded-mcp-resources.js.map +1 -1
  23. package/dist/resources/mem-resources-boot.d.ts.map +1 -1
  24. package/dist/resources/mem-resources-boot.js +19 -14
  25. package/dist/resources/mem-resources-boot.js.map +1 -1
  26. package/dist/services/memory/memory-accessors.d.ts +10 -0
  27. package/dist/services/memory/memory-accessors.d.ts.map +1 -1
  28. package/dist/services/memory/memory-accessors.js +19 -0
  29. package/dist/services/memory/memory-accessors.js.map +1 -1
  30. package/dist/services/memory/store.d.ts.map +1 -1
  31. package/dist/services/memory/store.js +2 -2
  32. package/dist/services/memory/store.js.map +1 -1
  33. package/dist/services/vector-store/lancedb/lance-records-reads.d.ts.map +1 -1
  34. package/dist/services/vector-store/lancedb/lance-records-reads.js +2 -2
  35. package/dist/services/vector-store/lancedb/lance-records-reads.js.map +1 -1
  36. package/dist/tools/mcp-tool-input-teaching.js +8 -8
  37. package/dist/tools/mcp-tool-input-teaching.js.map +1 -1
  38. package/dist/tools/review-evidence-check.d.ts +1 -1
  39. package/dist/tools/review-evidence-check.js +4 -4
  40. package/dist/tools/review-evidence-check.js.map +1 -1
  41. package/dist/tools/train_schema.js +4 -4
  42. package/dist/tools/train_schema.js.map +1 -1
  43. package/dist/tools/tune_schema.js +3 -3
  44. package/dist/tools/tune_schema.js.map +1 -1
  45. package/dist/ui/assets/{AccountPage-DhaO-G9K.js → AccountPage-r5IOzWyQ.js} +1 -1
  46. package/dist/ui/assets/{index-BtwABqCT.js → index-B80vBrUV.js} +2 -2
  47. package/dist/ui/assets/index-CSUUmfdT.css +2 -0
  48. package/dist/ui/index.html +2 -2
  49. package/package.json +1 -1
  50. package/dist/embed-docs/mem/phase-critic-guide.md +0 -199
  51. package/dist/ui/assets/index-fBTJW4Qq.css +0 -2
@@ -0,0 +1,3 @@
1
+ /** Force delete-then-retrain of all shipped adapters at boot (repair path). */
2
+ export declare const MEM_BOOT_FORCE_INJECT: boolean;
3
+ //# sourceMappingURL=mem-boot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mem-boot.d.ts","sourceRoot":"","sources":["../../src/config/mem-boot.ts"],"names":[],"mappings":"AAkBA,+EAA+E;AAC/E,eAAO,MAAM,qBAAqB,SAAgD,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Boot-injection force switch (ADR 0002 / issue #24) — kept out of `config.ts`
3
+ * to satisfy the max-lines budget, following the `src/config/*` convention.
4
+ *
5
+ * Normal boots leave this false so `injectMemResourcesAtBoot` honours the
6
+ * version-based reuse skip: an app-space adapter already stored at (or newer
7
+ * than) its shipped version is left untouched instead of being deleted and
8
+ * re-embedded on every start. Setting `MEM_BOOT_FORCE_INJECT=true` is the
9
+ * structural-repair escape hatch — it bypasses the version check and forces a
10
+ * delete-then-retrain of every shipped adapter, which is how an operator
11
+ * recovers a corrupted or duplicated app-space store without a code change.
12
+ */
13
+ function getEnvBoolean(key, defaultValue) {
14
+ const raw = process.env[key];
15
+ if (raw === undefined || raw.trim() === '')
16
+ return defaultValue;
17
+ return ['1', 'true', 'yes', 'on'].includes(raw.trim().toLowerCase());
18
+ }
19
+ /** Force delete-then-retrain of all shipped adapters at boot (repair path). */
20
+ export const MEM_BOOT_FORCE_INJECT = getEnvBoolean('MEM_BOOT_FORCE_INJECT', false);
21
+ //# sourceMappingURL=mem-boot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mem-boot.js","sourceRoot":"","sources":["../../src/config/mem-boot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,SAAS,aAAa,CAAC,GAAW,EAAE,YAAqB;IACvD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,YAAY,CAAC;IAChE,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;AACvE,CAAC;AAED,+EAA+E;AAC/E,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC"}
@@ -5,7 +5,7 @@ documents that are injected into the Squadrules app space at boot.
5
5
 
6
6
  <!-- squadrules-doc-keep: directory-local authority for the shipped meta-protocol bundle (slugs, versions, chain-linking rules); source of truth for these files, not a restatement of wiki Core Concepts -->
7
7
 
8
- Version: **4.2.0**
8
+ Version: **4.3.0**
9
9
 
10
10
  ## Philosophy
11
11
 
@@ -16,6 +16,13 @@ time: discovery, clarification, ideation, planning, execution, validation,
16
16
  review, and handoff. The bundle prefers truth, explicit sequencing, and
17
17
  observable verification over polished but weak wording.
18
18
 
19
+ **Autonomy (AI-ownership).** The bundle is written for autonomous execution:
20
+ adapters resolve intent from context, run critic-loop in a loop until it returns
21
+ `PASS`, and gate irreversible remote mutations with objective pre/post contracts
22
+ (shell/mcp) rather than human confirmation. They do **not** stop to ask a human to
23
+ approve or acknowledge. Human escalation is reserved for genuinely ambiguous intent
24
+ or a hard blocker (a required tool/auth that cannot be established automatically).
25
+
19
26
  Bundled mem resources that intentionally use **protocol** and **adapter** as
20
27
  synonyms. Prefer **adapter** in new copy when you are not mirroring user-facing trigger phrases.
21
28
 
@@ -25,13 +32,13 @@ synonyms. Prefer **adapter** in new copy when you are not mirroring user-facing
25
32
  |------|------|---------|
26
33
  | [create-new-protocol.md](create-new-protocol.md) | `create-new-protocol` | Authoring adapter — create, review, or refactor SQUADRULES protocols |
27
34
  | [refine-search.md](refine-search.md) | `refine-search` | Refine search — recover user intent after failed `activate` |
28
- | [phase-critic.md](phase-critic.md) | `phase-critic` | Phase-boundary adversarial review — verify claims against evidence |
35
+ | [critic-loop.md](critic-loop.md) | `critic-loop` | Phase-boundary adversarial review — verify claims against evidence |
29
36
  | [adapter-migration.md](adapter-migration.md) | `adapter-migration` | Batch structural migration — update all adapters to latest scheme |
30
37
 
31
38
  ### Linked authoring flow
32
39
 
33
40
  ```text
34
- create-new-protocol (Author) → forward(squadrules://adapter/phase-critic) → phase-critic (Phase-Critic Review) → train (with review_evidence)
41
+ create-new-protocol (Author) → forward(squadrules://adapter/critic-loop) → critic-loop (Critic-Loop Review) → train (with review_evidence)
35
42
  ```
36
43
 
37
44
  ## Reference Documents
@@ -40,7 +47,7 @@ create-new-protocol (Author) → forward(squadrules://adapter/phase-critic) →
40
47
  |------|------|---------|
41
48
  | [challenge-type-guide.md](challenge-type-guide.md) | `challenge-type-guide` | Challenge type selection, interpreter choice, and stronger verification patterns |
42
49
  | [protocol-linking-guide.md](protocol-linking-guide.md) | `protocol-linking-guide` | Layers vs chains, `activate` vs `forward` + slug, chaining back/forward, multi-layer conductor vs extension URI, chain-root collapsing, MCP argument validation |
43
- | [phase-critic-guide.md](phase-critic-guide.md) | `phase-critic-guide` | Phase-critic integration rules, mutation gates, solution check vs critic decision table |
50
+ | [critic-loop-guide.md](critic-loop-guide.md) | `critic-loop-guide` | Critic-loop integration rules, mutation gates, solution check vs critic decision table |
44
51
 
45
52
  ## Cross-Protocol Linking
46
53
 
@@ -55,7 +62,7 @@ cohesive concern.
55
62
  - the adapter exceeds 350 lines
56
63
  - weaker models cannot follow the full adapter in one pass
57
64
  - runtime routing to different adapters is needed (Router pattern)
58
- - a step is reusable across multiple parent adapters (e.g. `phase-critic`)
65
+ - a step is reusable across multiple parent adapters (e.g. `critic-loop`)
59
66
 
60
67
  Chaining is NOT a replacement for layers. A 6-step protocol that fits in 350
61
68
  lines should stay as one adapter with 6 H2 layers.
@@ -65,7 +72,7 @@ lines should stay as one adapter with 6 H2 layers.
65
72
  Both system and user-authored adapters chain using slugs in `next_action`:
66
73
 
67
74
  ```text
68
- call forward with squadrules://adapter/phase-critic and no solution to start the phase critic
75
+ call forward with squadrules://adapter/critic-loop and no solution to start the critic loop
69
76
  call forward with squadrules://adapter/implement-terraform and no solution to start this adapter
70
77
  ```
71
78
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- version: "5.3.0"
2
+ version: "5.4.0"
3
3
  slug: adapter-migration
4
4
  title: Adapter Migration Protocol
5
5
  ---
@@ -8,7 +8,7 @@ title: Adapter Migration Protocol
8
8
 
9
9
  Batch-migrate all adapters in a space to the current structural scheme. Exports
10
10
  every adapter, applies conservative structural transformations, reports changes
11
- per adapter, and re-trains only after user approval.
11
+ per adapter, and re-trains the conforming subset autonomously.
12
12
 
13
13
  This protocol handles structural migrations only — it preserves semantic content
14
14
  (steps, intent, examples) while updating format, headings, and contract shapes
@@ -30,7 +30,7 @@ to match the latest SQUADRULES requirements.
30
30
 
31
31
  **Must Never:**
32
32
  - Alter semantic content (step text, trigger phrases, examples, intent).
33
- - Auto-train without showing the user a change report first.
33
+ - Auto-train an adapter without first producing a per-adapter change report.
34
34
  - Guess transformations when the adapter structure is ambiguous.
35
35
  - Delete adapters or layers during migration.
36
36
  - Migrate adapters that already conform (report them as "no changes needed").
@@ -39,7 +39,7 @@ to match the latest SQUADRULES requirements.
39
39
  - Export every adapter before making any changes.
40
40
  - Apply only conservative, reversible structural transformations.
41
41
  - Flag ambiguous cases for manual review instead of guessing.
42
- - Show a per-adapter change report before executing any writes.
42
+ - Produce a per-adapter change report before executing any writes.
43
43
  - Preserve the adapter's slug, version, and chain_root fields.
44
44
 
45
45
  **Good trigger examples:**
@@ -59,9 +59,10 @@ Before running migration, verify readiness:
59
59
  1. `export` tool is available and callable.
60
60
  2. `tune` and `train` tools are available for writes.
61
61
  3. Target space is identified (personal or a named group space).
62
- 4. User understands this is a structural-only migration.
62
+ 4. The migration is structural-only (no semantic changes).
63
63
 
64
- If any tool is unavailable, stop and ask the user to fix the connection.
64
+ If any tool is unavailable, stop and report the connection blocker with
65
+ remediation guidance.
65
66
 
66
67
  ```json
67
68
  {"contract":{"type":"comment","comment":{"min_length":80},"required":true}}
@@ -98,16 +99,16 @@ For each exported adapter, perform structural analysis and apply migrations.
98
99
  existing `chain_root` when present.
99
100
  5. **Line count** — adapters exceeding 350 lines must be flagged for splitting
100
101
  (do NOT auto-split; report as manual review needed).
101
- 6. **Phase-critic integration** — check whether the adapter includes at least
102
- one `phase-critic` chain link. If not, add a recommendation (do NOT
102
+ 6. **Critic-loop integration** — check whether the adapter includes at least
103
+ one `critic-loop` chain link. If not, add a recommendation (do NOT
103
104
  auto-add; report as suggestion).
104
105
 
105
106
  ### Transformation rules
106
107
 
107
108
  - **Conservative only:** If a transformation might change meaning, skip it and
108
109
  flag for manual review.
109
- - **Reversible:** Every change must be expressible as a diff so the user can
110
- reject individual changes.
110
+ - **Reversible:** Every change must be expressible as a diff so it is auditable
111
+ and reversible.
111
112
  - **Idempotent:** Running migration twice on the same adapter produces no
112
113
  additional changes.
113
114
 
@@ -123,7 +124,7 @@ For each adapter, produce:
123
124
 
124
125
  ## Report Changes
125
126
 
126
- Present a summary table to the user:
127
+ Record a summary table:
127
128
 
128
129
  | Adapter slug | Status | Changes | Warnings |
129
130
  |-------------|--------|---------|----------|
@@ -138,18 +139,18 @@ For each adapter with `needs_changes`, show the specific transformations:
138
139
  For each adapter with `needs_manual_review`, explain what needs human
139
140
  attention and why the protocol cannot auto-fix it.
140
141
 
141
- Ask the user to choose:
142
- - **Apply all** — train all `needs_changes` adapters.
143
- - **Select individually** — choose which adapters to update.
144
- - **Abort** — cancel the migration without changes.
142
+ Apply the migration autonomously:
143
+ - **Apply all** `needs_changes` adapters.
144
+ - **Leave untouched** every `needs_manual_review` adapter and report it with the
145
+ reason it cannot be auto-fixed.
145
146
 
146
147
  ```json
147
- {"contract":{"type":"user_input","user_input":{"prompt":"Review the migration report above. Choose: apply all, select individually, or abort."},"required":true}}
148
+ {"contract":{"type":"comment","comment":{"min_length":120},"required":true}}
148
149
  ```
149
150
 
150
151
  ## Execute Migration
151
152
 
152
- For each approved adapter, apply the structural changes:
153
+ For each `needs_changes` adapter, apply the structural changes:
153
154
 
154
155
  1. For adapters needing only content-level fixes (heading reorder, fence
155
156
  conversion, field rename): use `tune` with the transformed content and
@@ -166,7 +167,7 @@ Do NOT change the adapter's space assignment during migration.
166
167
 
167
168
  ## Verify and Report
168
169
 
169
- After executing all approved migrations:
170
+ After executing all migrations:
170
171
 
171
172
  1. Re-export each migrated adapter to verify structural compliance.
172
173
  2. Report final status:
@@ -180,7 +181,7 @@ After executing all approved migrations:
180
181
  | Flagged for manual review | N |
181
182
 
182
183
  3. For each failure, report the error message and suggested fix.
183
- 4. Recommend running `phase-critic` on migrated adapters to verify semantic
184
+ 4. Recommend running `critic-loop` on migrated adapters to verify semantic
184
185
  integrity after structural changes.
185
186
 
186
187
  ```json
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  slug: bulk-insert-adapters-via-cli
3
- version: "5.3.0"
3
+ version: "5.4.0"
4
4
  title: Bulk Insert Adapters via SQUADRULES CLI
5
5
  ---
6
6
 
@@ -65,9 +65,9 @@ If any check fails, stop and report the issue with remediation guidance.
65
65
  {"contract":{"type":"shell","shell":{"cmd":"squadrules --version && squadrules token > /dev/null 2>&1 && echo 'auth: ok'","timeout_seconds":15},"required":true}}
66
66
  ```
67
67
 
68
- ## Confirm Scope
68
+ ## Resolve Scope Autonomously
69
69
 
70
- Present the batch operation details to the user:
70
+ Resolve and record the batch operation details:
71
71
 
72
72
  1. **Source directory** — absolute path.
73
73
  2. **File count** — number of `.md` files found (recursive or flat).
@@ -75,10 +75,11 @@ Present the batch operation details to the user:
75
75
  4. **Force mode** — whether `--force` will be used (overwrites existing).
76
76
  5. **Model attribution** — which `--model` value to use.
77
77
 
78
- List the files that will be trained and ask for confirmation.
78
+ List the files that will be trained, record the resolved scope, and proceed
79
+ autonomously — no confirmation prompt.
79
80
 
80
81
  ```json
81
- {"contract":{"type":"user_input","user_input":{"prompt":"Confirm batch scope: directory, file list, target space, force mode, and model ID"},"required":true}}
82
+ {"contract":{"type":"comment","comment":{"min_length":80},"required":true}}
82
83
  ```
83
84
 
84
85
  ## Validate Structure
@@ -91,9 +92,9 @@ Before training, validate each `.md` file against SQUADRULES adapter requirement
91
92
  - Contains at least one fenced `json` block with a top-level `contract` object.
92
93
  - Does not exceed 350 lines.
93
94
 
94
- Report any files that fail validation. Ask user whether to:
95
- - skip invalid files and proceed with valid ones
96
- - abort and fix issues first
95
+ Report any files that fail validation, then proceed autonomously: skip the invalid
96
+ files, train the valid subset, and document every skipped file with its validation
97
+ error and a suggested fix. Do not stop to ask the user.
97
98
 
98
99
  ```json
99
100
  {"contract":{"type":"shell","shell":{"cmd":"echo 'Validation complete — see output above for results'","timeout_seconds":30},"required":true}}
@@ -1,5 +1,5 @@
1
1
  ---
2
- version: "5.3.0"
2
+ version: "5.4.0"
3
3
  slug: challenge-type-guide
4
4
  title: Challenge Type Selection Guide
5
5
  ---
@@ -15,7 +15,7 @@ drafting and review.
15
15
  ## Activation Patterns
16
16
 
17
17
  **Typically invoked by:** `create-new-protocol` and
18
- `phase-critic`.
18
+ `critic-loop`.
19
19
 
20
20
  **Can be invoked directly when agent needs:**
21
21
  - "challenge type reference" / "which challenge type to use"
@@ -39,7 +39,7 @@ drafting and review.
39
39
 
40
40
  **Bad trigger examples:**
41
41
  - "Create a new protocol" → use `create-new-protocol`
42
- - "Review my protocol draft" → use `phase-critic`
42
+ - "Review my protocol draft" → use `critic-loop`
43
43
 
44
44
  ## Core Rules
45
45
 
@@ -243,7 +243,7 @@ to avoid collisions between parallel sessions.
243
243
  **Phase-batch with critic**
244
244
  - batch related TODO items into one phase
245
245
  - verify hard artifacts with shell
246
- - then call `phase-critic` for adversarial review
246
+ - then call `critic-loop` for adversarial review
247
247
 
248
248
  **Dry-run before execution**
249
249
  - dry-run command
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  slug: create-new-protocol
3
- version: "5.3.0"
3
+ version: "5.4.0"
4
4
  title: Create / Review / Refactor SQUADRULES Protocol
5
5
  ---
6
6
 
@@ -67,7 +67,7 @@ as synonyms. Supports three operations:
67
67
  - "No match found; I want to create a new protocol" → run this protocol (create)
68
68
  - "Review all v4 protocol families for missing cross-references" → run this protocol (review)
69
69
  - "Update the MR adapter to include a review step" → run this protocol (update)
70
- - "Edit the phase-critic adapter triggers" → run this protocol (update)
70
+ - "Edit the critic-loop adapter triggers" → run this protocol (update)
71
71
  - "Refactor the MR adapter to be less ambiguous" → run this protocol (update)
72
72
 
73
73
  **Bad trigger examples:**
@@ -85,19 +85,19 @@ run:
85
85
  2. Required CLI tools for planned shell steps are installed and callable.
86
86
  3. Required auth/session state is valid for the target MCP server.
87
87
 
88
- If any check fails, stop before main execution and ask the user to choose one:
89
- - proceed with AI-assisted setup and then resume
90
- - abort this protocol run now
91
-
92
- Do not continue to intent confirmation until preflight passes.
88
+ If any check fails, attempt AI-assisted remediation automatically (install or
89
+ configure the missing tool, refresh auth/session), then re-run preflight. Only
90
+ hard-stop when a required tool or auth genuinely cannot be established
91
+ autonomously; report the concrete blocker and the remediation already attempted.
92
+ Do not continue to intent resolution until preflight passes.
93
93
 
94
94
  ```json
95
95
  {"contract":{"type":"comment","comment":{"min_length":80},"required":true}}
96
96
  ```
97
97
 
98
- ## Confirm Intent
98
+ ## Resolve Intent Autonomously
99
99
 
100
- Infer `{operation}` from the user's trigger:
100
+ Infer `{operation}` from the user's trigger — do not stop to ask for confirmation:
101
101
 
102
102
  | Signal | Operation |
103
103
  |---|---|
@@ -105,12 +105,15 @@ Infer `{operation}` from the user's trigger:
105
105
  | "review", "audit", "check", "gaps", "cross-references" | **review** |
106
106
  | "update", "edit", "fix", "modify", "change", "improve", "patch", "refactor", "add missing", "correct" | **update** |
107
107
 
108
- For `create`: ask whether to create a new protocol or refine the search.
109
- For `review`: ask which adapter(s), family, or bundle to review.
110
- For `update`: ask which adapter to update and what the issue is.
108
+ Resolve the target from context without a confirmation prompt: for `create`,
109
+ proceed to author a new adapter; for `review`, select the adapter(s), family, or
110
+ bundle named or implied by the request; for `update`, select the adapter and the
111
+ specific issue. Record the inferred operation and target, then continue. Escalate
112
+ to the user only when the request is genuinely ambiguous and no reasonable default
113
+ exists.
111
114
 
112
115
  ```json
113
- {"contract":{"type":"user_input","user_input":{"prompt":"Confirm operation and target"},"required":true}}
116
+ {"contract":{"type":"comment","comment":{"min_length":80},"required":true}}
114
117
  ```
115
118
 
116
119
  ## Gather Requirements
@@ -175,11 +178,11 @@ Export target adapter(s). For each adapter, check:
175
178
  use explicit `forward` when the next adapter slug is already known; reserve
176
179
  `activate` for ambiguous runtime discovery (see `protocol-linking-guide`,
177
180
  **Chaining Back and Forward**).
178
- 12. **Phase-critic integration** — does the adapter include phase-critic chain
179
- links at major phase boundaries? Does each phase-critic invocation have a
181
+ 12. **Critic-loop integration** — does the adapter include critic-loop chain
182
+ links at major phase boundaries? Does each critic-loop invocation have a
180
183
  FAIL gate shell contract (`grep -qi '^PASS$'` on the verdict file)? Are
181
184
  solution checks restricted to irreversible remote mutations (see
182
- `phase-critic-guide`)?
185
+ `critic-loop-guide`)?
183
186
 
184
187
  ### For `update` — identify the specific issue
185
188
 
@@ -267,8 +270,8 @@ H2 Reward Signal. Frontmatter: `slug` (required), `version` (optional),
267
270
  **Challenge types:** Load `challenge-type-guide` for decision rules and JSON
268
271
  formats (`forward` with `squadrules://adapter/challenge-type-guide`).
269
272
 
270
- **Phase-critic and mutation gates:** Load `phase-critic-guide` for placement,
271
- FAIL gate, and solution check rules (`forward` with `squadrules://adapter/phase-critic-guide`).
273
+ **Critic-loop and mutation gates:** Load `critic-loop-guide` for placement,
274
+ FAIL gate, and solution check rules (`forward` with `squadrules://adapter/critic-loop-guide`).
272
275
 
273
276
  **If Router pattern:** draft the router and each extension as separate files.
274
277
 
@@ -278,13 +281,13 @@ Post the full drafted markdown.
278
281
  {"contract":{"type":"comment","comment":{"min_length":120},"required":true}}
279
282
  ```
280
283
 
281
- ## Phase-Critic Review (create and update only)
284
+ ## Critic-Loop Review (create and update only)
282
285
 
283
- For `create` and `update`: run phase-critic against the drafted markdown before
284
- presenting to the user. This is the quality gate — the agent owns content, the
285
- critic owns quality.
286
+ For `create` and `update`: run critic-loop against the drafted markdown. This is an
287
+ autonomous quality loop — the agent owns content, the critic owns quality, and no
288
+ human approval is requested at any point.
286
289
 
287
- 1. Invoke phase-critic via `forward` with `squadrules://adapter/phase-critic`.
290
+ 1. Invoke critic-loop via `forward` with `squadrules://adapter/critic-loop`.
288
291
  Provide the drafted markdown as `input_file`, the slug as
289
292
  `calling_protocol_slug`, and "structural compliance and agent behaviour"
290
293
  as `verification_target`.
@@ -294,7 +297,9 @@ critic owns quality.
294
297
  {"contract":{"type":"shell","shell":{"cmd":"head -1 \"$VERDICT_FILE\" | grep -qi '^PASS$'","timeout_seconds":5},"required":true}}
295
298
  ```
296
299
 
297
- 3. If FAIL: address findings, re-invoke phase-critic. Do NOT proceed.
300
+ 3. If FAIL: address every finding, then re-invoke critic-loop and re-run the FAIL
301
+ gate. **Loop automatically until the verdict is PASS** — do not proceed and do
302
+ not ask the user whether to continue.
298
303
  4. If PASS: capture the verdict file path for the `review_evidence` field
299
304
  in the `train` call below.
300
305
 
@@ -304,29 +309,33 @@ For `review`: skip this step (read-only operation).
304
309
  {"contract":{"type":"comment","comment":{"min_length":80},"required":true}}
305
310
  ```
306
311
 
307
- ## User Review
312
+ ## Autonomous Review Gate
308
313
 
309
- For `create`: present the drafted protocol(s) and the phase-critic verdict.
310
- User acknowledges (informational, not an approval gate).
314
+ No human approval step. The critic-loop PASS verdict from the previous step is the
315
+ sole quality gate; once it is PASS, proceed directly to finalise.
311
316
 
312
- For `review`: present the findings report and ask which findings to act on.
317
+ For `create`: record the drafted adapter slug(s) and the critic-loop verdict, then
318
+ continue to `train`.
313
319
 
314
- For `update`: present the corrected markdown, change summary, and critic verdict.
320
+ For `review`: record the findings and the actions taken, then continue.
321
+
322
+ For `update`: record the corrected markdown, the change summary, and the critic
323
+ verdict, then continue.
315
324
 
316
325
  ```json
317
- {"contract":{"type":"user_input","user_input":{"prompt":"Acknowledge the draft and verdict (create/update) or review findings"},"required":true}}
326
+ {"contract":{"type":"comment","comment":{"min_length":80},"required":true}}
318
327
  ```
319
328
 
320
329
  ## FinaliseOperation
321
330
 
322
331
  For `create`: call `train` with the drafted markdown and `review_evidence`
323
- from the phase-critic step. Use `force_update: false` unless overwrite was
332
+ from the critic-loop step. Use `force_update: false` unless overwrite was
324
333
  explicitly requested.
325
334
 
326
335
  For `review`: do not call `train`. Save the findings report only if requested.
327
336
 
328
337
  For `update`: call `train` with `force_update: true`, `review_evidence` from
329
- the phase-critic step, and update the corresponding repo file.
338
+ the critic-loop step, and update the corresponding repo file.
330
339
 
331
340
  Report the outcome: adapter URI(s) for create / update, or findings summary for
332
341
  review.
@@ -339,7 +348,7 @@ review.
339
348
 
340
349
  Protocol complete when:
341
350
  - `create` — adapter(s) stored via `train` (with review_evidence) and URI(s) reported
342
- - `review` — findings report delivered and acknowledged
351
+ - `review` — findings report delivered
343
352
  - `update` — corrected adapter trained with `force_update: true` + review_evidence, repo file updated
344
353
 
345
354
  A successful result means the resulting SQUADRULES adapter is more truthful,