Skip to content

Commit a6b66b3

Browse files
committed
feat:(Auto detect new models)
- Turn crew identity off by default
1 parent 1f2cf4e commit a6b66b3

67 files changed

Lines changed: 1297 additions & 436 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎AGENTS.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,8 @@ crewcoder/
254254

255255
## Current hard-won notes
256256

257+
- Worker identity is off by default and opt-in through `workerIdentityEnabled` and `identity on|off|status`. Preserve `activeWorker` selection while disabled; keep default/custom/host system prompts and propagate identity suppression to delegated runs. Host opt-in must never override the user's opt-out.
258+
- `codex-cli` is the sole registered Codex provider and fresh-install default; do not restore the managed `codex` provider or its bundled dependency/login flow. Claude model discovery and execution must share the executable resolver: explicit override, installed Claude Code on PATH, then the SDK bundle. An older SDK bundle must not hide models exposed by the user's installed CLI.
257259
- Provider thinking streams are user-visible behavior. Do not remove or simplify `onThinkingDelta`, `thinking_delta`, or TUI `thinking` blocks without replacing the behavior and tests.
258260
- Codex/OpenAI reasoning summaries can arrive as live `response.reasoning_summary_text.delta`, final `response.reasoning_*_done`, response-level `output` reasoning items, or completed `response.output_item.done` reasoning items.
259261
- OpenCode uses the Anthropic-compatible provider path and must request `stream: true` to surface thinking deltas.

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ npm run dev -w @onpoint-dev-tools/crewcoder-tui
178178
```ts
179179
import { createCrewCoderSession } from "@onpoint-dev-tools/crewcoder-sdk";
180180

181-
const session = createCrewCoderSession({ cwd: process.cwd(), provider: "codex", approval: "review" });
181+
const session = createCrewCoderSession({ cwd: process.cwd(), provider: "codex-cli", approval: "review" });
182182
session.subscribe((event) => {
183183
if (event.type === "assistant_delta") process.stdout.write(event.text);
184184
});
@@ -201,7 +201,7 @@ See [SDK.md](https://github.com/OnPoint-Dev-Tools/crewcoder/blob/main/crewcoder-
201201
## Detached durable goals
202202

203203
```sh
204-
crewcoder goal start "Complete the migration and stop when contract tests pass" --provider codex
204+
crewcoder goal start "Complete the migration and stop when contract tests pass" --provider codex-cli
205205
crewcoder goal status
206206
crewcoder goal approve
207207
```

‎crewcoder-agent/AGENTS.md‎

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ CrewCoder should become a best-in-class coding agent with:
2020

2121
## CLI aliases
2222

23-
The `@openai/codex` dependency uses npm's `latest` tag so new CrewCoder installations receive the current stable Codex app-server. Keep `scripts/release.cjs` from replacing that tag with an exact version. Existing installations update only when their package manager installs again.
23+
`codex-cli` is the sole registered Codex provider and fresh-install default. It uses
24+
the user's installed Codex CLI and login; never restore the managed `codex` provider,
25+
its device login flow, or an `@openai/codex` package dependency through release automation.
26+
Existing configs naming `codex` must explicitly select `codex-cli`; there is no provider alias.
2427

2528
The agent package maps `crewcoder`, `crew`, and `crewcoder-agent` to the same CLI entrypoint. Keep `crew` behavior identical to `crewcoder`, including no-argument TUI launch and all argument-bearing backend commands. Never restore the `cc` alias because it shadows the standard Unix C compiler command.
2629

@@ -184,7 +187,7 @@ Do not store CrewCoder extensions under `/.crewcode`.
184187

185188
```txt
186189
1. Built-in providers
187-
- codex
190+
- codex-cli
188191
- claude
189192
- opencode
190193
@@ -205,6 +208,20 @@ Built-ins are not plugins. They live in `src/providers` and are first-class prov
205208

206209
Users add additional providers through CrewCoder extensions.
207210

211+
Native model catalogs for `codex-cli` and `claude` come from app-server
212+
`model/list` and Agent SDK `supportedModels()`. Keep the bundled catalogs as
213+
offline fallbacks and known context metadata, never as the picker allowlist.
214+
Update both `models` and `modelCatalog` when hydrating: picker resolution prefers
215+
the latter. Preserve five-second discovery deadlines, bounded pagination,
216+
five-minute process caching, account separation, and no-inference discovery.
217+
Claude catalog probes must disable hooks/tools/MCP/skills and persistence.
218+
Discovery and execution must share `resolveClaudeExecutable`: explicit override,
219+
installed `claude` on PATH, then the SDK bundle. Never let an older bundled CLI
220+
hide models available in the user's installed CLI. Executable changes invalidate the cache.
221+
ACP model state must await the same discovered registry used by CLI/TUI.
222+
`auth --json` must use `listProviders({ discoverModels: false })` to avoid
223+
credential refreshes and discovery subprocesses. See [Providers](docs/PROVIDERS.md#automatic-model-discovery).
224+
208225
Thinking/reasoning stream behavior is part of the provider contract:
209226

210227
```txt
@@ -245,7 +262,7 @@ Codex / OpenAI Responses:
245262
- Never treat reasoning token usage as proof the UI received a summary; usage can show reasoning_tokens while no summary was emitted.
246263
- If successful Codex output leaks raw SSE `data:` lines, normalize it back into CrewCoder assistant JSON before returning.
247264
- HTTP 200 does not prove a successful Codex turn: SSE `error`, `response.failed`, and `response.incomplete` events are terminal provider failures. A stream ending without assistant text, tool calls, or completion metadata is also a provider/protocol failure, never a successful `(empty Codex response)` placeholder.
248-
- Codex primarily uses official app-server durable threads stored under CrewCoder's isolated Codex home. Persist only the encoded thread/contract identifier in `providerSessionIds.codex`; never auth tokens. Local app-server turns use its native workspace-write shell/patch capabilities, and provider-native approval requests must route through the active host interaction channel. When `useProviderNativeFileTools` is false for an ACP/SDK virtual filesystem, skip app-server entirely and use the direct Responses transport so built-in local shell/patch tools cannot bypass the host filesystem. Preserve failed native `fileChange` error detail rather than projecting only its proposed patch. The direct connection-cached WebSocket and stateless SSE transports are guarded fallbacks; never replay after app-server `turn/start` has been sent.
265+
- Codex CLI uses official app-server durable threads in the user's own Codex home. Persist the encoded native thread/contract identifier in `providerSessionIds["codex-cli"]`; never auth tokens. Hosted or virtual-filesystem sessions must lock native tools down and use CrewCoder dynamic tools under a read-only sandbox. Preserve native approval routing and failed tool details. The registered provider has no direct Responses, WebSocket, or SSE fallback; never replay a started native turn.
249266
- Native Codex approval questions show the reason without appending the shell command; keep command details in tool events and preserve all provider approval decision values. See `docs/CODEX_CLI_PROVIDER.md`.
250267
- Native Codex command failures must preserve error text and otherwise report declined status or exit code. Empty `aggregatedOutput` is not a useful failure result and must not become an unexplained blank tool row.
251268
- Provider-native compaction is observable lifecycle, not merely a token-count change. Codex app-server `contextCompaction` item start/completion and legacy `thread/compacted` notifications must emit one deduplicated provider-compaction lifecycle; Claude `compact_boundary` must emit provider completion. ACP projects these through `_crewcoder/compaction_update` without claiming the CrewCoder durable transcript itself was rewritten.
@@ -306,7 +323,7 @@ serialization -> provider adapters read the file + base64 at request time
306323
into the user text; only the text is rewritten.
307324
- Encoded per runtime: `anthropic-messages` -> Anthropic `image`/base64 (or OpenAI
308325
chat `image_url` for OpenAI-shaped models); `openai-responses` and
309-
`openai-codex-responses` (codex) -> Responses API `input_image` data URI.
326+
`openai-codex-responses` (codex-cli) -> app-server `localImage` input.
310327
- Codex image input is additive: it adds an `input_image` content part to the user
311328
turn only. It does NOT change the sensitive ChatGPT OAuth contract (originator,
312329
headers, model access, session/thread metadata, tool_choice, prompt_cache_key) —
@@ -516,7 +533,7 @@ See `docs/COST_LEDGER.md`.
516533

517534
## Model diff (`diff-models`)
518535

519-
`crewcoder diff-models <prompt> --models codex:gpt-5.6,opencode:claude-sonnet-4-6` races one
536+
`crewcoder diff-models <prompt> --models codex-cli:gpt-5.6,opencode:claude-sonnet-4-6` races one
520537
prompt across N models and reports response, cost, and latency. Like `session why`, it is a
521538
**one-shot call per candidate with `availableTools: []` and no session write** — it must never
522539
become an agent run or gain tools. Candidates run in parallel by default (`--sequential` when
@@ -727,9 +744,9 @@ crewcoder sessions
727744
crewcoder session show <id>
728745
crewcoder session show <id> --out conversation.md
729746
crewcoder session why <id>
730-
crewcoder diff-models "explain generics" --models codex:gpt-5.6,opencode:claude-sonnet-4-6
747+
crewcoder diff-models "explain generics" --models codex-cli:gpt-5.6,opencode:claude-sonnet-4-6
731748
crewcoder cost --today --by-model
732-
crewcoder cost price codex:gpt-5.6-luna --input 1.25 --output 10
749+
crewcoder cost price codex-cli:gpt-5.6-luna --input 1.25 --output 10
733750
crewcoder doctor
734751
```
735752

@@ -1047,7 +1064,12 @@ CrewCoder supports multiple named **workers** (agent identities) the user can sw
10471064
- `identity.json` — structured identity: `workerName`, `ownerName`, `ownerHandle`, `description`.
10481065
- `IDENTITY.md` (per worker) — freeform persona/instructions for that worker. Its body is embedded in the worker identity block in the system prompt. Defines WHO the worker is and HOW it behaves.
10491066

1050-
The **active worker** is stored in `config.json` as `activeWorker` (default `"Crew"`). A default `Crew` worker is auto-created on first use; a legacy single `identity.json` is migrated into it once.
1067+
The selected worker is stored in `config.json` as `activeWorker` (default `"Crew"`).
1068+
`workerIdentityEnabled` (default `false`; explicit opt-in required) separately controls prompt identity.
1069+
`crewcoder identity on|off|status` and TUI `/identity on|off|status` manage it.
1070+
Disabling preserves worker files and the selected name; ordinary identity-off
1071+
runs and worker listing must not auto-create a default worker. Explicit worker
1072+
selections remain validated. See [optional worker identity](docs/WORKER_IDENTITY.md).
10511073

10521074
### Two instruction layers — keep them separate
10531075

@@ -1057,7 +1079,13 @@ Repo AGENTS.md -> rules for the codebase in the working dir (normal AGEN
10571079
This AGENTS.md -> CrewCoder package docs/standards, documentation ONLY
10581080
```
10591081

1060-
Identity assembly lives in `src/core/identity.ts` (`getActiveWorker`, `buildIdentityPrompt`). The agent loop passes the identity block, including the `IDENTITY.md` body, to `buildSystemPrompt` as `identityPrompt`, so it sits at the top of the system prompt on every run. Fresh installs auto-create `Crew` with owner placeholders `CrewCoder User` / `@CrewCoderUser` and a useful general-purpose starter identity; never overwrite an existing worker's customized files.
1082+
Identity assembly lives in `src/core/identity.ts` (`getActiveWorker`, `buildIdentityPrompt`).
1083+
The agent loop includes that block only when both user config and the host/run
1084+
instruction policy permit it. Neither an explicit worker nor a host enabling its
1085+
identity policy overrides user opt-out. Delegated children inherit suppression.
1086+
Keep normal/custom/host system prompts and tool/approval policy intact. Fresh
1087+
identity-enabled installs create `Crew` with placeholder owner metadata; never
1088+
overwrite customized worker files.
10611089

10621090
### Worker commands
10631091

‎crewcoder-agent/README.md‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,17 @@ Layout:
3333

3434
## Default worker
3535

36-
On first use, CrewCoder creates the global `Crew` worker under `~/.crewcoder/workers/Crew/` (or the configured CrewCoder home). Its starter metadata identifies the owner as `CrewCoder User` (`@CrewCoderUser`), and its `IDENTITY.md` provides a practical general-purpose coding-partner role and working style. Both files are user-editable; existing workers are not overwritten.
36+
Worker identity is off by default for new users. After `crewcoder identity on`, first use creates the global `Crew` worker under `~/.crewcoder/workers/Crew/` (or the configured CrewCoder home). Its starter metadata identifies the owner as `CrewCoder User` (`@CrewCoderUser`), and its `IDENTITY.md` provides a practical general-purpose coding-partner role and working style. Both files are user-editable; existing workers are not overwritten.
37+
38+
Use `crewcoder identity off` or TUI `/identity off` to keep the normal and custom
39+
system prompts while omitting the worker persona. `identity on` restores it, and
40+
`identity status` reports the setting. `activeWorker` preserves the selected name;
41+
`workerIdentityEnabled` stores the toggle. See [optional worker identity](docs/WORKER_IDENTITY.md).
3742

3843
## Three separate systems
3944

4045
```txt
41-
1. Built-in providers: codex, claude, opencode
46+
1. Built-in providers: codex-cli, claude, opencode
4247
2. CrewCoder extensions: /.crewcoder/extensions, crewcoder.extension.json
4348
3. CrewCode app plugins: crewcode.plugin.json, generated from /CrewCode/examples/plugins when available
4449
```
@@ -94,7 +99,7 @@ crewcoder upgrade
9499
crewcoder update --yes
95100
```
96101

97-
New installations resolve the current npm `@openai/codex@latest` app-server. Existing installations keep their installed Codex version until npm updates them.
102+
Codex uses your separately installed Codex CLI and its login. Install/update that CLI normally; CrewCoder does not install a second Codex runtime.
98103

99104
The scoped agent and TUI packages can still be installed separately for development or custom packaging.
100105

@@ -104,16 +109,18 @@ The scoped agent and TUI packages can still be installed separately for developm
104109
crewcoder providers
105110
crewcoder run --provider opencode "fix this bug"
106111
crewcoder run --provider claude "refactor this module"
107-
crewcoder run --provider codex "write tests for this CLI"
112+
crewcoder run --provider codex-cli "write tests for this CLI"
108113
crewcoder run --provider claude --model claude-sonnet-5 "review this change" # local Claude Code login
109114
crewcoder run --provider anthropic --model claude-sonnet-5 "review this change" # direct API key
110115
crewcoder run --provider openrouter --model openai/gpt-5.4 "fix this bug"
111116
crewcoder config set defaultProvider opencode
112117
```
113118

119+
Codex CLI and Claude model pickers automatically discover models from their native runtimes. Claude discovery and inference prefer your installed Claude Code over the SDK bundle. New runtime-reported models appear without editing CrewCoder's model list. Discovery uses a five-minute process cache and falls back to the last successful or bundled list when unavailable. See [automatic model discovery](docs/PROVIDERS.md#automatic-model-discovery).
120+
114121
CrewCoder resolves model context windows from provider metadata first, then from a strict-match, 24-hour disk cache of OpenRouter's public model catalog. Unknown or offline models remain token-only. See `docs/MODEL_CONTEXT_WINDOWS.md`.
115122

116-
The built-in Codex provider uses official app-server threads persisted under CrewCoder's home, so resumed turns send only new input across process and machine restarts. The direct WebSocket/SSE transport remains a guarded fallback. See `docs/CODEX_TRANSPORT.md`.
123+
`codex-cli` is the sole Codex provider and fresh-install default. It uses official app-server threads in the user's Codex home, so resumed turns send only new input across process and machine restarts. Existing configurations with `defaultProvider: codex` must run `crewcoder config set defaultProvider codex-cli`. See `docs/CODEX_TRANSPORT.md`.
117124

118125
Provider adapters use checked process, HTTP/SSE, WebSocket, continuation, fallback, and replay profiles. Built-ins include Claude Code Agent SDK, Grok CLI (ACP stdio), OpenAI, Anthropic, OpenRouter, xAI, DeepSeek, Mistral, Codex, and OpenCode; extensions may select vetted generic transports without receiving CrewCoder-owned OAuth credentials. Models/providers can advertise parallel tool-call support, while only tools explicitly marked parallel-safe execute concurrently; sequential tools remain ordering barriers. See `docs/PROVIDERS.md`, `docs/PARALLEL_TOOL_CALLS.md`, `docs/contributor/PROVIDER_TRANSPORTS.md`, and `docs/ACP_CLIENT_PROVIDER.md`.
119126

@@ -122,7 +129,7 @@ Provider adapters use checked process, HTTP/SSE, WebSocket, continuation, fallba
122129
CrewCoder owns a detached, provider-independent goal supervisor. Codex is the model provider; `/goal` is not forwarded to the Codex Responses endpoint.
123130

124131
```bash
125-
crewcoder goal start "Complete the migration and stop when contract tests pass" --provider codex --approval review
132+
crewcoder goal start "Complete the migration and stop when contract tests pass" --provider codex-cli --approval review
126133
crewcoder goal status
127134
crewcoder goal approve
128135
crewcoder goal pause

‎crewcoder-agent/docs/ACP_ADAPTER.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ CrewCoder's own instruction sources apply. It accepts
157157
Without a policy the session behaves as standalone CrewCoder: worker identity on, no global files.
158158

159159
- `workerIdentity: false` omits the active worker's identity block (`~/.crewcoder/workers/<name>`).
160+
- `workerIdentity: true` permits identity only when the user's persistent `workerIdentityEnabled` setting is also on. Host opt-in never overrides user opt-out. See [worker identity](WORKER_IDENTITY.md).
160161
Hosted text-only sessions never include it either way.
161162
- `globalInstructions: true` adds the user's `$CODEX_HOME/AGENTS.md` (default `~/.codex`) and
162163
`$CLAUDE_CONFIG_DIR/CLAUDE.md` (default `~/.claude`) under a "Global user instructions" heading,

‎crewcoder-agent/docs/CLAUDE_AGENT_SDK.md‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,21 @@ claude
1515
crewcoder run --provider claude --model claude-sonnet-5 "inspect this repository"
1616
```
1717

18-
The SDK bundles its platform Claude executable. Set `CREWCODER_CLAUDE_PATH` only when CrewCoder
19-
must use a specific installed Claude Code executable. CrewCoder defaults
18+
CrewCoder selects `CREWCODER_CLAUDE_PATH` when set, otherwise the first executable
19+
`claude` on `PATH`, and uses the SDK's bundled executable only when no installed
20+
CLI is available. Model discovery and inference share this resolver, so a newer
21+
installed CLI supplies its current catalog instead of the SDK bundle's older list.
22+
An explicit override is authoritative; an invalid override is not replaced.
23+
On Windows, use the actual executable through `CREWCODER_CLAUDE_PATH` when the
24+
installation exposes only a `.cmd` shim. CrewCoder defaults
2025
`CLAUDE_CODE_STREAM_CLOSE_TIMEOUT` to 24 hours because MCP-backed tools can remain paused for user
2126
approval; an explicitly configured value is preserved.
2227

28+
Model pickers call SDK `supportedModels()` without sending an inference prompt.
29+
Alias rows include their canonical `resolvedModel` IDs. Executable path and file
30+
changes invalidate the process catalog cache, so native CLI updates are detected
31+
without maintaining another model allowlist. See [automatic model discovery](PROVIDERS.md#automatic-model-discovery).
32+
2333
## Hybrid tool ownership
2434

2535
Claude keeps native read-only interaction tools:

‎crewcoder-agent/docs/CODEX_CLI_PROVIDER.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
# Bring-your-own Codex CLI provider
22

3-
The `codex-cli` provider runs the user's own installed Codex CLI (`codex app-server --stdio`) with the user's own Codex login. CrewCoder never reads, copies, refreshes, or stores those tokens. This is the opposite of the `codex` provider, which signs in through `crewcoder login codex` and holds ChatGPT OAuth tokens itself.
3+
The `codex-cli` provider is CrewCoder's sole Codex provider and fresh-install default.
4+
It runs the user's installed Codex CLI (`codex app-server --stdio`) with its own
5+
login. CrewCoder never reads, copies, refreshes, or stores those tokens. The former
6+
managed `codex` provider and `crewcoder login codex` flow have been removed.
47

58
## Setup
69

710
```bash
811
codex login # the user's normal Codex CLI sign-in
12+
crewcoder config set defaultProvider codex-cli # replace a previously configured codex default
913
crewcoder auth --json # codex-cli should report "signed-in"
1014
crewcoder run --provider codex-cli --model gpt-5.6-luna "inspect this repository"
1115
```

0 commit comments

Comments
 (0)