agent-runtime
Skill0 starsChanged 25 days agoMITView on GitHub
Build the Energy agent runtime adapter wrapping Claude Agent SDK. This is the core of Phase 1. The adapter has TWO processes: Runs on the server. Routes messages, manages sessions, spawns sandboxes. Runs inside E2B sandbox. Calls Claude Agent SDK, executes tools.
9 other projects use a version of this.
Adopted by
Most recently taken up by
- naman10parikh/pennyword for word, first seen Nov 8, 2026
- naman10parikh/wikimemword for word, first seen Nov 8, 2026
- naman10parikh/turboword for word, first seen Oct 25, 2026
- naman10parikh/agentgridword for word, first seen Oct 20, 2026
- oocx/tfplan2mdtheir own version, first seen Oct 8, 2026
- Zack-Grogan/agentos-foundationtheir own version, first seen Sep 8, 2026
Other versions9 projects use a version of this.
Word for word · 4
- naman10parikh/agentgrid★ 9100% same
- naman10parikh/wikimem★ 8100% same
- naman10parikh/penny★ 0100% same
- naman10parikh/turbo★ 0100% same
Edited · 0
None found.
Wrote their own version · 5
- oocx/tfplan2md★ 174same name
- sublimotion/agent-aiops-on-aws★ 4same name
- DangoSys/skills★ 1same name
- xin-yi33/coding-agent-crew★ 1same name
- Zack-Grogan/agentos-foundation★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository59 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- frontend-designSkill
- architectSkill
- deep-thinkSkill
- design-systemsSkill
- ecosystem-referenceSkill
- fractal-delegationSkill
- harness-reviewSkill
- heartbeatSkill
- integrate-resourcesSkill
- llm-council-critiqueSkill
- loop-createSkill
- mcp-setupSkill
- memory-compressionSkill
- memorySkill
- model-routingSkill
- oss-project-scaffoldSkill
- playwright-cliSkill
- repo-scoutSkill
- self-improveSkill
- skill-creatorSkill
- skill-routingSkill
- sprintSkill
- test-visualSkill
- troubleshootSkill
- ux-auditSkill
- Accessibility AuditorSkill
- artifacts-builderSkill
- brand-guidelinesSkill
- canvas-designSkill
- frontend-patternsSkill
- design-mirrorSkill
- design-system-starterSkill
- design-to-codeSkill
- feature-design-assistantSkill
- figma-implement-designSkill
- frontend-designSkill
- frontend-dev-guidelinesSkill
- mobile-designSkill
- motion-canvasSkill
- pixel-agent-uiSkill
- pixel-animateSkill
- pixel-anti-slopSkill
- pixel-brain-pageSkill
- pixel-migrate-next16Skill
- pixel-rsc-boundarySkill
- pixel-ship-gateSkill
- premium-web-designSkill
- senior-frontendSkill
- shadcnSkill
- tailwind-design-systemSkill
- tailwind-patternsSkill
- theme-factorySkill
- ui-design-systemSkill
- ui-ux-pro-maxSkill
- ux-researcher-designerSkill
- web-design-guidelinesSkill
The file
Files
Skill: Agent Runtime Adapter (~1,000 Lines)
Build the Energy agent runtime adapter wrapping Claude Agent SDK. This is the core of Phase 1.
Architecture (From NanoClaw Study)
The adapter has TWO processes:
1. Host Process (~500 lines) — Orchestration
Runs on the server. Routes messages, manages sessions, spawns sandboxes.
src/runtime/
├── gateway.ts # HTTP + WebSocket server, message routing
├── session-manager.ts # Per-user session isolation, SQLite state
├── sandbox-runner.ts # E2B sandbox spawning, volume mounts, streaming
├── ipc.ts # File-based IPC (host ↔ sandbox), atomic writes
├── channel-router.ts # Channel abstraction (web, WhatsApp, API)
├── task-scheduler.ts # Cron/interval scheduled tasks (HEARTBEAT.md)
├── concurrency.ts # Max concurrent sandboxes, per-user queuing
└── types.ts # Shared type definitions2. Sandbox Process (~500 lines) — Agent Intelligence
Runs inside E2B sandbox. Calls Claude Agent SDK, executes tools.
src/sandbox/
├── agent-loop.ts # Claude SDK query(), MessageStream for multi-turn
├── tool-registry.ts # Custom tools via createSdkMcpServer()
├── memory-loader.ts # Bootstrap: SOUL.md + MEMORY.md + skills/ → context
├── ipc-server.ts # MCP server exposing send_message, schedule_task
└── hooks.ts # PreCompact flush, PreToolUse sanitizerKey Patterns (Extracted from NanoClaw Source)
The Message Flow
Channel → SQLite → Polling Loop (2s) → Spawn Sandbox → Claude SDK query() → ResponseContainer Isolation (Security Boundary = OS)
- Each user gets their own E2B sandbox (Firecracker microVM)
- Agent files mounted read-only, user memory writable
- Secrets passed via stdin JSON, never written to disk
- Bash hook strips API keys from subprocess env
The Agent Loop (Inside Sandbox)
import { query, createSdkMcpServer } from "@anthropic-ai/claude-agent-sdk";
for await (const message of query({
prompt: messageStream, // AsyncIterable for multi-turn
options: {
cwd: "/workspace/user",
allowedTools: [
"Read",
"Write",
"Edit",
"Bash",
"Grep",
"Glob",
"WebSearch",
"WebFetch",
"mcp__energy__*",
],
permissionMode: "bypassPermissions",
mcpServers: {
energy: energyMcpServer, // send_message, schedule_task, etc.
},
hooks: {
PreCompact: [{ hooks: [preCompactFlush] }],
PreToolUse: [{ hooks: [sanitizeBash] }],
},
},
})) {
if (message.type === "result") writeOutput(message);
}MessageStream (Keep Session Alive for Multi-Turn)
class MessageStream {
private queue: SDKUserMessage[] = [];
private waiting: (() => void) | null = null;
private done = false;
push(text: string): void {
this.queue.push({ type: "user", message: { role: "user", content: text } });
this.waiting?.();
}
end(): void {
this.done = true;
this.waiting?.();
}
async *[Symbol.asyncIterator](): AsyncGenerator<SDKUserMessage> {
while (true) {
while (this.queue.length > 0) yield this.queue.shift()!;
if (this.done) return;
await new Promise<void>((r) => {
this.waiting = r;
});
}
}
}File-Based IPC (Host ↔ Sandbox)
// Atomic write: temp file → rename (prevents partial reads)
function writeIpc(dir: string, data: object): void {
const tmp = path.join(dir, `${Date.now()}-${random}.tmp`);
const final = tmp.replace(".tmp", ".json");
fs.writeFileSync(tmp, JSON.stringify(data));
fs.renameSync(tmp, final);
}Tool Registration
import { tool, createSdkMcpServer } from "@anthropic-ai/claude-agent-sdk";
import { z } from "zod";
const sendMessageTool = tool(
"send_message",
"Send a message to a channel",
{ chatId: z.string(), text: z.string() },
async (args) => {
writeIpc(MESSAGES_DIR, { type: "message", ...args });
return { content: [{ type: "text", text: "Message sent" }] };
},
);
const scheduleTaskTool = tool(
"schedule_task",
"Schedule a recurring task",
{
prompt: z.string(),
schedule_type: z.enum(["cron", "interval", "once"]),
schedule_value: z.string(),
},
async (args) => {
writeIpc(TASKS_DIR, { type: "schedule_task", ...args });
return {
content: [{ type: "text", text: `Scheduled: ${args.schedule_type}` }],
};
},
);
const energyMcpServer = createSdkMcpServer({
name: "energy",
version: "1.0.0",
tools: [sendMessageTool, scheduleTaskTool],
});Dependencies
{
"@anthropic-ai/claude-agent-sdk": "^0.2.63",
"@anthropic-ai/sdk": "latest",
"@modelcontextprotocol/sdk": "latest",
"zod": "^4.3.6",
"better-sqlite3": "^11.8.1",
"cron-parser": "^5.5.0",
"pino": "^9.6.0"
}Build Order
types.ts— shared interfacestool-registry.ts— custom tools via MCPmemory-loader.ts— reads SOUL.md, skills/, MEMORY.md into contextagent-loop.ts— wraps Claude SDK query() with our tools + hookssandbox-runner.ts— E2B sandbox lifecyclesession-manager.ts— per-user isolation in SQLitegateway.ts— HTTP + WebSocket serveripc.ts— file-based communication- Integration tests
- End-to-end: create agent → deploy → chat → verify memory compounds
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.

