Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
30d9bd8
scient: load installed Codex plugins' skills and MCP servers
yaacovcorcos Nov 21, 2026
0af9eab
fix(codex-plugins): never widen a plugin server's tools; one bad serv…
yaacovcorcos Nov 22, 2026
4d90a48
fix(codex-plugins): load Codex plugins under Codex's own trust rules
yaacovcorcos Nov 22, 2026
e53bde7
fix(codex-plugins): match Codex on launch env, policy layers, contain…
yaacovcorcos Nov 22, 2026
65ffa2e
fix(codex-plugins): authoritative launch env, Codex approvals and EMA…
yaacovcorcos Nov 22, 2026
a507587
fix(codex-plugins): build-marked launch env, ema_auth left out, Codex…
yaacovcorcos Nov 22, 2026
24ee20a
fix(codex-plugins): skill rules, omit_tools_from, durations, path fal…
yaacovcorcos Nov 22, 2026
e6abb5a
fix(codex-plugins): stable server names, manifest-named skill rules, …
yaacovcorcos Nov 22, 2026
c3a232e
fix(codex-plugins): exact CODEX_HOME, plugins switch, top-level serve…
yaacovcorcos Nov 22, 2026
c9eaa43
fix(codex-plugins): own sign-in per imported server, Codex disables a…
yaacovcorcos Nov 22, 2026
084a5de
fix(codex-plugins): bound sign-ins through reconnect and unauth, bear…
yaacovcorcos Nov 22, 2026
97a0826
fix(codex-plugins): only the codex source binds a sign-in, required b…
yaacovcorcos Nov 22, 2026
92cf28e
fix(codex-plugins): trust server-bound sign-ins on every connection p…
yaacovcorcos Nov 22, 2026
b069eaf
fix(codex-plugins): selected-definition provenance, client-bound sign…
yaacovcorcos Nov 22, 2026
02a3d55
fix(codex-plugins): supplied-source provenance, exact confidential cl…
yaacovcorcos Nov 22, 2026
bfa3436
fix(codex-plugins): Codex OAuth validation, secret-bound refresh, one…
yaacovcorcos Nov 22, 2026
6416142
fix(codex-plugins): no tool-call deadline for a connection without co…
yaacovcorcos Nov 22, 2026
e34e47e
fix(codex-plugins): Codex alias and blank rules, current-secret refre…
yaacovcorcos Nov 22, 2026
c245207
fix(codex-plugins): no token-endpoint redirects, broker refresh witho…
yaacovcorcos Nov 22, 2026
3987cf3
feat(mcp): host status and sign-in command, live pickup of new sign-ins
yaacovcorcos Nov 22, 2026
23bd4e4
fix(mcp): host command keeps credentials out of its output and prompt…
yaacovcorcos Nov 22, 2026
fe1fe04
fix(mcp): mcp login shows no keyed sign-in page and signs in to the s…
yaacovcorcos Nov 22, 2026
ab3f275
fix(mcp): mcp login signs in to URL-only entries over the inferred tr…
yaacovcorcos Nov 22, 2026
da0eaa9
fix(mcp): mcp login words every refusal itself
yaacovcorcos Nov 22, 2026
dbddbf8
fix(mcp): mcp login refuses a keyed server address before any request
yaacovcorcos Nov 22, 2026
422c23b
fix(mcp): mcp login refuses before connecting; no Sign in for a keyed…
yaacovcorcos Nov 22, 2026
8db5d84
fix(mcp): an ordinary server with auth: null no longer stops RPC startup
yaacovcorcos Nov 22, 2026
a661944
fix(mcp): pickup reconnects servers independently, before skills too;…
yaacovcorcos Nov 22, 2026
1ca806a
fix(mcp): mcp output written with Bun.write; later prompts join picku…
yaacovcorcos Nov 22, 2026
bc97ef1
fix(mcp): a prompt sharing a sign-in re-read waits for the reconnect …
yaacovcorcos Nov 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion SCIENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ Everything else is upstream's code and behavior.
| Wording | The agent calls itself Scient Agent, and its command `scient-agent`, wherever a person or a model reads its words: messages, help, sign-in instructions, prompts, the built-in documentation, window and notification titles. The prompts also address researchers: the model's role is a research and coding assistant, and each personality matches its explanations to the reader's expertise instead of assuming a technical reader. `scripts/scient/rename-wording.ts` generates this. |
| State | The config root is `~/.scient-agent` (project folder `.scient-agent/`), or the absolute directory a host sets in `SCIENT_AGENT_ROOT`. User config lookups, the native addon cache, browser storage state and crash logs follow it. A host's root is authoritative: `SCIENT_AGENT_DIR` is ignored under it, and a `.env` in the project or the home directory cannot set any `SCIENT_AGENT_*` variable (a `.env` inside the root can). The root is taken only from the launch environment, never from a `.env`. Standalone use keeps upstream's `.env` overrides. |
| Variables | The variables that choose where state lives have `SCIENT_AGENT_*` names: `CONFIG_DIR`, `CONFIG_FILES`, `DIR`, `PROFILE`, `SESSION_DIR`, `WORKTREE_DIR`, `AUTH_BROKER_*`, `NATIVES_DIR`, the cache database overrides, the directory, TCP address and re-exec hand-over of Oh My Pi's per-user daemon, and the configuration the agent hands its own workers. OMP's names for them are ignored. Tuning variables (`PI_*`) are unchanged. |
| Discovery | A host can add foreign user-level sources with `SCIENT_AGENT_ENABLE_SOURCES` (provider ids separated by commas or whitespace). These are unioned with `enabledProviders` for discovery without changing or persisting that setting; `disabledProviders` still wins. The same aliases apply, including `claude` enabling `claude-plugins`. Under a host root, project and home `.env` files cannot add sources. |
| Discovery | A host can add foreign user-level sources with `SCIENT_AGENT_ENABLE_SOURCES` (provider ids separated by commas or whitespace). These are unioned with `enabledProviders` for discovery without changing or persisting that setting; `disabledProviders` still wins. The same aliases apply, including `claude` enabling `claude-plugins`. Under a host root, project and home `.env` files cannot add sources. `--runtime-info` lists the plugin sources a host may add (`enableSources`). |
| Codex plugins | The opt-in source `codex-plugins` loads the skills and MCP servers of the Codex plugins a person installed and enabled (`[plugins."<name>@<marketplace>"]` in `$CODEX_HOME/config.toml`, default `~/.codex`, or `[plugins._default]`), from the version Codex runs in its plugin cache, under Codex's own rules: its manifest precedence (a root Agent Plugins `plugin.json`, then `.codex-plugin`, `.claude-plugin`, `.cursor-plugin`), its field types and `./` paths (falling back to `skills/` and `.mcp.json` as Codex does), its skill scan, skill names and the user's `[[skills.config]]` rules, one transport per server with only that transport's fields, package files, skills and launch paths inside the package, a stdio server inheriting only the variables Codex passes (`HOME`, `PATH` and the like, plus its `env_vars`), plugin values taken literally, and each tool call held to the server's `tool_timeout_sec`, or Codex's five-minute default, on a clock that never runs backwards, whatever the call asks to wait and across a sign-in refresh, a reconnect and a replay of the same call (a server with `tool_timeout_sec = 0`, whose every call Codex times out, is skipped). Servers are named `<plugin>@<marketplace>:<server>`; `/mcp enable` and `/mcp disable` toggle them through `disabledServers`. Each imported HTTP server signs in under its own credential (`mcp_oauth:server:…`), which only a definition the `codex-plugins` source supplies can claim and which never stands in for another server's at the same URL: re-signing in keeps its values literal and asks for its configured scopes and `oauth_resource`, reconnecting keeps that sign-in, a sign-in made for another confidential client ID than the plugin now configures (compared exactly) is not used, the sign-in keeps no client secret, so refreshing and re-signing in send only the secret the plugin configures now, a sign-in challenge from the live server is answered for that server and never for a same-named config-file entry, and `/mcp unauth` removes only it. Its OAuth settings are read as Codex reads them (camelCase aliases giving way to snake_case keys); settings Codex refuses (a client secret without a client ID, or either of them blank; `authorization_server_issuer` or `token_endpoint_auth_method` without `ema_auth`) or a client ID or secret with surrounding whitespace skip the server. A server that names its own token (`bearer_token_env_var`) keeps that token and is never signed in with OAuth, and is skipped when the token's variable is unset, as in Codex. `CODEX_HOME`, header credentials and servers' variables come from the environment Scient Agent was launched with, never a `.env` file; a run that cannot tell that environment apart (from source without `--no-env-file` outside Linux, or with an explicit `--env-file`) loads nothing. A server whose tools Codex narrows (`enabled_tools`, or a non-empty `disabled_tools`), hides (`omit_tools_from`), caps (`output_token_limit`) or always asks about (`prompt` or `writes` approval; `auto` follows the session's approval policy, as Scient Agent's approval mode does) is skipped with a warning, because Scient Agent cannot enforce either; so is a server Codex turns off (`enabled = false`, `ema_auth`), one the user's own `[mcp_servers]` replaces, one two plugins declare under the same name, and one with malformed or unsupported fields, while its siblings load. Nothing loads while an organization policy manages Codex, or may and cannot be checked, while `[features] plugins` is off, or when Codex cannot read its `[plugins]` settings. Plugins and servers that run only inside OpenAI's apps (browser, Chrome, computer use, the Codex app's tools, the Computer Use client launcher, Codex's ChatGPT session) are left out, and so are app references, which the ChatGPT apps cover. `codex` does not enable it. |
| MCP sign-in | `scient-agent mcp list` prints each MCP server a conversation loads with its status (connected with its tool count, needs sign-in, failed) and whether a browser sign-in serves it; `scient-agent mcp login <name>` runs that sign-in and prints the page to open, for a host's own Sign in button (`--runtime-info` lists `mcp` in `hostCommands`). A conversation in RPC mode picks up a sign-in made elsewhere at its next prompt. An authorization server that registers only the apps it approved (Figma) refuses Scient Agent until it approves it. |
| Native addon cache | A compiled binary extracts its addons into a directory named for their content, so two builds on one upstream version never load each other's, and it loads only from that directory. A modern addon that fails to load falls back to the same build's baseline addon; an addon found beside the executable is not a fallback. |
| Symbol | The sign-in page every browser sign-in ends on and the `stats` dashboard show Scient Agent's symbol (`packages/utils/src/scient/scient-agent-symbol.svg.txt`, the file Scient Desktop shows for the agent; copy it over when the symbol changes) in Scient's colors. |
| Shared workers | The tiny model worker, the embedding server and word prediction run in Oh My Pi's per-user daemon. The daemon's build carries Scient Agent's release, not the upstream package version, so a new Scient Agent release has an older release's daemon re-exec into it, which replaces its workers. |
Expand Down
2 changes: 1 addition & 1 deletion docs/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ It documents only active behavior.

## Host discovery sources

`SCIENT_AGENT_ENABLE_SOURCES` adds foreign user-level discovery sources to the effective `enabledProviders` set without replacing or persisting that setting. Set it in the launch environment, for example `SCIENT_AGENT_ENABLE_SOURCES=claude-plugins` to load Claude Code's installed plugins under `~/.claude/plugins`. Separate multiple provider ids with commas or whitespace; empty and malformed entries are ignored. Ids use lowercase letters, digits and hyphens, starting with a letter; `*` and `all` are also accepted. The normal opt-in semantics apply, including `claude` enabling `claude-plugins`. `disabledProviders` takes precedence.
`SCIENT_AGENT_ENABLE_SOURCES` adds foreign user-level discovery sources to the effective `enabledProviders` set without replacing or persisting that setting. Set it in the launch environment, for example `SCIENT_AGENT_ENABLE_SOURCES=claude-plugins` to load Claude Code's installed plugins under `~/.claude/plugins`, or `codex-plugins` to load the skills and MCP servers of the Codex plugins installed and enabled in `$CODEX_HOME/config.toml` (default `~/.codex`) from Codex's plugin cache. Separate multiple provider ids with commas or whitespace; empty and malformed entries are ignored. Ids use lowercase letters, digits and hyphens, starting with a letter; `*` and `all` are also accepted. The normal opt-in semantics apply, including `claude` enabling `claude-plugins`. `disabledProviders` takes precedence. `--runtime-info` lists the plugin sources the executable can load in `enableSources`.

This uses the same environment loading rules as other `SCIENT_AGENT_*` variables: when a host sets `SCIENT_AGENT_ROOT`, project and home `.env` files cannot set it (a `.env` inside the host root can). Standalone use retains the normal `.env` loading rules below. The additions affect discovery only; `getEnabledProviders()`, settings UI values, and source enable/disable writes remain based on settings alone.
<!-- scient(SA-DISCOVERY): end -->
Expand Down
8 changes: 8 additions & 0 deletions packages/coding-agent/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## [Unreleased]

<!-- scient(SA-CODEX-PLUGINS): begin - Installed Codex plugins. -->
### Added

- The skills and MCP servers of the Codex plugins you installed and enabled load when the `codex-plugins` source is on (`enabledProviders`, or a host's `SCIENT_AGENT_ENABLE_SOURCES`), as `<plugin>@<marketplace>:<server>` servers, under Codex's own rules: only the plugins Codex would run (`[plugins._default]`, `[features] plugins`, its manifest formats and field types included), only the skills your Codex config leaves on (`[[skills.config]]`), servers that inherit only the variables Codex would pass them from the environment Scient Agent was launched with (never a `.env` file), plugin values taken literally, tool calls held to the plugin's `tool_timeout_sec` (five minutes unless set, as in Codex), and package paths and skills kept inside the package. Each imported HTTP server signs in on its own, never with another server's sign-in at the same URL, asking for the scopes and resource the plugin configures and signing in again when the plugin changes its OAuth client; one that names its own token keeps it and is never signed in with OAuth. Plugins that only work inside OpenAI's apps are left out, and so, with a warning, are servers whose tools Codex narrows (`enabled_tools` or `disabled_tools`), hides (`omit_tools_from`), caps (`output_token_limit`) or always asks about (`prompt` or `writes` approval), servers Codex turns off (`enabled = false`, `ema_auth`) or replaces with your own `[mcp_servers]` entry, servers two plugins declare under one name, and servers with malformed or unsupported fields. Nothing loads while an organization policy manages Codex, or may and cannot be checked, when Codex cannot read its `[plugins]` settings, or when Scient Agent cannot tell its launch environment from `.env` files (from source without `--no-env-file` outside Linux, or with an explicit `--env-file`).

- `scient-agent mcp list` prints each MCP server a conversation loads with its status (connected with its tool count, needs sign-in, failed) and whether a browser sign-in serves it, and `scient-agent mcp login <name>` runs that sign-in and prints the page to open, for a host's own Sign in button (`--runtime-info` lists `mcp` in `hostCommands`). A conversation in RPC mode picks up a sign-in made elsewhere at its next prompt, without a restart.

<!-- scient(SA-CODEX-PLUGINS): end -->
## [19.0.1] - 2026-11-19

### Added
Expand Down
3 changes: 3 additions & 0 deletions packages/coding-agent/scripts/compile-binary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ export async function compileCodingAgent(options: CodingAgentCompileOptions): Pr
// scient(SA-EXPORT): begin - exports from a binary carry Scient's viewer.
"process.env.SCIENT_EXPORT_VIEWER": JSON.stringify(await exportViewerSource(options.repoRoot)),
// scient(SA-EXPORT): end
// scient(SA-CODEX-PLUGINS): begin - tells utils env.ts that Bun loaded no dotenv file (autoloadDotenv below).
__SCIENT_AGENT_NO_DOTENV__: "true",
// scient(SA-CODEX-PLUGINS): end
},
// Precompiled bytecode skips parsing the ~20 MB bundle at boot:
// `omp --version` 256 ms -> 30 ms on M4 Max (+52 MB binary).
Expand Down
3 changes: 3 additions & 0 deletions packages/coding-agent/src/capability/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ const FOREIGN_USER_PROVIDERS: Record<string, true> = {
codex: true,
claude: true,
"claude-plugins": true,
// scient(SA-CODEX-PLUGINS): begin - Installed Codex plugins are opt-in like Claude's.
"codex-plugins": true,
// scient(SA-CODEX-PLUGINS): end
gemini: true,
opencode: true,
windsurf: true,
Expand Down
11 changes: 11 additions & 0 deletions packages/coding-agent/src/capability/mcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export interface MCPServer {
enabled?: boolean;
/** Connection timeout in milliseconds */
timeout?: number;
// scient(SA-CODEX-PLUGINS): begin - a hard cap on tool calls.
/** Hard limit on a tool call in milliseconds, never extended by its arguments (Codex's `tool_timeout_sec`). */
toolTimeoutMs?: number;
// scient(SA-CODEX-PLUGINS): end
/** Encoding for outgoing JSON-RPC request ids (default: `"number"`) */
requestIdFormat?: MCPRequestIdFormat;
/** Include server-provided instructions in the system prompt (default: true) */
Expand All @@ -36,6 +40,10 @@ export interface MCPServer {
envPolicy?: "literal";
/** Env keys whose values are final package data (expanded by the provider). */
envLiteralKeys?: string[];
// scient(SA-CODEX-PLUGINS): begin - A Codex plugin's server inherits only what Codex passes it.
/** When set, the stdio server inherits only these variables from the agent's environment, plus its own `env`. */
envInherit?: string[];
// scient(SA-CODEX-PLUGINS): end
/** Working directory for stdio transport */
cwd?: string;
/** URL (for HTTP/SSE transport) */
Expand Down Expand Up @@ -98,6 +106,9 @@ export function isSameMCPConnection(left: MCPServer, right: MCPServer): boolean
Bun.deepEquals(left.args, right.args) &&
Bun.deepEquals(left.env, right.env) &&
Bun.deepEquals(literalKeysOf(left), literalKeysOf(right)) &&
// scient(SA-CODEX-PLUGINS): begin - Inheritance decides what the process sees.
Bun.deepEquals(left.envInherit, right.envInherit) &&
// scient(SA-CODEX-PLUGINS): end
left.cwd === right.cwd
);
}
Expand Down
10 changes: 10 additions & 0 deletions packages/coding-agent/src/cli-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ import { dictateHelp } from "./scient/command-help";
// scient(SA-CHATGPT-APPS): begin - Scient's ChatGPT apps command.
import { appsHelp } from "./scient/command-help";
// scient(SA-CHATGPT-APPS): end
// scient(SA-CODEX-PLUGINS): begin - the host's MCP status and sign-in command.
import { mcpHelp } from "./scient/command-help";
// scient(SA-CODEX-PLUGINS): end

function loadLaunchHelp(): typeof LaunchHelp.launchHelp {
const module: typeof LaunchHelp = require("./commands/launch-help");
Expand Down Expand Up @@ -299,6 +302,13 @@ export const commands: CommandEntry[] = [
help: appsHelp,
},
// scient(SA-CHATGPT-APPS): end
// scient(SA-CODEX-PLUGINS): begin - the host's MCP status and sign-in command.
{
name: "mcp",
load: () => import("./scient/mcp-command").then(m => m.default),
help: mcpHelp,
},
// scient(SA-CODEX-PLUGINS): end
{
name: "usage",
load: () => import("./commands/usage").then(m => m.default),
Expand Down
3 changes: 3 additions & 0 deletions packages/coding-agent/src/cli/auth-broker-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ export function refreshBrokerOAuthCredential(
return refreshManagedMcpOAuthCredential(credential, {
serverUrl: mcpOAuthServerUrlFromCredentialId(provider),
signal,
// scient(SA-CODEX-PLUGINS): begin - a server-bound row refreshes without a stored secret or redirects.
credentialId: provider,
// scient(SA-CODEX-PLUGINS): end
});
}
// Non-MCP rows: same per-provider path AuthStorage would take by default
Expand Down
3 changes: 3 additions & 0 deletions packages/coding-agent/src/discovery/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ import "./ssh";
import "./ssh-config";
import "./vscode";
import "./windsurf";
// scient(SA-CODEX-PLUGINS): begin - Installed, enabled Codex plugins.
import "../scient/codex-plugins";
// scient(SA-CODEX-PLUGINS): end

// Re-export the main API from capability registry
export {
Expand Down
12 changes: 11 additions & 1 deletion packages/coding-agent/src/mcp/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import { loadCapability } from "../discovery";
import { readMCPConfigFile } from "./config-writer";
import { builtinDropFor, type MCPDroppedServer, type MCPTransformContext } from "./transforms";
import type { MCPConfigFile, MCPServerConfig } from "./types";
// scient(SA-CODEX-PLUGINS): begin - server-bound sign-ins.
import { trustedMcpAuth } from "./oauth-flow";
// scient(SA-CODEX-PLUGINS): end

/** Options for loading MCP configs */
export interface LoadMCPConfigsOptions {
Expand Down Expand Up @@ -53,7 +56,11 @@ function convertToLegacyConfig(server: MCPServer): MCPServerConfig {
timeout: server.timeout,
requestIdFormat: server.requestIdFormat,
instructions: server.instructions,
auth: server.auth,
// scient(SA-CODEX-PLUGINS): begin - only the codex-plugins source binds a server to its own sign-in,
// and only under the id its name and URL give: any other definition naming one is not bound to it.
auth: trustedMcpAuth(server.name, server.auth, server.url, server._source.provider),
toolTimeoutMs: server.toolTimeoutMs,
// scient(SA-CODEX-PLUGINS): end
oauth: server.oauth,
};

Expand All @@ -67,6 +74,9 @@ function convertToLegacyConfig(server: MCPServer): MCPServerConfig {
if (server.env) config.env = server.env;
if (server.envPolicy) config.envPolicy = server.envPolicy;
if (server.envLiteralKeys) config.envLiteralKeys = server.envLiteralKeys;
// scient(SA-CODEX-PLUGINS): begin - A Codex plugin's server inherits only what Codex passes it.
if (server.envInherit) config.envInherit = server.envInherit;
// scient(SA-CODEX-PLUGINS): end
if (server.cwd) config.cwd = server.cwd;
return config;
}
Expand Down
Loading