@squadrules/mcp 5.10.1 → 5.12.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 (132) 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/resources/mem-resources-boot.d.ts.map +1 -1
  17. package/dist/resources/mem-resources-boot.js +6 -1
  18. package/dist/resources/mem-resources-boot.js.map +1 -1
  19. package/dist/runtime/boot-local-runtime.d.ts.map +1 -1
  20. package/dist/runtime/boot-local-runtime.js +9 -0
  21. package/dist/runtime/boot-local-runtime.js.map +1 -1
  22. package/dist/services/forward-runtime-store.d.ts +1 -5
  23. package/dist/services/forward-runtime-store.d.ts.map +1 -1
  24. package/dist/services/forward-runtime-store.js +1 -35
  25. package/dist/services/forward-runtime-store.js.map +1 -1
  26. package/dist/services/memory/validate-protocol-structure.d.ts.map +1 -1
  27. package/dist/services/memory/validate-protocol-structure.js +73 -4
  28. package/dist/services/memory/validate-protocol-structure.js.map +1 -1
  29. package/dist/services/qdrant/memory-retrieval.d.ts.map +1 -1
  30. package/dist/services/qdrant/memory-retrieval.js +1 -2
  31. package/dist/services/qdrant/memory-retrieval.js.map +1 -1
  32. package/dist/services/vector-store/lancedb/lance-records-engine.d.ts +7 -0
  33. package/dist/services/vector-store/lancedb/lance-records-engine.d.ts.map +1 -1
  34. package/dist/services/vector-store/lancedb/lance-records-engine.js +30 -1
  35. package/dist/services/vector-store/lancedb/lance-records-engine.js.map +1 -1
  36. package/dist/services/vector-store/lancedb/lance-records-mutations.d.ts.map +1 -1
  37. package/dist/services/vector-store/lancedb/lance-records-mutations.js +4 -1
  38. package/dist/services/vector-store/lancedb/lance-records-mutations.js.map +1 -1
  39. package/dist/services/vector-store/lancedb/lance-records-reads.d.ts.map +1 -1
  40. package/dist/services/vector-store/lancedb/lance-records-reads.js +1 -2
  41. package/dist/services/vector-store/lancedb/lance-records-reads.js.map +1 -1
  42. package/dist/services/vector-store/lancedb/lance-records-search.d.ts.map +1 -1
  43. package/dist/services/vector-store/lancedb/lance-records-search.js +8 -4
  44. package/dist/services/vector-store/lancedb/lance-records-search.js.map +1 -1
  45. package/dist/services/vector-store/lancedb/lance-records-write-artifact.d.ts.map +1 -1
  46. package/dist/services/vector-store/lancedb/lance-records-write-artifact.js +3 -1
  47. package/dist/services/vector-store/lancedb/lance-records-write-artifact.js.map +1 -1
  48. package/dist/services/vector-store/lancedb/lance-records-writes.d.ts.map +1 -1
  49. package/dist/services/vector-store/lancedb/lance-records-writes.js +6 -4
  50. package/dist/services/vector-store/lancedb/lance-records-writes.js.map +1 -1
  51. package/dist/services/vector-store/lancedb/lance-store-metadata.d.ts +21 -0
  52. package/dist/services/vector-store/lancedb/lance-store-metadata.d.ts.map +1 -0
  53. package/dist/services/vector-store/lancedb/lance-store-metadata.js +69 -0
  54. package/dist/services/vector-store/lancedb/lance-store-metadata.js.map +1 -0
  55. package/dist/stdio/stdio-banner.d.ts.map +1 -1
  56. package/dist/stdio/stdio-banner.js +1 -3
  57. package/dist/stdio/stdio-banner.js.map +1 -1
  58. package/dist/tools/export.d.ts.map +1 -1
  59. package/dist/tools/export.js +39 -0
  60. package/dist/tools/export.js.map +1 -1
  61. package/dist/tools/export_schema.d.ts +12 -0
  62. package/dist/tools/export_schema.d.ts.map +1 -1
  63. package/dist/tools/export_schema.js +11 -2
  64. package/dist/tools/export_schema.js.map +1 -1
  65. package/dist/tools/forward-trace.d.ts +1 -4
  66. package/dist/tools/forward-trace.d.ts.map +1 -1
  67. package/dist/tools/forward-trace.js +1 -111
  68. package/dist/tools/forward-trace.js.map +1 -1
  69. package/dist/tools/forward-view.d.ts +0 -1
  70. package/dist/tools/forward-view.d.ts.map +1 -1
  71. package/dist/tools/forward-view.js +4 -44
  72. package/dist/tools/forward-view.js.map +1 -1
  73. package/dist/tools/forward.d.ts.map +1 -1
  74. package/dist/tools/forward.js +1 -4
  75. package/dist/tools/forward.js.map +1 -1
  76. package/dist/tools/forward_schema.d.ts +0 -46
  77. package/dist/tools/forward_schema.d.ts.map +1 -1
  78. package/dist/tools/forward_schema.js +7 -32
  79. package/dist/tools/forward_schema.js.map +1 -1
  80. package/dist/tools/next-pow-challenge-shape.d.ts.map +1 -1
  81. package/dist/tools/next-pow-challenge-shape.js +0 -7
  82. package/dist/tools/next-pow-challenge-shape.js.map +1 -1
  83. package/dist/tools/next-pow-helpers.d.ts.map +1 -1
  84. package/dist/tools/next-pow-helpers.js +0 -3
  85. package/dist/tools/next-pow-helpers.js.map +1 -1
  86. package/dist/tools/next_schema.d.ts +4 -4
  87. package/dist/tools/next_schema.js +2 -2
  88. package/dist/tools/next_schema.js.map +1 -1
  89. package/dist/tools/search_output.d.ts.map +1 -1
  90. package/dist/tools/search_output.js +0 -5
  91. package/dist/tools/search_output.js.map +1 -1
  92. package/dist/tools/shell-challenge-invocation.d.ts +8 -2
  93. package/dist/tools/shell-challenge-invocation.d.ts.map +1 -1
  94. package/dist/tools/shell-challenge-invocation.js +18 -7
  95. package/dist/tools/shell-challenge-invocation.js.map +1 -1
  96. package/dist/tools/squadrules-challenge-display.d.ts.map +1 -1
  97. package/dist/tools/squadrules-challenge-display.js +7 -9
  98. package/dist/tools/squadrules-challenge-display.js.map +1 -1
  99. package/dist/tools/tool-registry.d.ts +23 -22
  100. package/dist/tools/tool-registry.d.ts.map +1 -1
  101. package/dist/tools/train.d.ts.map +1 -1
  102. package/dist/tools/train.js +31 -0
  103. package/dist/tools/train.js.map +1 -1
  104. package/dist/tools/train_schema.d.ts +11 -0
  105. package/dist/tools/train_schema.d.ts.map +1 -1
  106. package/dist/tools/train_schema.js +13 -4
  107. package/dist/tools/train_schema.js.map +1 -1
  108. package/dist/types/memory.d.ts +4 -18
  109. package/dist/types/memory.d.ts.map +1 -1
  110. package/dist/ui/assets/{AccountPage-BpPby8tL.js → AccountPage-rmFJddfQ.js} +1 -1
  111. package/dist/ui/assets/{ProtocolDetailPage-DFe_JOr3.js → ProtocolDetailPage-kPGgNobg.js} +1 -1
  112. package/dist/ui/assets/{ProtocolEditPage-HAcAGXw7.js → ProtocolEditPage-IvFbUiUS.js} +2 -2
  113. package/dist/ui/assets/RunGuidedPage-Db_CQ-9q.js +1 -0
  114. package/dist/ui/assets/{SkillBundlePage-CiMQN0nf.js → SkillBundlePage-DV9CXjfI.js} +1 -1
  115. package/dist/ui/assets/{export-skill-zip-D8iQY1Dl.js → export-skill-zip-seCWjJSV.js} +1 -1
  116. package/dist/ui/assets/{index-cB_UoTxa.css → index-BGjXjHf7.css} +1 -1
  117. package/dist/ui/assets/{index-DLLKkKKa.js → index-D_BmxEln.js} +3 -3
  118. package/dist/ui/index.html +2 -2
  119. package/dist/utils/adapter-alias.d.ts +1 -11
  120. package/dist/utils/adapter-alias.d.ts.map +1 -1
  121. package/dist/utils/adapter-alias.js +2 -20
  122. package/dist/utils/adapter-alias.js.map +1 -1
  123. package/dist/utils/directory-access.d.ts +26 -0
  124. package/dist/utils/directory-access.d.ts.map +1 -0
  125. package/dist/utils/directory-access.js +153 -0
  126. package/dist/utils/directory-access.js.map +1 -0
  127. package/package.json +1 -3
  128. package/dist/embed-docs/mem/create-new-protocol.md +0 -44
  129. package/dist/embed-docs/mem/phase-critic-guide.md +0 -42
  130. package/dist/embed-docs/mem/phase-critic.md +0 -46
  131. package/dist/embed-docs/mem/skill-format-guide.md +0 -280
  132. package/dist/ui/assets/RunGuidedPage-Bewi7Wsx.js +0 -1
@@ -1,94 +1,74 @@
1
1
  ---
2
2
  slug: author-adapter
3
- version: "5.10.1"
3
+ version: "5.12.0"
4
4
  title: Author Adapter (Create / Review / Refactor)
5
5
  ---
6
6
 
7
-
8
-
9
7
  # Author Adapter (Create / Review / Refactor)
10
8
 
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
9
+ > **Note to the agent:** SQUADRULES adapters are interfaces for AI agents — you
10
+ > are the primary user. When you author an adapter, you design behaviour for
13
11
  > yourself and others. Write for them: single source of truth (never duplicate
14
12
  > 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
13
+ > steps teach modes (each step teaches its cognitive mode), truth over fluency
14
+ > (an adapter that reads well but causes wrong behaviour is worse than one that
17
15
  > reads rough but executes correctly).
18
16
 
19
17
  ## Activation Patterns
20
18
 
21
- Preferred entry URI: `squadrules://adapter/author-adapter`. The retired
22
- `create-new-protocol` slug is a redirect tombstone (see phase-critic pattern).
19
+ Preferred entry URI: `squadrules://adapter/author-adapter`.
23
20
  If `forward.authoring` is present, use its operation and target throughout this
24
21
  run. Do not reinterpret update as create or change the target mid-run. This
25
22
  context describes the requested work; it does not override host permissions.
26
23
 
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.
24
+ SQUADRULES authoring lifecycle — create, review, or update adapters / workflows.
25
+ Supports three operations:
26
+ - **create** — draft and train a new adapter from scratch.
31
27
  - **review** — audit an existing adapter, family, or bundle for structural issues,
32
28
  missing cross-references, chaining gaps, DRY violations, stale guidance, or
33
29
  agent-hostile ambiguity. Read-only.
34
- - **update** — apply specific corrections to an existing adapter / protocol and
30
+ - **update** — apply specific corrections to an existing adapter and
35
31
  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)
32
+
33
+ **Run this adapter when the user says ANY of:**
34
+ - "create a new SQUADRULES adapter" / "register a personal adapter"
35
+ - "train adapter into personal" / "train a workflow"
36
+ - "review adapter" / "audit adapters" / "check adapter families for gaps"
37
+ - "update adapter" / "edit adapter" / "fix adapter" / "modify adapter"
38
+ - "patch adapter" / "refactor adapter" / "change adapter" / "improve adapter"
39
+
45
40
  **Trigger pattern:** **create** / **train** / **register** / **review** /
46
41
  **audit** / **fix** / **update** / **edit** / **modify** / **change** /
47
42
  **improve** / **patch** / **refactor** / **correct** +
48
- (protocol / adapter / workflow).
43
+ (adapter / workflow).
44
+
49
45
  **Must Never:**
50
- - Run when the user only asked to execute an existing protocol.
46
+ - Run when the user only asked to execute an existing adapter.
51
47
  - Mutate adapters during a `review` operation.
52
- - Optimise only for pretty wording; this protocol designs agent behaviour.
48
+ - Optimise only for pretty wording; this adapter designs agent behaviour.
53
49
  - Treat "update", "edit", or "modify an existing adapter" as **create**.
50
+
54
51
  **Must Always:**
55
52
  - Infer `{operation}` from trigger: create / review / update.
56
- When the user says "update", "edit", "modify", or "fix" → operation is **update**.
57
53
  - 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
54
  - Include Activation Patterns as the first H2 and Reward Signal as the last H2
61
55
  in any newly drafted adapter.
62
56
  - 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
57
 
75
58
  ## Preflight Dependencies
76
59
 
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`).
60
+ Before running authoring actions, verify dependency and auth readiness:
61
+ 1. Required MCP tools are available: `activate`, `forward`, `reward`, and the
62
+ operation-dependent tool (`train`, `export`, or `tune`).
81
63
  2. Required CLI tools for planned shell steps are installed and callable.
82
64
  3. Required auth/session state is valid for the target MCP server.
83
65
 
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.
66
+ If any check fails, attempt AI-assisted remediation automatically, then re-run
67
+ preflight. Only hard-stop when a required tool or auth genuinely cannot be
68
+ established autonomously.
89
69
 
90
70
  ```json
91
- {"contract":{"type":"comment","comment":{"min_length":80},"required":true}}
71
+ {"contract":{"type":"shell","shell":{"cmd":"echo 'preflight: ok'","interpreter":"bash","timeout_seconds":10},"required":true}}
92
72
  ```
93
73
 
94
74
  ## Resolve Intent Autonomously
@@ -100,198 +80,101 @@ Use structured `authoring` when provided. For original calls without it, infer
100
80
  |---|---|
101
81
  | "create", "new", "train", no match from activate | **create** |
102
82
  | "review", "audit", "check", "gaps", "cross-references" | **review** |
103
- | "update", "edit", "fix", "modify", "change", "improve", "patch", "refactor", "add missing", "correct" | **update** |
83
+ | "update", "edit", "fix", "modify", "change", "improve", "patch", "refactor" | **update** |
104
84
 
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.
85
+ Resolve the target from context without a confirmation prompt. Record the
86
+ inferred operation and target, then continue. Escalate to the user only when
87
+ the request is genuinely ambiguous and no reasonable default exists.
111
88
 
112
89
  ```json
113
- {"contract":{"type":"comment","comment":{"min_length":80},"required":true}}
90
+ {"contract":{"type":"subagent","subagent":{"instruction":"Resolve the authoring operation (create/review/update) and target adapter from user context. Record the decision."},"required":true}}
114
91
  ```
115
92
 
116
93
  ## Gather Requirements
117
94
 
118
- ### For `create` — collect details for a new protocol
95
+ ### For `create` — collect details for a new adapter
96
+
119
97
  **1. Determine the pattern:**
120
98
 
121
99
  | Signal | Pattern |
122
100
  |---|---|
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`)?
101
+ | One workflow, no variants | **Standalone** — one adapter, all steps inline |
102
+ | Multiple issue types / output formats | **Router + Extensions** — router classifies, routes via `activate` |
103
+ | Exceeds 350 lines or too complex for weaker models | **Chain** — split into sequential adapters linked via `forward` + slug |
104
+
105
+ **2. Collect per adapter:**
106
+ - Title, user problem, agent behaviour, mode map, steps, challenge type per step
107
+ - Domain reference, existing adapters to reuse/compose, DRY/size check
108
+ - Chain position, failure analysis
109
+
110
+ ### For `review` — audit existing adapters
111
+
112
+ Export target adapter(s). Check: user-need fit, mode/step clarity,
113
+ cross-reference completeness, handoff gaps, DRY violations, contract coverage,
114
+ truth-first behaviour, activation pattern accuracy, structure compliance
115
+ (first H2 Activation Patterns, last H2 Reward Signal, under 350 lines),
116
+ sibling consistency, chained adapter families, critic-loop integration.
177
117
 
178
118
  ### For `update` — identify the specific issue
179
119
 
180
120
  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.
121
+ error, and plan the minimal change.
184
122
 
185
123
  ```json
186
- {"contract":{"type":"comment","comment":{"min_length":80},"required":true}}
124
+ {"contract":{"type":"subagent","subagent":{"instruction":"Gather requirements for the resolved operation: collect pattern/details for create, audit checklist for review, or identify the specific issue for update."},"required":true}}
187
125
  ```
188
126
 
189
127
  ## Draft Markdown
190
128
 
191
129
  ### MCP / Local-Filesystem Boundary
192
130
 
193
- The MCP database and the local repo/filesystem are **independent environments**.
194
-
195
- - A personal adapter stored in MCP **cannot** reference local files
196
- (`.qoder/rules/`, `src/`, etc.) — those files do not exist inside the MCP
197
- execution context.
198
- - A personal adapter **cannot** use `mcp forward` contracts with
199
- `squadrules://adapter/` URIs pointing to other personal adapters — the target
200
- may not exist in every user's space.
131
+ - A personal adapter stored in MCP **cannot** reference local files.
201
132
  - Only **system adapters** (bundled in the server) can chain to other system
202
133
  adapters via `forward`.
203
- - Personal adapters must be **self-contained**. If guidance text references a
204
- local constraint file, it is prose-only context for the drafting agent, not a
205
- runtime dependency.
134
+ - Personal adapters must be **self-contained**.
206
135
  - When a shell contract needs a reusable script, attach it as an **artifact**
207
- via `train` (with `mime`, `artifact_name`, `adapter_uri`) rather than
208
- inlining it in the contract JSON. At execution time, reference it via
209
- `export` with `squadrules://artifact/{uuid}`.
210
-
211
- ### For `create` — draft new adapter markdown
212
-
213
- Draft the full markdown for `train`.
214
-
215
- ### For `review` — draft findings report
216
-
217
- Write a structured gap report to `$REVIEW_FINDINGS_FILE` (an absolute path
218
- provided by the invoking agent or chosen by you under
219
- `$SQUADRULES_LOCAL_ARTIFACT_DIR` with a session-unique segment). For each finding
220
- include:
221
- - adapter title
222
- - gap type
223
- - severity
224
- - why the issue matters for AI-agent behaviour
225
- - specific recommended fix
226
-
227
- ### For `update` — draft corrected adapter markdown
228
-
229
- Apply the identified change and show a diff-style summary of what changed.
230
-
231
- ### Shared drafting rules (all operations)
232
- **Core SQUADRULES rule — right mode at the right time:**
136
+ via `train` (with `mime`, `artifact_name`, `adapter_uri`).
233
137
 
234
- Every protocol must help the agent recognise whether the current step is for
235
- exploration, clarification, ideation, planning, execution, validation, review,
236
- or handoff. Do not blur those modes.
237
- **Truth over fluency:**
138
+ ### Drafting rules (all operations)
238
139
 
239
- Design protocols to reduce guessing and fake certainty. Prefer explicit prompts,
240
- explicit stop conditions, explicit uncertainty escalation, and observable
241
- verification over narrative reassurance.
242
- **User need over literal phrasing:**
140
+ **Right mode at the right time:** Every adapter must help the agent recognise
141
+ whether the current step is for exploration, clarification, ideation, planning,
142
+ execution, validation, review, or handoff.
243
143
 
244
- The protocol should help the agent provide what the user actually needs, not
245
- just echo the wording used in the request.
246
- **DRY:**
144
+ **Truth over fluency:** Prefer explicit prompts, stop conditions, uncertainty
145
+ escalation, and observable verification over narrative reassurance.
247
146
 
248
- Shared content across protocols must live in one place. If two protocols share
249
- >50% of their body, extract shared logic.
147
+ **DRY:** Shared content across adapters must live in one place.
250
148
 
251
- **350-line maximum per file:**
149
+ **350-line maximum per file.** Split into linked adapters if exceeded.
252
150
 
253
- No protocol file may exceed 350 lines. If it grows beyond that, split it into
254
- linked adapters or extract a reference file.
151
+ **Slug convention:** Every adapter gets a short, unique, lowercase-hyphenated slug.
255
152
 
256
- **Generic-first — create generic, link from detailed:**
257
-
258
- Create protocols from generic to detailed. The generic adapter must stand alone.
259
- Extensions should contain only the delta.
260
-
261
- **Slug convention — deterministic protocol linking:**
262
-
263
- Every protocol gets a short, unique, lowercase-hyphenated `slug`.
264
-
265
- **Artifacts:**
266
-
267
- Store scripts or config blobs as artifacts via `train` (set `mime`,
268
- `artifact_name`, `adapter_uri`). Retrieve with `export` using
269
- `squadrules://artifact/{uuid}`.
270
-
271
- **Protocol structure:** H1 title, first H2 Activation Patterns, second H2
272
- Preflight Dependencies, middle H2s one per step with JSON contract block, last
273
- H2 Reward Signal. Frontmatter: `slug` (required), `version` (optional),
274
- `chain_root` (required for mid-chain adapters).
153
+ **Structure:** H1 title, first H2 Activation Patterns, second H2 Preflight
154
+ Dependencies, middle H2s one per step with JSON contract block, last H2 Reward
155
+ Signal. Frontmatter: `slug` (required), `version` (optional), `chain_root`
156
+ (required for mid-chain adapters).
275
157
 
276
158
  **Challenge types:** Load `challenge-type-guide` for decision rules and JSON
277
159
  formats (`forward` with `squadrules://adapter/challenge-type-guide`).
278
160
 
279
161
  **Critic-loop and mutation gates:** Load `critic-loop-guide` for placement,
280
- FAIL gate, and solution check rules (`forward` with `squadrules://adapter/critic-loop-guide`).
162
+ FAIL gate, and solution check rules (`forward` with
163
+ `squadrules://adapter/critic-loop-guide`).
281
164
 
282
- **If Router pattern:** draft the router and each extension as separate files.
283
-
284
- Post the full drafted markdown.
165
+ For `create`: draft the full adapter markdown.
166
+ For `review`: write a structured gap report to `$REVIEW_FINDINGS_FILE`.
167
+ For `update`: apply the identified change and show a diff-style summary.
285
168
 
286
169
  ```json
287
- {"contract":{"type":"comment","comment":{"min_length":120},"required":true}}
170
+ {"contract":{"type":"subagent","subagent":{"instruction":"Draft the adapter markdown (create), findings report (review), or corrected markdown (update) following all shared drafting rules."},"required":true}}
288
171
  ```
289
172
 
290
173
  ## Critic-Loop Review (create and update only)
291
174
 
292
- For `create` and `update`: run critic-loop against the drafted markdown. This is an
293
- autonomous quality loop — the agent owns content, the critic owns quality, and no
294
- human approval is requested at any point.
175
+ For `create` and `update`: run critic-loop against the drafted markdown. This is
176
+ an autonomous quality loop — the agent owns content, the critic owns quality, and
177
+ no human approval is requested at any point.
295
178
 
296
179
  1. Invoke critic-loop via `forward` with `squadrules://adapter/critic-loop`.
297
180
  Submit the drafted markdown as a `file_set` work submission — write
@@ -302,7 +185,7 @@ human approval is requested at any point.
302
185
  2. Run the FAIL gate shell contract on the verdict file:
303
186
 
304
187
  ```json
305
- {"contract":{"type":"shell","shell":{"cmd":"head -1 \"$VERDICT_FILE\" | grep -qi '^PASS$'","timeout_seconds":5},"required":true}}
188
+ {"contract":{"type":"shell","shell":{"cmd":"head -1 \"$VERDICT_FILE\" | grep -qi '^PASS$'","interpreter":"bash","timeout_seconds":5},"required":true}}
306
189
  ```
307
190
 
308
191
  3. If FAIL: address every finding, then re-invoke critic-loop and re-run the FAIL
@@ -313,29 +196,10 @@ human approval is requested at any point.
313
196
 
314
197
  For `review`: skip this step (read-only operation).
315
198
 
316
- ```json
317
- {"contract":{"type":"comment","comment":{"min_length":80},"required":true}}
318
- ```
319
-
320
- ## Autonomous Review Gate
321
-
322
- No human approval step. The critic-loop PASS verdict from the previous step is the
323
- sole quality gate; once it is PASS, proceed directly to finalise.
324
-
325
- For `create`: record the drafted adapter slug(s) and the critic-loop verdict, then
326
- continue to `train`.
327
-
328
- For `review`: record the findings and the actions taken, then continue.
329
-
330
- For `update`: record the corrected markdown, the change summary, and the critic
331
- verdict, then continue.
332
-
333
- ```json
334
- {"contract":{"type":"comment","comment":{"min_length":80},"required":true}}
335
- ```
336
-
337
199
  ## FinaliseOperation
338
200
 
201
+ No human approval step. The critic-loop PASS verdict is the sole quality gate.
202
+
339
203
  For `create`: call `train` with the drafted markdown and `review_evidence`
340
204
  from the critic-loop step. Use `force_update: false` unless overwrite was
341
205
  explicitly requested.
@@ -343,14 +207,12 @@ explicitly requested.
343
207
  For `review`: do not call `train`. Save the findings report only if requested.
344
208
 
345
209
  For `update`: use `tune` with the existing adapter URI, corrected content, and
346
- `review_evidence` for edits that preserve adapter identity and layer count.
347
- Use `train` with `force_update: true` only for a required structural replacement
348
- (such as changing identity/H1 mapping or layer count), preserving the intended
349
- space and verifying the resulting identity. Never create a duplicate as fallback.
350
- Update the corresponding repository source when the adapter is repo-managed;
351
- make repository edits in the task's isolated worktree.
352
-
353
- Report the outcome: adapter URI(s) for create / update, or findings summary for
210
+ `review_evidence`. Use `train` with `force_update: true` only for a required
211
+ structural replacement (changing identity/H1 mapping or layer count). Update the
212
+ corresponding repository source when the adapter is repo-managed; make repository
213
+ edits in the task's isolated worktree.
214
+
215
+ Report the outcome: adapter URI(s) for create/update, or findings summary for
354
216
  review.
355
217
 
356
218
  ```json
@@ -359,11 +221,11 @@ review.
359
221
 
360
222
  ## Reward Signal
361
223
 
362
- Protocol complete when:
224
+ Adapter complete when:
363
225
  - `create` — adapter(s) stored via `train` (with review_evidence) and URI(s) reported
364
226
  - `review` — findings report delivered
365
227
  - `update` — corrected adapter saved via `tune` (or required structural replacement),
366
228
  read back and verified; repo-managed source updated in the task worktree
367
229
 
368
230
  A successful result means the resulting SQUADRULES adapter is more truthful,
369
- phase-aware, agent-readable, and aligned with human–AI harmony.
231
+ step-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.10.1"
3
+ version: "5.12.0"
4
4
  title: Bulk Insert Adapters via SQUADRULES CLI
5
5
  ---
6
6
 
@@ -12,42 +12,43 @@ Batch-register multiple SQUADRULES adapters from a local directory tree using th
12
12
  `squadrules train` CLI. Handles directory scanning, validation, space targeting,
13
13
  and error recovery for bulk operations.
14
14
 
15
- **Run this protocol when the user says ANY of:**
15
+ **Run this workflow when the user says ANY of:**
16
16
 
17
17
  - "bulk insert adapters" / "bulk train adapters"
18
- - "train all protocols in a directory"
18
+ - "train all adapters in a directory"
19
19
  - "batch register adapters from folder"
20
20
  - "upload all .md files to SQUADRULES"
21
- - "sync local protocols to SQUADRULES" / "push protocols to SQUADRULES"
21
+ - "sync local adapters to SQUADRULES" / "push adapters to SQUADRULES"
22
22
  - "train directory recursively" / "train --recursive"
23
23
 
24
24
  **Trigger pattern:** **bulk** / **batch** / **all** / **directory** / **recursive** +
25
- (train | insert | register | upload | push | sync) + (adapters | protocols).
25
+ (train | insert | register | upload | push | sync) + (adapters | workflows).
26
26
 
27
27
  **Must Never:**
28
28
 
29
29
  - Train files without first validating their structure.
30
- - Overwrite existing adapters without explicit user confirmation (`--force`).
31
- - Train files that contain secrets or token-like strings without `--allow-sensitive-upload`.
30
+ - Overwrite existing adapters without explicit `--force`.
31
+ - Train files that contain secrets or token-like strings without
32
+ `--allow-sensitive-upload`.
32
33
  - Skip reporting partial failures in a batch.
33
34
 
34
35
  **Must Always:**
35
36
 
36
37
  - Verify the target directory exists and contains `.md` files.
37
- - Show the user the file list and target space before executing.
38
+ - Show the file list and target space before executing.
38
39
  - Report per-file success/failure after the batch completes.
39
40
  - Respect the user's choice of space (personal or group).
40
41
 
41
42
  **Good trigger examples:**
42
43
 
43
- - "Train all adapters in squadrules-v4/_personal/" → run this protocol
44
- - "Bulk insert the protocols from my export folder" → run this protocol
45
- - "Push all .md files in this directory to my personal space" → run this protocol
44
+ - "Train all adapters in my-adapters/" → run this workflow
45
+ - "Bulk insert the adapters from my export folder" → run this workflow
46
+ - "Push all .md files in this directory to my personal space" → run this workflow
46
47
 
47
48
  **Bad trigger examples:**
48
49
 
49
- - "Train this one protocol" → use `squadrules train <file>` directly
50
- - "Create a new protocol" → use `author-adapter`
50
+ - "Train this one adapter" → use `squadrules train <file>` directly
51
+ - "Create a new adapter" → use `author-adapter`
51
52
  - "Export my adapters" → use `squadrules export`
52
53
 
53
54
  ## Preflight Dependencies
@@ -62,42 +63,30 @@ Verify before execution:
62
63
  If any check fails, stop and report the issue with remediation guidance.
63
64
 
64
65
  ```json
65
- {"contract":{"type":"shell","shell":{"cmd":"squadrules --version && squadrules token > /dev/null 2>&1 && echo 'auth: ok'","timeout_seconds":15},"required":true}}
66
+ {"contract":{"type":"shell","shell":{"cmd":"squadrules --version && squadrules token > /dev/null 2>&1 && echo 'auth: ok'","interpreter":"bash","timeout_seconds":15},"required":true}}
66
67
  ```
67
68
 
68
- ## Resolve Scope Autonomously
69
+ ## Resolve Scope and Validate
69
70
 
70
- Resolve and record the batch operation details:
71
+ Resolve the batch operation details autonomously:
71
72
 
72
73
  1. **Source directory** — absolute path.
73
74
  2. **File count** — number of `.md` files found (recursive or flat).
74
75
  3. **Target space** — personal (default) or a named group space.
75
76
  4. **Force mode** — whether `--force` will be used (overwrites existing).
76
- 5. **Model attribution** — which `--model` value to use.
77
-
78
- List the files that will be trained, record the resolved scope, and proceed
79
- autonomously — no confirmation prompt.
80
-
81
- ```json
82
- {"contract":{"type":"comment","comment":{"min_length":80},"required":true}}
83
- ```
84
-
85
- ## Validate Structure
86
-
87
- Before training, validate each `.md` file against SQUADRULES adapter requirements:
88
77
 
78
+ Validate each `.md` file against SQUADRULES adapter requirements:
89
79
  - Has an H1 title.
90
80
  - First H2 is "Activation Patterns".
91
81
  - Last H2 is "Reward Signal".
92
82
  - Contains at least one fenced `json` block with a top-level `contract` object.
93
83
  - Does not exceed 350 lines.
94
84
 
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.
85
+ Skip invalid files, train the valid subset, and document every skipped file with
86
+ its validation error and a suggested fix. Do not stop to ask the user.
98
87
 
99
88
  ```json
100
- {"contract":{"type":"shell","shell":{"cmd":"echo 'Validation complete — see output above for results'","timeout_seconds":30},"required":true}}
89
+ {"contract":{"type":"shell","shell":{"cmd":"test -d \"$SOURCE_DIR\" && find \"$SOURCE_DIR\" -name '*.md' | head -1 | grep -q .","interpreter":"bash","timeout_seconds":10},"required":true}}
101
90
  ```
102
91
 
103
92
  ## Execute Bulk Train
@@ -109,14 +98,13 @@ squadrules train <directory> --recursive --model <model> --space <space> [--forc
109
98
  ```
110
99
 
111
100
  If the directory contains files that should NOT be trained (README, reference
112
- docs), either:
113
- - train file-by-file for the valid subset, or
114
- - move non-adapter files out before running `--recursive`
101
+ docs), either train file-by-file for the valid subset, or move non-adapter files
102
+ out before running `--recursive`.
115
103
 
116
104
  Capture stdout and stderr. The CLI reports per-file status.
117
105
 
118
106
  ```json
119
- {"contract":{"type":"shell","shell":{"cmd":"squadrules train <directory> --recursive --model <model_id> --space <space>","timeout_seconds":120},"required":true}}
107
+ {"contract":{"type":"shell","shell":{"cmd":"squadrules train \"$SOURCE_DIR\" --recursive --model \"$MODEL_ID\" --space \"$TARGET_SPACE\"","interpreter":"bash","timeout_seconds":120},"required":true}}
120
108
  ```
121
109
 
122
110
  ## Report Results
@@ -130,11 +118,7 @@ Summarise the batch outcome:
130
118
  | Failed | N |
131
119
  | Skipped (invalid) | N |
132
120
 
133
- For each failure, report:
134
- - File path
135
- - Error message
136
- - Suggested fix
137
-
121
+ For each failure, report: file path, error message, suggested fix.
138
122
  If all succeeded, confirm adapter URIs are accessible via `squadrules spaces`.
139
123
 
140
124
  ```json
@@ -143,11 +127,11 @@ If all succeeded, confirm adapter URIs are accessible via `squadrules spaces`.
143
127
 
144
128
  ## Reward Signal
145
129
 
146
- Protocol complete when:
130
+ Workflow complete when:
147
131
  - All valid adapter files in the target directory have been trained to the
148
132
  specified space.
149
- - Per-file results have been reported to the user.
133
+ - Per-file results have been reported.
150
134
  - Any failures have been documented with remediation guidance.
151
135
 
152
- A successful bulk insert means the user's local protocol library is now
136
+ A successful bulk insert means the user's local adapter library is now
153
137
  registered in SQUADRULES and available for activation by AI agents.