agent-composer 0.2.0 → 0.2.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.
- package/README.md +38 -2
- package/dist/cli/install-plugin.js +16 -4
- package/dist/cli/install-plugin.js.map +1 -1
- package/dist/util/dispatchHint.d.ts +15 -0
- package/dist/util/dispatchHint.js +110 -27
- package/dist/util/dispatchHint.js.map +1 -1
- package/package.json +1 -1
- package/plugin/composer-mastermind/README.md +15 -2
- package/plugin/composer-mastermind/hooks/boundary_guard.sh +30 -3
- package/plugin/composer-mastermind/hooks/learn.sh +23 -0
- package/plugin/composer-mastermind/hooks/lint-on-save.sh +24 -0
- package/plugin/composer-mastermind/skills/composer-mastermind/SKILL.md +21 -3
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ Two coordinated artefacts:
|
|
|
13
13
|
| **`agent-composer`** (this npm package) | MCP server exposing `composer_handoff_create`, `composer_research`, `composer_code`, `composer_code_chain`, `composer_code_cli`, `composer_review`, and `composer_review_claude`. Wraps GLM (via Anthropic-compatible endpoint) and CLI executors such as Codex, `agy`, or bounded `claude -p`. |
|
|
14
14
|
| **`composer-mastermind`** (Claude Code plugin) | Orchestrator skill + haiku-wrapped subagents (`coder`, `researcher`, `reviewer`, optional `reviewer-claude`) + `boundary_guard` PreToolUse hook + `/evolve` slash command. |
|
|
15
15
|
|
|
16
|
-
Combined, they turn the main Claude session into a coordinator that never writes code
|
|
16
|
+
Combined, they turn the main Claude session into a coordinator that never writes code or edits files directly. The main session may use Bash for inspection and verification, while code changes are dispatched through Composer MCP tools. The boundary hook fails closed if a denied file-mutating tool is requested.
|
|
17
17
|
|
|
18
18
|
## Tools
|
|
19
19
|
|
|
@@ -119,6 +119,27 @@ asks for Claude review or when a risky diff needs an expensive second opinion.
|
|
|
119
119
|
|
|
120
120
|
The MCP server reads `.env.json` via `fs.readFileSync` — it is **never** exposed to the orchestrator session.
|
|
121
121
|
|
|
122
|
+
### Soft-disable Composer
|
|
123
|
+
|
|
124
|
+
Composer hooks can be disabled without editing Claude Code settings:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Disable for one launch
|
|
128
|
+
COMPOSER_ENABLED=0 claude
|
|
129
|
+
|
|
130
|
+
# Disable globally for already-configured hooks
|
|
131
|
+
touch ~/.claude/composer.disabled
|
|
132
|
+
|
|
133
|
+
# Re-enable globally
|
|
134
|
+
rm -f ~/.claude/composer.disabled
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Project-local disable is also supported with `touch .composer-disabled`.
|
|
138
|
+
For scripts or tests, set `COMPOSER_DISABLED_FILE=/path/to/sentinel`.
|
|
139
|
+
This disables Composer hooks immediately. To fully suppress skill autoload,
|
|
140
|
+
also set `"composer-mastermind": "off"` in Claude Code `skillOverrides` and
|
|
141
|
+
restart CC.
|
|
142
|
+
|
|
122
143
|
## How dispatch works
|
|
123
144
|
|
|
124
145
|
Inside a Claude Code session, dispatch flow:
|
|
@@ -137,6 +158,21 @@ MCP server routes to GLM (anthropic) or Codex/agy CLI (cli) per composer.config.
|
|
|
137
158
|
Subagent returns summary; orchestrator integrates
|
|
138
159
|
```
|
|
139
160
|
|
|
161
|
+
Composer also emits a deterministic dispatch hint for `Task`/`Agent` calls
|
|
162
|
+
when `scripts/dispatch_guard.sh` is installed. The hint classifies the
|
|
163
|
+
request before the worker starts, so the orchestrator can choose a cheaper
|
|
164
|
+
lane when the task is simple and reserve expensive paths for the cases that
|
|
165
|
+
need isolation or extra reasoning.
|
|
166
|
+
|
|
167
|
+
| Task shape | Default route |
|
|
168
|
+
|---|---|
|
|
169
|
+
| Tiny rename/comment/non-mutating request | Inline |
|
|
170
|
+
| Small self-contained diff review | Inline review |
|
|
171
|
+
| File mutation with path references | `composer_code_cli` |
|
|
172
|
+
| Research-first implementation | Researcher brief, then `composer_code_cli` |
|
|
173
|
+
| Security or large review | `composer_review` first |
|
|
174
|
+
| Explicit premium/Claude review | `composer_review_claude` |
|
|
175
|
+
|
|
140
176
|
## Measuring trust
|
|
141
177
|
|
|
142
178
|
Composer's route-confidence harness compares the same tasks across direct
|
|
@@ -175,7 +211,7 @@ Five resilience layers ensure unattended `/evolve` runs cannot damage the host r
|
|
|
175
211
|
- **`agent-composer` publish surface**: `dist/`, `composer.config.schema.json`, `README.md`, `package.json`. No tests, no source, no `.env*` (gitignored). 34 KB tarball.
|
|
176
212
|
- **Spend caps**: per-call (`maxUsdPerCall`, default $0.50) and per-session (`maxUsdPerSession`, default $5.00) enforced in the runner before any external API call. Configurable per project.
|
|
177
213
|
- **Self-evolution scope** (see ADR 0003): five layers gate any SKILL.md mutation — diff-path regex, text deny-list, stat gate, human-promote-only, audit trail. Auto-promote is permanently off the table.
|
|
178
|
-
- **Boundary hook**: PreToolUse fail-closed denial of `Edit`/`Update`/`Write`/`
|
|
214
|
+
- **Boundary hook**: PreToolUse fail-closed denial of `Edit`/`Update`/`Write`/`NotebookEdit` in the orchestrator session, plus MCP write/edit/exec variants. Native Bash is allowed for inspection and verification. The C0.5 subagent tools allowlist is append-only.
|
|
179
215
|
|
|
180
216
|
## Contributing
|
|
181
217
|
|
|
@@ -87,7 +87,7 @@ function copyOne(srcPath, destPath, label, opts = {}) {
|
|
|
87
87
|
*/
|
|
88
88
|
function wireBoundaryHook(claudeHome, hookScriptPath) {
|
|
89
89
|
const settingsPath = join(claudeHome, "settings.json");
|
|
90
|
-
const matcher = "
|
|
90
|
+
const matcher = "Edit|Update|Write|NotebookEdit";
|
|
91
91
|
const entry = {
|
|
92
92
|
matcher,
|
|
93
93
|
hooks: [{ type: "command", command: hookScriptPath }],
|
|
@@ -112,9 +112,21 @@ function wireBoundaryHook(claudeHome, hookScriptPath) {
|
|
|
112
112
|
}
|
|
113
113
|
const hooks = current["hooks"] ?? {};
|
|
114
114
|
const preToolUse = hooks["PreToolUse"] ?? [];
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
const composerEntryIndex = preToolUse.findIndex((e) => e.hooks?.some((h) => h.command === hookScriptPath));
|
|
116
|
+
if (composerEntryIndex >= 0) {
|
|
117
|
+
const existing = preToolUse[composerEntryIndex];
|
|
118
|
+
if (existing.matcher !== matcher) {
|
|
119
|
+
const nextPreToolUse = preToolUse.map((e, i) => i === composerEntryIndex ? { ...e, matcher } : e);
|
|
120
|
+
const nextHooks = { ...hooks, PreToolUse: nextPreToolUse };
|
|
121
|
+
const next = { ...current, hooks: nextHooks };
|
|
122
|
+
writeFileSync(settingsPath, JSON.stringify(next, null, 2) + "\n", "utf8");
|
|
123
|
+
return {
|
|
124
|
+
name: "~/.claude/settings.json boundary hook",
|
|
125
|
+
status: "updated",
|
|
126
|
+
path: settingsPath,
|
|
127
|
+
reason: `refreshed PreToolUse matcher → ${matcher}`,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
118
130
|
return {
|
|
119
131
|
name: "~/.claude/settings.json boundary hook",
|
|
120
132
|
status: "skipped",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-plugin.js","sourceRoot":"","sources":["../../src/cli/install-plugin.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,EAAE;AACF,0EAA0E;AAC1E,sEAAsE;AACtE,sEAAsE;AACtE,EAAE;AACF,0EAA0E;AAC1E,oDAAoD;AAEpD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC;;;GAGG;AACH,MAAM,UAAU,sBAAsB;IACpC,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACrD,OAAO,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,E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uCAAuC;QAC7C,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE,+BAA+B,cAAc,EAAE;KACxD,CAAC;AACJ,CAAC"}
|
|
@@ -1,20 +1,35 @@
|
|
|
1
1
|
export type Tier = "cheap" | "premium";
|
|
2
2
|
export type Reasoning = "none" | "low" | "high";
|
|
3
3
|
export type PromptSize = "lite" | "full";
|
|
4
|
+
export type TaskClass = "unknown" | "refuse" | "review-inline" | "review" | "bug-explain" | "research-first-code" | "cross-file-code" | "simple-code" | "trivial";
|
|
5
|
+
export type RouteTarget = "inline" | "refuse" | "review-inline" | "task-reviewer" | "task-researcher-coder" | "composer-code-cli" | "composer-code-chain" | "composer-review-claude";
|
|
6
|
+
export type ProviderRole = "researcher" | "coder" | "coderCli" | "reviewer" | "reviewerClaude";
|
|
4
7
|
export interface DispatchSignals {
|
|
5
8
|
promptChars: number;
|
|
6
9
|
estOutputTokens: number;
|
|
7
10
|
hasCode: boolean;
|
|
8
11
|
hasFileRef: boolean;
|
|
9
12
|
hasDestructive: boolean;
|
|
13
|
+
hasResearch: boolean;
|
|
14
|
+
isWriteRequest: boolean;
|
|
15
|
+
isSecuritySensitive: boolean;
|
|
10
16
|
complexityScore: number;
|
|
11
17
|
isReviewWithInlineDiff: boolean;
|
|
12
18
|
}
|
|
19
|
+
export interface RoutePolicy {
|
|
20
|
+
taskClass: TaskClass;
|
|
21
|
+
target: RouteTarget;
|
|
22
|
+
providerRole?: ProviderRole;
|
|
23
|
+
requiresReview: boolean;
|
|
24
|
+
confidence: number;
|
|
25
|
+
rationale: string;
|
|
26
|
+
}
|
|
13
27
|
export interface DispatchHint {
|
|
14
28
|
tier: Tier;
|
|
15
29
|
reasoning: Reasoning;
|
|
16
30
|
promptSize: PromptSize;
|
|
17
31
|
recommendDispatch: boolean;
|
|
32
|
+
route: RoutePolicy;
|
|
18
33
|
rationale: string;
|
|
19
34
|
signals: DispatchSignals;
|
|
20
35
|
}
|
|
@@ -12,10 +12,14 @@ const WorkerPromptPartsSchema = z.object({
|
|
|
12
12
|
brief: z.string().optional(),
|
|
13
13
|
});
|
|
14
14
|
const CODE_KEYWORD = /\b(?:function|class|const|let|import|export|def)\b|=>/;
|
|
15
|
-
const FILE_REF =
|
|
15
|
+
const FILE_REF = /\b(?:(?:src|tests|lib|app)\/[A-Za-z0-9._/-]+|[A-Za-z0-9._/-]+\.(?:ts|tsx|js|jsx|mjs|cjs|json|md|vue|svelte|css|scss|html|py|rs|go|java|kt|swift|rb|php|sh|ya?ml)(?::\d+)?)\b/i;
|
|
16
16
|
const DESTRUCTIVE = /(?:\brm\s+-rf\b|\bdrop\s+table\b|\bdelete\s+from\b|\btruncate\b|\breset\s+--hard\b|--force\b|\bdestroy\b)/i;
|
|
17
17
|
const SENSITIVE = /security|auth|crypto|payment/i;
|
|
18
18
|
const REVIEW = /\b(review|audit)\b/i;
|
|
19
|
+
const PREMIUM_REVIEW = /\b(?:premium review|claude review|claude reviewer|review with claude|second opinion|escalate to claude)\b/i;
|
|
20
|
+
const BUG_EXPLAIN = /\b(find|explain|identify)\b.{0,40}\bbug\b|\boff-by-one\b|\bmissing await\b/i;
|
|
21
|
+
const RESEARCH = /\b(research|look up|lookup|docs?|documentation|best practice|current|latest|web search)\b/i;
|
|
22
|
+
const WRITE_REQUEST = /\b(add|implement|create|edit|modify|refactor|fix|write|update|change)\b/i;
|
|
19
23
|
const DIFF_OR_CODE_BLOCK = /```|^diff --git |^@@ |^(?:---|\+\+\+) /m;
|
|
20
24
|
const HIGH_COMPLEXITY_TERMS = [
|
|
21
25
|
/\brefactor(?:ing|s|ed)?\b/i,
|
|
@@ -41,47 +45,53 @@ export function classifyDispatch(input) {
|
|
|
41
45
|
const validated = ClassifyInputSchema.parse(input);
|
|
42
46
|
const prompt = validated.prompt;
|
|
43
47
|
const description = validated.description ?? "";
|
|
48
|
+
const corpus = `${description}\n${prompt}`;
|
|
44
49
|
const promptChars = prompt.length;
|
|
45
50
|
const hasCode = detectCode(prompt);
|
|
46
51
|
const hasFileRef = FILE_REF.test(prompt);
|
|
47
52
|
const hasDestructive = DESTRUCTIVE.test(prompt);
|
|
53
|
+
const hasResearch = RESEARCH.test(corpus);
|
|
54
|
+
const isWriteRequest = WRITE_REQUEST.test(corpus);
|
|
55
|
+
const isSecuritySensitive = SENSITIVE.test(corpus);
|
|
48
56
|
const complexityScore = computeComplexityScore(prompt, {
|
|
49
57
|
hasCode,
|
|
50
58
|
hasFileRef,
|
|
51
59
|
});
|
|
52
60
|
const estOutputTokens = Math.round((promptChars / 4) * (1 + complexityScore * 2)) +
|
|
53
61
|
(hasCode ? 200 : 0);
|
|
54
|
-
const isReviewWithInlineDiff = REVIEW.test(
|
|
55
|
-
let recommendDispatch = estOutputTokens > 500 || (hasFileRef && complexityScore > 0.3);
|
|
56
|
-
if (isReviewWithInlineDiff && estOutputTokens <= 600) {
|
|
57
|
-
recommendDispatch = false;
|
|
58
|
-
}
|
|
59
|
-
if (hasDestructive && promptChars < 200) {
|
|
60
|
-
recommendDispatch = false;
|
|
61
|
-
}
|
|
62
|
-
const sensitive = SENSITIVE.test(`${description}\n${prompt}`);
|
|
63
|
-
const tier = complexityScore >= 0.6 || promptChars > 2000 || sensitive
|
|
64
|
-
? "premium"
|
|
65
|
-
: "cheap";
|
|
66
|
-
const reasoning = complexityScore >= 0.6 ? "high" : complexityScore >= 0.25 ? "low" : "none";
|
|
67
|
-
const promptSize = complexityScore >= 0.4 || (hasFileRef && estOutputTokens > 800)
|
|
68
|
-
? "full"
|
|
69
|
-
: "lite";
|
|
62
|
+
const isReviewWithInlineDiff = REVIEW.test(corpus) && DIFF_OR_CODE_BLOCK.test(prompt);
|
|
70
63
|
const signals = {
|
|
71
64
|
promptChars,
|
|
72
65
|
estOutputTokens,
|
|
73
66
|
hasCode,
|
|
74
67
|
hasFileRef,
|
|
75
68
|
hasDestructive,
|
|
69
|
+
hasResearch,
|
|
70
|
+
isWriteRequest,
|
|
71
|
+
isSecuritySensitive,
|
|
76
72
|
complexityScore,
|
|
77
73
|
isReviewWithInlineDiff,
|
|
78
74
|
};
|
|
75
|
+
const route = classifyRoute({ corpus, signals });
|
|
76
|
+
const recommendDispatch = route.target !== "inline" &&
|
|
77
|
+
route.target !== "refuse" &&
|
|
78
|
+
route.target !== "review-inline";
|
|
79
|
+
const tier = complexityScore >= 0.6 || promptChars > 2000 || route.target === "composer-review-claude"
|
|
80
|
+
? "premium"
|
|
81
|
+
: "cheap";
|
|
82
|
+
const reasoning = complexityScore >= 0.6 ? "high" : complexityScore >= 0.25 ? "low" : "none";
|
|
83
|
+
const promptSize = route.target === "task-researcher-coder" ||
|
|
84
|
+
complexityScore >= 0.4 ||
|
|
85
|
+
(hasFileRef && estOutputTokens > 800)
|
|
86
|
+
? "full"
|
|
87
|
+
: "lite";
|
|
79
88
|
return {
|
|
80
89
|
tier,
|
|
81
90
|
reasoning,
|
|
82
91
|
promptSize,
|
|
83
92
|
recommendDispatch,
|
|
84
|
-
|
|
93
|
+
route,
|
|
94
|
+
rationale: rationaleFor({ recommendDispatch, route, signals }),
|
|
85
95
|
signals,
|
|
86
96
|
};
|
|
87
97
|
}
|
|
@@ -145,21 +155,94 @@ function computeComplexityScore(prompt, signals) {
|
|
|
145
155
|
score += 0.2;
|
|
146
156
|
return roundScore(clamp(score, 0, 1));
|
|
147
157
|
}
|
|
148
|
-
function
|
|
149
|
-
const {
|
|
158
|
+
function classifyRoute(input) {
|
|
159
|
+
const { corpus, signals } = input;
|
|
160
|
+
const wantsPremiumReview = PREMIUM_REVIEW.test(corpus);
|
|
150
161
|
if (signals.hasDestructive && signals.promptChars < 200) {
|
|
151
|
-
return
|
|
162
|
+
return routePolicy({
|
|
163
|
+
taskClass: "refuse",
|
|
164
|
+
target: "refuse",
|
|
165
|
+
confidence: 0.95,
|
|
166
|
+
rationale: "Tiny destructive prompt should be refused inline, not delegated.",
|
|
167
|
+
});
|
|
152
168
|
}
|
|
153
169
|
if (signals.isReviewWithInlineDiff && signals.estOutputTokens <= 600) {
|
|
154
|
-
return
|
|
170
|
+
return routePolicy({
|
|
171
|
+
taskClass: "review-inline",
|
|
172
|
+
target: "review-inline",
|
|
173
|
+
confidence: 0.86,
|
|
174
|
+
rationale: "Self-contained small diff review is cheaper inline than a cold reviewer dispatch.",
|
|
175
|
+
});
|
|
155
176
|
}
|
|
156
|
-
if (
|
|
157
|
-
return
|
|
177
|
+
if (REVIEW.test(corpus) && (signals.isSecuritySensitive || signals.promptChars > 1200 || wantsPremiumReview)) {
|
|
178
|
+
return routePolicy({
|
|
179
|
+
taskClass: "review",
|
|
180
|
+
target: wantsPremiumReview ? "composer-review-claude" : "task-reviewer",
|
|
181
|
+
providerRole: wantsPremiumReview ? "reviewerClaude" : "reviewer",
|
|
182
|
+
confidence: wantsPremiumReview ? 0.85 : signals.isSecuritySensitive ? 0.8 : 0.78,
|
|
183
|
+
rationale: wantsPremiumReview
|
|
184
|
+
? "Explicit premium review request should use the Claude reviewer lane."
|
|
185
|
+
: signals.isSecuritySensitive
|
|
186
|
+
? "Security-sensitive review should start in the isolated reviewer lane before premium escalation."
|
|
187
|
+
: "Large review prompt should be isolated in the reviewer context.",
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
if (BUG_EXPLAIN.test(corpus) && !signals.hasFileRef && signals.estOutputTokens <= 700) {
|
|
191
|
+
return routePolicy({
|
|
192
|
+
taskClass: "bug-explain",
|
|
193
|
+
target: "inline",
|
|
194
|
+
confidence: 0.74,
|
|
195
|
+
rationale: "Small bug explanation can stay inline; no file mutation or broad context needed.",
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
if (signals.hasResearch && signals.isWriteRequest) {
|
|
199
|
+
return routePolicy({
|
|
200
|
+
taskClass: "research-first-code",
|
|
201
|
+
target: "task-researcher-coder",
|
|
202
|
+
providerRole: "researcher",
|
|
203
|
+
requiresReview: true,
|
|
204
|
+
confidence: 0.82,
|
|
205
|
+
rationale: "Research-first implementation needs a researcher brief before code execution.",
|
|
206
|
+
});
|
|
158
207
|
}
|
|
159
|
-
if (
|
|
160
|
-
return
|
|
208
|
+
if (signals.isWriteRequest && (signals.complexityScore >= 0.4 || signals.hasFileRef)) {
|
|
209
|
+
return routePolicy({
|
|
210
|
+
taskClass: signals.complexityScore >= 0.4 ? "cross-file-code" : "simple-code",
|
|
211
|
+
target: "composer-code-cli",
|
|
212
|
+
providerRole: "coderCli",
|
|
213
|
+
requiresReview: true,
|
|
214
|
+
confidence: signals.complexityScore >= 0.4 ? 0.8 : 0.68,
|
|
215
|
+
rationale: "Code mutation should be applied off the main session by the CLI executor.",
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
if (LOW_COMPLEXITY_TERMS.some((term) => term.test(corpus))) {
|
|
219
|
+
return routePolicy({
|
|
220
|
+
taskClass: "trivial",
|
|
221
|
+
target: "inline",
|
|
222
|
+
confidence: 0.7,
|
|
223
|
+
rationale: "Trivial non-mutating prompt is cheaper inline.",
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
return routePolicy({
|
|
227
|
+
taskClass: "unknown",
|
|
228
|
+
target: "inline",
|
|
229
|
+
confidence: 0.55,
|
|
230
|
+
rationale: "No strong route signal; default to inline to avoid unnecessary cold dispatch.",
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
function routePolicy(policy) {
|
|
234
|
+
return {
|
|
235
|
+
requiresReview: false,
|
|
236
|
+
...policy,
|
|
237
|
+
confidence: roundScore(clamp(policy.confidence, 0, 1)),
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function rationaleFor(input) {
|
|
241
|
+
const { recommendDispatch, route, signals } = input;
|
|
242
|
+
if (recommendDispatch) {
|
|
243
|
+
return `Route ${route.target}: ${route.rationale} Estimated ${signals.estOutputTokens} tokens, complexity ${signals.complexityScore}.`;
|
|
161
244
|
}
|
|
162
|
-
return `
|
|
245
|
+
return `Route ${route.target}: ${route.rationale} Estimated ${signals.estOutputTokens} tokens, complexity ${signals.complexityScore}.`;
|
|
163
246
|
}
|
|
164
247
|
function nonEmptyItems(items) {
|
|
165
248
|
return items.filter((item) => item.trim().length > 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatchHint.js","sourceRoot":"","sources":["../../src/util/dispatchHint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"dispatchHint.js","sourceRoot":"","sources":["../../src/util/dispatchHint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA6ExB,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC;AAEH,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACrC,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC3C,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC1C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,uDAAuD,CAAC;AAC7E,MAAM,QAAQ,GACZ,+KAA+K,CAAC;AAClL,MAAM,WAAW,GACf,4GAA4G,CAAC;AAC/G,MAAM,SAAS,GAAG,+BAA+B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,CAAC,MAAM,KAAK,KAAK,CAAC,SAAS,cAAc,OAAO,CAAC,eAAe,uBAAuB,OAAO,CAAC,eAAe,GAAG,CAAC;IACzI,CAAC;IACD,OAAO,SAAS,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,SAAS,cAAc,OAAO,CAAC,eAAe,uBAAuB,OAAO,CAAC,eAAe,GAAG,CAAC;AACzI,CAAC;AAED,SAAS,aAAa,CAAC,KAA4B;IACjD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,WAAW,CAAC,KAAa,EAAE,IAAY;IAC9C,OAAO,GAAG,KAAK,MAAM,IAAI,EAAE,CAAC;AAC9B,CAAC;AAED,SAAS,UAAU,CAAC,KAAa,EAAE,KAA4B;IAC7D,OAAO,GAAG,KAAK,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AACrE,CAAC;AAED,SAAS,KAAK,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW;IACpD,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AACvC,CAAC"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## What it is
|
|
6
6
|
|
|
7
|
-
Composer-mastermind is a Claude Code plugin that turns the main session into a coordinator. The orchestrator never writes code
|
|
7
|
+
Composer-mastermind is a Claude Code plugin that turns the main session into a coordinator. The orchestrator never writes code or edits files directly; it may use Bash for inspection and verification. Code changes are dispatched through subagents and direct apply tools wired to the `agent-composer` MCP server:
|
|
8
8
|
|
|
9
9
|
| Subagent | Tool | Role |
|
|
10
10
|
|---|---|---|
|
|
@@ -16,7 +16,20 @@ Composer-mastermind is a Claude Code plugin that turns the main session into a c
|
|
|
16
16
|
| `reviewer` | `mcp__composer__composer_review` | Code review via `agy` CLI |
|
|
17
17
|
| `reviewer-claude` | `mcp__composer__composer_review_claude` | Premium Claude second-opinion review for explicit/risky cases |
|
|
18
18
|
|
|
19
|
-
The orchestrator's allowed-tool surface is enforced by `boundary_guard.sh` — `Edit`, `Update`, `Write`, `
|
|
19
|
+
The orchestrator's allowed-tool surface is enforced by `boundary_guard.sh` — `Edit`, `Update`, `Write`, `NotebookEdit`, and MCP write/edit/exec variants are denied; native Bash, composer MCP tools, `Read`, and `Glob` pass.
|
|
20
|
+
|
|
21
|
+
Soft-disable Composer hooks without editing Claude Code settings:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
COMPOSER_ENABLED=0 claude # one launch
|
|
25
|
+
touch ~/.claude/composer.disabled # global live toggle off
|
|
26
|
+
rm -f ~/.claude/composer.disabled # global live toggle on
|
|
27
|
+
touch .composer-disabled # project-local toggle off
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The sentinel disables hooks immediately. To fully suppress skill autoload,
|
|
31
|
+
set `"composer-mastermind": "off"` in Claude Code `skillOverrides` and restart
|
|
32
|
+
CC.
|
|
20
33
|
|
|
21
34
|
## What's inside
|
|
22
35
|
|
|
@@ -9,6 +9,29 @@
|
|
|
9
9
|
|
|
10
10
|
set -u
|
|
11
11
|
|
|
12
|
+
composer_disabled() {
|
|
13
|
+
case "${COMPOSER_ENABLED:-}" in
|
|
14
|
+
0|false|FALSE|off|OFF|no|NO) return 0 ;;
|
|
15
|
+
esac
|
|
16
|
+
case "${COMPOSER_DISABLED:-}" in
|
|
17
|
+
1|true|TRUE|on|ON|yes|YES) return 0 ;;
|
|
18
|
+
esac
|
|
19
|
+
if [[ -n "${COMPOSER_DISABLED_FILE:-}" && -e "$COMPOSER_DISABLED_FILE" ]]; then
|
|
20
|
+
return 0
|
|
21
|
+
fi
|
|
22
|
+
if [[ -n "${CLAUDE_PROJECT_DIR:-}" && -e "$CLAUDE_PROJECT_DIR/.composer-disabled" ]]; then
|
|
23
|
+
return 0
|
|
24
|
+
fi
|
|
25
|
+
if [[ -n "${HOME:-}" && -e "$HOME/.claude/composer.disabled" ]]; then
|
|
26
|
+
return 0
|
|
27
|
+
fi
|
|
28
|
+
return 1
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if composer_disabled; then
|
|
32
|
+
exit 0
|
|
33
|
+
fi
|
|
34
|
+
|
|
12
35
|
emit_deny() {
|
|
13
36
|
local reason="$1"
|
|
14
37
|
# Claude Code v2.1.150+ requires the decision wrapped in hookSpecificOutput.
|
|
@@ -78,12 +101,16 @@ if [[ "$TRANSCRIPT" == */subagents/* ]] \
|
|
|
78
101
|
exit 0
|
|
79
102
|
fi
|
|
80
103
|
|
|
81
|
-
# 4. Block list — native dangerous tools + MCP-prefixed variants.
|
|
104
|
+
# 4. Block list — native dangerous file-mutating tools + MCP-prefixed variants.
|
|
105
|
+
# Native Bash is allowed on the main thread for inspection and verification;
|
|
106
|
+
# the orchestrator skill still forbids using Bash to author code or perform
|
|
107
|
+
# destructive state changes. MCP exec/bash wrappers stay blocked because they
|
|
108
|
+
# bypass Claude Code's native Bash permissions surface.
|
|
82
109
|
case "$TOOL" in
|
|
83
|
-
|
|
110
|
+
Edit|Update|Write|NotebookEdit \
|
|
84
111
|
| mcp__*__write_file | mcp__*__edit_file | mcp__*__bash \
|
|
85
112
|
| mcp__*__write | mcp__*__edit | mcp__*__exec)
|
|
86
|
-
emit_deny "DENY (main thread): route Edit/Update/Write via Task(subagent_type=\"coder\").
|
|
113
|
+
emit_deny "DENY (main thread): route Edit/Update/Write via Task(subagent_type=\"coder\"). Native Bash is allowed for inspection and verification."
|
|
87
114
|
;;
|
|
88
115
|
esac
|
|
89
116
|
|
|
@@ -8,6 +8,29 @@
|
|
|
8
8
|
|
|
9
9
|
set -u
|
|
10
10
|
|
|
11
|
+
composer_disabled() {
|
|
12
|
+
case "${COMPOSER_ENABLED:-}" in
|
|
13
|
+
0|false|FALSE|off|OFF|no|NO) return 0 ;;
|
|
14
|
+
esac
|
|
15
|
+
case "${COMPOSER_DISABLED:-}" in
|
|
16
|
+
1|true|TRUE|on|ON|yes|YES) return 0 ;;
|
|
17
|
+
esac
|
|
18
|
+
if [[ -n "${COMPOSER_DISABLED_FILE:-}" && -e "$COMPOSER_DISABLED_FILE" ]]; then
|
|
19
|
+
return 0
|
|
20
|
+
fi
|
|
21
|
+
if [[ -n "${CLAUDE_PROJECT_DIR:-}" && -e "$CLAUDE_PROJECT_DIR/.composer-disabled" ]]; then
|
|
22
|
+
return 0
|
|
23
|
+
fi
|
|
24
|
+
if [[ -n "${HOME:-}" && -e "$HOME/.claude/composer.disabled" ]]; then
|
|
25
|
+
return 0
|
|
26
|
+
fi
|
|
27
|
+
return 1
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if composer_disabled; then
|
|
31
|
+
exit 0
|
|
32
|
+
fi
|
|
33
|
+
|
|
11
34
|
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}"
|
|
12
35
|
LEARN_DIR="$PROJECT_DIR/.claude/learnings"
|
|
13
36
|
MONTH="$(date +%Y-%m)"
|
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# PostToolUse hook: auto-lint after Edit/Update/Write/NotebookEdit. Fail-soft.
|
|
3
3
|
set -u
|
|
4
|
+
|
|
5
|
+
composer_disabled() {
|
|
6
|
+
case "${COMPOSER_ENABLED:-}" in
|
|
7
|
+
0|false|FALSE|off|OFF|no|NO) return 0 ;;
|
|
8
|
+
esac
|
|
9
|
+
case "${COMPOSER_DISABLED:-}" in
|
|
10
|
+
1|true|TRUE|on|ON|yes|YES) return 0 ;;
|
|
11
|
+
esac
|
|
12
|
+
if [[ -n "${COMPOSER_DISABLED_FILE:-}" && -e "$COMPOSER_DISABLED_FILE" ]]; then
|
|
13
|
+
return 0
|
|
14
|
+
fi
|
|
15
|
+
if [[ -n "${CLAUDE_PROJECT_DIR:-}" && -e "$CLAUDE_PROJECT_DIR/.composer-disabled" ]]; then
|
|
16
|
+
return 0
|
|
17
|
+
fi
|
|
18
|
+
if [[ -n "${HOME:-}" && -e "$HOME/.claude/composer.disabled" ]]; then
|
|
19
|
+
return 0
|
|
20
|
+
fi
|
|
21
|
+
return 1
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if composer_disabled; then
|
|
25
|
+
exit 0
|
|
26
|
+
fi
|
|
27
|
+
|
|
4
28
|
command -v jq >/dev/null 2>&1 || exit 0
|
|
5
29
|
INPUT="$(cat || true)"
|
|
6
30
|
[[ -z "$INPUT" ]] && exit 0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: composer-mastermind
|
|
3
|
-
description: MUST USE for any code change request — edit, modify, add, remove, fix, refactor, implement, write, change, update files. Also for research, documentation lookup, or code review. Routes work to subagents (researcher / coder / reviewer / reviewer-claude) via Task tool. Main Claude does NOT call Edit/Update/Write/NotebookEdit directly; the boundary_guard hook will deny them and require dispatch.
|
|
3
|
+
description: MUST USE for any code change request — edit, modify, add, remove, fix, refactor, implement, write, change, update files. Also for research, documentation lookup, or code review. Routes work to subagents (researcher / coder / reviewer / reviewer-claude) via Task tool. Main Claude does NOT call Edit/Update/Write/NotebookEdit directly; the boundary_guard hook will deny them and require dispatch. Main Claude may use Bash only for inspection and verification.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Composer Mastermind
|
|
@@ -18,8 +18,12 @@ output.
|
|
|
18
18
|
|
|
19
19
|
# Hard prohibitions
|
|
20
20
|
|
|
21
|
-
- **DO NOT** use `Edit`, `Update`, `Write`,
|
|
21
|
+
- **DO NOT** use `Edit`, `Update`, `Write`, or `NotebookEdit`. If you
|
|
22
22
|
need any of these, delegate to a subagent or ask the user.
|
|
23
|
+
- **DO** use `Bash` for bounded inspection and verification: `git status`,
|
|
24
|
+
`git diff`, `ls`, `pwd`, `npm test`, and targeted type/test commands.
|
|
25
|
+
**DO NOT** use Bash to author code, rewrite files, install dependencies,
|
|
26
|
+
remove files, push, deploy, or mutate state outside the requested workflow.
|
|
23
27
|
- **DO NOT** call `mcp__composer__composer_research`, `composer_code`,
|
|
24
28
|
or `composer_review` directly from the main session. **ALWAYS**
|
|
25
29
|
dispatch via the `Task` tool to the matching subagent so the worker's
|
|
@@ -36,7 +40,8 @@ output.
|
|
|
36
40
|
**Default to `composer_code_cli`** for coding; the configured CLI executor
|
|
37
41
|
is Codex on this machine. Use `composer_code_chain` when you explicitly
|
|
38
42
|
want GLM to author complete files and the server to apply them.
|
|
39
|
-
- **NEVER** write code in the main session — not even a one-liner
|
|
43
|
+
- **NEVER** write code in the main session — not even a one-liner or a Bash
|
|
44
|
+
heredoc / `sed` / `awk` rewrite. Delegate to `coder`.
|
|
40
45
|
- **NEVER** speculate when a fact is needed. Delegate to `researcher`.
|
|
41
46
|
- **NEVER** integrate a candidate patch without review. Delegate to
|
|
42
47
|
`reviewer` first.
|
|
@@ -54,6 +59,19 @@ output.
|
|
|
54
59
|
| Claude review explicitly requested, or high-risk/security-sensitive second opinion | `reviewer-claude` subagent after the default `reviewer` gate |
|
|
55
60
|
| Anything that mutates state outside the conversation (push, deploy, install) | Escalate to the user. Do not act. |
|
|
56
61
|
|
|
62
|
+
**Class-based route policy:** route by task class, not by a blanket
|
|
63
|
+
"always dispatch" rule.
|
|
64
|
+
|
|
65
|
+
| Task class | Route |
|
|
66
|
+
|---|---|
|
|
67
|
+
| Refusal / destructive request / secret hardcode / unsafe config | Inline refusal; do not dispatch |
|
|
68
|
+
| Tiny explanation or self-contained bug explanation | Inline answer |
|
|
69
|
+
| Small inline diff review | Inline review unless security-sensitive |
|
|
70
|
+
| Security-sensitive review | `reviewer`, then `reviewer-claude` if risk remains or user asks |
|
|
71
|
+
| Research-first implementation | `researcher` brief → `composer_code_cli` → `reviewer` |
|
|
72
|
+
| Any file mutation | `composer_code_cli` by default; never Edit/Write in main session |
|
|
73
|
+
| GLM fallback requested or Codex unsuitable | `composer_code_chain` → `reviewer` |
|
|
74
|
+
|
|
57
75
|
For multi-step requests, run in order: `composer_handoff_create` →
|
|
58
76
|
`researcher` → plan → `composer_code_cli` by default, or `composer_code_chain`
|
|
59
77
|
(apply, passing `handoffPath`) → `reviewer` on the `git diff` with the
|