Skip to content

Commit 54d47f3

Browse files
committed
docs: refresh bilingual README and add terminal hero
1 parent 7febc90 commit 54d47f3

3 files changed

Lines changed: 494 additions & 204 deletions

File tree

README.md

Lines changed: 195 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,190 +1,268 @@
11
# MiniCode Python
22

33
<p align="center">
4-
<strong>A self-regulating Python coding agent for local development.</strong>
4+
<strong>A lightweight local coding agent for developers who want durable terminal workflows, not just a chat wrapper.</strong>
55
</p>
66

77
<p align="center">
8-
<a href="./README.zh-CN.md">简体中文</a>
9-
·
8+
<a href="./README.zh-CN.md">Chinese</a>
9+
|
1010
<a href="https://github.com/LiuMengxuan04/MiniCode">MiniCode Main Repo</a>
11-
·
11+
|
1212
<a href="https://github.com/QUSETIONS/MiniCode-Python">Python Repo</a>
1313
</p>
1414

1515
<p align="center">
1616
<img alt="Python" src="https://img.shields.io/badge/Python-3.11%2B-3776AB?style=flat-square&logo=python&logoColor=white">
17-
<img alt="Tests" src="https://img.shields.io/badge/tests-1027%20passed-brightgreen?style=flat-square">
17+
<img alt="Tests" src="https://img.shields.io/badge/tests-1030%20passed-brightgreen?style=flat-square">
1818
<img alt="Package" src="https://img.shields.io/badge/package-minicode--py-555?style=flat-square">
1919
</p>
2020

21-
MiniCode Python is the Python implementation in the MiniCode family. The main
22-
project is [LiuMengxuan04/MiniCode](https://github.com/LiuMengxuan04/MiniCode);
23-
this repository now focuses on a Python-first agent runtime with cybernetic
24-
control, adaptive memory, durable sessions, rewindable local edits, and
25-
testable product surfaces for real local use.
21+
<p align="center">
22+
<img alt="MiniCode Python terminal hero showing memory, session, rewind, and readiness" src="./docs/assets/readme/minicode-terminal-hero.svg" width="100%">
23+
</p>
2624

27-
Instead of treating context pressure, tool failures, memory noise, and cost
28-
drift as prompt-only problems, MiniCode Python measures them during execution
29-
and feeds those signals back into runtime decisions.
25+
<p align="center">
26+
<em>Memory / Session / Rewind / Readiness: the runtime is part of the product.</em>
27+
</p>
3028

31-
## Why It Exists
29+
MiniCode Python is the Python runtime in the MiniCode family. It is built for local development where the agent needs to survive long sessions, keep its state inspectable, recover from bad edits, and show what it is doing while it works.
3230

33-
Most coding agents are model wrappers: prompt in, tool calls out, hope the loop
34-
stays healthy. MiniCode Python is built around a different idea:
31+
If Claude Code represents the polished terminal-agent experience, MiniCode Python is the lightweight, local-first version that leans harder into runtime transparency, durable sessions, memory-backed continuity, rewindability, and verifiable behavior.
3532

36-
> a coding agent should observe itself while it works, then adjust its own
37-
> context, memory, verification, concurrency, and recovery behavior.
33+
## At a Glance
3834

39-
That makes this repository useful as:
35+
MiniCode Python is for you if you want:
4036

41-
- a local coding-agent implementation you can inspect end to end;
42-
- a Python research bed for agent control, memory, and verification loops;
43-
- a companion implementation to the TypeScript MiniCode main repo;
44-
- a practical place to test ideas before they become larger platform features.
37+
- a terminal coding agent that behaves like a runtime, not a chat window;
38+
- durable sessions you can inspect, replay, resume, and summarize;
39+
- a memory stack that can protect working context and re-inject relevant project knowledge;
40+
- safe local editing with checkpoints, rewind preview, and recovery flows;
41+
- explicit signals for verification, widening, provider readiness, and failures.
4542

46-
## Highlights
43+
If you only remember one thing, remember this:
4744

48-
| Area | What MiniCode Python Adds |
49-
| --- | --- |
50-
| Runtime control | `TurnKernel`, `CyberneticOrchestrator`, and runtime profiles (`single`, `single-deep`) coordinate phase-aware execution, widening, verification gates, and recovery. |
51-
| Context management | PID-style context pressure handling, compaction, budget adjustment, predictive guards, and runtime timelines. |
52-
| Memory | Domain-aware retrieval, optional reranking, prompt injection, reflection write-back, maintenance, and working-memory importance tracking. |
53-
| Tool loop | Local file/search/edit/command tools with scheduler-aware execution, structured progress, and local slash-command surfaces. |
54-
| Recovery | Self-healing paths for context overflow, tool failures, oscillation, provider outages, rewind safety, and bounded fallback chains. |
55-
| Product surfaces | Session inspect/replay, checkpoint preview/rewind, readiness reporting, hook and instruction summaries, and benchmark artifacts. |
56-
| Verification | Focused unit, integration, stress, cybernetics, runtime-profile, and release-readiness tests across the active root package. |
45+
> MiniCode Python is optimized for local trust: you should be able to inspect the work, recover the edits, and understand why the agent stopped.
5746
58-
## Architecture
47+
## Why This Repo Exists
5948

60-
```mermaid
61-
flowchart LR
62-
User["User task"] --> Loop["agent_loop.py"]
63-
Loop --> Kernel["turn_kernel.py<br/>phase policy, widening,<br/>verification gate"]
64-
Kernel --> Tools["Local tools<br/>files, search, edit, shell"]
65-
Tools --> Loop
49+
Most coding-agent READMEs lead with model access and feature lists. MiniCode Python is organized around a different promise:
6650

67-
Loop --> Sensors["Sensors<br/>context, cost, errors,<br/>progress, provider state"]
68-
Sensors --> Orchestrator["CyberneticOrchestrator"]
69-
Orchestrator --> Control["Controllers<br/>PID, prediction,<br/>memory, model, progress"]
70-
Control --> Actions["Runtime actions<br/>compact, cap concurrency,<br/>adjust budget, inject memory,<br/>recover, checkpoint, rewind"]
71-
Actions --> Loop
72-
```
51+
> the runtime should be observable, recoverable, and testable, not just clever.
7352
74-
The main loop now drives the orchestrator lifecycle directly and layers it with
75-
the turn kernel, runtime profiles, and product surfaces:
53+
That changes the product priorities:
7654

77-
- `wire_memory()`
78-
- `wire_healing()`
79-
- `inject_memories()`
80-
- `step_start()`
81-
- `step_end()`
82-
- `reflect_on_task()`
83-
- `derive_turn_step_policy()`
84-
- `activate_widening()`
85-
- `record_runtime_event()`
55+
| Priority | What it means here |
56+
| --- | --- |
57+
| Session-first | Sessions can be inspected, replayed, resumed, and summarized. |
58+
| Recovery-first | File edits are checkpointed, previewable, and rewindable. |
59+
| Runtime-first | Widening, verification, compaction, and stop reasons are explicit. |
60+
| Local-first | The agent is built around real repos, local tools, and terminal workflows. |
8661

87-
This keeps controller initialization, memory injection, per-step observation,
88-
feedback, self-healing, checkpointing, verification, and post-task reflection
89-
tied to the same runtime surface.
62+
## Why MiniCode Python
9063

91-
## Repository Status
64+
| Area | What MiniCode Python emphasizes |
65+
| --- | --- |
66+
| Durable sessions | Inspect, replay, resume, and summarize live or saved sessions with local commands. |
67+
| Memory as a first-class system | Protect active task context, re-inject project knowledge, compact with memory awareness, and persist useful reflections over time. |
68+
| Safe recovery | Automatic checkpoints, rewind preview, rewind safety groups, and saved-session rewind flows. |
69+
| Runtime control | `single` and `single-deep` profiles, phase-aware execution, widening, verification gates, and structured stop reasons. |
70+
| Observable behavior | Runtime timelines, readiness reports, provider diagnostics, transcript summaries, and benchmark artifacts. |
71+
| Local product surface | CLI and TUI commands such as `/session`, `/session-replay`, `/memory`, `/checkpoints`, `/rewind`, and `/readiness`. |
72+
| Verifiable implementation | The root package is backed by an active test suite, not aspirational docs. |
9273

93-
The active package is the root package configured in `pyproject.toml`.
74+
## What You Can Do Today
9475

95-
| Path | Role |
96-
| --- | --- |
97-
| `minicode/` | Canonical Python package used by install and tests. |
98-
| `tests/` | Active test suite. |
99-
| `py-src/minicode/` | Compatibility/staging mirror kept aligned for migration work. |
100-
| `benchmarks/` | Runtime profile and release-readiness benchmark entrypoints plus generated reports. |
101-
| `openspec/` | Productization specs, archived changes, and implementation checklists. |
102-
| `docs/OPTIMIZATION_SUMMARY.md` | Full optimization and integration record. |
103-
| `docs/memory_theory.md` | Memory/control theory notes. |
76+
With the current repository state, you can already:
77+
78+
- run an interactive terminal agent with `minicode-py`;
79+
- run a single-shot command with `minicode-headless`;
80+
- inspect the current session with `/session`;
81+
- browse previous sessions with `/sessions`;
82+
- replay a session with `/session-replay`;
83+
- inspect memory state with `/memory`;
84+
- inspect checkpoints with `/checkpoints`;
85+
- preview or execute rewinds with `/rewind-preview` and `/rewind`;
86+
- inspect provider and fallback health with `/readiness`.
87+
88+
## 3-Minute Demo
89+
90+
### 0. What you need
10491

105-
The main TypeScript repository may include this project as
106-
`external/MiniCode-Python`, but this Python package is installed and verified
107-
from this repository root.
92+
- Python 3.11+
93+
- a local terminal on Windows, macOS, or Linux
94+
- model/provider credentials if you want live model execution
10895

109-
## Quick Start
96+
### 1. Install and launch
11097

11198
```bash
11299
git clone https://github.com/QUSETIONS/MiniCode-Python.git
113100
cd MiniCode-Python
114101
python -m pip install -e .[dev]
102+
minicode-py
115103
```
116104

117-
Run the CLI:
105+
### 2. Ask it to do a real repo task
118106

119-
```bash
120-
minicode-py
107+
```text
108+
Explain this repository and tell me which commands matter most for day-to-day use.
109+
```
110+
111+
You should expect the normal MiniCode loop here: inspect repo state, explain findings, then let you inspect, replay, or continue the session.
112+
113+
### 3. Inspect what the runtime is doing
114+
115+
```text
116+
/session
117+
/memory
118+
/readiness
119+
```
120+
121+
### 4. Replay or recover if needed
122+
123+
```text
124+
/session-replay
125+
/checkpoints
126+
/rewind-preview
121127
```
122128

123-
Or run the module directly:
129+
### 5. Run one-shot headless mode
124130

125131
```bash
126-
python -m minicode.main
132+
minicode-headless "Explain what this repo does."
127133
```
128134

129-
Useful local product surfaces now available from the CLI and TUI include:
135+
## Typical Workflow
130136

131-
- `/session`, `/sessions`, `/session-replay`
132-
- `/checkpoints`, `/rewind`, `/rewind-preview`
133-
- `/readiness`
137+
```mermaid
138+
flowchart LR
139+
Start["Start local task"] --> Run["Run minicode-py"]
140+
Run --> Work["Agent reads, edits, tests, and reports"]
141+
Work --> Inspect["Inspect with /session, /memory, or /readiness"]
142+
Inspect --> Replay["Replay with /session-replay"]
143+
Inspect --> Recover["Preview or use /rewind if edits go wrong"]
144+
Replay --> Continue["Resume or continue the next turn"]
145+
Recover --> Continue
146+
```
147+
148+
The main point is simple: MiniCode Python is not trying to hide the runtime. It lets you see the work, inspect the state, and recover from mistakes without manually cleaning everything up.
149+
150+
That same philosophy applies to memory: active task context is protected, durable project knowledge can be re-injected when it matters, and compaction is allowed to reuse memory instead of blindly dropping context.
151+
152+
## Everyday Commands
153+
154+
If you only use six commands at first, use these: `/session`, `/sessions`, `/session-replay`, `/memory`, `/rewind-preview`, and `/readiness`.
155+
156+
| Command | What it does |
157+
| --- | --- |
158+
| `/session` | Show the current live session snapshot. |
159+
| `/sessions` | List saved sessions for the current workspace. |
160+
| `/session-replay` | Replay the current or a saved session with transcript and runtime context. |
161+
| `/memory` | Show memory system status for the current workspace. |
162+
| `/checkpoints` | Show checkpoint history for the current or a saved session. |
163+
| `/rewind-preview` | Preview what a rewind would restore before changing files. |
164+
| `/rewind` | Rewind the latest edit group, a step count, or a checkpoint id. |
165+
| `/readiness` | Inspect runtime/provider readiness, fallback coverage, and product surface status. |
134166

135-
## Verification
167+
## Current Status
136168

137-
The current root package was verified with:
169+
This repository is past the prototype stage. It already behaves like a usable local product, but it is still being tightened into a more polished lightweight Claude Code style experience.
170+
171+
The active package is the root `minicode/` package configured by `pyproject.toml` as `minicode-py`.
172+
173+
Current local verification result:
174+
175+
```text
176+
1030 passed, 2 skipped, 3 warnings
177+
```
178+
179+
Verification command:
138180

139181
```bash
140182
python -m compileall -q minicode py-src\minicode tests
141183
pytest -q
142184
```
143185

144-
Latest local result:
186+
Current state, honestly:
145187

146-
```text
147-
1027 passed, 2 skipped, 3 warnings
188+
- core runtime, session, replay, checkpoint, rewind, and readiness surfaces are in good shape;
189+
- memory is not bolted on: working memory, project memory, memory injection, and memory-aware compaction are already in the runtime path;
190+
- provider and fallback diagnostics are much clearer than before;
191+
- real provider availability still depends on your local credentials and configured channels;
192+
- the project is usable today, but it is still evolving toward a more polished lightweight Claude Code experience.
193+
194+
The 3 warnings are unregistered `pytest.mark.benchmark` markers in benchmark tests. They are not failing behavior.
195+
196+
## Architecture
197+
198+
```mermaid
199+
flowchart LR
200+
User["User task"] --> Loop["agent_loop.py"]
201+
Loop --> Kernel["turn_kernel.py<br/>phase policy, widening,<br/>verification gate"]
202+
Loop --> Memory["Memory stack<br/>working_memory.py,<br/>memory.py, memory_pipeline.py"]
203+
Kernel --> Tools["Local tools<br/>files, search, edit, shell"]
204+
Tools --> Loop
205+
Memory --> Loop
206+
207+
Loop --> Signals["Signals<br/>context, cost, errors,<br/>progress, provider state"]
208+
Signals --> Orchestrator["CyberneticOrchestrator"]
209+
Orchestrator --> Actions["Runtime actions<br/>compact, checkpoint, rewind,<br/>adjust budget, recover, reflect"]
210+
Actions --> Loop
148211
```
149212

150-
The warnings are unregistered `pytest.mark.benchmark` markers in benchmark
151-
tests. They do not indicate failing behavior.
213+
What matters is not the diagram itself. What matters is that runtime state is treated as something explicit:
214+
215+
- the loop can widen instead of silently stalling;
216+
- verification can block a premature "done";
217+
- memory can preserve task-critical context and re-inject project knowledge instead of relying only on the current chat window;
218+
- session state can survive process boundaries;
219+
- rewind can reverse local edits instead of asking you to clean them up by hand;
220+
- readiness can tell you whether failure is local logic or provider availability.
152221

153-
Additional product-level checks now live in:
222+
## Repository Guide
154223

155-
- `benchmarks/runtime_profile_eval.py`
156-
- `benchmarks/release_readiness.py`
224+
| Path | Role |
225+
| --- | --- |
226+
| `minicode/` | Canonical Python package used by install and tests. |
227+
| `tests/` | Active test suite. |
228+
| `benchmarks/` | Runtime profile and release-readiness runners plus generated reports. |
229+
| `docs/` | Architecture notes, optimization history, and productization reports. |
230+
| `openspec/` | Specs, archived change records, and build/verify planning artifacts. |
231+
| `.mini-code-memory/` | Workspace-level durable memory state created by the runtime. |
232+
| `py-src/minicode/` | Compatibility and migration mirror. |
157233

158234
## Core Modules
159235

160236
| Module | Purpose |
161237
| --- | --- |
162-
| `minicode/agent_loop.py` | Main model/tool loop, runtime event flow, and product-surface integration. |
163-
| `minicode/turn_kernel.py` | Step-policy kernel for phases, widening, verification gates, and typed turn decisions. |
164-
| `minicode/runtime_profiles.py` | Runtime profile definitions such as `single` and `single-deep`. |
165-
| `minicode/cybernetic_orchestrator.py` | Facade for controller lifecycle hooks. |
166-
| `minicode/context_cybernetics.py` | Context sensing, PID control, and compaction loop. |
167-
| `minicode/feedback_controller.py` | Outer-loop system-state to control-signal mapping. |
168-
| `minicode/self_healing_engine.py` | Fault detection and recovery delegation. |
169-
| `minicode/memory_pipeline.py` | Unified memory read/inject/write/maintain facade. |
170-
| `minicode/session.py` | Durable session storage, inspect/replay views, checkpoint trails, and rewind helpers. |
171-
| `minicode/product_surfaces.py` | Readiness, hook, instruction, delegation, and extension-facing summaries. |
172-
| `minicode/release_readiness.py` | Release-oriented runtime smoke and provider-readiness reporting. |
173-
| `minicode/model_switcher.py` | Bounded model/provider fallback selection and failover wiring. |
174-
| `minicode/model_registry.py` | Model selection controller and availability metadata. |
175-
| `minicode/progress_controller.py` | Task health and stall detection. |
238+
| `minicode/agent_loop.py` | Main model and tool loop, runtime event flow, and product integration. |
239+
| `minicode/turn_kernel.py` | Step policy, phase transitions, widening, and verification gates. |
240+
| `minicode/session.py` | Durable sessions, inspect and replay views, checkpoints, and rewind helpers. |
241+
| `minicode/cli_commands.py` | Local product commands such as session, replay, rewind, and readiness. |
242+
| `minicode/memory.py` | Long-term project memory manager and retrieval surface. |
243+
| `minicode/working_memory.py` | Protected working-memory entries that survive compaction pressure. |
244+
| `minicode/memory_pipeline.py` | Closed-loop memory retrieval, injection, reflection writeback, and optimization path. |
245+
| `minicode/product_surfaces.py` | User-facing summaries for readiness, hooks, instructions, delegation, and extensions. |
246+
| `minicode/release_readiness.py` | Release-oriented runtime smoke and provider-readiness checks. |
247+
| `minicode/model_switcher.py` | Bounded fallback and failover selection. |
248+
| `minicode/runtime_profiles.py` | Runtime profiles such as `single` and `single-deep`. |
249+
| `minicode/cybernetic_orchestrator.py` | Runtime control lifecycle facade. |
176250

177251
## MiniCode Family
178252

179253
| Version | Repository | Focus |
180254
| --- | --- | --- |
181-
| TypeScript | [LiuMengxuan04/MiniCode](https://github.com/LiuMengxuan04/MiniCode) | Mainline terminal agent, TUI, MCP, skills, sessions, context controls. |
182-
| Python | [QUSETIONS/MiniCode-Python](https://github.com/QUSETIONS/MiniCode-Python) | Cybernetic Python runtime, session/rewind product surfaces, readiness reporting, and verification-oriented experiments. |
183-
| Rust | [harkerhand/MiniCode-rs](https://github.com/harkerhand/MiniCode-rs/tree/master) | Rust implementation and systems-side experimentation. |
255+
| TypeScript | [LiuMengxuan04/MiniCode](https://github.com/LiuMengxuan04/MiniCode) | Mainline terminal agent, TUI, MCP, skills, sessions, and context controls. |
256+
| Python | [QUSETIONS/MiniCode-Python](https://github.com/QUSETIONS/MiniCode-Python) | Local-first Python runtime with stronger session, rewind, readiness, and observability surfaces. |
257+
| Rust | [harkerhand/MiniCode-rs](https://github.com/harkerhand/MiniCode-rs/tree/master) | Systems-side implementation and experiments. |
184258
| Java | [hobbescalvin414-tech/minicode4j](https://github.com/hobbescalvin414-tech/minicode4j/tree/feat/default-ts-ui) | Java implementation with a TypeScript-style UI direction. |
185259

186260
## Documentation
187261

262+
Start here if you want the deeper implementation and productization record:
263+
264+
265+
- [Chinese README](./README.zh-CN.md)
188266
- [Optimization Summary](./docs/OPTIMIZATION_SUMMARY.md)
189267
- [Memory Theory](./docs/memory_theory.md)
190268
- [Minicode-lite Productization Design](./docs/superpowers/specs/2026-06-05-minicode-lite-productization-design.md)
@@ -194,9 +272,9 @@ Additional product-level checks now live in:
194272

195273
## Design Principles
196274

197-
- Keep the agent loop inspectable.
198-
- Prefer measured runtime signals over hidden prompt magic.
199-
- Apply bounded actions: compact, cap, adjust, recover, rewind, reflect.
200-
- Treat verification and evidence as part of the agent runtime.
201-
- Make sessions, checkpoints, replay, and readiness first-class product surfaces.
202-
- Keep the Python implementation useful as both software and research scaffold.
275+
- Keep the runtime inspectable.
276+
- Treat memory as a controllable runtime subsystem, not an afterthought.
277+
- Prefer measured signals over prompt folklore.
278+
- Make recovery a product feature, not a manual cleanup step.
279+
- Treat verification as part of execution, not just reporting.
280+
- Keep docs aligned with implemented behavior, not future ambition.

0 commit comments

Comments
 (0)