Recreated Claude Code's behavior in 280 lines of Python
The magic in AI coding assistants isn't the code -- it's the prompts. I studied the externally observable behavior of Claude Code and recreated it from scratch in Python with the exact same behaviors. It works with any model -- OpenAI, Gemini, Claude. What's surprising: 1. You can keep the core agent really simple, just 280 lines of Python. As long as it supports hooks, custom sub-agents and Model Context Protocol (MCP), then all the rest of the coding-assistant-specific behavior and tools can be factored out into a separate MCP server. 2. The magic is in the prompts (1200 lines of…
What it does
In the maker’s words, at launch
The magic in AI coding assistants isn't the code -- it's the prompts. I studied the externally observable behavior of Claude Code and recreated it from scratch in Python with the exact same behaviors. It works with any model -- OpenAI, Gemini, Claude. What's surprising: 1. You can keep the core agent really simple, just 280 lines of Python. As long as it supports hooks, custom sub-agents and Model Context Protocol (MCP), then all the rest of the coding-assistant-specific behavior and tools can be factored out into a separate MCP server. 2. The magic is in the prompts (1200 lines of system-prompt, tool-descriptions, system-reminders), not the tool implementations (400 lines of code) nor the core agent itself. I created my own crummy prompts, and so get much worse results from this assistant than from Claude. 3. The magic is also in the UX. This mini-agent has none of Claude's polished UX, none of its permissions system, none of its file-based configurability. It's not fun to use. It's really just an educational toy. 4. Coding assistants are "transparent" in the sense that there aren't hidden depths, and you can see what's going on. "Hey agent, please list for me all your built-in tools. Please study their input schemas and create a suite of test-cases to exercise all edge cases. Please study this suite of test-cases written by a junior developer and fill in the gaps. Please implement a function which satisfies all the test-cases." (Those four sentences are a glib summary of what really took me four hours per tool.) Modern AI coding assistants took huge effort to create and get right. It's striking that the end result has such a straightforward architecture. And what is that architecture? I'll let it speak for itself... $ python3 -m venv venv $ source venv/bin/activate $ pip install -r requirements.txt $ export GEMINI_API_KEY=redacted $ ./mini_agent.py --model gemini/gemini-2.5-pro [MODEL: gemini/gemini-2.5-pro + gemini/gemini-2.5-flash] [IMPLICIT --mcp builtin] [TRANSCRIPT: /Users/ljw1004/.claude/projects/default/2025-09-01.jsonl] > Please analyze the files in my current directory and tell me what they do. >> <system-reminder># CLAUDE.md (project instructions) ...</system-reminder> >> <system-reminder>Your TODO list is empty. Remember that the TodoWrite tool is a great way to stay on top of complex tasks.</system-reminder> [7193 input tokens, 202 response tokens] >> LS(...) -> "- /Users/ljw1004/code/mini_agent/\n - CLAUDE.md\n - LICENSE [4042 cached input tokens, 3912 further input tokens, 204 response tokens] >> Read(...) -> " 1→# Mini-agent\n 2→\n 3→ >> Read(...) -> " 1→#!/usr/bin/env python3\n 2→\n 3→from __future__ >> Read(...) -> " 1→from __future__ import annotations\n 2→from path >> Read(...) -> " 1→from __future__ import annotations\n 2→from typi [55145 input tokens, 5650 further input tokens, 194 response tokens] < This project is a minimal coding assistant. Here's a breakdown of the key files: * `mini_agent.py`: The main script that runs the interactive agent loop. It takes user input, communicates with an LLM, and uses tools to perform tasks. * `core_tools.py`: Implements the core functionalities (tools) that the agent can use, such as reading/writing files (`Read`, `Write`, `Edit`), searching (`Grep`, `Glob`), and running commands (`Bash`). * `typedefs.py`: Defines the data structures and types used for messages, tools, and conversation history (transcripts). * `adapter.py`: A module that connects to different Language Models (like GPT, Claude, Gemini) through the `litellm` library, allowing the agent to be model-agnostic. * `test/`: Contains unit tests for the project.
Does the same job
all alternatives →




- APAgent PromptTrain – Manage Claude Code Conversations for Teams2025 · github.com · ▲5
I've been working on this internal project initially both to learn more Vibe-Coding but also to help our teams and projects to use AI more efficiently. As more people used it, it grew to support multiple teams/projects to analyze their Claude Code conversation and optimize them over time (understanding how to write better conversation with Claude Code and share knowledge between them) With time we added support for multiple Claude account management and monitor usage/rate limit. This is a simple project but has proved to be quite useful for our company. We have reached 5000+…
More ai this month
the category →
I trained a 125M-parameter transformer to autocomplete piano performances in real time (~108 notes/sec on an iPhone 15). The idea is basically GitHub Copilot or Tabnine, except instead of prompting it with code, you prompt it by playing a few notes on a MIDI piano. The model then continues what you played, entirely on-device. The app is free if anyone wants to try it. Happy to answer questions about the model, training, Core ML, or the many things that didn't work.
AI · 17d ago · simedw.com
Astute▲585Automate your B2B brand going viral, with new media creators
AI · 18d ago · company-app.joinastute.com


Hey HN, Henry from Cactus here! We previously released Cactus Needle, a 14MB agentic LLM for tool call, device use, and structured extraction for phones, wearables, smart homes, small robots and microcontrollers. We got really great feedback here, and have now incorporated the suggestions to release Needle 2. The whole model is a single 14MB binary that runs a full session in 28MB of RAM; 45m parameters at 2bit compression. Needle hits 500 tokens/sec decode speed on a Raspberry Pi 5, sits between 400-1,500 tokens/sec on VR devices like Meta Quest 3S and Apple Vision Pro, and ranges…
AI · 26d ago · cactuscompute.com


Launched alongside, September 2025
the whole month →
- AS
Commerce · Sep 2025 · anycrap.shop
- TE
I made a built-from scratch Wayland Compositor to display any GUI app* in the terminal! I think there is a lot of unexplored potential in custom Wayland compositors, a lot of really cool things you can embed existing applications into! So, I started with embedding apps into the terminal because that is the easiest input/output (output is just utf-8 and I use the great `chafa` library for that, and I just read from stdin for the input). If you have any other ideas for cool Wayland compositors, let me know. I purposedly wrote 80% the app in Typescript to appeal to the most developers and…
Dev tools · Sep 2025 · github.com
- IR
Years ago I stumbled across a basic version of this concept and it stuck with me. I knew if I was ever going to take on such a project, it would need to be flawless, but without coding experience it was just another idea that would never happen. By the end of 2024, as AI coding tools exploded everywhere, I finally had a way to make it real. I started from zero knowledge and spent months collaborating with AI agents as a learning experience. Every pixel and every function went through me. The AI translated what I asked for into code, but every decision was human. I didn't use existing OS…
AI · Sep 2025 · mitchivin.com

