Overview
claw is a Python CLI that sends prompts directly to a NanoClaw agent container from the terminal. It reads registered groups from the NanoClaw database, picks up secrets from .env, and pipes a JSON payload into a container run — no chat app required.
Use cases include:
- Scripting and automation — pipe output from one tool into an agent, or pipe the agent’s result into another tool
- CI/CD hooks — call an agent from a GitHub Action or git hook
- Dev workflow — stay in the terminal without context-switching to a chat app
- Bootstrapping — use an agent immediately before any messaging channel is set up
- Testing — faster feedback loop than sending a message through a chat app
Prerequisites
- Python 3.8 or later
- NanoClaw installed with a built container image (
nanoclaw-agent:latest) - Either
container(Apple Container, macOS 15+) ordockeravailable inPATH
Installation
Run the/claw skill in Claude Code from your NanoClaw directory:
scripts/claw and symlinks it to ~/bin/claw. Verify with:
If NanoClaw isn’t running or the database doesn’t exist yet, the group list will be empty — that’s expected.
Usage
Send a prompt
Resume a session
-s to continue the conversation.
Pipe input from stdin
--pipe, you can combine a positional prompt argument with stdin — the positional argument is prepended to the piped content.
List registered groups
Advanced options
How it works
claw bypasses the messaging channel layer entirely. It:
- Reads registered groups from the NanoClaw SQLite database
- Resolves the target group (by name, folder, or JID)
- Loads secrets from
.env(API keys, OAuth tokens) - Constructs a JSON payload with the prompt, group context, and secrets
- Pipes the payload into a container run (
docker run -i --rmorcontainer run -i --rm) - Streams stderr in real time and waits for the output sentinel
- Parses the structured output and prints the agent’s response to stdout
Scripting examples
CI/CD post-deploy check
Pipe git diff for code review
Daily summary via cron
Chain with other tools
Troubleshooting
'neither container nor docker found'
'neither container nor docker found'
Install Docker Desktop or Apple Container (macOS 15+), or pass
--runtime explicitly.'no secrets found in .env'
'no secrets found in .env'
The script reads
.env from your NanoClaw directory. Verify it exists and contains at least one of: CLAUDE_CODE_OAUTH_TOKEN, ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN.Container times out
Container times out
The default timeout is 300 seconds. For longer tasks, pass
--timeout 600 (or higher). If the container consistently hangs, rebuild the image with ./container/build.sh.'group not found'
'group not found'
Run
claw --list-groups to see registered groups. Group lookup does fuzzy partial matching on name and folder — if your query matches multiple groups, you get an error listing the ambiguous matches.Container crashes mid-stream
Container crashes mid-stream
Containers run with
--rm so they’re automatically removed. If the agent crashes before emitting the output sentinel, claw falls back to printing raw stdout. Use -v to inspect output. Rebuild the image if crashes are consistent.Override the NanoClaw directory
Override the NanoClaw directory
If
claw can’t find your database or .env, set the NANOCLAW_DIR environment variable:Next steps
Scheduled tasks
Automate recurring agent tasks with the built-in scheduler
Container runtime
Learn how agent containers are configured and managed