Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion SCIENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ 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`), one transport per server with only that transport's fields, package files and launch paths inside the package, a stdio server inheriting only the variables Codex passes (`HOME`, `PATH` and the like, plus its `env_vars`), and plugin values taken literally. `CODEX_HOME` and header credentials come from the launch environment, never a project's `.env`. A server whose tools Codex narrows (`enabled_tools`, or a non-empty `disabled_tools`) is skipped with a warning, because Scient Agent cannot enforce the filter; so is a server with malformed or unsupported fields, while its siblings load. Nothing loads while an organization policy manages Codex. 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. |
| 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
6 changes: 6 additions & 0 deletions packages/coding-agent/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## [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`), under Codex's own rules: only the plugins Codex would run (`[plugins._default]` and its manifest formats included), servers that inherit only the variables Codex would pass them, plugin values taken literally, and package paths kept inside the package. 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`) and servers with malformed or unsupported fields. Nothing loads while an organization policy manages Codex.

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

### Added
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
7 changes: 7 additions & 0 deletions packages/coding-agent/src/capability/mcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,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 +102,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
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
3 changes: 3 additions & 0 deletions packages/coding-agent/src/mcp/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,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
7 changes: 6 additions & 1 deletion packages/coding-agent/src/mcp/transports/stdio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -592,10 +592,15 @@ export class StdioTransport implements MCPTransport {
signal?.throwIfAborted();
if (this.#connected) return;

// scient(SA-CODEX-PLUGINS): begin - A Codex plugin's server inherits only what Codex passes it.
const inherited: Record<string, string | undefined> = this.config.envInherit
? Object.fromEntries(this.config.envInherit.map(name => [name, Bun.env[name]]).filter(([, value]) => value))
: Bun.env;
const env = {
...Bun.env,
...inherited,
...this.config.env,
};
// scient(SA-CODEX-PLUGINS): end
const cwd = this.config.cwd ?? getProjectDir();
const spawnCommand = await resolveStdioSpawnCommand(this.config, {
cwd,
Expand Down
4 changes: 4 additions & 0 deletions packages/coding-agent/src/mcp/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ export interface MCPStdioServerConfig extends MCPServerConfigBase {
envPolicy?: "literal";
/** Env keys whose values are final package data; auth resolution keeps them verbatim. */
envLiteralKeys?: string[];
// scient(SA-CODEX-PLUGINS): begin - A Codex plugin's server inherits only what Codex passes it.
/** When set, only these variables are inherited from the agent's environment; `env` still applies on top. */
envInherit?: string[];
// scient(SA-CODEX-PLUGINS): end
cwd?: string;
}

Expand Down
Loading
Loading