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.

6 min read · AaronCQL/miniclaw

A heavy industrial mechanical claw carefully picking up a classic glowing terminal prompt window and lowering it into the chassis of a modern smartphone. This represents the Go harness wrapping the CLI for Telegram.
miniclaw acts as a mechanical harness, lifting Anthropic's powerful single-player terminal experience directly into a multiplayer chat interface.

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.

AaronCQL, Project Creator and Maintainer · AaronCQL/miniclaw
Key Takeaways

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.

The execution bridge: how miniclaw intercepts terminal output and maps it to a chat interface.

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.

A vintage telegraph ticker tape machine converting dense machine code into recognizable symbols like magnifying glasses and file folders. This illustrates the translation of CLI JSON streams into Telegram UI elements.
Raw JSON streams from the terminal are translated on the fly into human-readable UI updates.

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.

Portrait of AaronCQL.

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.

An intricate clockwork automaton sitting at a drafting table, using an ink pen to redraw the blueprints of its own arm mechanism. This visualizes the agent's ability to edit its own source code.
By running in the project root, the agent has the permission to rewrite the very Go files that define its behavior.

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.

FeatureminiclawStandard Agent Stack
Core EngineOfficial CLI SubprocessREST API SDKs
Memory StoreMEMORY.md (Human readable)Vector Database (Embeddings)
Tool IntegrationsInherited automaticallyBuilt and maintained manually
InfrastructureSingle Go binaryMulti-container orchestration