Zero-dependency agent runner for jsclaw containers. Pure JavaScript ESM, no node_modules, talking to the Anthropic Messages API directly over fetch.
A drop-in replacement for jsclaw's default Claude Code runner: same stdin/stdout container contract, same identity files, same memory convention, same six IPC tools — in ~1,000 lines you can read in one sitting.
default runner (jsclaw-agent) |
jsclaw-agent-micro |
|
|---|---|---|
| Agent harness | Claude Code (proprietary, 238 MB) | this repo (AGPL, ~50 kB) |
| npm dependencies | claude-code, MCP SDK, cron-parser | none |
| Container image | ~1.5 GB (incl. chromium) | ~150 MB |
| Open source | partially | top to bottom |
Experimental scaffold. The loop, tools, sessions, and jsclaw IPC integration work and are tested; it has not yet been hardened against long real-world workloads.
# Build the container
docker build -t jsclaw-agent-micro:latest -f container/Dockerfile .
# Point jsclaw at it
npx jsclaw config set containerImage jsclaw-agent-micro:latestOr run it standalone, no container, for development:
export ANTHROPIC_API_KEY=sk-ant-...
export JSCLAW_WORKSPACE=$PWD
echo '{"prompt": "list the files here and summarize"}' | node runner.jsOutput arrives as sentinel-delimited JSON on stdout (jsclaw's ContainerOutput shape):
---JSCLAW_OUTPUT_START---
{"status":"success","result":"...","newSessionId":"..."}
---JSCLAW_OUTPUT_END---
runner.js— container entrypoint: ContainerInput on stdin, identity files (SOUL.md,IDENTITY.md,AGENTS.md,TOOLS.md,USER.md),memory/*.mdloading, IPC input polling, close sentinelsrc/api.js— Anthropic Messages API overfetch: retries with backoff, prompt caching viacache_controlsrc/loop.js— the agent loop: send, execute tool calls, append results, repeat; naive context trimmingsrc/tools.js—bash,read_file,write_file,edit_file,glob,grepsrc/jsclaw-tools.js— jsclaw's six IPC tools (send_message,schedule_task,list_tasks,pause_task,resume_task,cancel_task) in-process — no MCP transport neededsrc/session.js— sessions are the raw messages array as JSON under.jsclaw-micro/sessions/
| Variable | Default | Description |
|---|---|---|
ANTHROPIC_API_KEY |
— | Required (or ANTHROPIC_AUTH_TOKEN) |
ANTHROPIC_BASE_URL |
https://api.anthropic.com |
Alternate endpoint/proxy |
JSCLAW_MICRO_MODEL |
claude-sonnet-4-6 |
Default model (ContainerInput model wins) |
JSCLAW_WORKSPACE |
/workspace/agent |
Agent workspace dir |
JSCLAW_IPC_BASE |
/workspace/ipc |
IPC base dir |
JSCLAW_SYSTEM_PROMPT |
— | Extra system prompt |
JSCLAW_ALLOWED_TOOLS |
all | JSON array of allowed tool names |
JSCLAW_MEMORY_MAX_CHARS |
8000 |
Memory budget for the system prompt |
- External MCP servers (
ContainerInput.mcpServersis ignored with a stderr warning) - Web search / web fetch tools
- Sub-agents
- Streaming (responses arrive per-turn, which is fine for headless use)
- Claude subscription auth — bring an API key
npm test # node --test, no network needed
npm run lintAGPL-3.0-or-later. Copyright (c) 2026 Melvin Carvalho.