Content
<img src="assets/cc.png" height="40="absmiddle"> mini-cl
[](https://github.com/DRC/mini-claude-codeJava](https://img.shields/Java-17-4EB.svg)](https://www.oracle.com/java/)
[](https://maven.apache.org/)
**[English](./README_en.md) | English**
**Sister Projects:**
- [**mini-spring**](https://github.com/DerekYRC/mini-spring) **(A simplified Spring framework)**
mini-spring-cloud**](github.com/DerekYRC/mini-spring-cloud) **(A simplified Spring Cloud framework)**
- [**mini-netty**](https://github.comYRC/mini-netty) **(A simplified Netty framework)**
## About
**mini-claude-code** is a simplified Java version of the Claude Code programming Agent project, which helps you quickly understand the core principles of coding Agents. The project extracts the key mechanisms of Agent Harness, **with minimal code and core functionality retained**, such as Agent Loop, Tool Calling, Permission Control, Hooks, Todoagent, Skill Context Compression, Memory System, Task Background Tasks, Cron Multi-Agent Collaboration, Team Protocols Task Claiming, and MCPThe project is divided into chapters corresponding to an independent branch, code required to understand the currentIf this project helps you, it a **STAR**, thank## Features
* [s Loop](changelog.md#-agent-loop) — ReAct-Act-Observe, LLM closed-loop
* [s Dispatch](changelog.md#-tool-dispatch) — Tool Register and use, without modifying the main loop
* [s](changelog.md#smission) — Guardrails: verification, review before execution
s04 Hooks](changelogs04-hooks) — Lifecycle: Four event points, cross-cutting invading the loop
*05 Todo](changelog.md05-todo) — Planning execution, trackable status [s06 Subagent](changelog.md#s06-subagent) — Delegation: Delegate sub clean and isolated context
* [s07 Skill Loading](ch#s07-skill-loading) Skill Loading: Index in Prompt, load on demand
* [ Context Compact](changelog.md#s08-context-compact) —: Four-layer compression pipeline, free up space when full
*09 Memory](changelog.md#s09-memory) — Long-term What to remember, what to forget, and when to merge
*10 Task System](changelog.md#s10-task-system): Task graph + state machine + dependency check
*11 Background Tasks](changelog.md#s11-background-tasks): Slow operations go to, Agent continues to think
s12 Cron Scheduler](changelog.md#s12-cron-s — Scheduled Trigger: Cron expression, unattended trigger
* [s13 Agent Teams](changelog.md#-agent-teams) —: Lead assigns tasks, teammates
* [s Protocols](changelog.md#-team-protocols) — Structured Communication: request_id + state machine, between teammates
* [s15 Autonomous Agents](changelog.md15-autonomous-agents) — Self-Organization: Teammates scan the board, claim tasks autonomously [s16 MCP Pluginangelog.md#s16-mcp-plugin) — MCP: Dynamic tool pool, plug in and use when needed
## Usage
### 1. Prepare the Environment
This project requires Java 17 and Maven.
Before running the real model demo, set the following in the shell:
```sh
export ANTHROPIC_BASE_URL='Your Anthropic compatible API Base URL, e.g., https://api.deepseek.com/anthropic'
export MODEL_ID='Your model ID'
export ANTHROPIC_API_KEY='Your API Key'
```
###. the Chapter Branch
Each to a teaching branch. For example, to learn s01:
```sh
git switch s01-agent-loop
```
### 3. Start
Use Maven to start the specified demo:
```sh
mvn compile exec:java -DClass=org.miniclaude.S01AgentLoopDemo### 4. Read the Description
Read [changelogchangelog.md)
## Questions
[Ask questions here](https://github.com/DerekYRC/mini-claude-code/issues)
## Contributions
Pull Requests are welcome.
## Reference Projects
- [learn-claude-code](https://github.com/shareAI-lab/learn-claude-code) (Highly recommended)