← All projects

NanoClaw

Tiny Claude-Code-shaped clone. Excellent for studying the irreducible structure of an agent loop without production overhead.

Category
agent-cli
Language
TypeScript
Runtime
Node
Providers
Anthropic
Agent loop
generator
Tool format
anthropic-tool_use
Memory
rule-truncate
Caching
cache_control-explicit
Sandbox
process
Pedagogical
★★★★
Flags
streaming
Concepts
agent-loop ·tool-calling-formats ·prompt-caching ·streaming-tools
Verified
paper-pass
Upstream

What it is

The smallest faithful Claude-Code-shaped clone. Read this when you want to feel the irreducible structure of an agentic CLI without the production overhead.

What’s worth studying

  • The generator-yield agent loop in ~200 lines. Same shape as Claude Code’s, easier to read end-to-end. Trace one iteration: prompt assembly, stream, parse, dispatch, observe, loop.
  • cache_control placement at minimum scale. You can see exactly which content blocks are cacheable and where the boundary sits. Compare to Claude Code’s sentinel-string approach — same idea, smaller surface.
  • Anthropic SDK only. Zero abstraction tax. Useful as a counter-example to the LiteLLM / per-adapter complexity you might add later. See provider-abstraction.

Pair this with Mistral Vibe to compare a TS+Anthropic minimal vs a Python+OpenAI-fn minimal — same idea, two language ecosystems.

Drill-down

The full per-doc analysis lives below — these are the original numbered analyses, rendered as styled HTML. Pick a section to study deeper.