subconscious-cli 0.2.0 → 0.3.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 CHANGED
@@ -1,92 +1,275 @@
1
1
  # subconscious-cli
2
2
 
3
- Log in to Subconscious from your terminal, then launch your favorite coding
4
- agent against your hosted Subconscious model — no per-agent config required.
3
+ Log in to Subconscious, then run coding agents with the setup maintained in
4
+ [`ol-runbook`](https://github.com/subconscious-systems/ol-runbook).
5
5
 
6
6
  ## Quick start
7
7
 
8
8
  ```bash
9
- npx subconscious-cli login # sign in, saves your API key
10
- npx subconscious-cli claude-code # launch Claude Code on Subconscious
9
+ npm install -g subconscious-cli
10
+ subc login
11
+ subc claude
11
12
  ```
12
13
 
13
- Installed globally it's just `subconscious <command>`:
14
+ Login creates both the saved credential and a ready-to-use `default` runbook
15
+ profile, so Claude Code, Codex, and OpenCode can launch immediately. To apply
16
+ the persistent runbook setup for all six supported agents together, run:
14
17
 
15
18
  ```bash
16
- npm install -g subconscious-cli
17
- subconscious login
18
- subconscious open-code
19
+ subc setup
20
+ ```
21
+
22
+ Top-level help (`subc`, `subc help`, or `subc --help`) displays the
23
+ Subconscious logo as portable ASCII art. Set `NO_COLOR=1` for a
24
+ monochrome version; redirected output automatically uses a plain wordmark.
25
+
26
+ Each coding agent also has integration-specific help. These commands only read
27
+ the selected profile; they do not authenticate, install, configure, or launch
28
+ anything:
29
+
30
+ ```bash
31
+ subc help claude
32
+ subc codex help
33
+ subc opencode --help
34
+ subc help cursor
35
+ subc help copilot
36
+ subc pi -h
37
+ ```
38
+
39
+ Agent help includes launch/setup behavior, supported integration options, and
40
+ every relevant profile setting with API keys redacted.
41
+
42
+ This writes the Claude environment file; Codex provider, catalog, and hooks;
43
+ OpenCode provider and compaction plugin; Cursor and Copilot hooks; and Pi
44
+ provider and compaction extension. It configures integrations but does not
45
+ install the underlying desktop applications or agent binaries.
46
+
47
+ `subc claude` launches the normal `claude` executable with the Subconscious
48
+ gateway environment applied for that process. Arguments pass through as usual:
49
+
50
+ ```bash
51
+ subc claude --continue
52
+ subc codex exec "write a test"
53
+ subc opencode
54
+ subc pi
55
+ ```
56
+
57
+ ## Supported agents
58
+
59
+ The packaged integrations are synced from `ol-runbook/coding-agents`.
60
+
61
+ | Command | Behavior |
62
+ | --- | --- |
63
+ | `subc claude` | Launch Claude Code with the runbook environment, context limits, subagent limits, and OTEL usage reporting |
64
+ | `subc codex` | Launch Codex with the runbook provider, temporary model catalog, and compaction hooks |
65
+ | `subc opencode` | Launch OpenCode with the runbook provider, client header, and context/output limits |
66
+ | `subc cursor` | Install/update the runbook Cursor conversation and compaction hooks |
67
+ | `subc copilot` | Install/update the runbook VS Code custom endpoint and Copilot hooks |
68
+ | `subc pi` | Launch Pi with the Subconscious provider and active profile model; never installs or rewrites configuration |
69
+
70
+ If Claude Code, Codex, or OpenCode is missing, an interactive terminal offers
71
+ to install it before launching. Pi is launch-only: if its executable or
72
+ Subconscious configuration is missing, the CLI exits with instructions instead
73
+ of installing or changing anything.
74
+
75
+ `subc codex` disables Codex apps and plugin tools for that launch by default so
76
+ requests remain below the gateway's 128-tool limit. Core coding tools remain
77
+ available. Use `subc codex --external-tools` to opt back in when targeting a
78
+ gateway with a larger tool limit. It also defaults reasoning effort to `max`,
79
+ which is the highest effort accepted by the Subconscious models; override it
80
+ with `subc codex --reasoning-effort high` when desired.
81
+
82
+ Cursor and Copilot are setup commands because their runbook integrations write
83
+ user-level configuration. Pi's provider and extension are managed only through
84
+ the aggregate setup command:
85
+
86
+ ```bash
87
+ subc cursor status
88
+ subc cursor uninstall
89
+ subc copilot status
90
+ ```
91
+
92
+ You can inspect or remove every persistent integration together too:
93
+
94
+ ```bash
95
+ subc setup
96
+ subc setup status
97
+ subc setup uninstall
98
+ ```
99
+
100
+ Target one integration by adding its command name. Agent-specific install
101
+ options pass through to that integration:
102
+
103
+ ```bash
104
+ subc setup codex
105
+ subc setup codex status
106
+ subc setup opencode uninstall
107
+ subc setup codex --subagents
108
+ subc setup claude --compact-window 900000
109
+ ```
110
+
111
+ Claude Code and Codex also expose the runbook's persistent environment helpers:
112
+
113
+ ```bash
114
+ subc setup codex use -- --resume
115
+ source <(subc setup codex env)
116
+ source <(subc setup codex unset)
19
117
  ```
20
118
 
21
- ## Launching coding agents
119
+ Run `subc setup AGENT --help` for that integration's complete persistent setup
120
+ options. A one-off `--api-key` passed to targeted setup takes precedence for
121
+ that command but is not saved to the selected profile.
122
+
123
+ Cursor still requires enabling its OpenAI API Key Override in Cursor Settings.
124
+ Copilot requires entering the custom endpoint key once through VS Code's
125
+ Manage Language Models UI. The setup scripts print the relevant next steps.
126
+
127
+ The runbook scripts require Bash. Cursor and Copilot setup also require `jq`
128
+ and `curl`; Pi setup requires `jq`.
129
+
130
+ ## Runbook profiles
131
+
132
+ `subc login` automatically creates:
133
+
134
+ ```text
135
+ ~/.subconscious/profiles/default.env
136
+ ```
22
137
 
23
- `subconscious <agent>` resolves your saved API key, injects the env vars that
24
- point the agent at Subconscious, and exec's the real CLI. Nothing is written to
25
- the agent's own config the provider is passed in-memory for that run only.
138
+ The file is mode `600` and contains the shared gateway URL, API key, model,
139
+ optional per-agent key overrides, and all Claude/Codex/OpenCode/Pi/Copilot
140
+ context and output settings used by the packaged runbook scripts. You can
141
+ inspect or update it through the CLI:
26
142
 
27
- | Command | Launches | Requires (install) |
28
- | -------------------------- | ----------- | ------------------------------------------------------ |
29
- | `subconscious claude-code` | Claude Code | `npm i -g @anthropic-ai/claude-code` |
30
- | `subconscious open-code` | OpenCode | `npm i -g opencode-ai` |
31
- | `subconscious aider` | Aider | `python -m pip install aider-install && aider-install` |
32
- | `subconscious codex` | Codex CLI | `npm i -g @openai/codex` |
143
+ ```bash
144
+ subc config
145
+ subc config --model subconscious/glm-5.2
146
+ subc config --gateway-url https://gateway.example
147
+ subc config path
148
+ subc config list
149
+ ```
33
150
 
34
- If the underlying agent isn't installed, the CLI tells you the exact install
35
- command. Anything after the agent name is forwarded straight to it:
151
+ Use the interactive settings wizard to choose or create a profile and edit
152
+ shared settings, one agent's complete settings section, or every setting:
36
153
 
37
154
  ```bash
38
- subconscious claude-code --resume
39
- subconscious codex exec "write a test"
155
+ subc settings
156
+ subc --profile work settings
157
+ subc --profile staging config interactive
40
158
  ```
41
159
 
42
- ### Choosing a model
160
+ The wizard validates URLs, numeric ranges, and enumerated values; masks API-key
161
+ input; and does not write anything until you choose **Save and exit**. Press
162
+ Ctrl-C or choose **Cancel** to discard pending changes. In scripts and CI, keep
163
+ using `subc config --gateway-url`, `--api-key`, and `--model` or edit the
164
+ mode-`600` profile directly.
165
+
166
+ Each agent section can hold its own API key. An agent-specific key takes
167
+ precedence over the shared profile key and can be used on its own, so profiles
168
+ do not need an `API_KEY` when every configured agent has an explicit key.
43
169
 
44
- Defaults to `subconscious/tim-qwen3.6-27b`. Override per run with `--model`, or
45
- set `SUBCONSCIOUS_MODEL` in your environment:
170
+ Named profiles work like mbta profiles:
46
171
 
47
172
  ```bash
48
- subconscious open-code --model subconscious/tim-qwen3.6-27b
49
- export SUBCONSCIOUS_MODEL=subconscious/tim-qwen3.6-27b
173
+ subc --profile staging config \
174
+ --gateway-url https://staging.example \
175
+ --api-key sk-staging-... \
176
+ --model subconscious/glm-5.2
177
+
178
+ subc --profile staging claude
179
+ subc --profile staging setup
50
180
  ```
51
181
 
52
- ## Auth commands
182
+ You can also select one with `SUBC_PROFILE=staging` (`MBTA_PROFILE` is accepted
183
+ as a compatibility fallback). Explicit shell variables
184
+ such as `SUBCONSCIOUS_API_KEY`, `SUBCONSCIOUS_BASE_URL`,
185
+ `SUBCONSCIOUS_MODEL`, and agent-specific tuning variables override profile
186
+ values. A command-line `--model` override has the highest model precedence.
53
187
 
54
- ### `login`
188
+ ## Models and endpoint overrides
55
189
 
56
- Opens your browser to sign in (or create an account). After authentication, your
57
- API key is automatically generated and saved.
190
+ List the available models with `subc models`:
58
191
 
192
+ ```text
193
+ subconscious/glm-5.2 (default)
194
+ subconscious/tim-qwen3.6-27b
195
+ subconscious/deepseek-v4-flash-marathon
59
196
  ```
60
- Terminal Browser
61
- │ │
62
- │ 1. Start local callback server │
63
- │ 2. Open browser ───────────────►│
64
- │ │ 3. Sign in / sign up via Clerk
65
- │ │ 4. API key auto-created
66
- │ 5. Receive key ◄────────────────│
67
- │ 6. Save to ~/.subcon/config.json│
68
- │ │ "You can close this tab"
69
- ✓ Logged in! │
197
+
198
+ Select a model per run, save it in the current profile, or override it through
199
+ the environment:
200
+
201
+ ```bash
202
+ subc codex --model subconscious/glm-5.2
203
+ subc config --model subconscious/deepseek-v4-flash-marathon
204
+ export SUBCONSCIOUS_MODEL=subconscious/glm-5.2
70
205
  ```
71
206
 
72
- ### `logout`
207
+ The Claude Code, Codex, OpenCode, Pi, and Copilot integrations register all
208
+ three models with their native model pickers. The profile's `MODEL` remains the
209
+ active model where the agent supports setting one and is listed first in the
210
+ other catalogs. Cursor requires adding the three model IDs in its OpenAI API
211
+ Key Override settings; `subc cursor` prints the complete list and the model
212
+ selected by the active profile.
73
213
 
74
- Removes your saved API key.
214
+ The default gateway is `https://api.subconscious.dev`. Profiles containing
215
+ the former exact default (`https://api.subconscious.dev`) migrate automatically;
216
+ custom gateway URLs are preserved. Override the active gateway with
217
+ `SUBCONSCIOUS_BASE_URL`:
75
218
 
76
- ### `whoami`
219
+ ```bash
220
+ SUBCONSCIOUS_BASE_URL=http://localhost:9999 subc claude
221
+ ```
222
+
223
+ Agent-specific runbook tuning variables are also honored, including
224
+ `CLAUDE_CODE_AUTO_COMPACT_WINDOW`, `CODEX_CONTEXT_WINDOW`,
225
+ `OPENCODE_CONTEXT_LIMIT`, `PI_CONTEXT_WINDOW`, and the corresponding output or
226
+ max-context settings.
227
+
228
+ ## Authentication
77
229
 
78
- Shows your current authentication status and which key is active.
230
+ `subc login` opens a browser, completes sign-in, and saves the generated API
231
+ key to the selected runbook profile with mode `600`. For the default profile it
232
+ also maintains `~/.subconscious/config.json`.
79
233
 
80
- ## Where keys are stored
234
+ ```bash
235
+ subc login
236
+ subc update-key sk-new-key-...
237
+ subc update-url https://api.subconscious.dev
238
+ subc whoami
239
+ subc logout
240
+ ```
81
241
 
82
- Keys are saved to `~/.subcon/config.json` with `600` permissions
83
- (owner-read-only). The file looks like:
242
+ `subc update-key <api-key>` replaces the shared key in the selected profile.
243
+ For `default`, it also synchronizes `~/.subconscious/config.json`:
84
244
 
85
- ```json
86
- {
87
- "subconscious_api_key": "sk-..."
88
- }
245
+ ```bash
246
+ subc update-key sk-new-default-key-...
247
+ subc --profile staging update-key sk-new-staging-key-...
89
248
  ```
90
249
 
91
- Environment variable `SUBCONSCIOUS_API_KEY` takes precedence over the config
92
- file handy for CI or temporary overrides.
250
+ Because command arguments may be retained in shell history, `subc login` is
251
+ preferred when obtaining a new key interactively. If `SUBCONSCIOUS_API_KEY` is
252
+ set, it continues to override the updated saved key.
253
+
254
+ `subc update-url <gateway-url>` validates the URL and automatically updates
255
+ `GATEWAY_URL` in the default profile. No `--profile` option or separate config
256
+ command is needed:
257
+
258
+ ```bash
259
+ subc update-url https://api.subconscious.dev
260
+ ```
261
+
262
+ If `SUBC_PROFILE` already selects a named profile, that active profile is
263
+ updated automatically as well.
264
+
265
+ `SUBCONSCIOUS_BASE_URL` continues to take precedence when set. A configured
266
+ `CLAUDE_GATEWAY_URL` remains a Claude-specific override.
267
+
268
+ `SUBCONSCIOUS_API_KEY` takes precedence over profile and saved config keys,
269
+ which is useful for CI and temporary sessions. `subc logout` clears the
270
+ selected profile's shared key while preserving its non-secret runbook settings;
271
+ logging out of `default` also clears the backwards-compatible saved key.
272
+
273
+ Existing credentials and profiles under `~/.subcon` are copied into
274
+ `~/.subconscious` automatically on first use. The legacy files are left in
275
+ place so migration is recoverable.