@squadrules/mcp 5.11.0 → 5.12.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.
Files changed (85) hide show
  1. package/README.md +15 -0
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/embed-docs/mem/README.md +34 -37
  4. package/dist/embed-docs/mem/adapter-migration.md +31 -40
  5. package/dist/embed-docs/mem/author-adapter.md +91 -229
  6. package/dist/embed-docs/mem/bulk-insert-adapters-via-cli.md +28 -44
  7. package/dist/embed-docs/mem/challenge-type-guide.md +89 -205
  8. package/dist/embed-docs/mem/critic-loop-guide.md +10 -8
  9. package/dist/embed-docs/mem/critic-loop.md +20 -41
  10. package/dist/embed-docs/mem/protocol-linking-guide.md +36 -81
  11. package/dist/embed-docs/mem/refine-search.md +10 -33
  12. package/dist/resources/embedded-mcp-resources.d.ts +0 -4
  13. package/dist/resources/embedded-mcp-resources.d.ts.map +1 -1
  14. package/dist/resources/embedded-mcp-resources.js +10 -14
  15. package/dist/resources/embedded-mcp-resources.js.map +1 -1
  16. package/dist/services/forward-runtime-store.d.ts +1 -5
  17. package/dist/services/forward-runtime-store.d.ts.map +1 -1
  18. package/dist/services/forward-runtime-store.js +1 -35
  19. package/dist/services/forward-runtime-store.js.map +1 -1
  20. package/dist/services/memory/validate-protocol-structure.d.ts.map +1 -1
  21. package/dist/services/memory/validate-protocol-structure.js +73 -4
  22. package/dist/services/memory/validate-protocol-structure.js.map +1 -1
  23. package/dist/services/qdrant/memory-retrieval.d.ts.map +1 -1
  24. package/dist/services/qdrant/memory-retrieval.js +1 -2
  25. package/dist/services/qdrant/memory-retrieval.js.map +1 -1
  26. package/dist/services/vector-store/lancedb/lance-records-reads.d.ts.map +1 -1
  27. package/dist/services/vector-store/lancedb/lance-records-reads.js +1 -2
  28. package/dist/services/vector-store/lancedb/lance-records-reads.js.map +1 -1
  29. package/dist/tools/forward-trace.d.ts +1 -4
  30. package/dist/tools/forward-trace.d.ts.map +1 -1
  31. package/dist/tools/forward-trace.js +1 -111
  32. package/dist/tools/forward-trace.js.map +1 -1
  33. package/dist/tools/forward-view.d.ts +0 -1
  34. package/dist/tools/forward-view.d.ts.map +1 -1
  35. package/dist/tools/forward-view.js +4 -44
  36. package/dist/tools/forward-view.js.map +1 -1
  37. package/dist/tools/forward.d.ts.map +1 -1
  38. package/dist/tools/forward.js +1 -4
  39. package/dist/tools/forward.js.map +1 -1
  40. package/dist/tools/forward_schema.d.ts +0 -46
  41. package/dist/tools/forward_schema.d.ts.map +1 -1
  42. package/dist/tools/forward_schema.js +7 -32
  43. package/dist/tools/forward_schema.js.map +1 -1
  44. package/dist/tools/next-pow-challenge-shape.d.ts.map +1 -1
  45. package/dist/tools/next-pow-challenge-shape.js +0 -7
  46. package/dist/tools/next-pow-challenge-shape.js.map +1 -1
  47. package/dist/tools/next-pow-helpers.d.ts.map +1 -1
  48. package/dist/tools/next-pow-helpers.js +0 -3
  49. package/dist/tools/next-pow-helpers.js.map +1 -1
  50. package/dist/tools/next_schema.d.ts +4 -4
  51. package/dist/tools/next_schema.js +2 -2
  52. package/dist/tools/next_schema.js.map +1 -1
  53. package/dist/tools/search_output.d.ts.map +1 -1
  54. package/dist/tools/search_output.js +0 -5
  55. package/dist/tools/search_output.js.map +1 -1
  56. package/dist/tools/shell-challenge-invocation.d.ts +8 -2
  57. package/dist/tools/shell-challenge-invocation.d.ts.map +1 -1
  58. package/dist/tools/shell-challenge-invocation.js +18 -7
  59. package/dist/tools/shell-challenge-invocation.js.map +1 -1
  60. package/dist/tools/squadrules-challenge-display.d.ts.map +1 -1
  61. package/dist/tools/squadrules-challenge-display.js +7 -9
  62. package/dist/tools/squadrules-challenge-display.js.map +1 -1
  63. package/dist/tools/tool-registry.d.ts +0 -22
  64. package/dist/tools/tool-registry.d.ts.map +1 -1
  65. package/dist/types/memory.d.ts +4 -18
  66. package/dist/types/memory.d.ts.map +1 -1
  67. package/dist/ui/assets/{AccountPage-kxclGuKm.js → AccountPage-BhneCJCw.js} +1 -1
  68. package/dist/ui/assets/{ProtocolDetailPage-DFe_JOr3.js → ProtocolDetailPage-kPGgNobg.js} +1 -1
  69. package/dist/ui/assets/{ProtocolEditPage-HAcAGXw7.js → ProtocolEditPage-IvFbUiUS.js} +2 -2
  70. package/dist/ui/assets/RunGuidedPage-Db_CQ-9q.js +1 -0
  71. package/dist/ui/assets/{SkillBundlePage-CiMQN0nf.js → SkillBundlePage-DV9CXjfI.js} +1 -1
  72. package/dist/ui/assets/{export-skill-zip-D8iQY1Dl.js → export-skill-zip-seCWjJSV.js} +1 -1
  73. package/dist/ui/assets/{index-cB_UoTxa.css → index-BGjXjHf7.css} +1 -1
  74. package/dist/ui/assets/{index-Xj6EqBfp.js → index-rCZd_925.js} +3 -3
  75. package/dist/ui/index.html +2 -2
  76. package/dist/utils/adapter-alias.d.ts +1 -11
  77. package/dist/utils/adapter-alias.d.ts.map +1 -1
  78. package/dist/utils/adapter-alias.js +2 -20
  79. package/dist/utils/adapter-alias.js.map +1 -1
  80. package/package.json +1 -3
  81. package/dist/embed-docs/mem/create-new-protocol.md +0 -44
  82. package/dist/embed-docs/mem/phase-critic-guide.md +0 -42
  83. package/dist/embed-docs/mem/phase-critic.md +0 -46
  84. package/dist/embed-docs/mem/skill-format-guide.md +0 -280
  85. package/dist/ui/assets/RunGuidedPage-Bewi7Wsx.js +0 -1
@@ -1,21 +1,18 @@
1
1
  ---
2
- version: "5.11.0"
2
+ version: "5.12.1"
3
3
  slug: challenge-type-guide
4
4
  title: Challenge Type Selection Guide
5
5
  ---
6
6
 
7
-
8
-
9
7
  # Challenge Type Selection Guide
10
8
 
11
9
  Decision rules, JSON formats, interpreter selection, and anti-patterns for
12
- choosing SQUADRULES challenge types. Loaded by protocol-authoring agents during
10
+ choosing SQUADRULES challenge types. Loaded by adapter-authoring agents during
13
11
  drafting and review.
14
12
 
15
13
  ## Activation Patterns
16
14
 
17
- **Typically invoked by:** `author-adapter` and
18
- `critic-loop`.
15
+ **Typically invoked by:** `author-adapter` and `critic-loop`.
19
16
 
20
17
  **Can be invoked directly when agent needs:**
21
18
  - "challenge type reference" / "which challenge type to use"
@@ -25,31 +22,31 @@ drafting and review.
25
22
  **Trigger pattern:** **challenge** + (type | format | selection | guide).
26
23
 
27
24
  **Must Never:**
28
- - Be used as an execution protocol.
25
+ - Be used as an execution adapter.
29
26
  - Select `comment` merely because it is easy.
30
27
 
31
28
  **Must Always:**
32
- - Be consulted before assigning challenge types to protocol steps.
29
+ - Be consulted before assigning challenge types to adapter steps.
33
30
  - Choose the strongest observable contract available.
34
31
  - Match challenge choice to the mode of the step: ask, decide, act, verify, or review.
35
32
 
36
33
  **Good trigger examples:**
37
- - drafting a new protocol and need challenge types → load this
34
+ - drafting a new adapter and need challenge types → load this
38
35
  - reviewing challenge type selection in a draft → load this
39
36
 
40
37
  **Bad trigger examples:**
41
- - "Create a new protocol" → use `author-adapter`
42
- - "Review my protocol draft" → use `critic-loop`
38
+ - "Create a new adapter" → use `author-adapter`
39
+ - "Review my adapter draft" → use `critic-loop`
43
40
 
44
41
  ## Core Rules
45
42
 
46
43
  `comment` is the challenge type of **last resort**. If a step produces any
47
44
  observable artifact — a file, a git state change, an API response, or an exit
48
- code — use `shell` or `mcp` instead.
45
+ code — use `shell` or `subagent` instead.
49
46
 
50
47
  **Mode before challenge type:**
51
48
  - **clarify / approve** → `user_input`
52
- - **call a SQUADRULES / MCP tool** → `mcp`
49
+ - **chain to another adapter** → `mcp` (forward-link only)
53
50
  - **execute or verify local state** → `shell`
54
51
  - **delegate to another agent** → `subagent`
55
52
  - **pure reasoning with no observable artifact** → `comment`
@@ -57,63 +54,59 @@ code — use `shell` or `mcp` instead.
57
54
  ### Decision Tree
58
55
 
59
56
  ```
60
- Does the step call an MCP tool?
61
- ├─ YES → Is the step a chain link to another adapter?
62
- │ ├─ YES → "mcp" with tool_name + arguments (forward + slug URI)
63
- │ └─ NO → "mcp" with tool_name only
57
+ Does the step chain to another adapter via forward?
58
+ ├─ YES → "mcp" forward-link (tool_name: "forward", arguments.uri: squadrules://adapter/<slug>)
64
59
  └─ NO → Does the step produce or verify a file, command result, or system state?
65
- ├─ YES → "shell"
60
+ ├─ YES → "shell" (with interpreter)
66
61
  └─ NO → Does the step require human approval or choice?
67
62
  ├─ YES → "user_input"
68
63
  └─ NO → Does the step delegate work to another agent?
69
- ├─ YES → "subagent" with optional context
70
- └─ NO → "comment" only if there is no stronger observable contract
64
+ ├─ YES → "subagent"
65
+ └─ NO → "comment" (last resort — no stronger contract possible)
71
66
  ```
72
67
 
73
68
  ### Challenge JSON Formats
74
69
 
75
- **shell**
70
+ **shell** (interpreter is REQUIRED)
76
71
  ```json
77
- {"contract":{"type":"shell","shell":{"cmd":"<command>","timeout_seconds":30},"required":true}}
72
+ {"contract":{"type":"shell","shell":{"cmd":"<command>","interpreter":"bash","timeout_seconds":30},"required":true}}
78
73
  ```
79
74
 
80
- **mcp**
81
- ```json
82
- {"contract":{"type":"mcp","mcp":{"tool_name":"<tool>"},"required":true}}
83
- ```
75
+ Allowed interpreters: `bash`, `sh`, `python3`, `python`, `node`. Build tools
76
+ (`terraform`, `docker`, `npm`, etc.) are **not** interpreters — wrap them in a
77
+ `bash` command instead.
84
78
 
85
- **mcp with arguments (chain link)**
79
+ **mcp** (forward-link only — bare tool_name checks are not valid)
86
80
  ```json
87
81
  {"contract":{"type":"mcp","mcp":{"tool_name":"forward","arguments":{"uri":"squadrules://adapter/<slug>"}},"required":true}}
88
82
  ```
89
83
 
90
- Use the `arguments` form when the step's purpose is to invoke a specific
91
- adapter via `forward`. The server validates that `solution.mcp.arguments`
92
- is a superset of the contract's `mcp.arguments` (subset/deep matching),
93
- proving the agent called the correct target — not just any `forward` call.
84
+ The server validates that `solution.mcp.arguments` is a superset of the
85
+ contract's `mcp.arguments` (subset/deep matching), proving the agent called
86
+ `forward` with the correct target slug.
94
87
 
95
88
  **user_input**
96
89
  ```json
97
90
  {"contract":{"type":"user_input","user_input":{"prompt":"<specific question>"},"required":true}}
98
91
  ```
99
92
 
100
- **comment**
101
- ```json
102
- {"contract":{"type":"comment","comment":{"min_length":50},"required":true}}
103
- ```
104
-
105
93
  **subagent**
106
94
  ```json
107
- {"contract":{"type":"subagent","subagent":{"context":"<task description>"},"required":true}}
95
+ {"contract":{"type":"subagent","subagent":{"instruction":"<task description>"},"required":true}}
108
96
  ```
109
97
 
110
98
  Use `subagent` when a step delegates work to another agent (human or AI) rather
111
- than executing it directly. The optional `context` field provides task-specific
99
+ than executing it directly. The `instruction` field provides task-specific
112
100
  guidance. Evidence of completion is collected via the anti-cheat evidence gate.
113
101
 
102
+ **comment** (last resort — max 1 per adapter, closing ACK only)
103
+ ```json
104
+ {"contract":{"type":"comment","comment":{"min_length":50},"required":true}}
105
+ ```
106
+
114
107
  ### Solution JSON Formats
115
108
 
116
- Every solution, regardless of type, follows the same envelope:
109
+ Every solution follows the same envelope:
117
110
 
118
111
  ```json
119
112
  {
@@ -127,84 +120,43 @@ Every solution, regardless of type, follows the same envelope:
127
120
 
128
121
  **shell solution**
129
122
  ```json
130
- {
131
- "type": "shell",
132
- "outcome": "success",
133
- "evidence": {
134
- "exit_code": 0,
135
- "stdout": "...",
136
- "stderr": "",
137
- "duration_seconds": 1.2
138
- }
139
- }
123
+ {"type":"shell","outcome":"success","evidence":{"exit_code":0,"stdout":"...","stderr":"","duration_seconds":1.2}}
140
124
  ```
141
125
 
142
126
  **mcp solution**
143
127
  ```json
144
- {
145
- "type": "mcp",
146
- "outcome": "success",
147
- "evidence": {
148
- "tool_name": "activate",
149
- "arguments": { "query": "example search" },
150
- "response": { "choices": [...] }
151
- }
152
- }
128
+ {"type":"mcp","outcome":"success","evidence":{"tool_name":"forward","arguments":{"uri":"squadrules://adapter/critic-loop"},"response":{}}}
153
129
  ```
154
130
 
155
- **user_input solution**
131
+ **subagent solution**
156
132
  ```json
157
- {
158
- "type": "user_input",
159
- "outcome": "success",
160
- "evidence": {
161
- "confirmation": "agreed. proceed",
162
- "timestamp": "2026-05-18T14:49:00Z"
163
- }
164
- }
133
+ {"type":"subagent","outcome":"success","evidence":{"agent_id":"agent-uuid","artifacts":["path/to/output"],"summary":"Task completed"}}
165
134
  ```
166
135
 
167
136
  **comment solution**
168
137
  ```json
169
- {
170
- "type": "comment",
171
- "outcome": "success",
172
- "evidence": {
173
- "text": "Verified all 78 issues now have repo: labels."
174
- }
175
- }
138
+ {"type":"comment","outcome":"success","evidence":{"text":"Verified all items are complete."}}
176
139
  ```
177
140
 
178
- **subagent solution**
141
+ **user_input solution**
179
142
  ```json
180
- {
181
- "type": "subagent",
182
- "outcome": "success",
183
- "evidence": {
184
- "agent_id": "agent-uuid-or-name",
185
- "artifacts": ["path/to/output"],
186
- "summary": "Task completed successfully"
187
- }
188
- }
143
+ {"type":"user_input","outcome":"success","evidence":{"confirmation":"agreed. proceed","timestamp":"2026-05-18T14:49:00Z"}}
189
144
  ```
190
145
 
191
146
  ## Interpreter Selection
192
147
 
193
- | Task | Use bash | Use perl | Use python3 |
194
- |---|---|---|---|
195
- | File exists, tool installed, git state | yes | no | no |
196
- | Simple content grep | yes | no | no |
197
- | Multi-line regex | no | yes | no |
198
- | Paragraph processing | no | yes | no |
199
- | JSON validation | maybe | yes | yes |
200
- | YAML / complex data structure checks | no | no | yes |
148
+ | Task | Interpreter |
149
+ |---|---|
150
+ | File exists, tool installed, git state | `bash` |
151
+ | Simple content grep | `bash` |
152
+ | Multi-line regex or paragraph processing | `python3` |
153
+ | JSON validation | `bash` (jq) or `python3` |
154
+ | YAML / complex data structure checks | `python3` |
155
+ | Node.js ecosystem tools | `node` |
201
156
 
202
- **Rule of thumb:** if bash requires `while read`, `grep | awk`, or heavy quote
203
- escaping, rewrite in Perl. If you need imports for data formats, use Python.
204
-
205
- ```json
206
- {"contract":{"type":"comment","comment":{"min_length":30},"required":true}}
207
- ```
157
+ **Rule of thumb:** default to `bash`. If you need multi-line regex, imports for
158
+ data formats, or complex string processing, use `python3`. Use `node` only when
159
+ the check requires the Node.js runtime.
208
160
 
209
161
  ## Security and Working Directory Rules
210
162
 
@@ -216,148 +168,79 @@ to avoid collisions between parallel sessions.
216
168
  - all file paths in shell challenges reference variables (e.g., `$DRAFT_FILE`,
217
169
  `$VERDICT_FILE`) set by the parent agent — never hardcode filenames
218
170
  - the parent agent constructs collision-free paths under
219
- `$SQUADRULES_LOCAL_ARTIFACT_DIR` (e.g., with a session ID or random suffix)
220
- - when using SQUADRULES MCP, the latest `activate` / `forward` / `next` response field `squadrules_local_artifact_dir` is an ordered array of URI hints (`project://<rel>`, `user://<rel>`); pick one (`project://` when you have exactly one project context, otherwise `user://`), resolve on your machine, and `export SQUADRULES_LOCAL_ARTIFACT_DIR="<absolute>"` if your shell does not already define it
221
- - if the server-returned path is not usable on your local filesystem, resolve
222
- locally to `$PROJECT_DIR/.local/squadrules/work` and keep it stable for the run
223
- - prerequisites create the directory
224
- - Reward Signal cleans it up
171
+ `$SQUADRULES_LOCAL_ARTIFACT_DIR`
172
+ - when using SQUADRULES MCP, the latest `activate` / `forward` / `next` response
173
+ field `squadrules_local_artifact_dir` is an ordered array of URI hints
174
+ (`project://<rel>`, `user://<rel>`); pick one, resolve on your machine, and
175
+ `export SQUADRULES_LOCAL_ARTIFACT_DIR="<absolute>"`
176
+ - prerequisites create the directory; Reward Signal cleans it up
225
177
  - never write credentials or secrets to files
226
178
 
227
179
  ### Resolving `project://` and `user://` URI hints
228
180
 
229
- The server returns relative URI hints — it never names an absolute path on its
230
- own filesystem. Resolve on your machine:
231
-
232
181
  | Scheme | Resolution | Example |
233
182
  |--------|-----------|--------|
234
- | `project://<rel>` | `<IDE project root>/<rel>` | `project://.local/squadrules/work` → `/home/user/repos/my-project/.local/squadrules/work` |
235
- | `user://<rel>` | `<$XDG_CONFIG_HOME or $HOME>/<rel>` | `user://.config/squadrules/work` → `/home/user/.config/squadrules/work` |
183
+ | `project://<rel>` | `<IDE project root>/<rel>` | `project://.local/squadrules/work` |
184
+ | `user://<rel>` | `<$XDG_CONFIG_HOME or $HOME>/<rel>` | `user://.config/squadrules/work` |
236
185
 
237
- When your session spans multiple projects, prefer `user://` to avoid ambiguity
238
- about which project root applies. When you have exactly one project context,
239
- `project://` is fine.
186
+ When your session spans multiple projects, prefer `user://` to avoid ambiguity.
240
187
 
241
188
  ### Worktree placement (for task-isolation adapters)
242
189
 
243
190
  When an adapter requires a git worktree for isolation, the worktree path MUST
244
- be **outside** every existing checkout. A common mistake is placing the worktree
245
- inside `$REPO_ROOT` (e.g. `$REPO_ROOT/.mcp.worktrees/...`), which the setup
246
- script correctly rejects.
247
-
248
- **Correct placement — absolute path examples:**
191
+ be **outside** every existing checkout:
249
192
 
250
193
  ```
251
194
  REPO_ROOT=/home/user/repos/my-project
252
- # RIGHT: sibling of the repo, not inside it
195
+ # RIGHT: sibling of the repo
253
196
  WT=/home/user/repos/mcp.worktrees/<task-id>
254
-
255
- # WRONG: inside the checkout (rejected by setup script)
197
+ # WRONG: inside the checkout
256
198
  # WT=/home/user/repos/my-project/.mcp.worktrees/<task-id>
257
199
  ```
258
200
 
259
- **Common mistakes:**
260
- - `$REPO_ROOT/.mcp.worktrees/...` — inside checkout, rejected
261
- - `./mcp.worktrees/...` — relative path resolves inside checkout
262
- - `$REPO_ROOT/../mcp.worktrees/...` — correct only if `..` actually exits the repo
263
-
264
201
  **Rule of thumb:** `$(dirname "$REPO_ROOT")/mcp.worktrees/<task-id>`
265
202
 
266
203
  ### IDE worktree access limitations
267
204
 
268
- Most IDE file tools (Write, Read, Edit) scope operations to the open project
269
- root. They **cannot** reach worktrees placed outside `$REPO_ROOT`. When working
270
- in an IDE:
205
+ Most IDE file tools scope operations to the open project root. They **cannot**
206
+ reach worktrees placed outside `$REPO_ROOT`. Use the terminal/shell tool for
207
+ external worktrees, or open the worktree as a separate project window.
271
208
 
272
- 1. Use the **terminal/shell tool** (not IDE file tools) to read/write files in
273
- external worktrees.
274
- 2. Shell commands: `cat`, `tee`, `cp`, or your editor's CLI mode work on any
275
- absolute path.
276
- 3. If you need to edit a worktree file with IDE assistance, open the worktree
277
- as a separate project window or use `code <worktree-path>` to add it to the
278
- workspace.
279
- 4. The `squadrules export` MCP tool can retrieve adapter content without
280
- filesystem access to the worktree.
209
+ ## Composition Patterns
281
210
 
282
- ```json
283
- {"contract":{"type":"comment","comment":{"min_length":30},"required":true}}
211
+ **Multi-check compound command** — chain with `&&`, let the first failure stop.
212
+
213
+ **Agent-readable shell status** — preserve the original exit status:
214
+ ```bash
215
+ ( set -o pipefail; <command> ); rc=$?; printf '\nSQUADRULES_SHELL_EXIT=%s\n' "$rc" >&2; exit "$rc"
284
216
  ```
285
217
 
286
- ## Composition Patterns
218
+ **Freeze-then-verify** — step N writes checksum, step N+1 verifies before publish.
219
+
220
+ **Write-then-grep** — subagent writes a verdict file, main agent checks line 1.
287
221
 
288
- **Multi-check compound command**
289
- - chain with `&&`
290
- - let the first failure stop execution
291
-
292
- **Agent-readable shell status**
293
- - use when failure can produce no output, especially `test`, quiet `grep`,
294
- JSON probes, pipelines, or commands that redirect stderr
295
- - empty stdout or stderr is not success; success is the real process status
296
- reported as `solution.shell.exit_code`
297
- - print the final status marker to stderr when stdout is machine-readable
298
- - preserve the original status exactly:
299
- ```bash
300
- ( set -o pipefail; <command> ); rc=$?; printf '\nSQUADRULES_SHELL_EXIT=%s\n' "$rc" >&2; exit "$rc"
301
- ```
302
- - keep `&&` inside `<command>` for ordered checks; use the final
303
- `; rc=$?; ...` trailer only to capture, print, and return the process status
304
- - do not use `<command> || echo ERROR && false`; shell operators group
305
- left-to-right, so that form can fail after a successful command and it loses
306
- the original status
307
-
308
- **Freeze-then-verify**
309
- - step N writes checksum
310
- - step N+1 verifies checksum before publish
311
-
312
- **Write-then-grep**
313
- - subagent writes a verdict file
314
- - main agent checks the first line for `PASS`
315
-
316
- **Phase-batch with critic**
317
- - batch related TODO items into one phase
318
- - verify hard artifacts with shell
319
- - then call `critic-loop` for adversarial review
320
-
321
- **Dry-run before execution**
322
- - dry-run command
323
- - human review
324
- - real command
325
-
326
- **Chain-link via forward + slug**
327
- - layer N's contract requires `forward` with a specific adapter slug
328
- - agent calls `forward` to start the next adapter (new `execution_id`)
329
- - next adapter runs its own layer chain through to `reward`
330
- - use when the protocol exceeds 350 lines or needs multi-path routing
331
- - NOT a replacement for layers — layers remain the primary unit of work
332
- - example contract:
333
- ```json
334
- {"contract":{"type":"mcp","mcp":{"tool_name":"forward","arguments":{"uri":"squadrules://adapter/implement-plan"}},"required":true}}
335
- ```
222
+ **Phase-batch with critic** — batch related items, verify hard artifacts with
223
+ shell, then call `critic-loop` for adversarial review.
336
224
 
225
+ **Chain-link via forward + slug** — layer N's contract requires `forward` with a
226
+ specific adapter slug. Use when the adapter exceeds 350 lines or needs
227
+ multi-path routing. Example:
337
228
  ```json
338
- {"contract":{"type":"comment","comment":{"min_length":30},"required":true}}
229
+ {"contract":{"type":"mcp","mcp":{"tool_name":"forward","arguments":{"uri":"squadrules://adapter/implement-plan"}},"required":true}}
339
230
  ```
340
231
 
341
232
  ## Artifacts for Shell Contracts
342
233
 
343
- When a shell contract needs a reusable script (Python guard, validation logic,
344
- setup helper), **attach it as an artifact** rather than inlining it in the
345
- contract JSON:
234
+ When a shell contract needs a reusable script, **attach it as an artifact**
235
+ rather than inlining it in the contract JSON:
346
236
 
347
237
  1. Write the script file.
348
238
  2. `train` with `mime: "text/x-python"`, `artifact_name: "isolation-guard.py"`,
349
- `adapter_uri: "squadrules://adapter/my-adapter"`, and the script content in
350
- `content`.
239
+ `adapter_uri: "squadrules://adapter/my-adapter"`, and the script content.
351
240
  3. In the shell contract, reference it via `export` with
352
241
  `squadrules://artifact/{uuid}` at execution time.
353
242
 
354
- This keeps adapter markdown clean, makes scripts independently versionable,
355
- and avoids bloating contract JSON with large inline scripts.
356
-
357
- **Interpreter restriction:** The `interpreter` field in shell contracts accepts
358
- only: `bash`, `sh`, `python3`, `python`, `node`. Build tools (`terraform`,
359
- `docker`, `npm`, etc.) are **not** interpreters — wrap them in a `bash -c`
360
- command instead.
243
+ This keeps adapter markdown clean and makes scripts independently versionable.
361
244
 
362
245
  ```json
363
246
  {"contract":{"type":"comment","comment":{"min_length":30},"required":true}}
@@ -368,9 +251,10 @@ command instead.
368
251
  Only reachable after all prior steps are solved.
369
252
 
370
253
  The agent can now:
371
- 1. pick the correct challenge type for each protocol step
254
+ 1. pick the correct challenge type for each adapter step
372
255
  2. match challenge type to the step's mode
373
- 3. choose the right interpreter
256
+ 3. choose the right interpreter (bash, python3, node)
374
257
  4. apply working-directory and security rules
375
- 5. preserve real shell statuses for silent checks
376
- 6. use stronger verification patterns instead of weak narrative checks
258
+ 5. use forward-link mcp contracts for chain links
259
+ 6. use subagent contracts for delegated work
260
+ 7. apply stronger verification patterns instead of weak comment checks
@@ -1,5 +1,5 @@
1
1
  ---
2
- version: "5.11.0"
2
+ version: "5.12.1"
3
3
  slug: critic-loop-guide
4
4
  title: Critic Loop Integration and Mutation Gate Guide
5
5
  ---
@@ -100,7 +100,7 @@ Split proofs by **reversibility cost**, not by step count:
100
100
  sub-condition (`A && B && C && echo OK`):
101
101
 
102
102
  ```json
103
- {"contract":{"type":"shell","shell":{"cmd":"test -f \"$OUT_A\" && test -f \"$OUT_B\" && grep -q \"$EXPECTED\" \"$OUT_A\" && echo OK","timeout_seconds":10},"required":true}}
103
+ {"contract":{"type":"shell","shell":{"cmd":"test -f \"$OUT_A\" && test -f \"$OUT_B\" && grep -q \"$EXPECTED\" \"$OUT_A\" && echo OK","interpreter":"bash","timeout_seconds":10},"required":true}}
104
104
  ```
105
105
 
106
106
  - **Never let an aggregate proof degrade to `echo "done"`.** A proof that asserts
@@ -115,7 +115,7 @@ it happens — for example, confirm you are on a throwaway worktree and branch (
115
115
  `main`, not the human's active checkout) **before** making changes:
116
116
 
117
117
  ```json
118
- {"contract":{"type":"shell","shell":{"cmd":"test \"$(git rev-parse --abbrev-ref HEAD)\" != main && git rev-parse --git-common-dir | grep -q worktrees","timeout_seconds":5},"required":true}}
118
+ {"contract":{"type":"shell","shell":{"cmd":"test \"$(git rev-parse --abbrev-ref HEAD)\" != main && git rev-parse --git-common-dir | grep -q worktrees","interpreter":"bash","timeout_seconds":5},"required":true}}
119
119
  ```
120
120
 
121
121
  ## How to Chain Critic-Loop into an Adapter
@@ -154,7 +154,7 @@ Record `work` in the handoff file pointed to by `$WORK_MANIFEST`, as flat keys
154
154
  stays a machine-checkable file test instead of prose:
155
155
 
156
156
  ```json
157
- {"contract":{"type":"shell","shell":{"cmd":"test -f \"${WORK_MANIFEST:-}\" || test -f \"${INPUT_FILE:-}\"","timeout_seconds":3},"required":true}}
157
+ {"contract":{"type":"shell","shell":{"cmd":"test -f \"${WORK_MANIFEST:-}\" || test -f \"${INPUT_FILE:-}\"","interpreter":"bash","timeout_seconds":3},"required":true}}
158
158
  ```
159
159
 
160
160
  Anything that cannot be resolved is `verification_blocked` — an item the critic
@@ -194,7 +194,7 @@ fails when the verdict is not PASS. This is the mechanical guard that prevents
194
194
  weaker agents from proceeding after FAIL:
195
195
 
196
196
  ```json
197
- {"contract":{"type":"shell","shell":{"cmd":"head -1 \"$VERDICT_FILE\" | grep -qi '^PASS$'","timeout_seconds":5},"required":true}}
197
+ {"contract":{"type":"shell","shell":{"cmd":"head -1 \"$VERDICT_FILE\" | grep -qi '^PASS$'","interpreter":"bash","timeout_seconds":5},"required":true}}
198
198
  ```
199
199
 
200
200
  If the critic wrote FAIL, this shell command exits non-zero. The server rejects
@@ -229,15 +229,17 @@ Assert the preconditions with a shell or mcp contract so the action only runs fr
229
229
  valid state — never with a `user_input` "are you sure?" prompt:
230
230
 
231
231
  ```json
232
- {"contract":{"type":"shell","shell":{"cmd":"test -n \"$TARGET_REPO\" && test -n \"$TARGET_BRANCH\"","timeout_seconds":5},"required":true}}
232
+ {"contract":{"type":"shell","shell":{"cmd":"test -n \"$TARGET_REPO\" && test -n \"$TARGET_BRANCH\"","interpreter":"bash","timeout_seconds":5},"required":true}}
233
233
  ```
234
234
 
235
235
  ### Post-mutation verification (objective)
236
236
 
237
- Confirm the mutation actually took effect by reading the remote state back:
237
+ Confirm the mutation actually took effect by reading the remote state back.
238
+ Use a `subagent` contract when the verification requires multi-step reasoning
239
+ or tool orchestration beyond a single shell command:
238
240
 
239
241
  ```json
240
- {"contract":{"type":"mcp","mcp":{"tool_name":"getMergeRequest","arguments":{"repo":"X"}},"required":true}}
242
+ {"contract":{"type":"subagent","subagent":{"instruction":"Verify the remote mutation took effect: read back the created/updated resource and confirm its state matches the intended outcome."},"required":true}}
241
243
  ```
242
244
 
243
245
  The guarantee comes from critic-loop (truth of intent) plus these objective
@@ -1,5 +1,5 @@
1
1
  ---
2
- version: "5.11.0"
2
+ version: "5.12.1"
3
3
  slug: critic-loop
4
4
  title: Critic Loop
5
5
  ---
@@ -96,7 +96,7 @@ This protocol produces:
96
96
  }
97
97
  ```
98
98
 
99
- ## Precondition Check [SUBAGENT]
99
+ ## Precondition Check
100
100
 
101
101
  Verify foundational preconditions before deep investigation. Early-abort if any
102
102
  are broken.
@@ -122,10 +122,10 @@ are broken.
122
122
  **Output:** verified preconditions or early-abort diagnostics
123
123
 
124
124
  ```json
125
- {"contract":{"type":"shell","shell":{"cmd":"test -f \"${WORK_MANIFEST:-}\" || test -f \"${INPUT_FILE:-}\"","timeout_seconds":3},"required":true}}
125
+ {"contract":{"type":"shell","shell":{"cmd":"test -f \"${WORK_MANIFEST:-}\" || test -f \"${INPUT_FILE:-}\"","interpreter":"bash","timeout_seconds":3},"required":true}}
126
126
  ```
127
127
 
128
- ## Resolve Submission [SUBAGENT]
128
+ ## Resolve Submission
129
129
 
130
130
  Turn the submission into the material under review. What cannot be resolved is
131
131
  never guessed at.
@@ -150,8 +150,7 @@ never guessed at.
150
150
  stderr as the material.
151
151
  - `inline` — the text recorded in the manifest is the material.
152
152
  3. Record the resolved inventory before auditing: `kind`, item count, per-item
153
- status (`resolved` or `blocked`), and where each item's evidence lives. The
154
- audit investigates this inventory and nothing else.
153
+ status (`resolved` or `blocked`), and where each item's evidence lives.
155
154
  4. A `pr` or `git_diff` submission is reviewed as a diff: claims are checked
156
155
  against the changed lines and the tests they touch, never against the
157
156
  description written alongside them.
@@ -159,10 +158,10 @@ never guessed at.
159
158
  **Output:** resolved work inventory for the audit
160
159
 
161
160
  ```json
162
- {"contract":{"type":"comment","comment":{"min_length":80},"required":true}}
161
+ {"contract":{"type":"subagent","subagent":{"instruction":"Resolve the work submission into reviewable material: read the manifest, resolve each item by kind from work.root, and record the resolved inventory with per-item status."},"required":true}}
163
162
  ```
164
163
 
165
- ## Audit [SUBAGENT]
164
+ ## Audit
166
165
 
167
166
  Perform bounded adversarial review of the target against the resolved work
168
167
  submission and invariants.
@@ -187,14 +186,8 @@ Extract every verifiable claim that matters operationally:
187
186
  4. continue reviewing all in-scope claims even after a normal FAIL condition is met;
188
187
  only a precondition failure stops the audit early
189
188
 
190
- **High-risk areas**
191
- - setup steps and prerequisites
192
- - CLI commands and flags
193
- - configuration keys and environment variables
194
- - authentication, identity, and permissions
195
- - deployment and release behaviour
196
- - external publishing actions
197
- - destructive or irreversible operations
189
+ **High-risk areas:** setup steps, CLI commands, configuration keys, authentication,
190
+ deployment, external publishing, destructive operations.
198
191
 
199
192
  **Step 3 — Gather evidence using the hierarchy**
200
193
 
@@ -207,43 +200,29 @@ Extract every verifiable claim that matters operationally:
207
200
  | 5 | external docs, web pages, linked references |
208
201
  | 6 | conversational assumption or indirect inference |
209
202
 
210
- **Rules:**
211
- - higher-priority evidence overrides lower-priority evidence
212
- - priority 5–6 alone is not enough for `verified`
213
- - a submitted link or PR description is priority 5 evidence: verify the claim
214
- against the fetched content or the actual diff, never against the summary
203
+ **Rules:** higher-priority evidence overrides lower; priority 5–6 alone is not
204
+ enough for `verified`; a submitted link or PR description is priority 5.
215
205
 
216
206
  **Step 4 — Produce claim verdicts**
217
-
218
- For each claim, record:
219
- - CLAIM
220
- - EVIDENCE
221
- - EVIDENCE PRIORITY
222
- - VERDICT: `verified` / `partially_verified` / `unverifiable` / `incorrect`
223
-
207
+ For each claim: CLAIM, EVIDENCE, EVIDENCE PRIORITY, VERDICT
208
+ (`verified` / `partially_verified` / `unverifiable` / `incorrect`).
224
209
  A claim must not be marked `verified` without positive supporting evidence.
225
210
 
226
211
  **Step 5 — Review the phase boundary**
227
- Check whether the calling protocol preserved the right mode boundary:
228
- - was execution reviewed independently?
229
- - were review and execution kept separate?
230
- - did the protocol switch to verification when it should have?
231
- - is escalation needed because certainty was overstated?
212
+ Check whether the calling adapter preserved the right mode boundary.
232
213
 
233
214
  **Step 6 — Check requirement coverage**
234
- For every item in the supplied `requirements` list, confirm the target addresses
235
- it with positive evidence and record it as `covered` / `partial` / `missing`. An
236
- omitted requirement leaves no trace in the output, so coverage can only be judged
237
- against the list, never from the artifact alone. Any `missing` item — or any
238
- `partial` high-risk item — forces a FAIL with `failure_class: requirement_gap`.
215
+ For every item in `requirements`, confirm coverage with positive evidence.
216
+ Any `missing` item — or any `partial` high-risk item — forces FAIL with
217
+ `failure_class: requirement_gap`.
239
218
 
240
219
  **Output:** structured audit findings for the verdict step
241
220
 
242
221
  ```json
243
- {"contract":{"type":"comment","comment":{"min_length":120},"required":true}}
222
+ {"contract":{"type":"subagent","subagent":{"instruction":"Perform bounded adversarial audit: extract claims, investigate with scope discipline, gather evidence by priority hierarchy, produce claim verdicts, review phase boundary, and check requirement coverage."},"required":true}}
244
223
  ```
245
224
 
246
- ## Verdict [SUBAGENT]
225
+ ## Verdict
247
226
 
248
227
  Turn the audit into a final PASS / FAIL result.
249
228
 
@@ -275,7 +254,7 @@ Turn the audit into a final PASS / FAIL result.
275
254
  **Output:** final verdict file
276
255
 
277
256
  ```json
278
- {"contract":{"type":"shell","shell":{"cmd":"test -f \"$VERDICT_FILE\" && head -1 \"$VERDICT_FILE\" | grep -qiE '^(PASS|FAIL)$' && sed -n '2p' \"$VERDICT_FILE\" | grep -qiE '^(High|Medium|Low)$'","timeout_seconds":5},"required":true}}
257
+ {"contract":{"type":"shell","shell":{"cmd":"test -f \"$VERDICT_FILE\" && head -1 \"$VERDICT_FILE\" | grep -qiE '^(PASS|FAIL)$' && sed -n '2p' \"$VERDICT_FILE\" | grep -qiE '^(High|Medium|Low)$'","interpreter":"bash","timeout_seconds":5},"required":true}}
279
258
  ```
280
259
 
281
260
  ## Reward Signal