@heretyc/subagent-mcp 2.8.2 → 2.8.3
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/directives/carryover-claude.md +6 -10
- package/directives/carryover-codex.md +6 -10
- package/directives/orchestration-claude.md +22 -14
- package/directives/orchestration-codex.md +22 -13
- package/directives/reminder-off-claude.md +6 -7
- package/directives/reminder-off-codex.md +6 -7
- package/directives/reminder-on.md +5 -12
- package/directives/short-off.md +1 -0
- package/directives/short-on.md +1 -0
- package/dist/hooks/orchestration-claude.js +2 -1
- package/dist/hooks/orchestration-codex.js +2 -1
- package/dist/orchestration/hook-core.js +4 -4
- package/dist/setup.js +2 -1
- package/package.json +1 -1
- package/scripts/postinstall.mjs +1 -1
- package/directives/off-turn-reminder.md +0 -1
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
<!-- INJECTED PRE-PROMPT DIRECTIVE — BINDING, NON-NEGOTIABLE -->
|
|
2
|
+
<ORCHESTRATION-CARRYOVER>
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
(persists until disabled with permission). Not user-enabled THIS session.
|
|
4
|
+
Orchestration MODE was ON at session start — carried over from PRIOR session for this project (persists until disabled with permission). Not enabled THIS session.
|
|
6
5
|
|
|
7
6
|
THIS turn, ONCE:
|
|
8
7
|
1. NOTIFY user it carried over.
|
|
9
8
|
2. ASK keep ON? via AskUserQuestion.
|
|
10
|
-
3. ADVISE fit: long-horizon context-filling → keep ON; bounded
|
|
11
|
-
core-bound to main-session-only MCP → propose OFF.
|
|
9
|
+
3. ADVISE fit: long-horizon context-filling → keep ON; bounded/interactive/core-bound to main-session-only MCP → propose OFF.
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
enabled:false. NEVER disable on own initiative. After answer: handshake done —
|
|
15
|
-
do not re-raise.
|
|
11
|
+
Declines → orchestration-mode enabled:false. NEVER disable on own initiative. After answer: handshake done — do not re-raise.
|
|
16
12
|
|
|
17
|
-
</ORCHESTRATION-
|
|
13
|
+
</ORCHESTRATION-CARRYOVER>
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
<!-- INJECTED PRE-PROMPT DIRECTIVE — BINDING, NON-NEGOTIABLE -->
|
|
2
|
+
<ORCHESTRATION-CARRYOVER>
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
(persists until disabled with permission). Not user-enabled THIS session.
|
|
4
|
+
Orchestration MODE was ON at session start — carried over from PRIOR session for this project (persists until disabled with permission). Not enabled THIS session.
|
|
6
5
|
|
|
7
6
|
THIS turn, ONCE:
|
|
8
7
|
1. NOTIFY user it carried over.
|
|
9
8
|
2. ASK keep ON? via request-user-input.
|
|
10
|
-
3. ADVISE fit: long-horizon context-filling → keep ON; bounded
|
|
11
|
-
core-bound to main-session-only MCP → propose OFF.
|
|
9
|
+
3. ADVISE fit: long-horizon context-filling → keep ON; bounded/interactive/core-bound to main-session-only MCP → propose OFF.
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
enabled:false. NEVER disable on own initiative. After answer: handshake done —
|
|
15
|
-
do not re-raise.
|
|
11
|
+
Declines → orchestration-mode enabled:false. NEVER disable on own initiative. After answer: handshake done — do not re-raise.
|
|
16
12
|
|
|
17
|
-
</ORCHESTRATION-
|
|
13
|
+
</ORCHESTRATION-CARRYOVER>
|
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
ORCHESTRATION
|
|
3
|
-
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
<!-- INJECTED PRE-PROMPT DIRECTIVE — BINDING, NON-NEGOTIABLE -->
|
|
2
|
+
<ORCHESTRATION-INVARIANT priority="CRITICAL" override="NONE">
|
|
3
|
+
SCOPE: If this session's prompt begins with "<this is a request from a parent process>", SUB-AGENT-INVARIANT does NOT apply to this session, SKIP the remainder of this directive.
|
|
4
|
+
|
|
5
|
+
ORCHESTRATION MODE ON. You = ORCHESTRATOR. DEFAULT = DELEGATE.
|
|
6
|
+
|
|
7
|
+
INLINE BY RIGHT (no violation): steps bound to main-session-only capability —
|
|
8
|
+
MCP tools sub-agents can't inherit, interactive/consent tools, tight verify
|
|
9
|
+
loops. State which + why, one line.
|
|
10
|
+
|
|
11
|
+
MUST DELEGATE/OFFLOAD (breach if not): pure compute (parse/aggregate/transform);
|
|
12
|
+
any payload >50KB or >200 lines → scratch file, hand off the PATH.
|
|
13
|
+
Mixed task = SPLIT. One MCP-bound step never makes the whole task inline.
|
|
14
|
+
|
|
15
|
+
CONFLICT ORDER: safety-scope > user instruction this turn > delegate-default.
|
|
16
|
+
User tool-pin re-partitions work; does not suspend mode.
|
|
17
|
+
|
|
18
|
+
IPC = temp scratch files ONLY. Windows: %TEMP%. POSIX: /tmp.
|
|
19
|
+
Full model + governance: server MCP instructions.
|
|
20
|
+
DISABLE: never on own initiative. Propose via AskUserQuestion only.
|
|
21
|
+
|
|
22
|
+
</ORCHESTRATION-INVARIANT>
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
<!-- INJECTED PRE-PROMPT DIRECTIVE — BINDING, NON-NEGOTIABLE -->
|
|
2
|
+
<ORCHESTRATION-INVARIANT priority="CRITICAL" override="NONE">
|
|
3
|
+
SCOPE: If this session's prompt begins with "<this is a request from a parent process>", SUB-AGENT-INVARIANT does NOT apply to this session, SKIP the remainder of this directive.
|
|
4
|
+
|
|
5
|
+
ORCHESTRATION MODE ON. You = ORCHESTRATOR. DEFAULT = DELEGATE.
|
|
6
|
+
|
|
7
|
+
INLINE BY RIGHT (no violation): steps bound to main-session-only capability —
|
|
8
|
+
MCP tools sub-agents can't inherit, interactive/consent tools, tight verify
|
|
9
|
+
loops. State which + why, one line.
|
|
10
|
+
|
|
11
|
+
MUST DELEGATE/OFFLOAD (breach if not): pure compute (parse/aggregate/transform);
|
|
12
|
+
any payload >50KB or >200 lines → scratch file, hand off the PATH.
|
|
13
|
+
Mixed task = SPLIT. One MCP-bound step never makes the whole task inline.
|
|
14
|
+
|
|
15
|
+
CONFLICT ORDER: safety-scope > user instruction this turn > delegate-default.
|
|
16
|
+
User tool-pin re-partitions work; does not suspend mode.
|
|
17
|
+
|
|
18
|
+
IPC = temp scratch files ONLY. Windows: %TEMP%. POSIX: /tmp.
|
|
19
|
+
Full model + governance: server MCP instructions.
|
|
20
|
+
DISABLE: never on own initiative. Propose via request-user-input only.
|
|
21
|
+
|
|
22
|
+
</ORCHESTRATION-INVARIANT>
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
<!-- INJECTED PER-PROMPT REMINDER — BINDING -->
|
|
1
2
|
<ORCHESTRATION-INVARIANT>
|
|
2
|
-
|
|
3
|
-
5-CALL RULE:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Advisory: At all times, delegating via subagent-mcp auto routing is advisable - do not assume your training data is still current.
|
|
8
|
-
For Sub-agent sessions ONLY (first prompt began "<this is a request from a parent process>" or env SUBAGENT_MCP_SUBAGENT=1): ignore this block.
|
|
3
|
+
|
|
4
|
+
Orchestration OFF. 5-CALL RULE: request likely needs >5 tool calls, OR 5th call done with work remaining — STOP, ask via AskUserQuestion whether to switch Orchestration ON. Even OFF, delegating via subagent-mcp auto routing advisable for durable results — calling model not always best fit. Sub-agent sessions: ignore.
|
|
5
|
+
|
|
6
|
+
WAIT-NOT-POLL: learn agent finish via `wait` — blocks until terminal exit, returns exit status (`verbose: true` for final output). Never loop `poll_agent` for completion (floods orchestrator context). `poll_agent` = single-call diagnostic on one agent (stalled stream, one-shot output). Stalled = alive, NOT dead.
|
|
7
|
+
|
|
9
8
|
</ORCHESTRATION-INVARIANT>
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
<!-- INJECTED PER-PROMPT REMINDER — BINDING -->
|
|
1
2
|
<ORCHESTRATION-INVARIANT>
|
|
2
|
-
|
|
3
|
-
5-CALL RULE:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Advisory: At all times, delegating via subagent-mcp auto routing is advisable - do not assume your training data is still current.
|
|
8
|
-
For Sub-agent sessions ONLY (first prompt began "<this is a request from a parent process>" or env SUBAGENT_MCP_SUBAGENT=1): ignore this block.
|
|
3
|
+
|
|
4
|
+
Orchestration OFF. 5-CALL RULE: request likely needs >5 tool calls, OR 5th call done with work remaining — STOP, ask via request-user-input whether to switch Orchestration ON. Even OFF, delegating via subagent-mcp auto routing advisable for durable results — calling model not always best fit. Sub-agent sessions: ignore.
|
|
5
|
+
|
|
6
|
+
WAIT-NOT-POLL: learn agent finish via `wait` — blocks until terminal exit, returns exit status (`verbose: true` for final output). Never loop `poll_agent` for completion (floods orchestrator context). `poll_agent` = single-call diagnostic on one agent (stalled stream, one-shot output). Stalled = alive, NOT dead.
|
|
7
|
+
|
|
9
8
|
</ORCHESTRATION-INVARIANT>
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
+
<!-- INJECTED PER-PROMPT REMINDER — BINDING -->
|
|
1
2
|
<ORCHESTRATION-INVARIANT>
|
|
2
|
-
ORCHESTRATION ON. Route EVERY sub-agent launch ONLY via subagent-mcp launch_agent. Inline ONLY main-session-only-capability steps; temp scratch-file IPC allowed. Repo/system safety rules outrank this.
|
|
3
|
-
- Delegate-default. 5-CALL RULE is satisfied by delegation.
|
|
4
|
-
EVERY reply starts: route: delegate|inline - <reason>
|
|
5
|
-
- Ruthlessly preserve orchestrator context, NO EXCEPTIONS.
|
|
6
|
-
- Subagents ask questions through the orchestrator; answers
|
|
7
|
-
return to subagents.
|
|
8
|
-
- Sub-agents use %TEMP%, /tmp/, /TEMP/ for all IPC.
|
|
9
|
-
Orchestration Steps:
|
|
10
|
-
1. Map out work before orchestrating.
|
|
11
|
-
2. Decompose into phases which have atomic tasks that are separate subagents. Phases = understand → design → implement → review.
|
|
12
|
-
3. Execute the phases, dispatching sub-agents and between EACH phase dispatch a quality-review sub-agent to validate all work done.
|
|
13
3
|
|
|
14
|
-
|
|
4
|
+
Orchestration ON. Delegate-default: decompose, delegate, keep orchestrator context lean. 5-CALL RULE satisfied by delegation. Full model + governance: server MCP instructions. Sub-agent sessions: ignore.
|
|
5
|
+
|
|
6
|
+
WAIT-NOT-POLL: learn agent finish via `wait` — blocks until terminal exit, returns exit status (`verbose: true` for final output). Never loop `poll_agent` for completion (floods orchestrator context). `poll_agent` = single-call diagnostic on one agent (stalled stream, one-shot output). Stalled = alive, NOT dead.
|
|
7
|
+
|
|
15
8
|
</ORCHESTRATION-INVARIANT>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<SUB-AGENT-INVARIANT>Orchestration OFF. 5-CALL RULE applies this turn. Obey last <ORCHESTRATION-INVARIANT> block.</SUB-AGENT-INVARIANT>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<SUB-AGENT-INVARIANT>Orchestration ON. 5-CALL RULE applies this turn. Run user request now via orchestration steps. Obey last <ORCHESTRATION-INVARIANT> block.</SUB-AGENT-INVARIANT>
|
|
@@ -43,7 +43,8 @@ export const claudeAdapter = {
|
|
|
43
43
|
return countJsonlType(transcriptPath, "user");
|
|
44
44
|
},
|
|
45
45
|
fullDirectiveFile: "orchestration-claude.md",
|
|
46
|
-
|
|
46
|
+
shortOnFile: "short-on.md",
|
|
47
|
+
shortOffFile: "short-off.md",
|
|
47
48
|
carryoverDirectiveFile: "carryover-claude.md",
|
|
48
49
|
reminderOnFile: "reminder-on.md",
|
|
49
50
|
reminderOffFile: "reminder-off-claude.md",
|
|
@@ -58,7 +58,8 @@ export const codexAdapter = {
|
|
|
58
58
|
return countJsonlType(transcriptPath, "turn_context");
|
|
59
59
|
},
|
|
60
60
|
fullDirectiveFile: "orchestration-codex.md",
|
|
61
|
-
|
|
61
|
+
shortOnFile: "short-on.md",
|
|
62
|
+
shortOffFile: "short-off.md",
|
|
62
63
|
carryoverDirectiveFile: "carryover-codex.md",
|
|
63
64
|
reminderOnFile: "reminder-on.md",
|
|
64
65
|
reminderOffFile: "reminder-off-codex.md",
|
|
@@ -179,10 +179,10 @@ export function classifyClaim(owner_session, baseline_turn, current) {
|
|
|
179
179
|
* temp dir cannot hold the state file would otherwise inject only the compact
|
|
180
180
|
* rule carrier on every prompt and never refresh the LONG block.
|
|
181
181
|
*/
|
|
182
|
-
function cadenceEmit(env, adapter, longFile, count, persisted) {
|
|
182
|
+
function cadenceEmit(env, adapter, longFile, shortFile, count, persisted) {
|
|
183
183
|
return !persisted || count % REMINDER_PERIOD === 0
|
|
184
184
|
? readDirective(env, longFile)
|
|
185
|
-
: readDirective(env,
|
|
185
|
+
: readDirective(env, shortFile);
|
|
186
186
|
}
|
|
187
187
|
/**
|
|
188
188
|
* Claim (or re-claim) an active marker for the current session and emit the
|
|
@@ -237,7 +237,7 @@ export function runHook(payload, env, adapter) {
|
|
|
237
237
|
if (!marker.isActive(cwd)) {
|
|
238
238
|
// OFF: no claim machinery — just the per-prompt reminder cadence.
|
|
239
239
|
const r = reminder.advance(cwd, current);
|
|
240
|
-
return cadenceEmit(env, adapter, adapter.reminderOffFile, r.count, r.persisted);
|
|
240
|
+
return cadenceEmit(env, adapter, adapter.reminderOffFile, adapter.shortOffFile, r.count, r.persisted);
|
|
241
241
|
}
|
|
242
242
|
const m = marker.readMarker(cwd);
|
|
243
243
|
const kind = classifyClaim(m.owner_session, m.baseline_turn, current);
|
|
@@ -247,7 +247,7 @@ export function runHook(payload, env, adapter) {
|
|
|
247
247
|
}
|
|
248
248
|
// SAME-SESSION: per-prompt reminder cadence, ON variant.
|
|
249
249
|
const r = reminder.advance(cwd, current);
|
|
250
|
-
return cadenceEmit(env, adapter, adapter.reminderOnFile, r.count, r.persisted);
|
|
250
|
+
return cadenceEmit(env, adapter, adapter.reminderOnFile, adapter.shortOnFile, r.count, r.persisted);
|
|
251
251
|
}
|
|
252
252
|
catch {
|
|
253
253
|
// Any failure -> inject nothing. Never crash or stall the host turn.
|
package/dist/setup.js
CHANGED
|
@@ -232,7 +232,8 @@ export function verifyInstall(root = INSTALL_ROOT) {
|
|
|
232
232
|
"dist/hooks/orchestration-codex.js",
|
|
233
233
|
"directives/orchestration-claude.md",
|
|
234
234
|
"directives/orchestration-codex.md",
|
|
235
|
-
"directives/
|
|
235
|
+
"directives/short-on.md",
|
|
236
|
+
"directives/short-off.md",
|
|
236
237
|
"directives/reminder-on.md",
|
|
237
238
|
"directives/reminder-off-claude.md",
|
|
238
239
|
"directives/reminder-off-codex.md",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heretyc/subagent-mcp",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.3",
|
|
4
4
|
"description": "MCP server that launches and manages local Claude Code and Codex CLI sub-agents as child processes (no direct Anthropic/OpenAI API).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
package/scripts/postinstall.mjs
CHANGED
|
@@ -71,7 +71,7 @@ try {
|
|
|
71
71
|
// Detected vendors — concrete, so the user knows what setup will touch.
|
|
72
72
|
if (hasClaude || hasCodex) {
|
|
73
73
|
line(" Detected on this machine:");
|
|
74
|
-
if (hasClaude) line(" - Claude Code CLI (will get MCP server + UserPromptSubmit/PreToolUse hooks)");
|
|
74
|
+
if (hasClaude) line(" - Claude Code CLI (will get MCP server + UserPromptSubmit/PreToolUse hooks)");
|
|
75
75
|
if (hasCodex) line(" - Codex CLI (will get MCP server + SessionStart/UserPromptSubmit hooks)");
|
|
76
76
|
} else {
|
|
77
77
|
line(" No Claude Code or Codex CLI detected yet. Install one,");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<ORCHESTRATION-INVARIANT> SUBAGENT MANDATES bind THIS turn. 5-CALL RULE APPLIES. SOLE CHANNEL: launch sub-agents ONLY via subagent-mcp. OFF: ask before enabling orchestration. ON replies must start: route: delegate|inline - <reason>. </ORCHESTRATION-INVARIANT>
|