@squadrules/mcp 5.5.1 → 5.6.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 (75) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/cli/render-helpers.d.ts +40 -0
  3. package/dist/cli/render-helpers.d.ts.map +1 -0
  4. package/dist/cli/render-helpers.js +65 -0
  5. package/dist/cli/render-helpers.js.map +1 -0
  6. package/dist/cli/render.d.ts.map +1 -1
  7. package/dist/cli/render.js +41 -25
  8. package/dist/cli/render.js.map +1 -1
  9. package/dist/constants/builtin-search-meta.d.ts +1 -1
  10. package/dist/constants/builtin-search-meta.d.ts.map +1 -1
  11. package/dist/constants/builtin-search-meta.js +3 -2
  12. package/dist/constants/builtin-search-meta.js.map +1 -1
  13. package/dist/embed-docs/mem/README.md +3 -2
  14. package/dist/embed-docs/mem/adapter-migration.md +3 -3
  15. package/dist/embed-docs/mem/author-adapter.md +347 -0
  16. package/dist/embed-docs/mem/bulk-insert-adapters-via-cli.md +2 -2
  17. package/dist/embed-docs/mem/challenge-type-guide.md +3 -3
  18. package/dist/embed-docs/mem/create-new-protocol.md +23 -334
  19. package/dist/embed-docs/mem/critic-loop-guide.md +3 -3
  20. package/dist/embed-docs/mem/critic-loop.md +2 -2
  21. package/dist/embed-docs/mem/phase-critic-guide.md +1 -1
  22. package/dist/embed-docs/mem/phase-critic.md +1 -1
  23. package/dist/embed-docs/mem/protocol-linking-guide.md +3 -3
  24. package/dist/embed-docs/mem/refine-search.md +1 -1
  25. package/dist/embed-docs/mem/skill-format-guide.md +3 -3
  26. package/dist/resources/embedded-mcp-resources.d.ts +1 -0
  27. package/dist/resources/embedded-mcp-resources.d.ts.map +1 -1
  28. package/dist/resources/embedded-mcp-resources.js +15 -14
  29. package/dist/resources/embedded-mcp-resources.js.map +1 -1
  30. package/dist/services/forward-runtime-store.d.ts +2 -0
  31. package/dist/services/forward-runtime-store.d.ts.map +1 -1
  32. package/dist/services/forward-runtime-store.js.map +1 -1
  33. package/dist/services/memory/validate-protocol-structure.d.ts +1 -1
  34. package/dist/services/memory/validate-protocol-structure.d.ts.map +1 -1
  35. package/dist/services/memory/validate-protocol-structure.js +1 -1
  36. package/dist/services/memory/validate-protocol-structure.js.map +1 -1
  37. package/dist/services/qdrant/memory-retrieval.d.ts.map +1 -1
  38. package/dist/services/qdrant/memory-retrieval.js +2 -1
  39. package/dist/services/qdrant/memory-retrieval.js.map +1 -1
  40. package/dist/services/vector-store/lancedb/lance-records-reads.d.ts.map +1 -1
  41. package/dist/services/vector-store/lancedb/lance-records-reads.js +2 -1
  42. package/dist/services/vector-store/lancedb/lance-records-reads.js.map +1 -1
  43. package/dist/tools/activate.d.ts.map +1 -1
  44. package/dist/tools/activate.js +37 -0
  45. package/dist/tools/activate.js.map +1 -1
  46. package/dist/tools/activate_schema.d.ts +27 -0
  47. package/dist/tools/activate_schema.d.ts.map +1 -1
  48. package/dist/tools/activate_schema.js +4 -1
  49. package/dist/tools/activate_schema.js.map +1 -1
  50. package/dist/tools/authoring-context.d.ts +13 -0
  51. package/dist/tools/authoring-context.d.ts.map +1 -0
  52. package/dist/tools/authoring-context.js +11 -0
  53. package/dist/tools/authoring-context.js.map +1 -0
  54. package/dist/tools/forward-register.js +1 -1
  55. package/dist/tools/forward-register.js.map +1 -1
  56. package/dist/tools/forward-view.d.ts.map +1 -1
  57. package/dist/tools/forward-view.js +2 -0
  58. package/dist/tools/forward-view.js.map +1 -1
  59. package/dist/tools/forward.d.ts.map +1 -1
  60. package/dist/tools/forward.js +26 -0
  61. package/dist/tools/forward.js.map +1 -1
  62. package/dist/tools/forward_schema.d.ts +36 -0
  63. package/dist/tools/forward_schema.d.ts.map +1 -1
  64. package/dist/tools/forward_schema.js +5 -0
  65. package/dist/tools/forward_schema.js.map +1 -1
  66. package/dist/tools/tool-registry.d.ts +54 -0
  67. package/dist/tools/tool-registry.d.ts.map +1 -1
  68. package/dist/ui/assets/{AccountPage-DyTJwGMC.js → AccountPage-W5I2ZuuS.js} +1 -1
  69. package/dist/ui/assets/{index-CKityaQ1.js → index-DBGTP8gM.js} +2 -2
  70. package/dist/ui/index.html +1 -1
  71. package/dist/utils/adapter-alias.d.ts +6 -0
  72. package/dist/utils/adapter-alias.d.ts.map +1 -0
  73. package/dist/utils/adapter-alias.js +10 -0
  74. package/dist/utils/adapter-alias.js.map +1 -0
  75. package/package.json +2 -1
@@ -0,0 +1,347 @@
1
+ ---
2
+ slug: author-adapter
3
+ version: "5.6.1"
4
+ title: Author Adapter (Create / Review / Refactor)
5
+ ---
6
+
7
+
8
+
9
+ # Author Adapter (Create / Review / Refactor)
10
+
11
+ > **Note to the agent:** SQUADRULES protocols are interfaces for AI agents — you
12
+ > are the primary user. When you author a protocol, you design behaviour for
13
+ > yourself and others. Write for them: single source of truth (never duplicate
14
+ > rules), explicit over implicit (agents fill ambiguity with hallucination),
15
+ > phases teach modes (each step teaches its cognitive mode), truth over fluency
16
+ > (a protocol that reads well but causes wrong behaviour is worse than one that
17
+ > reads rough but executes correctly).
18
+
19
+ ## Activation Patterns
20
+
21
+ Preferred entry URI: `squadrules://adapter/author-adapter`. The retired
22
+ `create-new-protocol` slug is a redirect tombstone (see phase-critic pattern).
23
+ If `forward.authoring` is present, use its operation and target throughout this
24
+ run. Do not reinterpret update as create or change the target mid-run. This
25
+ context describes the requested work; it does not override host permissions.
26
+
27
+ SQUADRULES authoring lifecycle — create, review, or update adapters / protocols / workflows.
28
+ In this context, those words refer to the same stored artifact and can be treated
29
+ as synonyms. Supports three operations:
30
+ - **create** — draft and train a new adapter / protocol from scratch.
31
+ - **review** — audit an existing adapter, family, or bundle for structural issues,
32
+ missing cross-references, chaining gaps, DRY violations, stale guidance, or
33
+ agent-hostile ambiguity. Read-only.
34
+ - **update** — apply specific corrections to an existing adapter / protocol and
35
+ save the correction. Also triggered by: edit, fix, modify, change, improve, patch, refactor.
36
+ **Run this protocol when the user says ANY of:**
37
+ - "create a new SQUADRULES protocol" / "create new protocol adapter"
38
+ - "register personal SQUADRULES adapter" / "register a personal adapter"
39
+ - "train adapter into personal" / "train protocol into personal"
40
+ - "train a workflow" / "register a new adapter" / "create a new workflow"
41
+ - "review protocol" / "audit adapters" / "check protocol families for gaps"
42
+ - "update adapter" / "edit adapter" / "fix protocol" / "modify adapter"
43
+ - "patch protocol" / "refactor protocol" / "change adapter" / "improve adapter"
44
+ - "create new protocol" (when `activate` found no match and user confirms)
45
+ **Trigger pattern:** **create** / **train** / **register** / **review** /
46
+ **audit** / **fix** / **update** / **edit** / **modify** / **change** /
47
+ **improve** / **patch** / **refactor** / **correct** +
48
+ (protocol / adapter / workflow).
49
+ **Must Never:**
50
+ - Run when the user only asked to execute an existing protocol.
51
+ - Mutate adapters during a `review` operation.
52
+ - Optimise only for pretty wording; this protocol designs agent behaviour.
53
+ - Treat "update", "edit", or "modify an existing adapter" as **create**.
54
+ **Must Always:**
55
+ - Infer `{operation}` from trigger: create / review / update.
56
+ When the user says "update", "edit", "modify", or "fix" → operation is **update**.
57
+ - Optimise for truth, low ambiguity, explicit sequencing, and user-need alignment.
58
+ - Design or review phase transitions explicitly: discovery, clarification,
59
+ ideation, planning, execution, validation, review, handoff.
60
+ - Include Activation Patterns as the first H2 and Reward Signal as the last H2
61
+ in any newly drafted adapter.
62
+ - Enforce the 350-line limit per file.
63
+ **Good trigger examples:**
64
+ - "Create a new SQUADRULES protocol for code review" → run this protocol (create)
65
+ - "No match found; I want to create a new protocol" → run this protocol (create)
66
+ - "Review all v4 protocol families for missing cross-references" → run this protocol (review)
67
+ - "Update the MR adapter to include a review step" → run this protocol (update)
68
+ - "Edit the critic-loop adapter triggers" → run this protocol (update)
69
+ - "Refactor the MR adapter to be less ambiguous" → run this protocol (update)
70
+ **Bad trigger examples:**
71
+ - "Run the standardise project protocol" → use activate / forward
72
+ - "Search for deployment protocol" → use activate
73
+ - "Create an MR" → use the MR adapter, not this protocol
74
+
75
+ ## Preflight Dependencies
76
+
77
+ Before running authoring actions, verify dependency and auth readiness for this
78
+ run:
79
+ 1. Required MCP tools are available and reachable: `activate`, `forward`,
80
+ `reward`, and the operation-dependent tool (`train`, `export`, or `tune`).
81
+ 2. Required CLI tools for planned shell steps are installed and callable.
82
+ 3. Required auth/session state is valid for the target MCP server.
83
+
84
+ If any check fails, attempt AI-assisted remediation automatically (install or
85
+ configure the missing tool, refresh auth/session), then re-run preflight. Only
86
+ hard-stop when a required tool or auth genuinely cannot be established
87
+ autonomously; report the concrete blocker and the remediation already attempted.
88
+ Do not continue to intent resolution until preflight passes.
89
+
90
+ ```json
91
+ {"contract":{"type":"comment","comment":{"min_length":80},"required":true}}
92
+ ```
93
+
94
+ ## Resolve Intent Autonomously
95
+
96
+ Use structured `authoring` when provided. For original calls without it, infer
97
+ `{operation}` from the user's trigger — do not stop to ask for confirmation:
98
+
99
+ | Signal | Operation |
100
+ |---|---|
101
+ | "create", "new", "train", no match from activate | **create** |
102
+ | "review", "audit", "check", "gaps", "cross-references" | **review** |
103
+ | "update", "edit", "fix", "modify", "change", "improve", "patch", "refactor", "add missing", "correct" | **update** |
104
+
105
+ Resolve the target from context without a confirmation prompt: for `create`,
106
+ proceed to author a new adapter; for `review`, select the adapter(s), family, or
107
+ bundle named or implied by the request; for `update`, select the adapter and the
108
+ specific issue. Record the inferred operation and target, then continue. Escalate
109
+ to the user only when the request is genuinely ambiguous and no reasonable default
110
+ exists.
111
+
112
+ ```json
113
+ {"contract":{"type":"comment","comment":{"min_length":80},"required":true}}
114
+ ```
115
+
116
+ ## Gather Requirements
117
+
118
+ ### For `create` — collect details for a new protocol
119
+ **1. Determine the pattern:**
120
+
121
+ | Signal | Pattern |
122
+ |---|---|
123
+ | One workflow, no variants | **Standalone** — one protocol, all steps inline |
124
+ | Multiple issue types / output formats / media | **Router + Extensions** — router classifies, routes via `activate` |
125
+ | Domain has a decision tree | **Router + Extensions** |
126
+ | Single workflow but exceeds 350 lines or too complex for weaker models | **Chain** — split into sequential adapters linked via `forward` + slug |
127
+ | Reference material needed by steps | Extract to a separate file, not a protocol |
128
+ **2. Collect per protocol:**
129
+ - **Title** — clear, descriptive H1.
130
+ - **User problem** — what real problem does this solve?
131
+ - **Agent behaviour** — what behaviour should this create in the agent?
132
+ - **Mode map** — which steps are for discovery, clarification, ideation,
133
+ planning, execution, validation, review, or handoff?
134
+ - **Steps** — each H2 must earn its place and end with a challenge.
135
+ - **Challenge type per step** — use the strongest observable contract possible.
136
+ - **Domain reference** — guides / docs the protocol should load.
137
+ - **Existing protocols** — reuse, compose, or extract shared content.
138
+ - **DRY / size check** — extract duplicated content; split if >350 lines.
139
+ - **Chain position** — entry, middle, or exit? What slug does the previous link forward to?
140
+ - **Failure analysis** — where would a weaker agent misread this protocol?
141
+ **3. If Router pattern:** variants, classification questions, forbidden types,
142
+ and which parts stay in the router vs extensions.
143
+ **4. If Chain pattern:** Load `protocol-linking-guide` for full rules
144
+ (`forward` with `squadrules://adapter/protocol-linking-guide`). Collect: chain
145
+ links and concerns, minimum number of links, entry point (matched by
146
+ `activate`), and artifacts flowing between links.
147
+
148
+ ### For `review` — audit existing adapters against this checklist
149
+
150
+ Export target adapter(s). For each adapter, check:
151
+ 1. **User-need fit** — does the adapter solve a real user problem, or merely
152
+ mirror literal wording?
153
+ 2. **Mode / phase clarity** — are discovery, clarification, ideation,
154
+ execution, validation, and review clearly separated?
155
+ 3. **Cross-reference completeness** — are all required related adapters linked?
156
+ 4. **Adapter handoff gaps** — does it hand off where another adapter should own
157
+ the work?
158
+ 5. **DRY violations** — is policy content duplicated instead of linked?
159
+ 6. **Contract coverage** — does every executable H2 have the right contract?
160
+ 7. **Truth-first behaviour** — does it reduce guessing, fake certainty, and
161
+ silent assumption-making?
162
+ 8. **Activation pattern accuracy** — do triggers match what users actually say?
163
+ 9. **Structure compliance** — first H2 Activation Patterns, last H2 Reward
164
+ Signal, no duplicate H2s, under 350 lines.
165
+ 10. **Sibling consistency** — are equivalent steps present across sibling
166
+ adapters in the same family?
167
+ 11. **Chained adapter families** (when applicable) — extension adapters include
168
+ `chain_root` and a prerequisite clause pointing at the root; parent adapters
169
+ use explicit `forward` when the next adapter slug is already known; reserve
170
+ `activate` for ambiguous runtime discovery (see `protocol-linking-guide`,
171
+ **Chaining Back and Forward**).
172
+ 12. **Critic-loop integration** — does the adapter include critic-loop chain
173
+ links at major phase boundaries? Does each critic-loop invocation have a
174
+ FAIL gate shell contract (`grep -qi '^PASS$'` on the verdict file)? Are
175
+ solution checks restricted to irreversible remote mutations (see
176
+ `critic-loop-guide`)?
177
+
178
+ ### For `update` — identify the specific issue
179
+
180
+ Export the target adapter, read the current markdown, identify the exact gap or
181
+ error, and plan the minimal change. Do not alter unrelated layers.
182
+
183
+ Summarise gathered requirements or findings.
184
+
185
+ ```json
186
+ {"contract":{"type":"comment","comment":{"min_length":80},"required":true}}
187
+ ```
188
+
189
+ ## Draft Markdown
190
+
191
+ ### For `create` — draft new adapter markdown
192
+
193
+ Draft the full markdown for `train`.
194
+
195
+ ### For `review` — draft findings report
196
+
197
+ Write a structured gap report to `$REVIEW_FINDINGS_FILE` (an absolute path
198
+ provided by the invoking agent or chosen by you under
199
+ `$SQUADRULES_LOCAL_ARTIFACT_DIR` with a session-unique segment). For each finding
200
+ include:
201
+ - adapter title
202
+ - gap type
203
+ - severity
204
+ - why the issue matters for AI-agent behaviour
205
+ - specific recommended fix
206
+
207
+ ### For `update` — draft corrected adapter markdown
208
+
209
+ Apply the identified change and show a diff-style summary of what changed.
210
+
211
+ ### Shared drafting rules (all operations)
212
+ **Core SQUADRULES rule — right mode at the right time:**
213
+
214
+ Every protocol must help the agent recognise whether the current step is for
215
+ exploration, clarification, ideation, planning, execution, validation, review,
216
+ or handoff. Do not blur those modes.
217
+ **Truth over fluency:**
218
+
219
+ Design protocols to reduce guessing and fake certainty. Prefer explicit prompts,
220
+ explicit stop conditions, explicit uncertainty escalation, and observable
221
+ verification over narrative reassurance.
222
+ **User need over literal phrasing:**
223
+
224
+ The protocol should help the agent provide what the user actually needs, not
225
+ just echo the wording used in the request.
226
+ **DRY:**
227
+
228
+ Shared content across protocols must live in one place. If two protocols share
229
+ >50% of their body, extract shared logic.
230
+
231
+ **350-line maximum per file:**
232
+
233
+ No protocol file may exceed 350 lines. If it grows beyond that, split it into
234
+ linked adapters or extract a reference file.
235
+
236
+ **Generic-first — create generic, link from detailed:**
237
+
238
+ Create protocols from generic to detailed. The generic adapter must stand alone.
239
+ Extensions should contain only the delta.
240
+
241
+ **Slug convention — deterministic protocol linking:**
242
+
243
+ Every protocol gets a short, unique, lowercase-hyphenated `slug`.
244
+
245
+ **Artifacts:**
246
+
247
+ Store scripts or config blobs as artifacts via `train` (set `mime`,
248
+ `artifact_name`, `adapter_uri`). Retrieve with `export` using
249
+ `squadrules://artifact/{uuid}`.
250
+
251
+ **Protocol structure:** H1 title, first H2 Activation Patterns, second H2
252
+ Preflight Dependencies, middle H2s one per step with JSON contract block, last
253
+ H2 Reward Signal. Frontmatter: `slug` (required), `version` (optional),
254
+ `chain_root` (required for mid-chain adapters).
255
+
256
+ **Challenge types:** Load `challenge-type-guide` for decision rules and JSON
257
+ formats (`forward` with `squadrules://adapter/challenge-type-guide`).
258
+
259
+ **Critic-loop and mutation gates:** Load `critic-loop-guide` for placement,
260
+ FAIL gate, and solution check rules (`forward` with `squadrules://adapter/critic-loop-guide`).
261
+
262
+ **If Router pattern:** draft the router and each extension as separate files.
263
+
264
+ Post the full drafted markdown.
265
+
266
+ ```json
267
+ {"contract":{"type":"comment","comment":{"min_length":120},"required":true}}
268
+ ```
269
+
270
+ ## Critic-Loop Review (create and update only)
271
+
272
+ For `create` and `update`: run critic-loop against the drafted markdown. This is an
273
+ autonomous quality loop — the agent owns content, the critic owns quality, and no
274
+ human approval is requested at any point.
275
+
276
+ 1. Invoke critic-loop via `forward` with `squadrules://adapter/critic-loop`.
277
+ Provide the drafted markdown as `input_file`, the slug as
278
+ `calling_protocol_slug`, and "structural compliance and agent behaviour"
279
+ as `verification_target`.
280
+ 2. Run the FAIL gate shell contract on the verdict file:
281
+
282
+ ```json
283
+ {"contract":{"type":"shell","shell":{"cmd":"head -1 \"$VERDICT_FILE\" | grep -qi '^PASS$'","timeout_seconds":5},"required":true}}
284
+ ```
285
+
286
+ 3. If FAIL: address every finding, then re-invoke critic-loop and re-run the FAIL
287
+ gate. **Loop automatically until the verdict is PASS** — do not proceed and do
288
+ not ask the user whether to continue.
289
+ 4. If PASS: capture the verdict file path for the `review_evidence` field
290
+ in the `train` call below.
291
+
292
+ For `review`: skip this step (read-only operation).
293
+
294
+ ```json
295
+ {"contract":{"type":"comment","comment":{"min_length":80},"required":true}}
296
+ ```
297
+
298
+ ## Autonomous Review Gate
299
+
300
+ No human approval step. The critic-loop PASS verdict from the previous step is the
301
+ sole quality gate; once it is PASS, proceed directly to finalise.
302
+
303
+ For `create`: record the drafted adapter slug(s) and the critic-loop verdict, then
304
+ continue to `train`.
305
+
306
+ For `review`: record the findings and the actions taken, then continue.
307
+
308
+ For `update`: record the corrected markdown, the change summary, and the critic
309
+ verdict, then continue.
310
+
311
+ ```json
312
+ {"contract":{"type":"comment","comment":{"min_length":80},"required":true}}
313
+ ```
314
+
315
+ ## FinaliseOperation
316
+
317
+ For `create`: call `train` with the drafted markdown and `review_evidence`
318
+ from the critic-loop step. Use `force_update: false` unless overwrite was
319
+ explicitly requested.
320
+
321
+ For `review`: do not call `train`. Save the findings report only if requested.
322
+
323
+ For `update`: use `tune` with the existing adapter URI, corrected content, and
324
+ `review_evidence` for edits that preserve adapter identity and layer count.
325
+ Use `train` with `force_update: true` only for a required structural replacement
326
+ (such as changing identity/H1 mapping or layer count), preserving the intended
327
+ space and verifying the resulting identity. Never create a duplicate as fallback.
328
+ Update the corresponding repository source when the adapter is repo-managed;
329
+ make repository edits in the task's isolated worktree.
330
+
331
+ Report the outcome: adapter URI(s) for create / update, or findings summary for
332
+ review.
333
+
334
+ ```json
335
+ {"contract":{"type":"comment","comment":{"min_length":80},"required":true}}
336
+ ```
337
+
338
+ ## Reward Signal
339
+
340
+ Protocol complete when:
341
+ - `create` — adapter(s) stored via `train` (with review_evidence) and URI(s) reported
342
+ - `review` — findings report delivered
343
+ - `update` — corrected adapter saved via `tune` (or required structural replacement),
344
+ read back and verified; repo-managed source updated in the task worktree
345
+
346
+ A successful result means the resulting SQUADRULES adapter is more truthful,
347
+ phase-aware, agent-readable, and aligned with human–AI harmony.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  slug: bulk-insert-adapters-via-cli
3
- version: "5.5.1"
3
+ version: "5.6.1"
4
4
  title: Bulk Insert Adapters via SQUADRULES CLI
5
5
  ---
6
6
 
@@ -47,7 +47,7 @@ and error recovery for bulk operations.
47
47
  **Bad trigger examples:**
48
48
 
49
49
  - "Train this one protocol" → use `squadrules train <file>` directly
50
- - "Create a new protocol" → use `create-new-protocol`
50
+ - "Create a new protocol" → use `author-adapter`
51
51
  - "Export my adapters" → use `squadrules export`
52
52
 
53
53
  ## Preflight Dependencies
@@ -1,5 +1,5 @@
1
1
  ---
2
- version: "5.5.1"
2
+ version: "5.6.1"
3
3
  slug: challenge-type-guide
4
4
  title: Challenge Type Selection Guide
5
5
  ---
@@ -14,7 +14,7 @@ drafting and review.
14
14
 
15
15
  ## Activation Patterns
16
16
 
17
- **Typically invoked by:** `create-new-protocol` and
17
+ **Typically invoked by:** `author-adapter` and
18
18
  `critic-loop`.
19
19
 
20
20
  **Can be invoked directly when agent needs:**
@@ -38,7 +38,7 @@ drafting and review.
38
38
  - reviewing challenge type selection in a draft → load this
39
39
 
40
40
  **Bad trigger examples:**
41
- - "Create a new protocol" → use `create-new-protocol`
41
+ - "Create a new protocol" → use `author-adapter`
42
42
  - "Review my protocol draft" → use `critic-loop`
43
43
 
44
44
  ## Core Rules