@heretyc/subagent-mcp 2.10.0 → 2.10.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/LICENSE CHANGED
@@ -1,201 +1,201 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined in Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity exercising
24
- permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or Object
36
- form, made available under the License, as indicated by a copyright
37
- notice that is included in or attached to the work (an example is
38
- provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original Work and any Derivative Works thereof, and any modifications
50
- and enhancements to those works or Derivative Works thereof, that is
51
- intentionally submitted to Licensor for inclusion in the Work by the
52
- copyright owner or by an individual or Legal Entity authorized to submit
53
- on behalf of the copyright owner. For the purposes of this definition,
54
- "submitted" means any form of electronic, verbal, or written communication
55
- sent to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any Legal Entity on behalf of
63
- whom a Contribution has been received by Licensor and subsequently
64
- incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file, then any
107
- Derivative Works that You distribute must include a readable
108
- copy of the attribution notices contained within such NOTICE
109
- file, excluding those notices that do not pertain to any part
110
- of the Derivative Works, in at least one of the following
111
- places: within a NOTICE text file distributed as part of the
112
- Derivative Works; within the Source form or documentation,
113
- if provided along with the Derivative Works; or, within a
114
- display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE from the Work, provided that
120
- such additional attribution notices cannot be construed as
121
- modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions of this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work by
132
- You to Licensor shall be under the terms and conditions of this License,
133
- without any additional terms or conditions. Notwithstanding the above,
134
- nothing herein shall supersede or modify the terms of any separate
135
- license agreement you may have executed with Licensor regarding such
136
- Contribution.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "{}"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file type. You may also add a brief
185
- description of what the file does on the same "printed page" as
186
- the copyright notice for easier identification within third-party
187
- archives.
188
-
189
- Copyright 2026 Lexi Blackburn
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined in Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
24
+ permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or Object
36
+ form, made available under the License, as indicated by a copyright
37
+ notice that is included in or attached to the work (an example is
38
+ provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original Work and any Derivative Works thereof, and any modifications
50
+ and enhancements to those works or Derivative Works thereof, that is
51
+ intentionally submitted to Licensor for inclusion in the Work by the
52
+ copyright owner or by an individual or Legal Entity authorized to submit
53
+ on behalf of the copyright owner. For the purposes of this definition,
54
+ "submitted" means any form of electronic, verbal, or written communication
55
+ sent to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
63
+ whom a Contribution has been received by Licensor and subsequently
64
+ incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file, then any
107
+ Derivative Works that You distribute must include a readable
108
+ copy of the attribution notices contained within such NOTICE
109
+ file, excluding those notices that do not pertain to any part
110
+ of the Derivative Works, in at least one of the following
111
+ places: within a NOTICE text file distributed as part of the
112
+ Derivative Works; within the Source form or documentation,
113
+ if provided along with the Derivative Works; or, within a
114
+ display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE from the Work, provided that
120
+ such additional attribution notices cannot be construed as
121
+ modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions of this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work by
132
+ You to Licensor shall be under the terms and conditions of this License,
133
+ without any additional terms or conditions. Notwithstanding the above,
134
+ nothing herein shall supersede or modify the terms of any separate
135
+ license agreement you may have executed with Licensor regarding such
136
+ Contribution.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file type. You may also add a brief
185
+ description of what the file does on the same "printed page" as
186
+ the copyright notice for easier identification within third-party
187
+ archives.
188
+
189
+ Copyright 2026 Lexi Blackburn
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/NOTICE CHANGED
@@ -1,5 +1,5 @@
1
- subagent-mcp
2
- Copyright 2026 Lexi Blackburn
3
-
4
- Licensed under the Apache License, Version 2.0.
5
- This product includes software developed by Lexi Blackburn.
1
+ subagent-mcp
2
+ Copyright 2026 Lexi Blackburn
3
+
4
+ Licensed under the Apache License, Version 2.0.
5
+ This product includes software developed by Lexi Blackburn.
package/README.md CHANGED
@@ -7,8 +7,6 @@
7
7
 
8
8
  MCP server that launches and manages always-interactive Claude Code and Codex sub-agent sessions — on macOS, Linux, and Windows. No direct API calls. No API keys.
9
9
 
10
- ---
11
-
12
10
  ## Install
13
11
 
14
12
  ### Prerequisites (runtime)
@@ -29,9 +27,11 @@ No authentication, no `.npmrc` configuration, and no PAT required. The package i
29
27
  npm install -g @heretyc/subagent-mcp
30
28
  ```
31
29
 
32
- **Use this path for all standard installs.**
33
-
34
- ### GitHub Packages (org-internal pin / supply-chain auditing)
30
+ **Use this path for all standard installs.**
31
+
32
+ `subagent-mcp update` always refreshes from npmjs, even on machines whose `.npmrc` routes `@heretyc` packages through GitHub Packages.
33
+
34
+ ### GitHub Packages (org-internal pin / supply-chain auditing)
35
35
 
36
36
  Use this path when your organization's `.npmrc` already routes the `@heretyc` scope through GitHub Packages, when you need supply-chain audit tracing against the org-internal artifact, or when you run inside a GitHub Actions workflow whose `GITHUB_TOKEN` carries `read:packages`. Otherwise prefer npmjs above — it is simpler and needs no credentials.
37
37
 
@@ -46,8 +46,6 @@ npm install -g @heretyc/subagent-mcp
46
46
 
47
47
  > **Note:** GitHub Packages requires authentication even for public packages. If you see `401 Unauthorized`, verify your PAT has the `read:packages` scope and has not expired. GitHub Packages does not render a README page — the live documentation appears on [npmjs.com](https://www.npmjs.com/package/@heretyc/subagent-mcp).
48
48
 
49
- ---
50
-
51
49
  ## Quick Start
52
50
 
53
51
  **1. Install** (see [Install](#install) above):
@@ -78,8 +76,6 @@ subagent-mcp init --global
78
76
 
79
77
  For manual wiring, Gemini CLI, Claude Desktop, and developer install from source, see [docs/registration.md](docs/registration.md).
80
78
 
81
- ---
82
-
83
79
  ## Features
84
80
 
85
81
  - Start Claude or Codex interactive sessions as managed sub-agents from any MCP host
@@ -91,8 +87,6 @@ For manual wiring, Gemini CLI, Claude Desktop, and developer install from source
91
87
  - stdio MCP transport; built with `@modelcontextprotocol/sdk` + `zod`
92
88
  - `orchestration-mode` tool — toggles orchestrator directives injected by bundled Claude Code / Codex hooks; Claude also gets a deterministic `PreToolUse` gate
93
89
 
94
- ---
95
-
96
90
  ## Orchestration Mode
97
91
 
98
92
  **ON:** the agent operates as an orchestrator — hook injection governs each session turn, preventing inline reads or writes, and all work is delegated through sub-agent tools.
@@ -101,12 +95,8 @@ For manual wiring, Gemini CLI, Claude Desktop, and developer install from source
101
95
 
102
96
  Toggle with the `orchestration-mode` tool. Desktop hosts toggle the mode but receive no hook injection. See [docs/spec/dev-loop/orchestration-directive-architecture.md](docs/spec/dev-loop/orchestration-directive-architecture.md) for full semantics.
103
97
 
104
- ---
105
-
106
98
  ## Auto Mode
107
99
 
108
- Pass `task_category` to `launch_agent` and the server picks the best provider, model, and effort for that category, with automatic fallback.
109
-
110
100
  `launch_agent` supports **auto mode**: pass `prompt` + `task_category` and the server picks the best provider/model/effort for that category from its routing table, silently falling back to the next-best candidate on any launch-time failure.
111
101
 
112
102
  `provider`, `model`, and `effort` are optional overrides — omit them to get the auto-selected best combination. Rules: passing `model` requires `provider`; passing `effort` requires both `provider` and `model`.
@@ -135,8 +125,6 @@ The last four are **composite-inferred**: they carry no dedicated benchmark and
135
125
 
136
126
  **Atomic-split guidance:** if you are unsure which category fits, do NOT submit one large amorphous task. Break the work into smaller atomic steps each mapping to a single category and launch one agent per step.
137
127
 
138
- ---
139
-
140
128
  ## Configuration
141
129
 
142
130
  ### Global concurrent-subagent cap
@@ -147,9 +135,7 @@ The cap is configured in `global-concurrency.jsonc`, a dedicated dist-sibling fi
147
135
 
148
136
  Set `globalConcurrentSubagents` in that file. The default is `20`; the minimum valid value is `10`. Validation is forced: `0`, unset, missing, or invalid values reset to `20`, and values `1` through `9` are pinned up to `10`. There is no environment-variable override; the file is the sole source of truth. The file is re-read on every `launch_agent` call, so edits take effect on the next launch with no server restart.
149
137
 
150
- When the cap is reached, `launch_agent` is rejected immediately; it never queues. Because the count includes other active sessions and the entire descendant tree, free slots manually with `list_agents` and `kill_agent` before retrying. There is no automatic cleanup or zombie reaping.
151
-
152
- ---
138
+ When the cap is reached, `launch_agent` is rejected immediately; it never queues. Before cap checks, hooks and tool calls run default zombie culling with no config knob: live agents idle for more than 6 minutes and terminal-but-alive agents idle for more than 30 seconds are terminated process-tree-first, then force-killed after 20 seconds if needed. Reports include `zombies`, and `poll_agent` keeps the tail with `zombie_killed` when culling terminates an agent.
153
139
 
154
140
  ## Tools
155
141
 
@@ -168,8 +154,6 @@ Eight tools are exposed over the stdio MCP transport.
168
154
 
169
155
  Full parameters, return shapes, and the `alive` / `idle_seconds` / `hint` / `recent_stream` fields are in [docs/tools.md](docs/tools.md).
170
156
 
171
- ---
172
-
173
157
  ## Agent Lifecycle
174
158
 
175
159
  Each agent transitions through these states:
@@ -184,8 +168,6 @@ Each agent transitions through these states:
184
168
 
185
169
  `processing` and `stalled` are live. `stalled` means the driver is alive but quiet (>= 10 min no visible stream); it recovers automatically and is never auto-killed — do not `kill_agent` a stalled agent. `wait` does not return on `stalled`. Full semantics: [docs/reference/status-lifecycle.md](docs/reference/status-lifecycle.md).
186
170
 
187
- ---
188
-
189
171
  ## Documentation
190
172
 
191
173
  | Document | Contents |
@@ -198,8 +180,6 @@ Each agent transitions through these states:
198
180
  | [docs/release-notes.md](docs/release-notes.md) | Operator-facing release notes |
199
181
  | [CONTRIBUTING.md](CONTRIBUTING.md) | Contributor guide — dev environment, build, test, publish |
200
182
 
201
- ---
202
-
203
183
  ## License
204
184
 
205
185
  Apache-2.0 — Copyright 2026 Lexi Blackburn
@@ -3,9 +3,11 @@ import { platform } from "node:os";
3
3
  import { join } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { CONCURRENCY_SCAFFOLD } from "./config-scaffold.js";
6
+ import { cullStaleSlots, ZOMBIE_FORCE_GRACE_MS, ZOMBIE_LIVE_IDLE_MS, ZOMBIE_TERMINAL_IDLE_MS, buildProcessTreeKillCommands, drainZombieIntents, drainZombieReports, parseSlotMetadata, readSlotMetadata, slotPathForAgent, writeSlotMetadata, } from "./zombie.js";
6
7
  export const DEFAULT_CAP = 20;
7
8
  export const MIN_CAP = 10;
8
9
  export const CONFIG_FILENAME = "global-concurrency.jsonc";
10
+ export { cullStaleSlots, ZOMBIE_FORCE_GRACE_MS, ZOMBIE_LIVE_IDLE_MS, ZOMBIE_TERMINAL_IDLE_MS, buildProcessTreeKillCommands, drainZombieIntents, drainZombieReports, parseSlotMetadata, readSlotMetadata, slotPathForAgent, writeSlotMetadata, };
9
11
  export function clampCap(raw) {
10
12
  if (!Number.isInteger(raw))
11
13
  return DEFAULT_CAP;
@@ -50,6 +52,8 @@ export function readGlobalCap(path = defaultConfigPath()) {
50
52
  }
51
53
  }
52
54
  export function slotDir() {
55
+ if (process.env.SUBAGENT_SLOT_DIR)
56
+ return process.env.SUBAGENT_SLOT_DIR;
53
57
  if (platform() === "win32") {
54
58
  return join(process.env.ProgramData || process.env.ALLUSERSPROFILE || "C:\\ProgramData", "subagent-mcp", "slots");
55
59
  }
@@ -63,11 +67,19 @@ export function countSlots(dir = slotDir()) {
63
67
  return 0;
64
68
  }
65
69
  }
66
- export function reserveSlot(agentId, max, dir = slotDir()) {
70
+ export function scheduleForceKill(ms, kill) {
71
+ const timer = setTimeout(kill, ms);
72
+ timer.unref();
73
+ }
74
+ export const NONBLOCKING_CULL_DEPS = {
75
+ scheduleForceKill,
76
+ };
77
+ export function reserveSlot(agentId, max, dir = slotDir(), cullDeps) {
67
78
  try {
68
79
  mkdirSync(dir, { recursive: true, mode: 0o1777 });
69
- const slotPath = join(dir, `slot-${agentId}.json`);
70
- writeFileSync(slotPath, JSON.stringify({ pid: process.pid, cwd: process.cwd(), startedAt: new Date().toISOString() }), { mode: 0o600 });
80
+ cullStaleSlots(dir, cullDeps);
81
+ const slotPath = slotPathForAgent(dir, agentId);
82
+ writeSlotMetadata(slotPath, { agent_id: agentId });
71
83
  const n = countSlots(dir);
72
84
  if (n > max) {
73
85
  try {
@@ -1,2 +1,2 @@
1
1
  // GENERATED by scripts/gen-ruleset-scaffold.mjs from src/global-concurrency.jsonc — DO NOT EDIT.
2
- export const CONCURRENCY_SCAFFOLD = "// subagent-mcp — Global Concurrent Subagent Cap\r\n// ------------------------------------------------------------------\r\n// SOLE source of truth for the machine-wide limit on how many subagents\r\n// may be ALIVE AT ONCE across EVERY session, process, and user on this\r\n// machine. There is NO environment-variable override.\r\n//\r\n// The whole recursive descendant tree counts toward this ONE number: a\r\n// subagent that itself launches subagents adds to the same machine-wide\r\n// total, and OTHER active agentic sessions count too.\r\n//\r\n// RE-READ on every launch_agent call — edits take effect immediately, no\r\n// server restart required.\r\n//\r\n// Value rules (forcibly applied to the number below):\r\n// - missing / unset / non-integer / 0 / negative -> reset to default 20\r\n// - 1 through 9 -> forced UP to minimum 10\r\n// - 10 or greater -> used as-is\r\n//\r\n// When the cap is reached, launch_agent is REJECTED (never queued). Free a\r\n// slot with list_agents + kill_agent, then retry.\r\n//\r\n// Slots free automatically as agents finish or are killed. There is NO\r\n// zombie reaping. If a server process CRASHES, its slots stay counted until\r\n// you delete the stale slot files by hand:\r\n// Windows: %ProgramData%\\subagent-mcp\\slots\r\n// macOS/Linux: /tmp/subagent-mcp/slots\r\n{\r\n \"globalConcurrentSubagents\": 20\r\n}\r\n";
2
+ export const CONCURRENCY_SCAFFOLD = "// subagent-mcp — Global Concurrent Subagent Cap\r\n// ------------------------------------------------------------------\r\n// SOLE source of truth for the machine-wide limit on how many subagents\r\n// may be ALIVE AT ONCE across EVERY session, process, and user on this\r\n// machine. There is NO environment-variable override.\r\n//\r\n// The whole recursive descendant tree counts toward this ONE number: a\r\n// subagent that itself launches subagents adds to the same machine-wide\r\n// total, and OTHER active agentic sessions count too.\r\n//\r\n// RE-READ on every launch_agent call — edits take effect immediately, no\r\n// server restart required.\r\n//\r\n// Value rules (forcibly applied to the number below):\r\n// - missing / unset / non-integer / 0 / negative -> reset to default 20\r\n// - 1 through 9 -> forced UP to minimum 10\r\n// - 10 or greater -> used as-is\r\n//\r\n// Zombie culling is always enabled. There is no config knob. Before cap\r\n// rejection, launch/tool/hook paths cull stale live agents idle for 6min and\r\n// terminal-but-alive agents idle for 30s. Culling gracefully terminates the\r\n// full process tree, then force-kills after 20s when needed.\r\n//\r\n// When the cap is reached after culling, launch_agent is REJECTED (never\r\n// queued). Free a slot with list_agents + kill_agent, then retry.\r\n{\r\n \"globalConcurrentSubagents\": 20\r\n}\r\n";
@@ -16,14 +16,13 @@
16
16
  // - 1 through 9 -> forced UP to minimum 10
17
17
  // - 10 or greater -> used as-is
18
18
  //
19
- // When the cap is reached, launch_agent is REJECTED (never queued). Free a
20
- // slot with list_agents + kill_agent, then retry.
19
+ // Zombie culling is always enabled. There is no config knob. Before cap
20
+ // rejection, launch/tool/hook paths cull stale live agents idle for 6min and
21
+ // terminal-but-alive agents idle for 30s. Culling gracefully terminates the
22
+ // full process tree, then force-kills after 20s when needed.
21
23
  //
22
- // Slots free automatically as agents finish or are killed. There is NO
23
- // zombie reaping. If a server process CRASHES, its slots stay counted until
24
- // you delete the stale slot files by hand:
25
- // Windows: %ProgramData%\subagent-mcp\slots
26
- // macOS/Linux: /tmp/subagent-mcp/slots
24
+ // When the cap is reached after culling, launch_agent is REJECTED (never
25
+ // queued). Free a slot with list_agents + kill_agent, then retry.
27
26
  {
28
27
  "globalConcurrentSubagents": 20
29
28
  }
@@ -1,6 +1,6 @@
1
1
  import { realpathSync } from "node:fs";
2
2
  import { pathToFileURL } from "node:url";
3
- import { claimAndEmit, classifyClaim, countJsonlType, runHook, sessionKey, } from "../orchestration/hook-core.js";
3
+ import { claimAndEmit, appendHookZombieReport, classifyClaim, countJsonlType, cullHookZombies, runHook, sessionKey, } from "../orchestration/hook-core.js";
4
4
  import * as marker from "../orchestration/marker.js";
5
5
  /**
6
6
  * Codex CLI hook entry. Branches on payload.hook_event_name:
@@ -80,11 +80,14 @@ export const codexAdapter = {
80
80
  export function runCodexHook(payload, env, adapter = codexAdapter) {
81
81
  try {
82
82
  if (payload.hook_event_name === "SessionStart") {
83
- if (adapter.isSubagent(payload, env))
84
- return "";
83
+ const zombieRecords = cullHookZombies();
84
+ if (adapter.isSubagent(payload, env)) {
85
+ return appendHookZombieReport("", zombieRecords);
86
+ }
85
87
  const cwd = payload.cwd || process.cwd();
86
- if (!marker.isActive(cwd))
87
- return "";
88
+ if (!marker.isActive(cwd)) {
89
+ return appendHookZombieReport("", zombieRecords);
90
+ }
88
91
  const current = sessionKey(payload);
89
92
  const turn = adapter.currentTurn(payload.transcript_path);
90
93
  const m = marker.readMarker(cwd);
@@ -93,7 +96,7 @@ export function runCodexHook(payload, env, adapter = codexAdapter) {
93
96
  // semantics — FULL + ON reminder, ack-latched CARRYOVER prepend, counter
94
97
  // re-baseline). SessionStart claims even on SAME-SESSION (resume) so
95
98
  // turn 0 is always covered.
96
- return claimAndEmit(cwd, current, turn, m, kind, env, adapter);
99
+ return appendHookZombieReport(claimAndEmit(cwd, current, turn, m, kind, env, adapter), zombieRecords);
97
100
  }
98
101
  // UserPromptSubmit (and any other event) -> normal cadence.
99
102
  return runHook(payload, env, adapter);