zyziyun

Claude Code Mini — Development skill for Claude Code

Development community

Async Python implementation of the Claude Code agent harness — real Bash/Read/Glob/Grep tools, three-tier caching, multi-stage compaction, allow/ask/deny permissions, Pre/PostToolUse hooks, slash comm.

How to install Claude Code Mini

This entry records only its repository, not the path inside it, so there is no exact command to give. Open zyziyun/claude-code-mini and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Claude Code Mini does

Async Python implementation of the Claude Code agent harness — real Bash/Read/Glob/Grep tools, three-tier caching, multi-stage compaction, allow/ask/deny permissions, Pre/PostToolUse hooks, slash commands, subagent isolation. OpenAI + Anthropic + Ollama. ~1.9K LOC, 14 commits.

Alternatives in Development

  • Check 1: Cache Exists? — CLAUDE_DIR="${CLAUDE_CONFIG_DIR:-$HOME/.claude}" CACHE_EXISTS=$(ls -d "$CLAUDE_DIR/plugins/cache/claude-hud" 2 10.9k ★
  • Semble — Fast and Accurate Code Search for Agents 6.1k ★
  • Agent Skill — A Claude Code plugin marketplace containing the ast-grep skill for powerful structural code search using Abstr 851 ★

README

claude-code-mini

An async Python implementation of the Claude Code agent harness. ~1,890 lines, 14 commits, every subsystem readable in one sitting.

[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/) [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](#license) [![Tests](https://img.shields.io/badge/tests-65%2F65-brightgreen.svg)](#tests--benchmarks)

Anthropic's leaked source revealed that **~98.4% of Claude Code is harness**, ~1.6% is model interaction. `claude-code-mini` is the smallest faithful reproduction of that ratio: agent loop, real filesystem tools, prompt/semantic/exact caching, multi-stage context compaction, allow/ask/deny permissions, Pre/PostToolUse hooks, slash commands, and subprocess subagents — all async, all in `src/claude_code_mini/`.

You can run it as a daily-driver REPL on your laptop. You can also `git log` your way through 14 commits and watch the architecture get built one feature at a time.

uv sync
cp .env.example .env  # add an API key, or skip if using Ollama
uv run ccm --tools real --yolo
claude-code-mini (provider=openai, model=gpt-4o-mini, tools=real)
[1] > what's the biggest python file under src and why?
The biggest file is src/claude_code_mini/harness.py at 244 lines; it owns
the 7-step request cascade (cache → context → LLM → permission → hook →
tool → format → cache writeback) plus the microcompact integration.
[2] > /cost
calls=4  in=8316  out=184  cached_read=1024  cost=$0.00136
[3] > /exit

Why this exists

Walking an interviewer through your own ~1.9 KLOC reproduction of the Claude Code architecture is a level of credibility no leetcode loop produces. Three audiences:

  • AI/ML infra engineers who want a working reference for prompt caching, context compaction, permission engines, and hook protocols — without reading 512K LOC of TypeScript.
  • Learners who want to read agent-harness internals end-to-end. Each of