Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
6f74d54
Refuse cmd.exe metacharacters in arguments routed through .cmd launchers
greenpolo Oct 1, 2026
58f2055
Gracefully stop Windows trees, skip post-close kills, bound lines not…
greenpolo Oct 1, 2026
ff114fc
Run managed-policy probes from system paths with a timeout
greenpolo Oct 1, 2026
3c91cdf
fsync atomic writes before rename and the directory after
greenpolo Oct 1, 2026
d3514b5
Make stale state-lock takeover hostname-tolerant and race-verified
greenpolo Oct 1, 2026
086c567
Count actions past the tracking cap and prune reply archives
greenpolo Oct 1, 2026
9d837c3
Preserve unsupported-version native session records aside
greenpolo Oct 1, 2026
9e7055e
Hold policy replies, evict idle mod sessions, and scope display tools…
greenpolo Oct 1, 2026
d9e40e2
Make Antigravity permissions an allowlist and protect its hook files
greenpolo Oct 1, 2026
a88694e
Keep Antigravity interruption state, evict idle records, remove hook …
greenpolo Oct 1, 2026
6ec3148
Fail closed on Grok toolsets and non-end_turn stops, evict idle records
greenpolo Oct 1, 2026
6c625a6
Forward recordedResponse through Cursor workspaces
greenpolo Oct 1, 2026
e52f9f2
Emit sequential Zen Chat blocks and bill OpenAI stop-sequence replies
greenpolo Oct 1, 2026
df09942
Merge provider plugin review fixes
greenpolo Oct 1, 2026
4837d1d
Add shared harness failure classifier; keep reply archives past excha…
greenpolo Oct 1, 2026
3133429
Merge platform and harness infrastructure review fixes
greenpolo Oct 1, 2026
d835c7e
Route unsafe prompts off cmd argv and unify harness failure status
greenpolo Oct 1, 2026
dfc5cef
Merge shared harness helper adoption
greenpolo Oct 1, 2026
49f0a81
Rework the Mod hooks around $state, $clock and one gateway client
greenpolo Oct 1, 2026
c0715d6
Scope compaction to one loop, evict idle permission contexts, drop de…
greenpolo Oct 1, 2026
432c6f8
Keep the session gateway out of nested Claude runs and harden the lau…
greenpolo Oct 1, 2026
e13a224
Make the gateway transparent to native Claude requests
greenpolo Oct 1, 2026
8ed849a
Merge native-behavior and gateway path review fixes
greenpolo Oct 1, 2026
25521f9
Untrack the node_modules symlink and ignore symlinked installs
greenpolo Oct 1, 2026
9751569
Document the Mods hooks as generally available
greenpolo Oct 1, 2026
aa853cf
Pass the codex credential store value without cmd.exe-unsafe quotes
greenpolo Oct 1, 2026
55a9332
Merge Mods hook layer review fixes
greenpolo Oct 1, 2026
664bc2f
Record the review fixes in the changelog
greenpolo Oct 1, 2026
bdd6408
Move Responses translation and SSE reader into multi-core
greenpolo Oct 1, 2026
02347df
Hold and echo the gateway's per-session mod key in the hooks client
greenpolo Oct 1, 2026
5063988
Share the CLI harness request flow between Antigravity and Grok
greenpolo Oct 1, 2026
9fa2a9f
Merge per-session mod key in the hooks
greenpolo Oct 1, 2026
6e415a0
Merge shared CLI harness base and core Responses translation
greenpolo Oct 1, 2026
f33ecaa
Move provider request construction out of the gateway and share routi…
greenpolo Oct 1, 2026
180e938
Merge branch 'fix/review-2026-10' into worktree-agent-a291b1419530c0633
greenpolo Oct 1, 2026
cd4f008
Route signature stripping through provider modules, drop the response…
greenpolo Oct 1, 2026
78aa9a6
Merge gateway server structure refactor
greenpolo Oct 1, 2026
79ffc5c
Consolidate isRecord and nativeSpelling into the core helpers
greenpolo Oct 1, 2026
7c0083d
Bring AGENTS.md, ARCHITECTURE.md and docs in line with the current mo…
greenpolo Oct 1, 2026
5661c46
Fix regression-review findings: Host check, review ownership, nested …
greenpolo Oct 1, 2026
7f41ec0
Wait for a concurrent launch's Antigravity hook lock instead of failing
greenpolo Oct 4, 2026
861b975
Deliver harness worker reports through SubagentHandback
greenpolo Oct 4, 2026
72f191c
Leave the handback report to auto mode's own review
greenpolo Oct 4, 2026
5f6081c
Merge harness worker handback delivery
greenpolo Oct 4, 2026
fdc8bd2
Fix CI regressions and run GPT-6.1 Sol on OpenAI
greenpolo Oct 5, 2026
6ee7ba3
Run npm shims for native binaries directly on Windows
greenpolo Oct 5, 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
3 changes: 2 additions & 1 deletion .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"name": "multi-core",
"description": "Shared Multi gateway, setup, status and reversible Claude startup integration.",
"skills": "./plugins/multi-core/skills",
"hooks": "./plugins/multi-core/hooks/hooks.json"
"hooks": "./plugins/multi-core/hooks/hooks.json",
"types": "./plugins/multi-core/types/multi-core.d.ts"
}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tmp_rp.txt
/docs/ACP_TRANSPORT_BLUEPRINT.md

# --- Tooling ---
node_modules/
node_modules

# Agent scratch area: plans, specs, reverse-engineering notes. Local-only.
/.agent/
Expand Down
20 changes: 11 additions & 9 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,19 @@ Claude Code function-hook UI and extensibility rules live in
| --- | --- |
| `plugins/multi-core/src/launcher.ts` | Launches the gateway and registers models and workers. |
| `plugins/multi-core/src/gateway/server.ts` | Routes requests and manages sessions. |
| `plugins/multi-core/src/gateway/messages.ts`, `fetch.ts`, `tools.ts` | Shared protocol, outbound fetch, and tool aliases. |
| `plugins/multi-core/src/gateway/messages.ts`, `fetch.ts`, `tools.ts`, `responses.ts`, `bounded.ts`, `record.ts` | Shared protocol, outbound fetch, tool aliases, Responses translation and SSE reader, bounded maps, and the `isRecord` guard. |
| `plugins/multi-core/src/gateway/provider.ts`, `provider-request.ts` | Model-prefix provider table, `nativeSpelling`, and the contract through which OpenAI and Zen modules build their own requests. |
| `plugins/multi-core/src/gateway/executable.ts`, `process-tree.ts` | Resolves executables and manages child processes. |
| `plugins/multi-core/src/gateway/atomic-write.ts`, `state-lock.ts` | Protects files and serializes native state. |
| `plugins/multi-core/src/gateway/cursor-settings.ts`, `mode-hook.ts`, `agent-definitions.ts`, `worker-catalog.ts` | Admits settings, maps prompt and worker permissions, and resolves the Agent tool's `model` against each provider's worker catalog. |
| `plugins/multi-core/src/gateway/harness-settings.ts`, `mode-hook.ts`, `agent-definitions.ts`, `worker-catalog.ts` | Admits harness settings (`checkHarnessSettings`, `mergePermissions`), maps prompt and worker permissions, and resolves the Agent tool's `model` against each provider's worker catalog. |
| `plugins/multi-core/src/gateway/approval.ts`, `permission-hook.ts` | Approval protocol and capability checks. |
| `plugins/multi-core/src/gateway/mod-*.ts`, `display-rows.ts`, `tool-observer.ts` | Claude Mods control-plane routes, compaction, policy, native action display rows, and tool observation. |
| `plugins/multi-core/src/gateway/harness-*.ts` | Session store, exchange registry, response builder, completion, and notices shared by Cursor, Antigravity, and Grok; CLI process runner and text prompt preparation shared by Antigravity and Grok. |
| `plugins/multi-core/src/gateway/mod-*.ts`, `display-rows.ts`, `tool-observer.ts`, `nested-env.ts` | Claude Mods control-plane routes, per-session mod key (`mod-keys.ts`), compaction, policy, native action display rows, tool observation, and the nested-`claude` environment restore. |
| `plugins/multi-core/hooks/` | Claude Mods function hooks; `gateway.ts` is the single gateway client, state lives in `$.state`, timing in `$.clock`. |
| `plugins/multi-core/src/gateway/harness-*.ts` | Session store, exchange registry, response builder, completion, notices, and failure classifier (`harness-failure.ts`) shared by Cursor, Antigravity, and Grok; the CLI harness base (`harness-cli.ts`), process runner, and text prompt preparation shared by Antigravity and Grok. |
| `plugins/multi-core/src/account.ts`, `setup.ts`, `install/` | Accounts, bootstrap, plugin discovery, and installation. |
| `plugins/multi-openai/src/` | Codex authentication, models, Responses translation, instructions, and reviewer. |
| `plugins/multi-openai/src/` | Codex authentication, models, request construction (`gateway-request.ts`), instructions, and reviewer. |
| `plugins/multi-cursor/src/` | Cursor SDK harness, permissions, progress, requests, models, and workspaces. |
| `plugins/multi-zen/src/` | Zen API-key authentication, catalogs, requests, and translations. |
| `plugins/multi-zen/src/` | Zen API-key authentication, catalogs, request construction (`gateway-request.ts`), and translations. |
| `plugins/multi-antigravity/src/` | `agy` CLI harness, models, hooks, requests, and permissions. |
| `plugins/multi-grok/src/` | Grok Build CLI harness, models, requests, permissions, and login state. |
| `test/unit/` | Offline unit tests for gateway and provider behavior. |
Expand Down Expand Up @@ -71,9 +73,9 @@ type checking, and offline tests. `npm test` runs `tsc --noEmit` and the unit
test suite. Use Node 24.12 or newer and avoid `DEP0190` warnings.

For Claude Mods hook or surface changes, also run `npm run test:mod`. It type-checks
the hooks against `.claude/types` (write them with `/plugin-types` first; they are
gitignored) and runs `claude plugin test` with the installed Claude executable,
without provider inference. It is separate from `npm run check` and the current CI matrix.
the hooks against `.claude-plugin/types/` (Claude Code writes them when it loads the
plugin; they are gitignored) and runs `claude plugin test` with the installed Claude
executable and the Mods rollout flag forced on, without provider inference. It is separate from `npm run check` and the current CI matrix.

| Command | Check | Login needed |
| --- | --- | --- |
Expand Down
52 changes: 41 additions & 11 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ session. The launcher registers provider models and one Agent-tool worker type
per provider. The Node gateway routes requests, preserves Claude passthrough,
and coordinates sessions.
Claude Mods provide the in-engine control plane for model rows, worker rows,
permission state, progress, and compaction. [The local Mods reference](docs/claude-mods.md)
permission state, progress, and compaction. The hooks (`plugins/multi-core/hooks/`)
reach the gateway through one client (`hooks/gateway.ts`) and keep state in
`$.state` so it survives a hot reload. The gateway mints a per-session mod key
(`mod-keys.ts`) on the mod's first request and, once the mod echoes it, refuses
`/multi/mod/*` requests carrying only the environment token, so a shell command
cannot loosen a session's permissions. Session state is dropped on `session.end`,
not when a client detaches. [The local Mods reference](docs/claude-mods.md)
is required reading for changes to Claude Code UI or extensibility. Provider adapters own their model
catalogs, authentication, execution, and review boundaries.

Expand All @@ -32,8 +38,19 @@ Claude Code session (/model, workers, prompts)
## Request flow

Claude Code sends Anthropic Messages traffic and provider requests to the gateway.
The gateway passes Anthropic traffic through and translates direct-provider
requests. `/model` exposes provider model and effort rows. Each connected
The gateway passes Anthropic traffic through untouched (every path other than
Messages and `/multi/*` is forwarded as raw bytes, and a failed upstream
connection is dropped so Claude Code's own retry runs) and translates
direct-provider requests. It honors `HTTPS_PROXY` and forwards to a caller-set
`ANTHROPIC_BASE_URL`. A `claude` started by a command inside the session gets
the session-start environment back (`nested-env.ts`, a PATH shim and the
bootstrap), so it never routes through the session gateway. Hosted-API
providers build their own requests: `gateway/provider-request.ts` defines the
contract, `multi-openai/src/gateway-request.ts` and
`multi-zen/src/gateway-request.ts` implement it, and the gateway owns keepalive,
events, and failure mapping. `gateway/provider.ts` is the one reader of a model
ID's provider prefix. The Responses translation and SSE reader live in
`gateway/responses.ts`. `/model` exposes provider model and effort rows. Each connected
provider's Agent-tool worker type runs that provider's picker rows; the Agent
tool's `model` parameter picks which. Each run reports a visible lifecycle: row,
elapsed time, streamed progress, completion, failure, and cancellation.
Expand Down Expand Up @@ -78,19 +95,26 @@ action becomes a display row in the harness's own reply: a tool_use block named
the native tool (`mcp__multi-core__run_command`) with the native parameters and a
gateway-issued token, answered by the Multi mod with the native output, so the row
sits in the transcript of the `/model` session or worker that ran it. Display tools
are never model tools: the gateway strips them from every provider's tools and
history, the mod defers them and refuses any call without an issued token, and the
are never model tools: they register in the engine lazily, only when a harness
prompt, worker, or step needs them, and the gateway strips them (and their
`tool_reference` blocks) from every provider's tools and history. The mod defers
them and refuses any call without an issued token, and the
gateway answers the engine's follow-up request with the reply's remaining text
without a native run. Nothing is replayed or re-executed. Cursor supports Auto, Plan, and Bypass. Antigravity uses its native CLI
with Claude policy enforcement at the prompt boundary. Grok carries the same
policy in its own run arguments, and each announced toolset is checked against
it because an unknown removal is accepted and ignored by that CLI.
it because an unknown removal is accepted and ignored by that CLI. Antigravity
runs an allowlist built from the Claude grant: unmapped tools are denied in
every mode, scheduling, messaging, task, and knowledge-deletion tools are always
denied, and write tools cannot touch agy's own hook or config files.

All three harnesses share their session store, in-flight exchange registry,
response builder, durable completion, notices, and the transcript action summary from
`plugins/multi-core/src/gateway/harness-*.ts`. Grok and Antigravity additionally
share native process execution, text prompt preparation, and the native action
tracker (Cursor uses it too) that turns native actions into display rows; Cursor retains its
response builder, durable completion, notices, failure classifier, and the
transcript action summary from `plugins/multi-core/src/gateway/harness-*.ts`.
Grok and Antigravity additionally share a CLI harness base (`harness-cli.ts`:
the request flow around one native run), native process execution, text prompt
preparation, and the native action tracker (Cursor uses it too) that turns
native actions into display rows; Cursor retains its
SDK and image-aware prompt format. Each provider still owns
its own event grammar, CLI argument construction, usage accounting, and (for
Cursor) SDK agent lifecycle. The shared layer owns turn leases, lock lifetime,
Expand All @@ -102,7 +126,9 @@ than queued against a native conversation that has moved on.
## Permissions

Claude's permission mode controls each provider at prompt boundaries through the
UserPromptSubmit and SubagentStart hooks. The gateway intersects worker rules,
UserPromptSubmit and SubagentStart hooks. Worker tool calls are attributed
through the Mods `tool.call` hook, with the session's permission mode.
Harness settings admission is `gateway/harness-settings.ts`. The gateway intersects worker rules,
provider capabilities, project settings, and platform policy. Unsupported modes,
unknown workers, untranslatable policies, and unavailable required reviewers fail
explicitly. Plan denies shell and edit capabilities. Bypass disables Cursor native
Expand All @@ -118,6 +144,10 @@ rule, and its announced toolset is verified because that CLI accepts an unknown
removal silently; its MCP tools stay visible to the model and are documented as
such. Explicit native workspace selection is required.

Auto-mode classifier requests for Claude's own actions go to Anthropic unless a
provider-owned pending action positively matches; only a request routed to
provider review keeps the session mismatch check.

Claude's launcher enables on-demand tool discovery for the local gateway. Direct
provider adapters omit deferred tool schemas until Claude discovers or uses
them; tool references and loaded declarations survive later turns and provider
Expand Down
Loading
Loading