@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.
- package/README.md +15 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/embed-docs/mem/README.md +34 -37
- package/dist/embed-docs/mem/adapter-migration.md +31 -40
- package/dist/embed-docs/mem/author-adapter.md +91 -229
- package/dist/embed-docs/mem/bulk-insert-adapters-via-cli.md +28 -44
- package/dist/embed-docs/mem/challenge-type-guide.md +89 -205
- package/dist/embed-docs/mem/critic-loop-guide.md +10 -8
- package/dist/embed-docs/mem/critic-loop.md +20 -41
- package/dist/embed-docs/mem/protocol-linking-guide.md +36 -81
- package/dist/embed-docs/mem/refine-search.md +10 -33
- package/dist/resources/embedded-mcp-resources.d.ts +0 -4
- package/dist/resources/embedded-mcp-resources.d.ts.map +1 -1
- package/dist/resources/embedded-mcp-resources.js +10 -14
- package/dist/resources/embedded-mcp-resources.js.map +1 -1
- package/dist/resources/mem-resources-boot.d.ts.map +1 -1
- package/dist/resources/mem-resources-boot.js +6 -1
- package/dist/resources/mem-resources-boot.js.map +1 -1
- package/dist/runtime/boot-local-runtime.d.ts.map +1 -1
- package/dist/runtime/boot-local-runtime.js +9 -0
- package/dist/runtime/boot-local-runtime.js.map +1 -1
- package/dist/services/forward-runtime-store.d.ts +1 -5
- package/dist/services/forward-runtime-store.d.ts.map +1 -1
- package/dist/services/forward-runtime-store.js +1 -35
- package/dist/services/forward-runtime-store.js.map +1 -1
- package/dist/services/memory/validate-protocol-structure.d.ts.map +1 -1
- package/dist/services/memory/validate-protocol-structure.js +73 -4
- package/dist/services/memory/validate-protocol-structure.js.map +1 -1
- package/dist/services/qdrant/memory-retrieval.d.ts.map +1 -1
- package/dist/services/qdrant/memory-retrieval.js +1 -2
- package/dist/services/qdrant/memory-retrieval.js.map +1 -1
- package/dist/services/vector-store/lancedb/lance-records-engine.d.ts +7 -0
- package/dist/services/vector-store/lancedb/lance-records-engine.d.ts.map +1 -1
- package/dist/services/vector-store/lancedb/lance-records-engine.js +30 -1
- package/dist/services/vector-store/lancedb/lance-records-engine.js.map +1 -1
- package/dist/services/vector-store/lancedb/lance-records-mutations.d.ts.map +1 -1
- package/dist/services/vector-store/lancedb/lance-records-mutations.js +4 -1
- package/dist/services/vector-store/lancedb/lance-records-mutations.js.map +1 -1
- package/dist/services/vector-store/lancedb/lance-records-reads.d.ts.map +1 -1
- package/dist/services/vector-store/lancedb/lance-records-reads.js +1 -2
- package/dist/services/vector-store/lancedb/lance-records-reads.js.map +1 -1
- package/dist/services/vector-store/lancedb/lance-records-search.d.ts.map +1 -1
- package/dist/services/vector-store/lancedb/lance-records-search.js +8 -4
- package/dist/services/vector-store/lancedb/lance-records-search.js.map +1 -1
- package/dist/services/vector-store/lancedb/lance-records-write-artifact.d.ts.map +1 -1
- package/dist/services/vector-store/lancedb/lance-records-write-artifact.js +3 -1
- package/dist/services/vector-store/lancedb/lance-records-write-artifact.js.map +1 -1
- package/dist/services/vector-store/lancedb/lance-records-writes.d.ts.map +1 -1
- package/dist/services/vector-store/lancedb/lance-records-writes.js +6 -4
- package/dist/services/vector-store/lancedb/lance-records-writes.js.map +1 -1
- package/dist/services/vector-store/lancedb/lance-store-metadata.d.ts +21 -0
- package/dist/services/vector-store/lancedb/lance-store-metadata.d.ts.map +1 -0
- package/dist/services/vector-store/lancedb/lance-store-metadata.js +69 -0
- package/dist/services/vector-store/lancedb/lance-store-metadata.js.map +1 -0
- package/dist/stdio/stdio-banner.d.ts.map +1 -1
- package/dist/stdio/stdio-banner.js +1 -3
- package/dist/stdio/stdio-banner.js.map +1 -1
- package/dist/tools/export.d.ts.map +1 -1
- package/dist/tools/export.js +39 -0
- package/dist/tools/export.js.map +1 -1
- package/dist/tools/export_schema.d.ts +12 -0
- package/dist/tools/export_schema.d.ts.map +1 -1
- package/dist/tools/export_schema.js +11 -2
- package/dist/tools/export_schema.js.map +1 -1
- package/dist/tools/forward-trace.d.ts +1 -4
- package/dist/tools/forward-trace.d.ts.map +1 -1
- package/dist/tools/forward-trace.js +1 -111
- package/dist/tools/forward-trace.js.map +1 -1
- package/dist/tools/forward-view.d.ts +0 -1
- package/dist/tools/forward-view.d.ts.map +1 -1
- package/dist/tools/forward-view.js +4 -44
- package/dist/tools/forward-view.js.map +1 -1
- package/dist/tools/forward.d.ts.map +1 -1
- package/dist/tools/forward.js +1 -4
- package/dist/tools/forward.js.map +1 -1
- package/dist/tools/forward_schema.d.ts +0 -46
- package/dist/tools/forward_schema.d.ts.map +1 -1
- package/dist/tools/forward_schema.js +7 -32
- package/dist/tools/forward_schema.js.map +1 -1
- package/dist/tools/next-pow-challenge-shape.d.ts.map +1 -1
- package/dist/tools/next-pow-challenge-shape.js +0 -7
- package/dist/tools/next-pow-challenge-shape.js.map +1 -1
- package/dist/tools/next-pow-helpers.d.ts.map +1 -1
- package/dist/tools/next-pow-helpers.js +0 -3
- package/dist/tools/next-pow-helpers.js.map +1 -1
- package/dist/tools/next_schema.d.ts +4 -4
- package/dist/tools/next_schema.js +2 -2
- package/dist/tools/next_schema.js.map +1 -1
- package/dist/tools/search_output.d.ts.map +1 -1
- package/dist/tools/search_output.js +0 -5
- package/dist/tools/search_output.js.map +1 -1
- package/dist/tools/shell-challenge-invocation.d.ts +8 -2
- package/dist/tools/shell-challenge-invocation.d.ts.map +1 -1
- package/dist/tools/shell-challenge-invocation.js +18 -7
- package/dist/tools/shell-challenge-invocation.js.map +1 -1
- package/dist/tools/squadrules-challenge-display.d.ts.map +1 -1
- package/dist/tools/squadrules-challenge-display.js +7 -9
- package/dist/tools/squadrules-challenge-display.js.map +1 -1
- package/dist/tools/tool-registry.d.ts +23 -22
- package/dist/tools/tool-registry.d.ts.map +1 -1
- package/dist/tools/train.d.ts.map +1 -1
- package/dist/tools/train.js +31 -0
- package/dist/tools/train.js.map +1 -1
- package/dist/tools/train_schema.d.ts +11 -0
- package/dist/tools/train_schema.d.ts.map +1 -1
- package/dist/tools/train_schema.js +13 -4
- package/dist/tools/train_schema.js.map +1 -1
- package/dist/types/memory.d.ts +4 -18
- package/dist/types/memory.d.ts.map +1 -1
- package/dist/ui/assets/{AccountPage-BpPby8tL.js → AccountPage-rmFJddfQ.js} +1 -1
- package/dist/ui/assets/{ProtocolDetailPage-DFe_JOr3.js → ProtocolDetailPage-kPGgNobg.js} +1 -1
- package/dist/ui/assets/{ProtocolEditPage-HAcAGXw7.js → ProtocolEditPage-IvFbUiUS.js} +2 -2
- package/dist/ui/assets/RunGuidedPage-Db_CQ-9q.js +1 -0
- package/dist/ui/assets/{SkillBundlePage-CiMQN0nf.js → SkillBundlePage-DV9CXjfI.js} +1 -1
- package/dist/ui/assets/{export-skill-zip-D8iQY1Dl.js → export-skill-zip-seCWjJSV.js} +1 -1
- package/dist/ui/assets/{index-cB_UoTxa.css → index-BGjXjHf7.css} +1 -1
- package/dist/ui/assets/{index-DLLKkKKa.js → index-D_BmxEln.js} +3 -3
- package/dist/ui/index.html +2 -2
- package/dist/utils/adapter-alias.d.ts +1 -11
- package/dist/utils/adapter-alias.d.ts.map +1 -1
- package/dist/utils/adapter-alias.js +2 -20
- package/dist/utils/adapter-alias.js.map +1 -1
- package/dist/utils/directory-access.d.ts +26 -0
- package/dist/utils/directory-access.d.ts.map +1 -0
- package/dist/utils/directory-access.js +153 -0
- package/dist/utils/directory-access.js.map +1 -0
- package/package.json +1 -3
- package/dist/embed-docs/mem/create-new-protocol.md +0 -44
- package/dist/embed-docs/mem/phase-critic-guide.md +0 -42
- package/dist/embed-docs/mem/phase-critic.md +0 -46
- package/dist/embed-docs/mem/skill-format-guide.md +0 -280
- package/dist/ui/assets/RunGuidedPage-Bewi7Wsx.js +0 -1
|
@@ -1,94 +1,74 @@
|
|
|
1
1
|
---
|
|
2
2
|
slug: author-adapter
|
|
3
|
-
version: "5.
|
|
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
|
|
12
|
-
> are the primary user. When you author
|
|
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
|
-
>
|
|
16
|
-
> (
|
|
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`.
|
|
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 /
|
|
28
|
-
|
|
29
|
-
|
|
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
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
- "
|
|
39
|
-
- "train adapter into personal" / "train
|
|
40
|
-
- "
|
|
41
|
-
- "
|
|
42
|
-
- "
|
|
43
|
-
|
|
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
|
-
(
|
|
43
|
+
(adapter / workflow).
|
|
44
|
+
|
|
49
45
|
**Must Never:**
|
|
50
|
-
- Run when the user only asked to execute an existing
|
|
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
|
|
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
|
|
78
|
-
|
|
79
|
-
|
|
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
|
|
85
|
-
|
|
86
|
-
|
|
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":"
|
|
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"
|
|
83
|
+
| "update", "edit", "fix", "modify", "change", "improve", "patch", "refactor" | **update** |
|
|
104
84
|
|
|
105
|
-
Resolve the target from context without a confirmation prompt
|
|
106
|
-
|
|
107
|
-
|
|
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":"
|
|
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
|
|
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
|
|
124
|
-
| Multiple issue types / output formats
|
|
125
|
-
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
-
|
|
130
|
-
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
-
|
|
136
|
-
-
|
|
137
|
-
|
|
138
|
-
|
|
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.
|
|
182
|
-
|
|
183
|
-
Summarise gathered requirements or findings.
|
|
121
|
+
error, and plan the minimal change.
|
|
184
122
|
|
|
185
123
|
```json
|
|
186
|
-
{"contract":{"type":"
|
|
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
|
-
|
|
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**.
|
|
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`)
|
|
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
|
-
|
|
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
|
-
|
|
240
|
-
|
|
241
|
-
|
|
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
|
-
|
|
245
|
-
|
|
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
|
|
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
|
-
|
|
254
|
-
linked adapters or extract a reference file.
|
|
151
|
+
**Slug convention:** Every adapter gets a short, unique, lowercase-hyphenated slug.
|
|
255
152
|
|
|
256
|
-
**
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
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
|
|
162
|
+
FAIL gate, and solution check rules (`forward` with
|
|
163
|
+
`squadrules://adapter/critic-loop-guide`).
|
|
281
164
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
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":"
|
|
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
|
|
293
|
-
autonomous quality loop — the agent owns content, the critic owns quality, and
|
|
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
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
|
15
|
+
**Run this workflow when the user says ANY of:**
|
|
16
16
|
|
|
17
17
|
- "bulk insert adapters" / "bulk train adapters"
|
|
18
|
-
- "train all
|
|
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
|
|
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 |
|
|
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
|
|
31
|
-
- Train files that contain secrets or token-like strings without
|
|
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
|
|
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
|
|
44
|
-
- "Bulk insert the
|
|
45
|
-
- "Push all .md files in this directory to my personal space" → run this
|
|
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
|
|
50
|
-
- "Create a new
|
|
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
|
|
69
|
+
## Resolve Scope and Validate
|
|
69
70
|
|
|
70
|
-
Resolve
|
|
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
|
-
|
|
96
|
-
|
|
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":"
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
|
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.
|