feat(experiments): add optional codemode MCP bridge and Codex trials

This commit is contained in:
N0zoM1z0
2026-10-11 16:20:16 +00:00
parent b5e4920823
commit e3d4ac12b3
5 changed files with 759 additions and 1 deletions
+52
View File
@@ -18,6 +18,39 @@ catalog to keep synchronized. A fresh QuickJS WASM context exposes only those
tool calls, JSON helpers and explicit output; it has no host filesystem, network,
process or module loader.
Start the bridge without changing an existing registration:
```bash
node bridge.mjs /absolute/path/to/node /absolute/path/to/rea/scripts/rea.mjs mcp
```
Register that command as a separate, temporary MCP server for a trial. Existing
REA registrations keep their original tools. `rea_search` accepts a query or exact
names; use `schemas: false` for the complete lightweight name/description list.
`rea_execute` accepts a JavaScript async function body. For example:
```js
const session = json(await tools.binary_session({})).result;
return { open: session.open, identity: session.server_identity };
```
The returned projection is not a new Evidence record. `calls` preserves operation,
argument/result digests, upstream errors and actual producer Evidence IDs when
provided. The upstream ledger retains complete original Evidence for later views
and exports. Non-Evidence session responses have no invented Evidence ID.
Calls and executions sharing one active target are serialized; `Promise.all`
currently provides composition rather than parallel provider execution.
`npm test` runs actual upstream and downstream stdio MCP against this checkout's
compiled runtime. The standalone experiment's nine tests cover discovery parity,
original results/errors, bulk promise settlement, host capability absence, CPU
deadline recovery, retained Evidence after an error, unresolved promises and the
two-tool downstream boundary. These tests do not establish real native/Android/
firmware provider behavior. A lifecycle regression revealed that the QuickJS job
pump can allocate an additional context: the execution scope now owns every
context at creation and releases them before the runtime. Increasing memory did
not fix that regression.
Install experimental dependencies separately with `npm ci` in this directory.
They do not change the production package or lockfile. Use the repository's pinned
Node and npm versions. No binary, provider database or raw third-party source is
@@ -32,6 +65,25 @@ Replay measurements establish mechanism costs, not model task accuracy or
inference latency. Real-agent trials must additionally verify supported facts,
source identity, omissions and preserved Evidence references.
`agent-trial.py` runs a real local Codex CLI with a disposable account/config and
one MCP registration. It copies authentication only, removes the profile on every
exit, and retains JSONL events, the answer and measured API usage outside the repo.
It defaults to `gpt-5.6-terra` with high reasoning, as requested. Run one task under
the resource wrapper:
```bash
python3 resource-run.py -- python3 agent-trial.py \
--mode direct --prompt /absolute/path/question.txt \
--output /absolute/path/new-trial-directory
```
Use `--mode bridge` for the experimental server; `--mode client-code` requests
Codex's own Code Mode. Optional `--providers` selects a JSON object of explicit
provider settings. No ambient environment snapshot is retained. A configured flag
or a model's `tool_mode` does not prove the model actually composed tools or
filtered an intermediate result. Inspect the transcript, and mark accuracy as
unassessed until the requested facts and source support have been reviewed.
The supplied feedback is a research lead. Its Ghidra timing claim also changed
auto-analysis options, so it does not isolate Code Mode's effect. Relevant primary
sources: [Cloudflare Code Mode](https://blog.cloudflare.com/code-mode/),