codemode-gateway
Skill10 starsChanged todayMITView on GitHub
Code Mode sandbox execution and RPC dispatch in AutoHarness gateway
In this repository44 other files it gives its agents.
- llms-full.txtllms.txt
- llms.txtllms.txt
- ai-prompt-engineering-safety-reviewSkill
- ast-codemapSkill
- ast-grepSkill
- autoharnessSkill
- autonomous-backlog-driverSkill
- claude-kimi-mcp-normalizationSkill
- cli-self-updaterSkill
- code-frugalitySkill
- codemode-typesSkill
- consequence-simulationSkill
- context-pruningSkill
- github-update-checkerSkill
- google-agents-cli-evalSkill
- google-agents-cli-scaffoldSkill
- history-searchSkill
- hook-gatingSkill
- hybrid-semantic-searchSkill
- kimi-code-agent-integrationSkill
- kimi-mcp-configurationSkill
- leann-vectorSkill
- log-summarizerSkill
- markdown-vagueSkill
- memory-reconciliationSkill
- mode-classificationSkill
- multiagent-orchestrationSkill
- output-compressionSkill
- prompt-injectionSkill
- python-anti-patternsSkill
- regression-sentinelSkill
- restart-trackingSkill
- rollback-guardSkill
- rust-call-graphSkill
- secrets-managementSkill
- security-best-practicesSkill
- session-compactorSkill
- sqlite-memorySkill
- swarm-barrierSkill
- swarm-dagSkill
- autoharnessSkill
- code-reliability-checksSkill
- skill-threat-rulesSkill
- autoharnessSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 9
Use when implementing or debugging Code Mode execution in AutoHarness Gateway:
- Very specific: line 24
When generating TypeScript definitions, server names with hyphens or dots are converted to valid TS identifiers (e.g., git-hub -> git_hub).
- Very specific: line 27
Run the sandbox subprocess with child_env({}) (restricted to safe system vars like PATH, SystemRoot) to prevent secret exfiltration from …
- Very specific: line 33
Test standalone execution without tool calls: return 1 + 1 yields 2.
- Very specific: line 34
Test async MCP dispatch: call a mock tool through mcp.mock_server.test_tool({ count: 5 }) and verify correct RPC dispatch and argument …
- Distinctive: line 35
Test hanging async promise: verify that an unresolved Promise times out cleanly without blocking the gateway.
- Very specific: line 36
Test hyphenated server name resolution: verify that server git-hub is callable via mcp.git_hub.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
codemode-gateway
When to use
Use when implementing or debugging Code Mode execution in AutoHarness Gateway:
- Connecting isolated script execution environments (Node.js/QuickJS subprocesses) with Gateway's internal MCP tool registry.
- Proxying tool calls from sandbox scripts to MCP client instances (
client.call_tool) without leaking host environment secrets or filesystem access. - Batching multi-step tool calls, loops, and data transformations into a single model round-trip.
Steps
- Define the RPC protocol over stdio:
- Establish a line-delimited JSON-RPC channel on stdio between the Gateway host and the sandbox runner.
- Deliver initial script payload via the first line of stdin rather than argv to avoid OS command-line length limits (Windows 32KB limit).
- Reference: Node.js stdio stream handling (https://nodejs.org/api/process.html#processstdout).
- Robust async timeout and cancellation:
node:vmtimeout only interrupts synchronous execution loops; async promises require an explicit JS-sidesetTimeoutwatchdog timer.- The host Python process must implement an independent watchdog timer (
threading.Timer) to forcefully terminateproc.kill()if stdio reads block on hanging async promises. - Reference: Node.js VM context isolation (https://nodejs.org/api/vm.html).
- Sanitized identifier mapping:
- When generating TypeScript definitions, server names with hyphens or dots are converted to valid TS identifiers (e.g.,
git-hub->git_hub). - The Gateway dispatch layer must maintain a reverse resolution map (
_resolve_server) somcp.git_hub.call()resolves back to target servergit-hub.
- When generating TypeScript definitions, server names with hyphens or dots are converted to valid TS identifiers (e.g.,
- Environment isolation:
- Run the sandbox subprocess with
child_env({})(restricted to safe system vars like PATH, SystemRoot) to prevent secret exfiltration from host environment variables. - Reference: AutoHarness child process isolation (https://github.com/D-Shey/autoharness).
- Run the sandbox subprocess with
- Resource cleanup:
- In Python
finallyblocks, ensureproc.stdin.close(),proc.stdout.close(),proc.stderr.close()andproc.wait()are executed on all exit paths.
- In Python
How to verify
- Test standalone execution without tool calls:
return 1 + 1yields2. - Test async MCP dispatch: call a mock tool through
mcp.mock_server.test_tool({ count: 5 })and verify correct RPC dispatch and argument forwarding. - Test hanging async promise: verify that an unresolved Promise times out cleanly without blocking the gateway.
- Test hyphenated server name resolution: verify that server
git-hubis callable viamcp.git_hub.
Facts found here
- Standard MCP gateway metadata tools in AutoHarness are defined in
src/autoharness/gateway.py. - MCP clients implement
call_tool(tool_name, arguments)returning standard MCP tool call results.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

