The CLI is the New SDK: Unpacking miniclaw
How a minimalist Go daemon wraps Anthropic's terminal tool to build a self-modifying AI assistant without a single API call.

Powered directly by Claude Code. Get Anthropic's state-of-the-art tool-use, codebase awareness, and memory management out of the box, with zero maintenance and automatic updates.
- miniclaw bypasses traditional API SDKs by hijacking the official Claude Code CLI via a Go subprocess.
- It translates real-time terminal stdout streams into an interactive Telegram chat interface with live tool execution indicators.
- The agent rejects vector databases entirely, opting for human-readable Markdown files for persistent memory.
- Because it runs in the project root with file system access, the daemon can autonomously edit its own Go source code and schedule cron tasks.
Bypassing the API
Building an AI agent usually starts with an SDK and an API key. Developers spend weeks writing integration code to handle tool routing, file system access, and context windows. miniclaw takes a radically different path. It ignores the API entirely.
Instead of building a bespoke agentic wrapper, miniclaw hijacks the official Anthropic Claude Code command-line tool. Inside internal/runner.go, a Go harness uses exec.CommandContext to run the CLI in the background. By passing the --output-format stream-json flag, miniclaw captures real-time thoughts directly from the terminal's standard output.
Translating the Terminal
Mapping a single-player terminal tool to a multiplayer chat interface introduces severe concurrency and UX challenges. If a user sends a new message while the agent is still thinking, thread collisions are imminent.
The application solves this in internal/app.go with a chatState mutex. It ensures only one agent instance runs per Telegram thread. To solve the black box problem of waiting for long-running terminal commands, miniclaw parses the JSON stream into a streamEvent struct. It maps raw tool executions to real-time Telegram emojis. When Claude reads a file, the user sees a document emoji instantly.
The Markdown Memory Rebellion
Modern agent architectures are obsessed with vector databases. Developers deploy complex Retrieval-Augmented Generation stacks just to remember a user's name. miniclaw explicitly rejects this complexity.
It relies entirely on Claude Code's native MEMORY.md file. For a personal assistant, a structured and human-editable Markdown file is vastly superior to opaque embeddings. Users can simply open the file and read exactly what the bot knows about them.
A Daemon That Edits Itself
Because miniclaw wraps a CLI that already possesses full file-system access, giving the agent agency over time is trivial. The task system in internal/scheduler.go is fully AI-managed.
To schedule a cron job, the bot simply writes a JSON file to a local tasks directory. Furthermore, the default workspace is the project root itself. The bot can rewrite its own Go source code, compile it, and restart. It is a recursive development loop.
Escaping the Heavyweight Tax
The contrast between miniclaw and traditional agent frameworks is stark. Complex multi-language stacks require Python, Go, C++, and embedding models just to maintain context. miniclaw achieves state-of-the-art capability with a single lightweight binary.
| Feature | miniclaw | Standard Agent Stack |
|---|---|---|
| Core Engine | Official CLI Subprocess | REST API SDKs |
| Memory Store | MEMORY.md (Human readable) | Vector Database (Embeddings) |
| Tool Integrations | Inherited automatically | Built and maintained manually |
| Infrastructure | Single Go binary | Multi-container orchestration |