subconscious-cli 0.2.1 → 0.3.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 +200 -76
- package/bin/agents.js +430 -23
- package/bin/auth.js +116 -24
- package/bin/branding.js +39 -0
- package/bin/cli.js +238 -18
- package/bin/colors.js +22 -10
- package/bin/profiles.js +782 -0
- package/bin/registry.generated.json +182 -44
- package/bin/runbook/README.md +22 -0
- package/bin/runbook/claude-code/install.sh +290 -0
- package/bin/runbook/claude-code/run.sh +164 -0
- package/bin/runbook/codex/hook.sh +112 -0
- package/bin/runbook/codex/hooks-lib.sh +139 -0
- package/bin/runbook/codex/hooks.json +29 -0
- package/bin/runbook/codex/install.sh +82 -0
- package/bin/runbook/codex/run.sh +248 -0
- package/bin/runbook/copilot/hook.sh +173 -0
- package/bin/runbook/copilot/hooks.json +19 -0
- package/bin/runbook/copilot/install.sh +470 -0
- package/bin/runbook/cursor/hook.sh +145 -0
- package/bin/runbook/cursor/hooks.json +17 -0
- package/bin/runbook/cursor/install.sh +284 -0
- package/bin/runbook/opencode/install.sh +298 -0
- package/bin/runbook/opencode/run.sh +106 -0
- package/bin/runbook/opencode/subconscious-compaction.ts +100 -0
- package/bin/runbook/pi/install.sh +278 -0
- package/bin/runbook/pi/run.sh +25 -0
- package/bin/runbook/pi/subconscious-compaction.ts +151 -0
- package/package.json +10 -5
package/README.md
CHANGED
|
@@ -1,123 +1,247 @@
|
|
|
1
1
|
# subconscious-cli
|
|
2
2
|
|
|
3
|
-
Log in to Subconscious
|
|
4
|
-
agent against your hosted Subconscious model — no per-agent config required.
|
|
3
|
+
Log in to Subconscious, then run coding agents against the Subconscious gateway.
|
|
5
4
|
|
|
6
5
|
## Quick start
|
|
7
6
|
|
|
8
7
|
```bash
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
npm install -g subconscious-cli
|
|
9
|
+
subc login
|
|
10
|
+
subc claude
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Login creates both the saved credential and a ready-to-use `default` profile,
|
|
14
|
+
so Claude Code, Codex, and OpenCode can launch immediately. Persistent editor
|
|
15
|
+
and Pi integrations are installed per agent:
|
|
14
16
|
|
|
15
17
|
```bash
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
subc cursor install
|
|
19
|
+
subc copilot install
|
|
20
|
+
subc pi install
|
|
21
|
+
subc <agent> uninstall
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Top-level help (`subc`, `subc help`, or `subc --help`) displays the
|
|
25
|
+
Subconscious logo as portable ASCII art. Set `NO_COLOR=1` for a
|
|
26
|
+
monochrome version; redirected output automatically uses a plain wordmark.
|
|
27
|
+
|
|
28
|
+
Every command accepts `help` as a subcommand. These only read the selected
|
|
29
|
+
profile; they do not authenticate, install, configure, or launch anything:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
subc claude help
|
|
33
|
+
subc codex help
|
|
34
|
+
subc cursor help
|
|
35
|
+
subc config help
|
|
36
|
+
subc login help
|
|
19
37
|
```
|
|
20
38
|
|
|
21
|
-
|
|
39
|
+
Agent help includes launch/install behavior, supported integration options, and
|
|
40
|
+
every relevant profile setting with API keys redacted.
|
|
41
|
+
|
|
42
|
+
`subc claude` launches the normal `claude` executable with the Subconscious
|
|
43
|
+
gateway environment applied for that process. Arguments pass through as usual:
|
|
22
44
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
45
|
+
```bash
|
|
46
|
+
subc claude --continue
|
|
47
|
+
subc codex exec "write a test"
|
|
48
|
+
subc opencode
|
|
49
|
+
subc pi
|
|
50
|
+
```
|
|
26
51
|
|
|
27
|
-
|
|
28
|
-
platform automatically. The table below shows the macOS/Linux command; on
|
|
29
|
-
Windows the equivalent native installer is used instead.
|
|
52
|
+
## Supported agents
|
|
30
53
|
|
|
31
|
-
|
|
32
|
-
| -------------------------- | ----------- | ------------------------------------------------------- |
|
|
33
|
-
| `subconscious claude-code` | Claude Code | `curl -fsSL https://claude.ai/install.sh \| bash` |
|
|
34
|
-
| `subconscious open-code` | OpenCode | `npm i -g opencode-ai` |
|
|
35
|
-
| `subconscious aider` | Aider | `python3 -m pip install aider-install && aider-install` |
|
|
36
|
-
| `subconscious codex` | Codex CLI | `npm i -g @openai/codex` |
|
|
54
|
+
The packaged integrations live in `cli/bin/runbook`.
|
|
37
55
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
56
|
+
| Command | Behavior |
|
|
57
|
+
| --- | --- |
|
|
58
|
+
| `subc claude` | Launch Claude Code with the runbook environment, context limits, subagent limits, and OTEL usage reporting |
|
|
59
|
+
| `subc codex` | Launch Codex with the runbook provider, temporary model catalog, and surgically merged compaction hooks |
|
|
60
|
+
| `subc opencode` | Launch OpenCode with the runbook provider, client header, and context/output limits |
|
|
61
|
+
| `subc cursor install` | Install/update Cursor conversation and compaction hooks |
|
|
62
|
+
| `subc copilot install` | Install/update the VS Code custom endpoint and Copilot hooks |
|
|
63
|
+
| `subc pi install` then `subc pi` | Merge the Pi provider, then launch |
|
|
41
64
|
|
|
42
|
-
If
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
prints the exact install command (and any fallback) and exits without running
|
|
47
|
-
anything.
|
|
65
|
+
If Claude Code, Codex, or OpenCode is missing, an interactive terminal offers
|
|
66
|
+
to install it before launching. Pi requires `subc pi install` first; if its
|
|
67
|
+
executable or Subconscious provider is missing, the CLI exits with instructions
|
|
68
|
+
instead of installing the binary.
|
|
48
69
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
70
|
+
`subc codex` disables Codex apps and plugin tools for that launch by default so
|
|
71
|
+
requests remain below the gateway's 128-tool limit. Core coding tools remain
|
|
72
|
+
available. Use `subc codex --external-tools` to opt back in when targeting a
|
|
73
|
+
gateway with a larger tool limit. It also defaults reasoning effort to `max`,
|
|
74
|
+
which is the highest effort accepted by the Subconscious models; override it
|
|
75
|
+
with `subc codex --reasoning-effort high` when desired.
|
|
55
76
|
|
|
56
|
-
|
|
77
|
+
Persistent writes are merge/unmerge only. They never replace a user's
|
|
78
|
+
`config.toml`, `opencode.json`, `models.json`, `hooks.json`, or VS Code
|
|
79
|
+
provider list. Remove Subconscious files with the matching uninstall command:
|
|
57
80
|
|
|
58
81
|
```bash
|
|
59
|
-
|
|
60
|
-
|
|
82
|
+
subc cursor uninstall
|
|
83
|
+
subc copilot uninstall
|
|
84
|
+
subc pi uninstall
|
|
85
|
+
subc codex uninstall
|
|
86
|
+
subc claude uninstall
|
|
87
|
+
subc opencode uninstall
|
|
61
88
|
```
|
|
62
89
|
|
|
63
|
-
|
|
90
|
+
`subc claude uninstall` and `subc opencode uninstall` only clean leftover files
|
|
91
|
+
from older overwrite-style setup. Launch those agents with `subc claude` /
|
|
92
|
+
`subc opencode`; they do not need install.
|
|
64
93
|
|
|
65
|
-
|
|
66
|
-
|
|
94
|
+
Inspect a persistent integration with `subc <agent> status`. A one-off
|
|
95
|
+
`--api-key` passed to install takes precedence for that command but is not
|
|
96
|
+
saved to the selected profile.
|
|
97
|
+
|
|
98
|
+
Cursor still requires enabling its OpenAI API Key Override in Cursor Settings.
|
|
99
|
+
Copilot requires entering the custom endpoint key once through VS Code's
|
|
100
|
+
Manage Language Models UI. The install scripts print the relevant next steps.
|
|
101
|
+
|
|
102
|
+
The runbook scripts require Bash. Cursor, Copilot, Pi, and Codex hook merge
|
|
103
|
+
also require `jq`; Cursor and Copilot also require `curl`.
|
|
104
|
+
|
|
105
|
+
## Runbook profiles
|
|
106
|
+
|
|
107
|
+
`subc login` automatically creates:
|
|
108
|
+
|
|
109
|
+
```text
|
|
110
|
+
~/.subconscious/profiles/default.env
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The file is mode `600` and contains the shared gateway URL, API key, model,
|
|
114
|
+
optional per-agent key overrides, and all Claude/Codex/OpenCode/Pi/Copilot
|
|
115
|
+
context and output settings used by the packaged runbook scripts.
|
|
67
116
|
|
|
68
117
|
```bash
|
|
69
|
-
|
|
70
|
-
|
|
118
|
+
subc config # list every profile and its file path
|
|
119
|
+
subc -p staging config # print that path and env file
|
|
120
|
+
subc -p staging config --model subconscious/glm-5.2
|
|
121
|
+
subc config --gateway-url https://gateway.example
|
|
122
|
+
subc config path
|
|
123
|
+
subc config edit # open the selected profile in $VISUAL, $EDITOR, vim, or nano
|
|
124
|
+
subc -p staging config edit vim
|
|
125
|
+
subc config edit nano
|
|
71
126
|
```
|
|
72
127
|
|
|
73
|
-
|
|
128
|
+
`subc config` lists each profile next to its `.env` path. `subc -p NAME config`
|
|
129
|
+
prints that path, then the file (API keys and other secrets redacted). Extra
|
|
130
|
+
`KEY=value` lines in the file are passed through to launches and override
|
|
131
|
+
Subconscious-injected defaults; resolved login identity (`GATEWAY_URL`,
|
|
132
|
+
`API_KEY`, `MODEL`) still comes from login, `--model`, and the matching flags.
|
|
133
|
+
In scripts and CI, keep using `subc config --gateway-url`, `--api-key`, and
|
|
134
|
+
`--model`.
|
|
74
135
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
136
|
+
Each agent section can hold its own API key. An agent-specific key takes
|
|
137
|
+
precedence over the shared profile key and can be used on its own, so profiles
|
|
138
|
+
do not need an `API_KEY` when every configured agent has an explicit key.
|
|
139
|
+
|
|
140
|
+
Named profiles work like AWS CLI profiles:
|
|
78
141
|
|
|
79
142
|
```bash
|
|
80
|
-
|
|
143
|
+
subc -p staging config \
|
|
144
|
+
--gateway-url https://staging.example \
|
|
145
|
+
--api-key sk-staging-... \
|
|
146
|
+
--model subconscious/glm-5.2
|
|
147
|
+
|
|
148
|
+
subc -p staging claude
|
|
149
|
+
subc -p staging cursor install
|
|
81
150
|
```
|
|
82
151
|
|
|
83
|
-
|
|
152
|
+
You can also select one with `SUBC_PROFILE=staging`. Explicit shell variables
|
|
153
|
+
such as `SUBCONSCIOUS_API_KEY`, `SUBCONSCIOUS_BASE_URL`,
|
|
154
|
+
`SUBCONSCIOUS_MODEL`, and agent-specific tuning variables override profile
|
|
155
|
+
values. A command-line `--model` override has the highest model precedence.
|
|
84
156
|
|
|
85
|
-
|
|
157
|
+
## Models and endpoint overrides
|
|
86
158
|
|
|
87
|
-
|
|
88
|
-
API key is automatically generated and saved.
|
|
159
|
+
List the available models with `subc models`:
|
|
89
160
|
|
|
161
|
+
```text
|
|
162
|
+
subconscious/glm-5.2 (default)
|
|
163
|
+
subconscious/tim-qwen3.6-27b
|
|
164
|
+
subconscious/deepseek-v4-flash-marathon
|
|
90
165
|
```
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
│ │ "You can close this tab"
|
|
100
|
-
✓ Logged in! │
|
|
166
|
+
|
|
167
|
+
Select a model per run, save it in the current profile, or override it through
|
|
168
|
+
the environment:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
subc codex --model subconscious/glm-5.2
|
|
172
|
+
subc config --model subconscious/deepseek-v4-flash-marathon
|
|
173
|
+
export SUBCONSCIOUS_MODEL=subconscious/glm-5.2
|
|
101
174
|
```
|
|
102
175
|
|
|
103
|
-
|
|
176
|
+
The Claude Code, Codex, OpenCode, Pi, and Copilot integrations register all
|
|
177
|
+
three models with their native model pickers. The profile's `MODEL` remains the
|
|
178
|
+
active model where the agent supports setting one and is listed first in the
|
|
179
|
+
other catalogs. Cursor requires adding the three model IDs in its OpenAI API
|
|
180
|
+
Key Override settings; `subc cursor install` prints the complete list and the model
|
|
181
|
+
selected by the active profile. Use the printed `/v1` Base URL in Cursor
|
|
182
|
+
Settings; the profile itself stores the gateway origin so correlation hooks can
|
|
183
|
+
post to `/v1/agent-hooks`.
|
|
184
|
+
|
|
185
|
+
The default gateway is `https://api.subconscious.dev`. Profiles containing
|
|
186
|
+
the former exact default (`https://api.subconscious.dev`) migrate automatically;
|
|
187
|
+
custom gateway URLs are preserved. Override the active gateway with
|
|
188
|
+
`SUBCONSCIOUS_BASE_URL`:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
SUBCONSCIOUS_BASE_URL=http://localhost:9999 subc claude
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Agent-specific runbook tuning variables are also honored, including
|
|
195
|
+
`CLAUDE_CODE_AUTO_COMPACT_WINDOW`, `CODEX_CONTEXT_WINDOW`,
|
|
196
|
+
`OPENCODE_CONTEXT_LIMIT`, `PI_CONTEXT_WINDOW`, and the corresponding output or
|
|
197
|
+
max-context settings. Extra `KEY=value` lines in the profile env file are
|
|
198
|
+
passed through the same way and override Subconscious-injected defaults.
|
|
199
|
+
|
|
200
|
+
## Authentication
|
|
104
201
|
|
|
105
|
-
|
|
202
|
+
`subc login` opens a browser, completes sign-in, and saves the generated API
|
|
203
|
+
key to the selected runbook profile with mode `600`. For the default profile it
|
|
204
|
+
also maintains `~/.subconscious/config.json`.
|
|
106
205
|
|
|
107
|
-
|
|
206
|
+
```bash
|
|
207
|
+
subc login
|
|
208
|
+
subc update-key sk-new-key-...
|
|
209
|
+
subc update-url https://api.subconscious.dev
|
|
210
|
+
subc whoami
|
|
211
|
+
subc logout
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
`subc update-key <api-key>` replaces the shared key in the selected profile.
|
|
215
|
+
For `default`, it also synchronizes `~/.subconscious/config.json`:
|
|
108
216
|
|
|
109
|
-
|
|
217
|
+
```bash
|
|
218
|
+
subc update-key sk-new-default-key-...
|
|
219
|
+
subc --profile staging update-key sk-new-staging-key-...
|
|
220
|
+
```
|
|
110
221
|
|
|
111
|
-
|
|
222
|
+
Because command arguments may be retained in shell history, `subc login` is
|
|
223
|
+
preferred when obtaining a new key interactively. If `SUBCONSCIOUS_API_KEY` is
|
|
224
|
+
set, it continues to override the updated saved key.
|
|
112
225
|
|
|
113
|
-
|
|
114
|
-
|
|
226
|
+
`subc update-url <gateway-url>` validates the URL and automatically updates
|
|
227
|
+
`GATEWAY_URL` in the default profile. No `--profile` option or separate config
|
|
228
|
+
command is needed:
|
|
115
229
|
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
"subconscious_api_key": "sk-..."
|
|
119
|
-
}
|
|
230
|
+
```bash
|
|
231
|
+
subc update-url https://api.subconscious.dev
|
|
120
232
|
```
|
|
121
233
|
|
|
122
|
-
|
|
123
|
-
|
|
234
|
+
If `SUBC_PROFILE` already selects a named profile, that active profile is
|
|
235
|
+
updated automatically as well.
|
|
236
|
+
|
|
237
|
+
`SUBCONSCIOUS_BASE_URL` continues to take precedence when set. A configured
|
|
238
|
+
`CLAUDE_GATEWAY_URL` remains a Claude-specific override.
|
|
239
|
+
|
|
240
|
+
`SUBCONSCIOUS_API_KEY` takes precedence over profile and saved config keys,
|
|
241
|
+
which is useful for CI and temporary sessions. `subc logout` clears the
|
|
242
|
+
selected profile's shared key while preserving its non-secret runbook settings;
|
|
243
|
+
logging out of `default` also clears the backwards-compatible saved key.
|
|
244
|
+
|
|
245
|
+
Existing credentials and profiles under `~/.subcon` are copied into
|
|
246
|
+
`~/.subconscious` automatically on first use. The legacy files are left in
|
|
247
|
+
place so migration is recoverable.
|