subconscious-cli 6.0.0 → 6.1.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 +135 -2
- package/bin/agent-data.js +242 -0
- package/bin/agent-help.js +106 -0
- package/bin/agent-install.js +354 -0
- package/bin/agent-launch.js +199 -0
- package/bin/agent-spawn.js +137 -0
- package/bin/agents.js +284 -840
- package/bin/auth.js +89 -33
- package/bin/branding.js +3 -1
- package/bin/claude-picker.js +143 -0
- package/bin/cli.js +87 -20
- package/bin/clipboard-image.js +24 -5
- package/bin/colors.js +1 -1
- package/bin/feedback.js +71 -21
- package/bin/harness-manifest.js +286 -0
- package/bin/headless-args.js +35 -0
- package/bin/launch-values.js +25 -0
- package/bin/model-capabilities.js +12 -8
- package/bin/models.js +35 -19
- package/bin/native/subc-tui-darwin-amd64 +0 -0
- package/bin/native/subc-tui-darwin-arm64 +0 -0
- package/bin/native/subc-tui-linux-amd64 +0 -0
- package/bin/native/subc-tui-linux-arm64 +0 -0
- package/bin/native/subc-tui-windows-amd64.exe +0 -0
- package/bin/native/subc-tui-windows-arm64.exe +0 -0
- package/bin/opencode-provider.js +48 -5
- package/bin/profile-settings.js +129 -0
- package/bin/profiles.js +136 -449
- package/bin/runbook/README.md +66 -23
- package/bin/runbook/claude-code/agent.json +300 -0
- package/bin/runbook/claude-code/install.sh +9 -252
- package/bin/runbook/codex/agent.json +461 -0
- package/bin/runbook/codex/hooks-lib.sh +17 -4
- package/bin/runbook/codex/install.sh +0 -4
- package/bin/runbook/codex/run.sh +16 -235
- package/bin/runbook/copilot/agent.json +185 -0
- package/bin/runbook/copilot/install.sh +45 -63
- package/bin/runbook/cursor/agent.json +137 -0
- package/bin/runbook/cursor/install.sh +8 -35
- package/bin/runbook/deepseek-harness/agent.json +163 -0
- package/bin/runbook/deepseek-harness/run.sh +20 -59
- package/bin/runbook/image-window/index.ts +14 -0
- package/bin/runbook/image-window/window.d.ts +19 -0
- package/bin/runbook/image-window/window.js +140 -0
- package/bin/runbook/lib.sh +41 -0
- package/bin/runbook/opencode/agent.json +158 -0
- package/bin/runbook/opencode/install.sh +9 -183
- package/bin/runbook/opencode/opencode-plugin.d.ts +16 -0
- package/bin/runbook/opencode/subconscious-image-window.ts +24 -0
- package/bin/runbook/pi/agent.json +216 -0
- package/bin/runbook/pi/install.sh +18 -44
- package/bin/runbook/pi/run.sh +6 -18
- package/bin/runbook/pi/subconscious-compaction.ts +71 -49
- package/bin/runbook/shared.json +58 -0
- package/bin/runbook/subconscious-code/agent.json +156 -0
- package/bin/sessions.js +173 -58
- package/bin/tui.js +104 -32
- package/bin/update-check.js +54 -21
- package/bin/upgrade.js +67 -43
- package/bin/usage.js +47 -24
- package/bin/windows/agents.js +141 -37
- package/bin/windows/common.js +36 -25
- package/bin/windows/install.js +116 -34
- package/bin/windows/launch.js +260 -77
- package/bin/windows/pi-compaction.ts +68 -13
- package/bin/windows/process.js +210 -57
- package/bin/windows/setup.js +251 -56
- package/package.json +9 -4
- package/bin/registry.generated.json +0 -406
- package/bin/runbook/claude-code/run.sh +0 -254
- package/bin/runbook/model-capabilities.generated.sh +0 -9
- package/bin/runbook/opencode/provider.sh +0 -93
- package/bin/runbook/opencode/run.sh +0 -99
- package/bin/runbook/opencode/subconscious-compaction.ts +0 -100
- package/bin/runbook/subconscious-code/run.sh +0 -21
- package/bin/windows/claude.js +0 -71
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "codex",
|
|
3
|
+
"command": "codex",
|
|
4
|
+
"aliases": [],
|
|
5
|
+
"name": "Codex CLI",
|
|
6
|
+
"description": "Run Codex on your hosted Subconscious model with a temporary provider catalog and compaction hooks.",
|
|
7
|
+
"protocol": "openai",
|
|
8
|
+
"homepage": "https://developers.openai.com/codex",
|
|
9
|
+
"install": {
|
|
10
|
+
"commands": {
|
|
11
|
+
"darwin": "npm i -g {package}",
|
|
12
|
+
"linux": "npm i -g {package}",
|
|
13
|
+
"win32": "npm i -g {package}"
|
|
14
|
+
},
|
|
15
|
+
"method": "npm",
|
|
16
|
+
"package": "@openai/codex",
|
|
17
|
+
"version": null,
|
|
18
|
+
"channel": "latest (unpinned)",
|
|
19
|
+
"minimum_version": "0.143.0",
|
|
20
|
+
"verified": true,
|
|
21
|
+
"note": "Below minimum_version Codex ignores multi_agent_version and runs without subagents. subc warns and does not block."
|
|
22
|
+
},
|
|
23
|
+
"runbook": {
|
|
24
|
+
"mode": "launch",
|
|
25
|
+
"script": "run.sh",
|
|
26
|
+
"setup_script": "install.sh",
|
|
27
|
+
"setup_actions": ["install", "status", "uninstall"]
|
|
28
|
+
},
|
|
29
|
+
"help": {
|
|
30
|
+
"usage": "subc [-p NAME] codex [help|install|status|uninstall] [Codex arguments...]",
|
|
31
|
+
"behavior": "Launches Codex with a temporary Subconscious provider catalog. Compaction hooks are merged into ~/.codex/hooks.json on first launch and removed with subc codex uninstall; Codex will not run them until you trust them with /hooks once.",
|
|
32
|
+
"options": [
|
|
33
|
+
["help", "Show this help"],
|
|
34
|
+
[
|
|
35
|
+
"install",
|
|
36
|
+
"Install the Subconscious compaction hooks (then trust with /hooks)"
|
|
37
|
+
],
|
|
38
|
+
["status", "Inspect the installed compaction hooks"],
|
|
39
|
+
["uninstall", "Remove only the Subconscious Codex hooks"],
|
|
40
|
+
["--model MODEL", "Override the profile model for this launch"]
|
|
41
|
+
],
|
|
42
|
+
"args": ["-- ARGS...", "Pass remaining arguments to Codex"]
|
|
43
|
+
},
|
|
44
|
+
"sessions": {
|
|
45
|
+
"key": "codex",
|
|
46
|
+
"portable": true
|
|
47
|
+
},
|
|
48
|
+
"prerequisites": [
|
|
49
|
+
{
|
|
50
|
+
"command": "jq",
|
|
51
|
+
"needed_for": "hooks",
|
|
52
|
+
"required": false,
|
|
53
|
+
"note": "Without jq a launch skips the hooks with a warning, and subc codex install fails."
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"command": "curl",
|
|
57
|
+
"needed_for": "hooks",
|
|
58
|
+
"required": false,
|
|
59
|
+
"note": "Without curl the hook exits without reporting."
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"launch": {
|
|
63
|
+
"argv": ["codex", "{config}", "{args}"],
|
|
64
|
+
"headless_argv": [
|
|
65
|
+
"codex",
|
|
66
|
+
"{config}",
|
|
67
|
+
"exec",
|
|
68
|
+
"--skip-git-repo-check",
|
|
69
|
+
"{args}",
|
|
70
|
+
"--",
|
|
71
|
+
"{prompt}"
|
|
72
|
+
],
|
|
73
|
+
"headless_platforms": ["darwin", "linux"],
|
|
74
|
+
"resume": ["resume", "{sessionId}"],
|
|
75
|
+
"handoff": ["{prompt}"],
|
|
76
|
+
"config_flag": "-c",
|
|
77
|
+
"persistent_setup": true,
|
|
78
|
+
"note": "Each launch merges the compaction hooks into ~/.codex/hooks.json when they are missing or stale (best effort). The root -c overrides also apply to codex exec."
|
|
79
|
+
},
|
|
80
|
+
"inputs": [
|
|
81
|
+
{
|
|
82
|
+
"name": "CODEX_API_KEY",
|
|
83
|
+
"label": "Codex API key",
|
|
84
|
+
"description": "Codex-specific credential override; blank uses API_KEY.",
|
|
85
|
+
"type": "secret"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"name": "CODEX_CONTEXT_WINDOW",
|
|
89
|
+
"default": 5000000,
|
|
90
|
+
"flag": "--context-window",
|
|
91
|
+
"metavar": "N",
|
|
92
|
+
"help": "Override catalog context_window",
|
|
93
|
+
"label": "Context window",
|
|
94
|
+
"description": "Context window written into the Codex model catalog.",
|
|
95
|
+
"type": "integer",
|
|
96
|
+
"min": 1
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"name": "CODEX_MAX_CONTEXT_WINDOW",
|
|
100
|
+
"default": "${CODEX_CONTEXT_WINDOW}",
|
|
101
|
+
"flag": "--max-context-window",
|
|
102
|
+
"metavar": "N",
|
|
103
|
+
"help": "Override catalog max_context_window",
|
|
104
|
+
"label": "Maximum context window",
|
|
105
|
+
"description": "Maximum context window written into the Codex catalog.",
|
|
106
|
+
"type": "integer",
|
|
107
|
+
"min": 1
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"name": "CODEX_AUTO_COMPACT_TOKEN_LIMIT",
|
|
111
|
+
"default": 4500000,
|
|
112
|
+
"flag": "--auto-compact-token-limit",
|
|
113
|
+
"metavar": "N",
|
|
114
|
+
"help": "Override the automatic compaction threshold",
|
|
115
|
+
"label": "Auto-compact token limit",
|
|
116
|
+
"description": "Codex token threshold that triggers automatic compaction.",
|
|
117
|
+
"type": "integer",
|
|
118
|
+
"min": 1
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"name": "CODEX_REASONING_EFFORT",
|
|
122
|
+
"default": "max",
|
|
123
|
+
"flag": "--reasoning-effort",
|
|
124
|
+
"metavar": "LEVEL",
|
|
125
|
+
"help": "Use none, low, medium, high, or max",
|
|
126
|
+
"label": "Reasoning effort",
|
|
127
|
+
"description": "Default Codex reasoning effort.",
|
|
128
|
+
"type": "choice",
|
|
129
|
+
"choices": ["none", "low", "medium", "high", "max"],
|
|
130
|
+
"strict": true
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"name": "CODEX_EXTERNAL_TOOLS",
|
|
134
|
+
"default": "false",
|
|
135
|
+
"flag": "--external-tools",
|
|
136
|
+
"flag_value": "true",
|
|
137
|
+
"help": "Enable Codex apps/plugins for this launch",
|
|
138
|
+
"label": "External tools",
|
|
139
|
+
"description": "Enable Codex apps/plugins; may exceed the gateway tool limit.",
|
|
140
|
+
"type": "choice",
|
|
141
|
+
"choices": ["false", "true"]
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"name": "CODEX_STREAM_IDLE_TIMEOUT_MS",
|
|
145
|
+
"default": 900000,
|
|
146
|
+
"flag": "--stream-idle-timeout",
|
|
147
|
+
"metavar": "MS",
|
|
148
|
+
"help": "Allow a longer silent think before timing out",
|
|
149
|
+
"label": "Stream idle timeout (ms)",
|
|
150
|
+
"description": "How long Codex waits on a silent stream before giving up. Needs to exceed the longest think the model will take.",
|
|
151
|
+
"type": "integer",
|
|
152
|
+
"min": 1,
|
|
153
|
+
"template": false,
|
|
154
|
+
"note": "The marathon models at max reasoning effort routinely think for longer than five minutes without emitting a token, and a subagent's turn is one uninterrupted think, so the old 300s ceiling cut off work that was still running."
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"name": "CODEX_MULTI_AGENT_VERSION",
|
|
158
|
+
"default": "v2",
|
|
159
|
+
"keep_empty": true,
|
|
160
|
+
"label": "Codex multi-agent version",
|
|
161
|
+
"description": "Which subagent implementation Codex offers: v2 gives the collaboration tools. Leave empty to turn subagents off entirely.",
|
|
162
|
+
"type": "text",
|
|
163
|
+
"template": false,
|
|
164
|
+
"note": "The catalog field selects which implementation Codex offers, not whether it offers one: v2 gives the collaboration namespace, \"v1\" registers nothing, and an empty field falls back to multi_agent_v1. Only agents.enabled=false turns subagents off, so an empty value sets both."
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"name": "CODEX_SUBAGENT_REASONING_EFFORT",
|
|
168
|
+
"default": "low",
|
|
169
|
+
"keep_empty": true,
|
|
170
|
+
"flag": "--subagent-effort",
|
|
171
|
+
"metavar": "LEVEL",
|
|
172
|
+
"help": "Effort for subagents, separate from the parent",
|
|
173
|
+
"label": "Subagent reasoning effort",
|
|
174
|
+
"description": "Effort for Codex subagents, set separately from the parent: a marathon model at max thinks for minutes without emitting a token, and a subagent turn is one uninterrupted think, so inheriting max makes every delegated subtask look like a hang.",
|
|
175
|
+
"type": "text",
|
|
176
|
+
"template": false,
|
|
177
|
+
"note": "Empty inherits Codex's default. Low rather than medium: the gateway rounds medium up to high for GLM, and at high a subagent handed an open-ended task keeps deliberating without ever writing the closing </think>, so the turn comes back as prose with no tool call and the agent reports success having produced no files. Measured against the worker on one broad task: low closed and called a tool in ~1.5k characters, high ran past 76k and was still going."
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"name": "MAX_CONCURRENT_SUBAGENTS",
|
|
181
|
+
"flag": "--max-subagents",
|
|
182
|
+
"metavar": "N",
|
|
183
|
+
"help": "Subagents allowed to run at once",
|
|
184
|
+
"template": false,
|
|
185
|
+
"note": "A ceiling, not a default: Codex spawns a subagent only when asked. Codex documents no nesting-depth limit, so concurrency is the only lever. Four is a floor rather than a considered limit: Codex's own default is three, and exceeding either fails the spawn outright rather than queueing it."
|
|
186
|
+
}
|
|
187
|
+
],
|
|
188
|
+
"env": [
|
|
189
|
+
{
|
|
190
|
+
"name": "SUBCONSCIOUS_API_KEY",
|
|
191
|
+
"value": "{apiKey}",
|
|
192
|
+
"description": "Credential Codex reads through model_providers.subconscious.env_key."
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"name": "SUBCONSCIOUS_GATEWAY_URL",
|
|
196
|
+
"value": "{baseUrl}",
|
|
197
|
+
"description": "Gateway origin for the hook environment."
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
"config": [
|
|
201
|
+
{
|
|
202
|
+
"kind": "cli-config",
|
|
203
|
+
"name": "model",
|
|
204
|
+
"value": "{model}",
|
|
205
|
+
"lifetime": "launch",
|
|
206
|
+
"description": "Model."
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"kind": "cli-config",
|
|
210
|
+
"name": "model_provider",
|
|
211
|
+
"value": "subconscious",
|
|
212
|
+
"lifetime": "launch",
|
|
213
|
+
"description": "Selects the provider below."
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"kind": "cli-config",
|
|
217
|
+
"name": "model_catalog_json",
|
|
218
|
+
"value": "{tempFile}",
|
|
219
|
+
"lifetime": "persistent",
|
|
220
|
+
"description": "Temporary model catalog written by the runbook; see the file entry."
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"kind": "cli-config",
|
|
224
|
+
"name": "model_reasoning_effort",
|
|
225
|
+
"value": "${CODEX_REASONING_EFFORT}",
|
|
226
|
+
"lifetime": "launch",
|
|
227
|
+
"description": "Parent reasoning effort."
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"kind": "cli-config",
|
|
231
|
+
"name": "web_search",
|
|
232
|
+
"value": "disabled",
|
|
233
|
+
"lifetime": "launch",
|
|
234
|
+
"description": "Keeps hosted web search, which the gateway cannot run, out of requests."
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"kind": "cli-config",
|
|
238
|
+
"name": "features.apps",
|
|
239
|
+
"value": false,
|
|
240
|
+
"when": {
|
|
241
|
+
"CODEX_EXTERNAL_TOOLS": {
|
|
242
|
+
"not": "true"
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
"lifetime": "launch",
|
|
246
|
+
"description": "Keeps the request under the gateway's 128-tool limit.",
|
|
247
|
+
"note": "The gateway accepts at most 128 tools per request, and Codex apps and installed plugins can exceed that before any core coding tools are added."
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"kind": "cli-config",
|
|
251
|
+
"name": "features.plugins",
|
|
252
|
+
"value": false,
|
|
253
|
+
"when": {
|
|
254
|
+
"CODEX_EXTERNAL_TOOLS": {
|
|
255
|
+
"not": "true"
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
"lifetime": "launch",
|
|
259
|
+
"description": "Keeps the request under the gateway's 128-tool limit."
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"kind": "cli-config",
|
|
263
|
+
"name": "apps._default.enabled",
|
|
264
|
+
"value": false,
|
|
265
|
+
"when": {
|
|
266
|
+
"CODEX_EXTERNAL_TOOLS": {
|
|
267
|
+
"not": "true"
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
"lifetime": "launch",
|
|
271
|
+
"description": "Keeps the request under the gateway's 128-tool limit."
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"kind": "cli-config",
|
|
275
|
+
"name": "agents.max_concurrent_threads_per_session",
|
|
276
|
+
"value": "${MAX_CONCURRENT_SUBAGENTS}",
|
|
277
|
+
"when": {
|
|
278
|
+
"CODEX_MULTI_AGENT_VERSION": "set"
|
|
279
|
+
},
|
|
280
|
+
"lifetime": "launch",
|
|
281
|
+
"description": "Concurrent subagents."
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"kind": "cli-config",
|
|
285
|
+
"name": "agents.interrupt_message",
|
|
286
|
+
"value": true,
|
|
287
|
+
"when": {
|
|
288
|
+
"CODEX_MULTI_AGENT_VERSION": "set"
|
|
289
|
+
},
|
|
290
|
+
"lifetime": "launch",
|
|
291
|
+
"description": "Subagent interrupt messages."
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
"kind": "cli-config",
|
|
295
|
+
"name": "agents.default_subagent_reasoning_effort",
|
|
296
|
+
"value": "${CODEX_SUBAGENT_REASONING_EFFORT}",
|
|
297
|
+
"when": {
|
|
298
|
+
"CODEX_MULTI_AGENT_VERSION": "set",
|
|
299
|
+
"CODEX_SUBAGENT_REASONING_EFFORT": "set"
|
|
300
|
+
},
|
|
301
|
+
"lifetime": "launch",
|
|
302
|
+
"description": "Subagent reasoning effort."
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
"kind": "cli-config",
|
|
306
|
+
"name": "agents.enabled",
|
|
307
|
+
"value": false,
|
|
308
|
+
"when": {
|
|
309
|
+
"CODEX_MULTI_AGENT_VERSION": "empty"
|
|
310
|
+
},
|
|
311
|
+
"lifetime": "launch",
|
|
312
|
+
"description": "Turns subagents off.",
|
|
313
|
+
"note": "Clearing the catalog field alone only downgrades Codex to multi-agent v1, whose tools this gateway has never been exercised against."
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"kind": "cli-config",
|
|
317
|
+
"name": "model_providers.subconscious.name",
|
|
318
|
+
"value": "Subconscious",
|
|
319
|
+
"lifetime": "launch",
|
|
320
|
+
"description": "Provider display name."
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"kind": "cli-config",
|
|
324
|
+
"name": "model_providers.subconscious.base_url",
|
|
325
|
+
"value": "{baseUrlV1}",
|
|
326
|
+
"lifetime": "launch",
|
|
327
|
+
"description": "Gateway endpoint; no relay."
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"kind": "cli-config",
|
|
331
|
+
"name": "model_providers.subconscious.wire_api",
|
|
332
|
+
"value": "responses",
|
|
333
|
+
"lifetime": "launch",
|
|
334
|
+
"description": "Uses the Responses API."
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
"kind": "cli-config",
|
|
338
|
+
"name": "model_providers.subconscious.env_key",
|
|
339
|
+
"value": "SUBCONSCIOUS_API_KEY",
|
|
340
|
+
"lifetime": "launch",
|
|
341
|
+
"description": "Env var holding the credential."
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"kind": "cli-config",
|
|
345
|
+
"name": "model_providers.subconscious.stream_idle_timeout_ms",
|
|
346
|
+
"value": "${CODEX_STREAM_IDLE_TIMEOUT_MS}",
|
|
347
|
+
"lifetime": "launch",
|
|
348
|
+
"description": "Silent-stream timeout."
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"kind": "file",
|
|
352
|
+
"path": "{tmp}/codex-model-catalog.XXXXXX.json",
|
|
353
|
+
"lifetime": "persistent",
|
|
354
|
+
"value": {
|
|
355
|
+
"context_window": "${CODEX_CONTEXT_WINDOW}",
|
|
356
|
+
"max_context_window": "${CODEX_MAX_CONTEXT_WINDOW}",
|
|
357
|
+
"auto_compact_token_limit": "${CODEX_AUTO_COMPACT_TOKEN_LIMIT}",
|
|
358
|
+
"multi_agent_version": "${CODEX_MULTI_AGENT_VERSION}"
|
|
359
|
+
},
|
|
360
|
+
"description": "One entry per catalog model, written by the runbook. Image input is advertised only for vision models. Left in the temp directory: the runbook execs codex, so its exit trap never runs."
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
"kind": "file",
|
|
364
|
+
"path": "~/.codex/hooks.json",
|
|
365
|
+
"lifetime": "persistent",
|
|
366
|
+
"description": "PreCompact and PostCompact entries are merged in; other entries are kept."
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
"kind": "file",
|
|
370
|
+
"path": "~/.codex/subconscious-hook.sh",
|
|
371
|
+
"lifetime": "persistent",
|
|
372
|
+
"description": "Hook script."
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
"kind": "file",
|
|
376
|
+
"path": "~/.codex/subconscious-hooks.env",
|
|
377
|
+
"lifetime": "persistent",
|
|
378
|
+
"description": "SUBCONSCIOUS_GATEWAY_URL and SUBCONSCIOUS_API_KEY for the hook (mode 600)."
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
"kind": "dir",
|
|
382
|
+
"path": "~/.codex/subconscious-hook-logs",
|
|
383
|
+
"lifetime": "persistent",
|
|
384
|
+
"description": "Hook fire log, one file per session."
|
|
385
|
+
}
|
|
386
|
+
],
|
|
387
|
+
"capabilities": {
|
|
388
|
+
"compaction": {
|
|
389
|
+
"default": "on",
|
|
390
|
+
"on": {
|
|
391
|
+
"set_by_subc": true,
|
|
392
|
+
"kind": "model-catalog-field",
|
|
393
|
+
"name": "auto_compact_token_limit",
|
|
394
|
+
"value": "${CODEX_AUTO_COMPACT_TOKEN_LIMIT}",
|
|
395
|
+
"verified": true,
|
|
396
|
+
"note": "Auto-compaction is on through the catalog threshold.",
|
|
397
|
+
"config": "{tmp}/codex-model-catalog.XXXXXX.json"
|
|
398
|
+
},
|
|
399
|
+
"off": {
|
|
400
|
+
"set_by_subc": false,
|
|
401
|
+
"kind": null,
|
|
402
|
+
"name": null,
|
|
403
|
+
"value": null,
|
|
404
|
+
"verified": false,
|
|
405
|
+
"note": "The runbook has no off switch. Setting a threshold above context_window may work, but that is not confirmed."
|
|
406
|
+
},
|
|
407
|
+
"threshold": {
|
|
408
|
+
"set_by_subc": true,
|
|
409
|
+
"kind": "model-catalog-field",
|
|
410
|
+
"name": "auto_compact_token_limit",
|
|
411
|
+
"value": "${CODEX_AUTO_COMPACT_TOKEN_LIMIT}",
|
|
412
|
+
"verified": true,
|
|
413
|
+
"note": "Written per model into model_catalog_json. subc does not use the model_auto_compact_token_limit config key.",
|
|
414
|
+
"semantics": "trigger",
|
|
415
|
+
"config": "{tmp}/codex-model-catalog.XXXXXX.json"
|
|
416
|
+
}
|
|
417
|
+
},
|
|
418
|
+
"mcp": {
|
|
419
|
+
"configured_by_subc": false,
|
|
420
|
+
"transports": null,
|
|
421
|
+
"verified": false,
|
|
422
|
+
"note": "subc adds no MCP servers. User MCP config in ~/.codex/config.toml is left alone."
|
|
423
|
+
},
|
|
424
|
+
"headers": [
|
|
425
|
+
{
|
|
426
|
+
"name": "x-subconscious-client",
|
|
427
|
+
"value": "codex",
|
|
428
|
+
"on": "hook POSTs to {baseUrl}/v1/agent-hooks",
|
|
429
|
+
"set_by_subc": true,
|
|
430
|
+
"verified": true,
|
|
431
|
+
"note": "Model requests carry no subc-set header."
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
"name": "Authorization",
|
|
435
|
+
"value": "Bearer {apiKey}",
|
|
436
|
+
"on": "hook POSTs to {baseUrl}/v1/agent-hooks",
|
|
437
|
+
"set_by_subc": true,
|
|
438
|
+
"verified": true
|
|
439
|
+
}
|
|
440
|
+
],
|
|
441
|
+
"hooks": [
|
|
442
|
+
{
|
|
443
|
+
"event": "PreCompact",
|
|
444
|
+
"posts": "conversation_compaction phase=start",
|
|
445
|
+
"endpoint": "{baseUrl}/v1/agent-hooks",
|
|
446
|
+
"config": "~/.codex/hooks.json",
|
|
447
|
+
"installed_by": ["launch", "install"],
|
|
448
|
+
"verified": true,
|
|
449
|
+
"note": "Per install.sh help: Codex runs hooks only once trusted with /hooks, and codex exec needs --dangerously-bypass-hook-trust, which subc never passes."
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
"event": "PostCompact",
|
|
453
|
+
"posts": "conversation_compaction phase=end",
|
|
454
|
+
"endpoint": "{baseUrl}/v1/agent-hooks",
|
|
455
|
+
"config": "~/.codex/hooks.json",
|
|
456
|
+
"installed_by": ["launch", "install"],
|
|
457
|
+
"verified": true
|
|
458
|
+
}
|
|
459
|
+
]
|
|
460
|
+
}
|
|
461
|
+
}
|
|
@@ -28,7 +28,10 @@ codex_strip_hook_entries() {
|
|
|
28
28
|
| map(select((.hooks | length) > 0));
|
|
29
29
|
.hooks = (.hooks // {})
|
|
30
30
|
| .hooks |= with_entries(.value |= strip)
|
|
31
|
-
' "$HOOKS_JSON" >"$tmp"
|
|
31
|
+
' "$HOOKS_JSON" >"$tmp" || {
|
|
32
|
+
rm -f "$tmp"
|
|
33
|
+
return 1
|
|
34
|
+
}
|
|
32
35
|
mv "$tmp" "$HOOKS_JSON"
|
|
33
36
|
}
|
|
34
37
|
|
|
@@ -41,7 +44,10 @@ codex_append_hook_groups() {
|
|
|
41
44
|
.hooks = (.hooks // {})
|
|
42
45
|
| .hooks.PreCompact = ((.hooks.PreCompact // []) + group("Reporting compaction start"))
|
|
43
46
|
| .hooks.PostCompact = ((.hooks.PostCompact // []) + group("Reporting compaction end"))
|
|
44
|
-
' "$HOOKS_JSON" >"$tmp"
|
|
47
|
+
' "$HOOKS_JSON" >"$tmp" || {
|
|
48
|
+
rm -f "$tmp"
|
|
49
|
+
return 1
|
|
50
|
+
}
|
|
45
51
|
mv "$tmp" "$HOOKS_JSON"
|
|
46
52
|
}
|
|
47
53
|
|
|
@@ -123,8 +129,15 @@ codex_ensure_hooks() {
|
|
|
123
129
|
fi
|
|
124
130
|
codex_write_hook_script
|
|
125
131
|
codex_write_hooks_env
|
|
126
|
-
|
|
127
|
-
|
|
132
|
+
# run.sh calls this behind `|| true`, which turns off `set -e` in here, so a
|
|
133
|
+
# failed merge has to be caught by hand or it reports success.
|
|
134
|
+
if ! codex_strip_hook_entries || ! codex_append_hook_groups; then
|
|
135
|
+
echo "warning: could not merge Subconscious hooks into ${HOOKS_JSON}; leaving your hooks unchanged" >&2
|
|
136
|
+
if [[ "$mode" == "strict" ]]; then
|
|
137
|
+
return 1
|
|
138
|
+
fi
|
|
139
|
+
return 0
|
|
140
|
+
fi
|
|
128
141
|
echo "Installed Subconscious compaction hooks in $HOOKS_JSON"
|
|
129
142
|
echo "These do not run until you trust them: type /hooks inside Codex once."
|
|
130
143
|
}
|
|
@@ -13,10 +13,6 @@ set -euo pipefail
|
|
|
13
13
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
14
14
|
HOOK_SRC="${SCRIPT_DIR}/hook.sh"
|
|
15
15
|
|
|
16
|
-
SHARED_ENV="${SUBC_ENV_FILE:-${SCRIPT_DIR}/../.env}"
|
|
17
|
-
[[ -f "$SHARED_ENV" ]] || SHARED_ENV="${SCRIPT_DIR}/../env.example"
|
|
18
|
-
if [[ -f "$SHARED_ENV" ]]; then set -a; source "$SHARED_ENV"; set +a; fi
|
|
19
|
-
|
|
20
16
|
# shellcheck source=hooks-lib.sh
|
|
21
17
|
source "${SCRIPT_DIR}/hooks-lib.sh"
|
|
22
18
|
|