nanoclaw
CLAUDE.md31k starsChanged 56 days agoMITView on GitHub
If you are reading this because you just ran git pull, git merge, git fetch && git merge, or any equivalent to bring in upstream changes — and you see merge conflicts or a large diff involving this file — HALT IMMEDIATELY. This is NanoClaw v2, a ground-up rewrite with breaking changes throughout. It cannot be merged into an existing v1 install. Attempting to resolve the conflicts by hand, run builds, or "fix" anything will corrupt the user's install and…
- Reads credentials
- Deletes or force-pushes
- Installs packages
Adopted by
Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data
Who's talking about nanocoai/nanoclaw
- @github-trending-js.bsky.social“📦 nanocoai / nanoclaw ⭐ 29,631 (+44) 🗒 TypeScript A lightweight alternative to OpenClaw that runs in …”Bluesky · Jun 2, 2026 · 2 likes
- mnemon-dev/mnemon“guide.md and skill.md not written under MNEMON_DATA_DIR — lost on container restart”GitHub · May 29, 2026 · 2 reactions
- socfortress/CoPilot“copilot-talon-improv”GitHub · Sep 2, 2026 · 1 reactions
- @githubfeed.bsky.social“🚀 GitHub Intelligence Drop nanoclaw (TypeScript • 🟢) ⭐ 30.6K → https://github.com/nanocoai/nanoclaw …”Bluesky · Aug 30, 2026 · 1 likes
- @github-trending-js.bsky.social“📦 nanocoai / nanoclaw ⭐ 28,995 (+59) 🗒 TypeScript A lightweight alternative to OpenClaw that runs in …”Bluesky · May 20, 2026 · 1 likes
The biggest 5 of 54 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 54
Talked about on GitHub and Bluesky (54 times).
On GitHub · 50
- May 29, 2026guide.md and skill.md not written under MNEMON_DATA_DIR — lost on container restart — mnemon-dev/mnemon2 reactions · 1 comment
- Sep 2, 2026copilot-talon-improv — socfortress/CoPilot1 reaction · 5 comments
- Nov 20, 2026agent-skills.github.nanocoai.nanoclaw: 2026.10.0 → 2026.11.0 — sudosubin/agents.nix0 reactions
- Nov 18, 2026[review mirror] fix(agent-runner): drop queued turns the provider answered inside another turn — drsmk238/nanoclaw0 reactions · 21 comments
- Nov 16, 2026مرشحون جدد للدليل (2026-11-16) — mgrd281/Skill-0 reactions
45 more on GitHub
- Nov 13, 2026OO player rewrites batch 6: sim, hermes, nanoclaw, openclaw, squad, crewai, paperclip, agentrq, crewlet, openswarm — Agent-Analytics/awesome-multi-agent-orchestrators0 reactions · 1 comment
- Nov 1, 2026Script gate for scheduled agents: a cheap check decides whether to wake the brain — Icewater1337/fridolin0 reactions
- Oct 29, 2026fix(telegram): wrap actions with more than 8 buttons into rows of 8 — vercel/chat0 reactions · 1 comment
- Oct 29, 2026Telegram polling: idle getUpdates has no client-side deadline and hangs on a black-holed connection — vercel/chat0 reactions
- Oct 21, 2026docs(gchat): Workspace add-on and webhook verification keys (nanoclaw #4132, #4100) — glifocat/nanoclaw-docs0 reactions · 1 comment
- Oct 16, 2026docs: add NanoClaw to client showcase — agentskills/agentskills0 reactions
- Oct 14, 2026Reposition README: a personable assistant with real memory — bbinoy/ted-personal-assistant0 reactions
- Oct 14, 2026agent-skills.github.nanocoai.nanoclaw: 2.4.0 → 2026.10.0 — sudosubin/agents.nix0 reactions
- Oct 13, 2026M19 stage 4: control-plane simplification decisions (containerized supervisor, embedded store, Hermes pin) — letya999/hermes-hub0 reactions · 2 comments
- Oct 12, 2026Add NanoClaw harness detection — auron-labs/harness-detect0 reactions
- Oct 11, 2026[App Request] NanoClaw — getumbrel/umbrel-apps0 reactions
- Oct 11, 2026Refresh latest contributions and organize profile projects — ogarciarevett/ogarciarevett0 reactions
- Oct 11, 2026docs(promotion): Step 9 — move the pin from v2.4.0 to v2026.10.0 — prathish-ks/isthmus0 reactions
- Oct 10, 2026chore(updates): weekly scan 2026-W41 — tiberiuarva/enterpriseaitools0 reactions · 1 comment
- Oct 4, 2026docs(env): CLAUDE_CODE_AUTO_COMPACT_WINDOW can be set on the host after v2.4.0 — glifocat/nanoclaw-docs0 reactions · 1 comment
- Oct 4, 2026docs(upgrading): setup commits its own files; never stash installed skill files — glifocat/nanoclaw-docs0 reactions · 1 comment
- Oct 4, 2026docs(upgrading): validation refreshes the selected gateway on gateway-skill changes — glifocat/nanoclaw-docs0 reactions · 1 comment
- Oct 3, 2026agent-skills.github.nanocoai.nanoclaw: 2.3.0 → 2.4.0 — sudosubin/agents.nix0 reactions
- Oct 2, 2026fix(e2e): accept NanoClaw setup's own commits after the tested commit — nanocoai/nanoclaw-oss-dev-toolssays it tested it0 reactions
- Oct 1, 2026Dependency advisories still open on v0.52.0 (grpc, x/crypto, otel log, go-archive) — paradigmxyz/iron-proxy0 reactions
- Sep 30, 2026[Candidate] nanocoai/nanoclaw - large collection (63 SKILL.md files) — ProSkillsMD/proskills0 reactions · 1 comment
- Sep 30, 2026agent-skills.github.nanocoai.nanoclaw: init at 2.3.0 — sudosubin/agents.nix0 reactions
- Sep 27, 2026[Plugin]: NanoClaw — omacom/omarchy-plugin-marketplace0 reactions · 11 comments
- Sep 27, 2026docs(promotion): G4 — move the pin from v2.3.0 to v2.4.0 — prathish-ks/isthmus0 reactions
- Sep 13, 2026feat(e2e): supervise provider authentication in the public wizard — nanocoai/nanoclaw-oss-dev-tools0 reactions
- Sep 2, 2026Suggest: nanocoai/nanoclaw — haggaishachar/awesomemap0 reactions · 1 comment
- Aug 31, 2026candidate: add-wechat — BigPengSays/awesome-creator-skills0 reactions
- Aug 30, 2026candidate: add-wechat — BigPengSays/awesome-creator-skills0 reactions
- Aug 29, 2026candidate: add-wechat — BigPengSays/awesome-creator-skills0 reactions
- Aug 25, 2026harvest: world watch — SaneSanders/noemium0 reactions
- Aug 24, 2026Upstream update detected: plan a sandbox refresh (2026-08-24) — DawoudIO/nanoclaw-community-agents0 reactions
- Aug 23, 2026Upstream: chat SDK dependency bump 4.29.0 -> 4.38.1 — nanocoai/nanoclaw#3460 / #3461 — DawoudIO/nanoclaw-community-agents0 reactions
- Aug 23, 2026Upstream: send_message double-delivery with mid-turn message blocks — nanocoai/nanoclaw#3462 — DawoudIO/nanoclaw-community-agents0 reactions
- Aug 23, 2026Upstream: messages_in UNIQUE-constraint crash on retry — nanocoai/nanoclaw#3457 — DawoudIO/nanoclaw-community-agents0 reactions
- Aug 23, 2026Upstream: Discord approval button custom_id corruption — nanocoai/nanoclaw#3185 / #3458 — DawoudIO/nanoclaw-community-agents0 reactions
- Aug 23, 2026Upstream: claim-stuck watchdog kills busy (not stuck) turns — nanocoai/nanoclaw#3455 — DawoudIO/nanoclaw-community-agents0 reactions
- Aug 23, 2026Track: upstream nanoclaw fixes opened 2026-08-22/23 — DawoudIO/nanoclaw-community-agents0 reactions
- Aug 20, 2026AI Agent Ecosystem Daily 2026-08-21 — huang-yi-dae/agents-radar0 reactions
- Aug 19, 2026fix(pairing): accept spaced approval codes — NousResearch/hermes-agent0 reactions · 1 comment
- Aug 13, 2026Add NanoClaw to compatible clients — agentplugins/agent-plugins-site0 reactions · 2 comments
- Aug 2, 2026chore(sync): update upstream pins for nanoclaw-aio — JSONbored/nanoclaw-aio0 reactions · 1 comment
- Jul 24, 2026🦞 OpenClaw 生态日报 2026-07-24 — zx0828/big_model_radar0 reactions
- Jul 20, 2026🦞 OpenClaw 生态日报 2026-07-20 — 96loveslife/big_model_radar0 reactions
- Jul 19, 2026Add NanoClaw installation instructions to README — Kehillat-Eretz-Hemdah/keh-agent-plugins0 reactions
- Jul 17, 2026[Argus] CVE-2026-56402: NanoClaw 2.1.17 미만 버전 - 검증되지 않은 승인 응답 핸들러를 통한 권한 상승 — LEEKIYOON-SEC/Argus-DEV0 reactions
On Bluesky · 4
- Jun 2, 2026📦 nanocoai / nanoclaw ⭐ 29,631 (+44) 🗒 TypeScript A lightweight alternative to OpenClaw that runs in containers for security. Connects to… — @github-trending-js.bsky.social2 likes and reposts
- Aug 30, 2026🚀 GitHub Intelligence Drop nanoclaw (TypeScript • 🟢) ⭐ 30.6K → https://github.com/nanocoai/nanoclaw heroui (TypeScript • 🟢) ⭐ 30.5K →… — @githubfeed.bsky.social1 likes and repost
- May 20, 2026📦 nanocoai / nanoclaw ⭐ 28,995 (+59) 🗒 TypeScript A lightweight alternative to OpenClaw that runs in containers for security. Connects to… — @github-trending-js.bsky.social1 likes and repost
- Aug 11, 2026My big gripe with a lot of those agent apps is that they basically just promote “go ask AI to configure x”. Like, if NanoClaw install… — @soulfire.jarexibackblaze.org0 likes and reposts · 3 replies
In this repository55 other files it gives its agents.
- AGENTS.mdAGENTS.md
- container/CLAUDE.mdCLAUDE.md
- add-anydocSkill
- add-atomic-chat-toolSkill
- add-clidashSkill
- add-codexSkill
- add-dashboardSkill
- add-deltachatSkill
- add-dial-numberSkill
- add-dialSkill
- add-dial-toolSkill
- add-discordSkill
- add-emacsSkill
- add-gchatSkill
- add-githubSkill
- add-imessageSkill
- add-iron-proxySkill
- add-karpathy-llm-wikiSkill
- add-linearSkill
- add-macos-statusbarSkill
- add-matrixSkill
- add-mattermostSkill
- add-mnemonSkill
- add-ollama-providerSkill
- add-ollama-toolSkill
- add-onecliSkill
- add-opencodeSkill
- add-resendSkill
- add-rtkSkill
- add-signalSkill
- add-slackSkill
- add-tavily-toolSkill
- add-teamsSkill
- add-telegramSkill
- add-vercelSkill
- add-webexSkill
- add-wechatSkill
- add-whatsapp-cloudSkill
- add-whatsappSkill
- customizeSkill
- debugSkill
- init-first-agentSkill
- learnSkill
- manage-channelsSkill
- manage-mountsSkill
- migrate-from-openclawSkill
- migrate-from-v1Skill
- migrate-memorySkill
- migrate-nanoclawSkill
- migrate-slack-agentsSkill
- setupSkill
- slack-a2a-roomsSkill
- slack-agent-flowSkill
- update-nanoclawSkill
- update-skillsSkill
The file
We split this CLAUDE.md into the rules it gives an agent
9 rules. About 0 are common, 5 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Wait for the user to confirm before doing anything else.
- Distinctive: line 12
If you are a fresh install (you ran git clone, not git pull) and there are no conflicts, ignore this banner and continue below.
- Very specific: line 207
Before creating a PR, adding a skill, or preparing any contribution, you MUST read CONTRIBUTING.md.
- Distinctive: line 211
Before creating a PR, run these checks:
- Distinctive: line 222
Run commands directly — don't tell the user to run them.
- Distinctive: line 251
Check these first when something goes wrong:
- Very specific: line 275
minimumReleaseAgeExclude: Never add entries without human sign-off. - Very specific: line 276
onlyBuiltDependencies: Never add packages to this list without human approval — build scripts execute arbitrary code during install. - Very specific: line 277
pnpm install --frozen-lockfile: should be used in CI, automation, and container builds.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md 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
⚠️ STOP — READ THIS FIRST IF YOU ARE CLAUDE ⚠️
If you are reading this because you just ran git pull, git merge, git fetch && git merge, or any equivalent to bring in upstream changes — and you see merge conflicts or a large diff involving this file — HALT IMMEDIATELY.
This is NanoClaw v2, a ground-up rewrite with breaking changes throughout. It cannot be merged into an existing v1 install. Attempting to resolve the conflicts by hand, run builds, or "fix" anything will corrupt the user's install and burn tokens for no result.
Do this instead:
- Abort the merge:
git merge --abort(orgit reset --hard ORIG_HEADif the merge already completed). - Tell the user, verbatim: "This is the v2 rewrite — it can't be merged into your existing install. Exit Claude Code (or open a separate terminal) and run
bash migrate-v2.shfrom the shell." - Wait for the user to confirm before doing anything else. Do not run the migration script yourself — it requires an interactive terminal and cannot be run from within Claude Code.
If you are a fresh install (you ran git clone, not git pull) and there are no conflicts, ignore this banner and continue below.
NanoClaw
Personal AI assistant. See README.md for philosophy and setup. Architecture lives in docs/.
Quick Context
The host is a single Node process that orchestrates per-session agent containers. Platform messages land via channel adapters, route through an entity model (users → messaging groups → agent groups → sessions), get written into the session's inbound DB, and wake a container. The agent-runner inside the container polls the DB, calls the agent, and writes back to the outbound DB. The host polls the outbound DB and delivers through the same adapter.
Everything is a message. There is no IPC, no file watcher, no stdin piping between host and container. The two session DBs are the sole IO surface.
Entity Model
users (id "<channel>:<handle>", kind, display_name)
user_roles (user_id, role, agent_group_id) — owner | admin (global or scoped)
agent_group_members (user_id, agent_group_id) — unprivileged access gate
user_dms (user_id, channel_type, messaging_group_id) — cold-DM cache
agent_groups (workspace, memory, CLAUDE.md, personality, container config)
↕ many-to-many via messaging_group_agents (session_mode, engage_mode/engage_pattern, sender_scope, priority)
messaging_groups (one chat/channel on one platform; instance = adapter-instance name, defaults to channel_type; unknown_sender_policy)
sessions (agent_group_id + messaging_group_id + thread_id → per-session container)Privilege is user-level (owner/admin), not agent-group-level. See docs/isolation-model.md for the three isolation levels (agent-shared, shared, separate agents).
Two-DB Session Split
Each session has two SQLite files under data/v2-sessions/<session_id>/:
inbound.db— host writes, container reads.messages_in, delivered, destinations, session_routing.outbound.db— container writes, host reads.messages_out, processing_ack, session_state, container_state.
Exactly one writer per file — no cross-mount lock contention. Heartbeat is a file touch at /workspace/.heartbeat, not a DB update. Host uses even seq numbers, container uses odd.
Central DB
The central database holds everything that isn't per-session: users, user_roles, agent_groups, messaging_groups, wiring, pending_approvals, user_dms, chat_sdk_* (for the Chat SDK bridge), schema_version. SQLite at data/v2.db is the default; host code uses the async DbDriver boundary. Migrations live at src/db/migrations/.
For ad-hoc central queries from skills or scripts, use the in-tree wrapper rather than the sqlite3 CLI: pnpm exec tsx scripts/q.ts data/v2.db "<sql>". The canonical central path routes through the installed composition; explicit session paths remain direct SQLite. Default output matches sqlite3 -list (pipe-separated, no header).
Key Files
| File | Purpose |
src/index.ts | Entry point: init DB, migrations, channel adapters, delivery polls, sweep, shutdown |
src/router.ts | Inbound routing: messaging group → agent group → session → inbound.db → wake |
src/delivery.ts | Polls outbound.db, delivers via adapter, handles system actions (schedule, approvals, etc.) |
src/delivery-guard.ts | DeliveryGuardSpec + runGuarded — the guard-consult pipeline for privileged delivery actions (registry stays in delivery.ts) |
src/host-sweep.ts | 60s sweep: processing_ack sync, stale detection, due-message wake, recurrence |
src/session-manager.ts | Resolves sessions; opens inbound.db / outbound.db; manages heartbeat path |
src/container-runner.ts | Spawns per-agent-group Docker containers with session DB + outbox mounts; leases the session's gateway contribution and revokes it on exit |
src/container-runtime.ts | Docker CLI wrapper (runtime binary, host-gateway args, mount args), orphan cleanup |
src/gateway-providers/ | Credential-gateway seam: GatewayProviderDefinition + its single registry. One provider per install, selected by NANOCLAW_GATEWAY_PROVIDER; overlays append a registration to installed.ts. See docs/gateway-seam.md |
src/gateway-approval-coordinator.ts | Core-owned human approval flow every gateway gets: request validation, approver routing, pending_approvals, terminal cards, and supervised reconnect of the provider's approval subscription |
src/guard/ | Privileged-action decision seam: guard(action, input) → allow | hold | deny. Module-edge guard.ts adapters (cli, agent-to-agent, self-mod, permissions) define each action's decision; ncl commands + delivery actions demand a guard at registration; approved replays carry the approval row as a grant and re-run the checks. Conformance test: src/guard/conformance.test.ts |
src/modules/permissions/access.ts | canAccessAgentGroup — owner / global admin / scoped admin / member resolution against user_roles + agent_group_members |
src/modules/approvals/primitive.ts | pickApprover, pickApprovalDelivery, requestApproval, approval-handler registry |
src/command-gate.ts | Router-side admin command gate — queries user_roles directly (no env var, no container-side check) |
src/modules/permissions/user-dm.ts | Cold-DM resolution + user_dms cache |
src/group-init.ts | Per-agent-group filesystem scaffold (CLAUDE.md, skills) — agent-runner source is a shared read-only mount, not copied per group |
src/db/container-configs.ts | CRUD for container_configs table (per-group container runtime config) |
src/backfill-container-configs.ts | Migrates legacy container.json files into the DB on startup |
src/project-doc-compose.ts | Composes each group's project document — every instruction source read on the host and inlined into one flat file, no imports |
src/container-restart.ts | Kill + on-wake respawn for agent group containers |
src/db/ | DB layer — agent_groups, messaging_groups, sessions, container_configs, user_roles, user_dms, pending_*, migrations |
src/channels/ | Channel adapter infra (registry, Chat SDK bridge); specific channel adapters are skill-installed from the channels branch |
src/channels/channel-defaults.ts | Wiring-creation helpers over adapter-declared channel defaults (resolveWiringDefaults, resolveThreadPolicy, engage validation) |
src/providers/ | Host-side provider container-config (claude baked in; opencode etc. installed from the providers branch) |
setup/gateways/ | Gateway catalog (gateway.json discovery), selection/detection, and the skill-driven install used by setup and /update-nanoclaw |
container/agent-runner/src/ | Agent-runner: poll loop, formatter, provider abstraction, MCP tools, destinations |
container/skills/ | Container skills mounted into every agent session (agent-browser, frontend-engineer, self-customize, welcome; the selected gateway's agent skill and opt-in skills like vercel-cli, slack-formatting and whatsapp-formatting install with the /add-* skill that adds their capability) |
groups/<folder>/ | Per-agent-group filesystem (CLAUDE.md, skills) — agent-runner source is a shared read-only mount, not copied per group |
scripts/init-first-agent.ts | Bootstrap the first DM-wired agent (used by /init-first-agent skill) |
scripts/skill-apply.ts | Deterministic SKILL.md applier — executes nc: directive fences; declare/emit core, journaled + idempotent |
scripts/skill-directives.ts + scripts/skill-policy.ts | nc: grammar parser + lint; UI-free driver policy derived from document structure (gate confirm, URL offer) |
setup/lib/skill-driver.ts + setup/channels/run-channel-skill.ts | Setup wizard's skill consumer: clack rendering of engine events + the generic channel-install flow |
migrate-v2.sh + setup/migrate-v2/ | v1→v2 migration. Standalone script: bash migrate-v2.sh. Seeds DB, copies groups/sessions, installs channels, builds container, offers service switchover, then hands off to /migrate-from-v1 skill for owner setup and CLAUDE.md cleanup. See docs/migration-dev.md. |
nanoclaw.sh --uninstall + setup/uninstall/ | Uninstall this copy only (slug-scoped): service, containers + image, data/, logs/, groups/, and whatever the installed gateway skill declares removable. Confirms per group; --dry-run previews, --yes skips prompts. Other copies and any shared gateway service are untouched. Bypasses bootstrap entirely; uninstall.sh is a pointer that execs it. |
Admin CLI (ncl)
ncl queries and modifies the central DB — agent groups, messaging groups, wirings, users, roles, and more. On the host it connects via Unix socket (src/cli/socket-server.ts); inside containers it uses the session DB transport (container/agent-runner/src/cli/ncl.ts).
ncl <resource> <verb> [<id>] [--flags]
ncl <resource> help
ncl help| Resource | Verbs | What it is |
| groups | list, get, create, update, delete, restart, config get/update, config add-mcp-server/remove-mcp-server, config add-package/remove-package | Agent groups (workspace, personality, container config) |
| messaging-groups | list, get, create, update, delete | A single chat/channel on one platform |
| wirings | list, get, create, update, delete | Links a messaging group to an agent group (session mode, triggers) |
| users | list, get, create, update | Platform identities (<channel>:<handle>) |
| roles | list, grant, revoke | Owner / admin privileges (global or scoped to an agent group) |
| members | list, add, remove | Unprivileged access gate for an agent group |
| destinations | list, add, remove | Where an agent group can send messages |
| sessions | list, get | Active sessions (read-only) |
| tasks | list, get, create, update, cancel, pause, resume, delete, run, append-log | Scheduled tasks for an agent group |
| user-dms | list | Cold-DM cache (read-only) |
| dropped-messages | list | Messages from unregistered senders (read-only) |
| approvals | list, get | Pending approval requests (read-only) |
Key files: src/cli/dispatch.ts (dispatcher + approval handler), src/cli/crud.ts (generic CRUD registration), src/cli/resources/ (per-resource definitions).
Channels and Providers (skill-installed)
Trunk does not ship any specific channel adapter or non-default agent provider. The codebase is the registry/infra; the actual adapters and providers live on long-lived sibling branches and get copied in by skills:
channelsbranch — Discord, Slack, Telegram, WhatsApp, Teams, Linear, GitHub, iMessage, Webex, Resend, Matrix, Google Chat, WhatsApp Cloud, Signal, WeChat, DeltaChat, Emacs (+ helpers, tests, channel-specific setup steps). Installed via/add-<channel>skills.providersbranch — OpenCode (and any future non-default agent providers). Installed via/add-opencode.
Each /add-<name> skill is idempotent: git fetch origin <branch> → copy module(s) into the standard paths → append a self-registration import to the relevant barrel → pnpm install <pkg>@<pinned-version> → build. Channel skills carry these steps as nc: directive fences: setup applies them via the engine (scripts/skill-apply.ts), an agent applies the prose — same install either way. See docs/skill-directives.md.
Channel defaults. Each adapter declares its wiring-time defaults (ChannelDefaults: per DM/group context — engage mode/pattern, thread policy, unknown-sender policy — plus mention signaling). Exactly two levels: the adapter declaration, and the per-wiring override chosen at creation — no per-instance DB config table. Undeclared (stale) adapters resolve through a behavior-faithful fallback, so a trunk update alone changes nothing. See docs/api-details.md and src/channels/channel-defaults.ts.
Self-Modification
One tier of agent self-modification today:
install_packages/add_mcp_server— changes to the per-agent-group container config in the DB (apt/npm deps, wire an existing MCP server). Single admin approval per request; on approve, the handler insrc/modules/self-mod/apply.tsrebuilds the image when needed (install_packagesonly), writes anon_wakemessage, kills the container, and respawns viaonExitcallback. The on-wake message is only picked up by the fresh container's first poll — dying containers can never steal it.container/agent-runner/src/mcp-tools/self-mod.ts.
A second tier (direct source-level self-edits via a draft/activate flow) is planned but not yet implemented.
Container Config
Per-agent-group container runtime config (provider, model, packages, MCP servers, mounts, etc.) lives in the container_configs table in the central DB. Materialized to groups/<folder>/container.json at spawn time so the container runner can read it. Managed via ncl groups config get/update and the self-mod MCP tools.
cli_scope — controls what the agent can do with ncl from inside the container:
| Value | Behavior |
disabled | Agent never learns about ncl (instructions excluded from CLAUDE.md). Host dispatch rejects any cli_request. |
group (default) | Agent can access groups, sessions, destinations, members, tasks only, scoped to its own agent group. --id and group args are auto-filled. Cross-group access rejected. cli_scope changes blocked. |
global | Unrestricted. Set automatically for owner agent groups via init-first-agent. |
Key files: src/db/container-configs.ts, src/container-config.ts, src/cli/dispatch.ts (scope enforcement), src/project-doc-compose.ts (instructions exclusion).
Container Restart
ncl groups restart --id <group-id> [--rebuild] [--message <text>]. Kills running containers; if --message is provided, writes an on_wake message and respawns via onExit callback. Without --message, containers come back on the next user message. From inside a container, --id is auto-filled and only the calling session is restarted.
The on_wake column on messages_in ensures wake messages are only picked up by a fresh container's first poll iteration. This prevents the race where a dying container (still in its SIGTERM grace period) could steal the message. killContainer accepts an optional onExit callback that fires after the process exits, guaranteeing the old container is gone before the new one spawns.
Key files: src/container-restart.ts, src/container-runner.ts (killContainer), container/agent-runner/src/db/messages-in.ts (getPendingMessages).
Secrets / Credentials / Gateways
API keys, OAuth tokens, and auth credentials are managed by a credential gateway — never by NanoClaw and never by an agent. Secrets are injected at the network boundary at request time; none are passed in env vars or through chat context.
NanoClaw ships the seam, not a gateway. One gateway is installed per copy from its /add-<gateway> skill (/add-onecli, /add-iron-proxy), and NANOCLAW_GATEWAY_PROVIDER in .env names the one this copy runs. With none registered the host refuses to start — there is no implicit default and no open-egress fallback.
The container agent learns the gateway's behavior from that gateway's own container skill, which the install copies into container/skills/. Only the selected gateway's skills reach an agent, so a container is never told about a proxy it is not behind.
Read docs/gateway-seam.md before touching any of this. It covers the provider contract, what core owns versus what a provider owns, the availability model, and the gateway-trust mount class. Operational detail for a specific gateway — vault modes, approval policy, dashboards — lives in that gateway's skill, not here.
Approvals
Approval-gating a credentialed action is a two-sided flow:
- Gateway-side: the gateway decides when to hold a request and emit a pending approval. How you configure that is gateway-specific; see the installed skill.
- Host-side:
src/gateway-approval-coordinator.tsowns the human flow for every gateway — validation, approver resolution viapickApprover+pickApprovalDelivery, thepending_approvalsrow, the card, click authorization, expiry, and the sweep of rows a previous host left behind. Approvers come from theuser_rolestable: scoped admins for the agent group → global admins → owners. There is no env var likeNANOCLAW_ADMIN_USER_IDS.
The subscription is supervised: if the provider's bridge ends, holds are denied, running sessions stop, and session admission closes until a reconnect proves the bridge is back. If the gateway has no rule asking for approval, the host side never fires regardless of how it is wired.
Skills
Five types of skills. See CONTRIBUTING.md for the full taxonomy.
- Channel/provider install skills — copy the relevant module(s) in from the
channelsorprovidersbranch, wire imports, install pinned deps (e.g./add-discord,/add-slack,/add-whatsapp,/add-opencode). - Utility skills — ship code files alongside
SKILL.md(e.g. ascripts/CLI or helper). - Gateway install skills — install the one credential gateway this copy runs. Unlike channel and provider skills these carry their implementation in the skill's own
payload/, onmain— no registry branch. Discovered by theirgateway.json(e.g./add-onecli,/add-iron-proxy). - Operational skills — instruction-only workflows (
/setup,/debug,/customize,/init-first-agent,/manage-channels,/update-nanoclaw). - Container skills — loaded inside agent containers at runtime (
container/skills/:agent-browser,frontend-engineer,self-customize,welcome; the selected gateway's agent skill and opt-in skills likevercel-cliand the channel formatters are copied in by the/add-*skill that adds their capability).
| Skill | When to Use |
/setup | First-time install, auth, service config |
/init-first-agent | Bootstrap the first DM-wired agent (channel pick → identity → wire → welcome DM) |
/manage-channels | Wire channels to agent groups with isolation level decisions |
/customize | Adding channels, integrations, behavior changes |
/debug | Container issues, logs, troubleshooting |
/update-nanoclaw | Bring upstream updates into a customized install |
/add-onecli, /add-iron-proxy | Install or refresh this copy's credential gateway |
/migrate-memory | Carry a group's agent memory across a provider switch (operator-run, both directions) |
Contributing
Before creating a PR, adding a skill, or preparing any contribution, you MUST read CONTRIBUTING.md. It covers accepted change types, the skill types and their guidelines, SKILL.md format rules, and the pre-submission checklist.
PR Hygiene
Before creating a PR, run these checks:
git diff upstream/main --stat HEAD
git log upstream/main..HEAD --onelineShow the output and wait for approval. Installation-specific files (group files, .claude/settings.json, local configs) should not be included.
Development
Run commands directly — don't tell the user to run them.
# Host (Node + pnpm)
pnpm run dev # Host via tsx (no watch)
pnpm run build # Compile host TypeScript (src/)
./container/build.sh # Rebuild agent container image (nanoclaw-agent:latest)
pnpm test # Host tests (vitest)
# Agent-runner (Bun — separate package tree under container/agent-runner/)
cd container/agent-runner && bun install # After editing agent-runner deps
cd container/agent-runner && bun test # Container tests (bun:test)Container typecheck is a separate tsconfig — if you edit container/agent-runner/src/, run pnpm exec tsc -p container/agent-runner/tsconfig.json --noEmit from root (or bun run typecheck from container/agent-runner/).
Service management:
# macOS (launchd)
launchctl load ~/Library/LaunchAgents/com.nanoclaw.plist
launchctl unload ~/Library/LaunchAgents/com.nanoclaw.plist
launchctl kickstart -k gui/$(id -u)/com.nanoclaw # restart
# Linux (systemd)
systemctl --user start|stop|restart nanoclawTroubleshooting
Check these first when something goes wrong:
| What | Where |
| Host logs | logs/nanoclaw.error.log first (delivery failures, crash-loop backoff, warnings), then logs/nanoclaw.log for the full routing chain |
| Setup logs | logs/setup.log (overall), logs/setup-steps/*.log (per-step: bootstrap, environment, container, gateway, mounts, service, etc.) |
| Session DBs | data/v2-sessions/<agent-group>/<session>/ — inbound.db (messages_in: did the message reach the container?), outbound.db (messages_out: did the agent produce a response?) |
Note: container logs are lost after the container exits (--rm flag). If the agent silently failed inside the container, there's no persistent log to inspect.
Timestamps
Two rules, no exceptions:
- Storage: every timestamp written from JS is
new Date().toISOString()(ISO-8601 UTC withZ). Central SQL receives that timestamp as a parameter; never usedatetime('now')orstrftime(...)there because they are SQLite-specific and the naive shape is misparsed as local time bynew Date(). SQLite-only mailbox SQL may usestrftime('%Y-%m-%dT%H:%M:%fZ','now'). SQLite-only comparisons wrap both sides indatetime(). - Display: anything shown to an agent or a user renders in the install timezone —
formatLocalTime(prose) orformatLocalStamp(log lines) fromsrc/timezone.ts/container/agent-runner/src/timezone.ts.--jsonoutput, DB values, and operator logs stay ISO.
An agent group can override the install timezone (ncl groups config update --timezone <IANA>, "" clears; approval-gated for agent callers). The override grounds that group's scheduling (cron interpretation, --process-after, run-log stamps — effective immediately) and the container's TZ env (effective on respawn). Host-side operator display (ncl human output) stays in the install timezone. Resolution: resolveGroupTimezone in src/container-config.ts — group override → install global.
Supply Chain Security (pnpm)
This project uses pnpm with minimumReleaseAge: 4320 (3 days) in pnpm-workspace.yaml. New package versions must exist on the npm registry for 3 days before pnpm will resolve them.
Rules — do not bypass without explicit human approval:
minimumReleaseAgeExclude: Never add entries without human sign-off. If a package must bypass the release age gate, the human must approve and the entry must pin the exact version being excluded (e.g.package@1.2.3), never a range.onlyBuiltDependencies: Never add packages to this list without human approval — build scripts execute arbitrary code during install.pnpm install --frozen-lockfileshould be used in CI, automation, and container builds. Never run barepnpm installin those contexts.
Docs Index
| Doc | Purpose |
| docs/architecture.md | Full architecture writeup |
| docs/api-details.md | Host API + DB schema details |
| docs/db.md | DB architecture overview: three-DB model, cross-mount rules, readers/writers map |
| docs/db-central.md | Central DB (data/v2.db) — every table + migration system |
| docs/db-session.md | Per-session inbound.db + outbound.db schemas + seq parity |
| docs/agent-runner-details.md | Agent-runner internals + MCP tool interface |
| docs/gateway-seam.md | Credential-gateway seam: the provider contract, what core owns, availability, selection |
| docs/isolation-model.md | Three-level channel isolation model |
| docs/setup-wiring.md | What's wired, what's open in the setup flow |
| docs/architecture-diagram.md | Diagram version of the architecture |
| docs/build-and-runtime.md | Runtime split (Node host + Bun container), lockfiles, image build surface, CI, key invariants |
| docs/v1-to-v2-changes.md | v1→v2 architecture diff — vocabulary for where v1 things moved |
| docs/migration-dev.md | Migration development guide — testing, debugging, dev loop |
| docs/provider-migration.md | Switching a live agent group between providers (e.g. Claude → Codex) — what carries over, rollback |
| docs/customizing.md | Short intro to customizing via skills |
| docs/skills-model.md | The skills model in full: recipes, tests, upgrades, migrations |
| docs/skill-guidelines.md | Authoritative checklist for writing a skill |
| docs/skill-directives.md | nc: directive reference: fence grammar, the eight kinds, effects, guards, lint |
| docs/skill-engine-seam.md | Skill-engine consumer contract (wizard / pipeline / agent-relay) + boundary-rule rationale |
| docs/templates.md | Agent templates: what they are, stamping via ncl groups create --template + the setup wizard, the gateway/MCP-credential model, supported providers, and how to contribute one |
| docs/hardened-image.md | Opt-in: pull the agent image from a registry instead of building it |
Container Build Cache
The container buildkit caches the build context aggressively. --no-cache alone does NOT invalidate COPY steps — the builder's volume retains stale files. To force a truly clean rebuild, prune the builder then re-run ./container/build.sh.
Container Runtime (Bun)
The agent container runs on Bun; the host runs on Node (pnpm). They communicate only via session DBs — no shared modules. Details and rationale: docs/build-and-runtime.md.
Gotchas — trigger + action:
- Adding or bumping a runtime dep in
container/agent-runner/→ editpackage.json, thencd container/agent-runner && bun installand commit the updatedbun.lock. Do not runpnpm installthere — agent-runner is not a pnpm workspace. - Bumping
@anthropic-ai/claude-agent-sdk,@modelcontextprotocol/sdk, or any agent-runner runtime dep → nominimumReleaseAgepolicy applies to this tree. Check the release date on npm, pin deliberately, neverbun updateblindly. - Writing a new named-param SQL insert/update in the container → use
$namein both SQL and JS keys:.run({ $id: msg.id }).bun:sqlitedoes not auto-strip the prefix the waybetter-sqlite3does on the host. Positional?params work normally. - Adding a test in
container/agent-runner/src/→ import frombun:test, notvitest. Vitest runs on Node and can't loadbun:sqlite.vitest.config.tsexcludes this tree. - Adding a Node CLI the agent invokes at runtime (like
agent-browser,claude-code,vercel) → put it in the Dockerfile's pnpm global-install block, pinned to an exact version via a newARG. Don't usebun install -g— that bypasses the pnpm supply-chain policy. - Changing the Dockerfile entrypoint or the dynamic-spawn command (
src/container-runner.tsline ~503) → keepexec bun ...so signals forward cleanly. The image has no/app/dist; don't reintroduce a tsc build step. - Changing session-DB pragmas (
container/agent-runner/src/mailbox/sqlite/connection.ts) →journal_mode=DELETEis load-bearing for cross-mount visibility. Read the comment block at the top of the file first.
CJK font support
Agent containers ship without CJK fonts by default (~200MB saved). If you notice signals the user works with Chinese/Japanese/Korean content — conversing in CJK, CJK timezone (e.g., Asia/Tokyo, Asia/Shanghai, Asia/Seoul, Asia/Taipei, Asia/Hong_Kong), system locale hint, or mentions of needing to render CJK in screenshots/PDFs/scraped pages — offer to enable it:
# Ensure .env has INSTALL_CJK_FONTS=true (overwrite or append)
grep -q '^INSTALL_CJK_FONTS=' .env && sed -i.bak 's/^INSTALL_CJK_FONTS=.*/INSTALL_CJK_FONTS=true/' .env && rm -f .env.bak || echo 'INSTALL_CJK_FONTS=true' >> .env
# Rebuild and restart so new sessions pick up the new image
./container/build.sh
launchctl kickstart -k gui/$(id -u)/com.nanoclaw # macOS
# systemctl --user restart nanoclaw # Linuxcontainer/build.sh reads INSTALL_CJK_FONTS from .env and passes it through as a Docker build-arg. Without CJK fonts, Chromium-rendered screenshots and PDFs containing CJK text show tofu (empty rectangles) instead of characters.
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.

