codemini-cli 0.5.9 → 0.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,7 +5,8 @@
5
5
  <h1 align="center">Codemini CLI</h1>
6
6
 
7
7
  <p align="center">
8
- A sharp, controllable coding agent for teams that want the power of modern AI coding without the chaos of an oversized tool surface.
8
+ <b>An extremely restrained coding + tasks CLI.</b><br />
9
+ Every platform. Every terminal. Minimal by design.
9
10
  </p>
10
11
 
11
12
  <p align="center">
@@ -34,193 +35,229 @@
34
35
 
35
36
  ## English
36
37
 
37
- Codemini is a local-first coding assistant with a CLI, a polished browser UI, compact context management, project indexing, skills, personalities, planning, memory, approvals, and Windows-first shell ergonomics.
38
+ ### What is Codemini?
38
39
 
39
- It is built around a simple product bet: coding agents get better when their default surface is smaller, their context is cleaner, and their actions are easier to audit.
40
+ Codemini is a **coding + tasks CLI** built for a simple premise: agentic help should work everywhere, scale from small models to frontier ones, and never waste your context budget.
40
41
 
41
- ### Why It Feels Different
42
+ It is equally at home refactoring a TypeScript codebase, automating a Git workflow, running a multi-step DevOps pipeline, or bulk-processing data files. **It is not limited to writing code** — it is a general-purpose task agent that happens to be very good at code.
42
43
 
43
- | What you get | Why it matters |
44
- | --- | --- |
45
- | **Small default tool surface** | Models spend less time choosing tools and more time doing the next useful thing. |
46
- | **Model-agnostic gateway config** | Works with OpenAI-compatible gateways and internal model providers. |
47
- | **Web UI included** | Sessions, projects, approvals, skills, souls, CodeWiki reports, and runtime status in one local browser app. |
48
- | **Compact context pipeline** | Micro-compact clears stale tool output; macro compact creates continuation summaries before context gets noisy. |
49
- | **Windows and PowerShell first** | Designed for real Windows developer machines, not just Unix demos. |
50
- | **Skills and souls** | Reusable workflows and response personalities without changing core execution policy. |
51
- | **Project index** | Keeps a lightweight `.codemini/` map so the agent can orient quickly. |
52
- | **Built-in safety rails** | Approvals, command policy, safe mode, todo tracking, and reviewable plans. |
44
+ It runs on Windows, macOS, or Linux — in any terminal (PowerShell, bash, zsh, and others). It works with any OpenAI-compatible or Anthropic API, so you are never locked into a single provider. And it gives you **two surfaces** — a rich terminal TUI and a browser-based Web UI — sharing the same sessions and engine.
53
45
 
54
- ### Quick Start
46
+ Codemini can use **two models in one session**: a lightweight model for routing and simple tasks, and a larger model for complex reasoning. Configure both, and the system dispatches work to the right one.
55
47
 
56
- Requires **Node.js 22 or newer**.
48
+ Other built-in capabilities include project indexing, persistent memory with self-evolution via `/reflect`, skill-based workflows, planning mode, approvals, and soul presets that change its tone without changing its behavior.
57
49
 
58
- ```bash
59
- npm install -g codemini-cli
60
- codemini config set gateway.base_url http://your-gateway/v1
61
- codemini config set gateway.api_key your_token
62
- codemini config set model.name your-model
63
- codemini
64
- ```
50
+ No SaaS. No telemetry. No mandatory registration.
65
51
 
66
- Open the Web UI:
52
+ ### Why "Restrained"?
67
53
 
68
- ```bash
69
- codemini --web
70
- ```
54
+ Many coding agents pursue an ever-expanding surface — more tools, more context, more automation. Codemini takes the opposite approach.
71
55
 
72
- On a new machine, the Web UI opens first and lets you configure the gateway from Settings, so a missing or wrong default endpoint does not block startup.
56
+ - **Small dependency footprint.** A focused set of npm packages. No Electron, no Docker, no Python runtime.
57
+ - **Managed context budgets.** Micro-compaction, tool-result spill-to-disk, prompt preflight triggers — designed to stay within your model's window.
58
+ - **Dual-model dispatch.** Configure a lightweight model (for routing and simple tasks) alongside a frontier model (for complex reasoning). Work reaches the right model automatically.
59
+ - **Proportional approvals.** Commands are classified by intent. Read-only operations pass through; destructive actions prompt for confirmation. You control the threshold.
60
+ - **Lazy-loaded skills.** A catalog of 1,000 skills costs the same as 1. Only the invoked skill contributes to the prompt.
61
+ - **Curated memory with self-evolution.** Inbox is temporary by design. The dream loop curates it, and `/reflect` converts successful patterns into reusable skills.
73
62
 
74
- ### Web UI
63
+ It is not about delivering less capability. It is about eliminating what you should not have to carry.
75
64
 
76
- The Web UI is bundled with the npm package and runs locally.
65
+ #### By the Numbers: What "Restrained" Looks Like
66
+
67
+ A typical first-turn system prompt in a real project — with AGENTS.md, an auto skill, memory snapshot, and project context — costs approximately **5,300 tokens**. The breakdown:
77
68
 
78
- ```bash
79
- codemini --web
80
- codemini --web --port 3210 --project /path/to/project
81
- codemini --web --session <session-id> --model <model-name> --no-open
69
+ ```
70
+ base system prompt 2,703 tokens ████████████████░░░░░░░░░ 51%
71
+ AGENTS.md project rules 535 tokens ███░░░░░░░░░░░░░░░░░░░░░ 10%
72
+ auto skill (superpowers) 1,371 tokens ████████░░░░░░░░░░░░░░░░ 26%
73
+ memory snapshot 144 tokens █░░░░░░░░░░░░░░░░░░░░░░░ 3%
74
+ project index snippet 447 tokens ██░░░░░░░░░░░░░░░░░░░░░░ 8%
75
+ reply language wrapper 27 tokens ░░░░░░░░░░░░░░░░░░░░░░░░ 1%
76
+ ─────────────────────────────────────────────────────────────────
77
+ total first turn ~5,300 tokens
82
78
  ```
83
79
 
84
- Highlights:
80
+ By contrast, many alternatives ship **15K–25K tokens** of system prompt before a user's first message. Every installed skill, saved memory, and rule file is poured in unconditionally.
85
81
 
86
- | Area | What it does |
87
- | --- | --- |
88
- | Chat runtime | Uses the same sessions and config as the CLI. |
89
- | Project switcher | Move between repositories and general chat without restarting. |
90
- | Approvals | Review tool calls and plans in focused dialogs/cards. |
91
- | Skills | Create, inspect, install, enable, and disable reusable workflows. |
92
- | Souls | Switch response tone without changing execution logic. |
93
- | CodeWiki | Generate project-requirements reports and ask read-only questions over them. |
94
- | Runtime status | See active mode, git branch, version state, live progress, and context usage. |
82
+ Codemini's restraint is architectural:
95
83
 
96
- Local Web UI development:
84
+ - **Skills lazy-load.** Ten skills installed = same system prompt cost as zero. Only the selected skill's body is loaded.
85
+ - **Memory is curated.** Inbox is temporary noise; only promoted memories enter the prompt. You control the volume.
86
+ - **Project index is compact.** Symbol maps replace raw file trees. An entire repository fits in a few hundred tokens.
87
+ - **No hidden payloads.** No telemetry scripts, no usage trackers, no injected context you did not request.
88
+
89
+ The principle is straightforward: **less prompt tax means more budget for actual work.**
90
+
91
+ ### Quick Start
97
92
 
98
93
  ```bash
99
- cd codemini-web
100
- bun install
101
- bun run dev
94
+ # Install globally
95
+ npm install -g codemini-cli
96
+
97
+ # Configure your gateway
98
+ codemini config set gateway.base_url http://127.0.0.1:8000/v1
99
+ codemini config set gateway.api_key your_api_key
100
+ codemini config set model.name your_model_name
101
+
102
+ # Start a session
103
+ codemini
102
104
  ```
103
105
 
104
- Single built server:
106
+ Three commands, and you are in an interactive session.
107
+
108
+ ### Beyond Code: Automated Tasks
109
+
110
+ Codemini's `codemini run` command turns any natural-language task into an automated workflow — no coding required.
105
111
 
106
112
  ```bash
107
- cd codemini-web
108
- npm run build
109
- npm run start -- --port 3210
110
- ```
113
+ # Interactive session (chat)
114
+ codemini "Summarize the recent Git history and write a CHANGELOG.md"
111
115
 
112
- ### Command Surface
116
+ # One-off task
117
+ codemini run "Find all .env files in this repo and check for hardcoded secrets"
113
118
 
114
- | Command | Description |
115
- | --- | --- |
116
- | `codemini [prompt]` | Start an interactive coding session. |
117
- | `codemini chat [prompt]` | Chat mode for single-turn or multi-turn use. |
118
- | `codemini run <task>` | Run a coding task non-interactively. |
119
- | `codemini run --harness <role> <task>` | Run with a specific sub-agent role such as `coder`, `planner`, or `reviewer`. |
120
- | `codemini run --pipeline <task>` | Run planning, implementation, and review as a pipeline. |
121
- | `codemini --web` | Launch the local Web UI. |
122
- | `codemini config set|get|list <key> [value]` | Manage gateway, model, shell, UI, context, memory, and soul settings. |
123
- | `codemini doctor` | Run environment diagnostics. |
124
- | `codemini skill list|install|enable|disable|inspect|reindex` | Manage builtin, project, and global skills. |
119
+ # Multi-role harness planner + coder + reviewer in sequence
120
+ codemini run --harness coder "Refactor the auth module to extract middleware"
125
121
 
126
- ### Context Compacting
122
+ # Pipeline — sequential steps with artifact passing
123
+ codemini run --pipeline "Bump version, update CHANGELOG, and create a GitHub release draft"
124
+ ```
127
125
 
128
- Codemini keeps long sessions usable with a two-phase compact pipeline:
126
+ Common non-coding task examples:
129
127
 
130
- 1. **Micro compact** replaces old tool result bodies with a lightweight marker while preserving message order.
131
- 2. **Macro compact** summarizes older context and keeps a legal recent message window for model APIs.
128
+ | Task | Command |
129
+ | --- | --- |
130
+ | **System diagnostics** | `codemini run "Check disk usage, top 5 memory processes, and recent error logs"` |
131
+ | **Git batch operations** | `codemini run "Squash the last 3 commits with message 'fix: pagination edge cases'"` |
132
+ | **Data migration** | `codemini run "Read users.csv, normalize emails, deduplicate by ID, write to users.json"` |
133
+ | **Release prep** | `codemini run --pipeline "Bump patch version, update CHANGELOG, git tag, build"` |
134
+ | **Dependency audit** | `codemini run "List all outdated npm packages and summarize breaking changes"` |
135
+ | **Project cleanup** | `codemini run "Find orphaned test fixtures and temporary debug logs"` |
132
136
 
133
- The compact view is stored with the session, so follow-up prompts continue from the compressed context while the full transcript remains available in history.
137
+ The `--harness` flag assigns a **role** (`planner`, `advisor`, `coder`, `reviewer`, `tester`) that constrains tool access. The `--pipeline` flag runs a multi-step plan where each step's output feeds the next. Both modes turn Codemini into a headless task agent — like Claude Code, but running entirely on your machine, with your model, under your approval policy.
134
138
 
135
- ### Skills
139
+ | What | Why it matters |
140
+ | --- | --- |
141
+ | **🧠 Persistent Memory** | `/capture` → inbox → dream consolidation → user, global, and project memory tiers. Your agent learns from your project. |
142
+ | **📂 Project Index** | Automatic `.codemini/` index with languages, symbols, imports, and exports. Refreshed incrementally after every edit. |
143
+ | **🛠 Skills System** | Decoupled routing metadata with lazy-loaded `SKILL.md` bodies. Bring your own workflow or choose from built-in presets. |
144
+ | **🔄 Self-Evolution** | `/reflect` converts successful workflows into reusable, reviewable `SKILL.md` files. Your toolset grows with your project. |
145
+ | **⚡ Dual-Model Dispatch** | Configure a fast, lightweight model alongside a capable frontier model. The system routes each task to the appropriate one. |
146
+ | **🖥 Terminal TUI** | Rich, interactive terminal UI with spinner animations, syntax-highlighted code blocks, live command output, and real-time status. |
147
+ | **🕸 Web UI** | Full browser interface — same engine, shared sessions. Switch between terminal and browser freely. |
148
+ | **🎭 Souls** | Tone presets (`professional`, `playful`, `anime`, `caveman`…) that change expression without affecting execution policy. |
149
+ | **📋 Planning Mode** | Multi-step plans with file paths, verification steps, and explicit approval before execution. |
150
+ | **🔒 Approvals** | Commands classified by risk level. Read-only passes; destructive operations pause for confirmation. Configurable thresholds. |
151
+ | **💾 Session Checkpoints** | Save, branch, or replay session state. Context is preserved across crashes and model errors. |
152
+ | **🌍 Cross-Platform** | PowerShell on Windows, bash/zsh on macOS and Linux — same tool, same configuration format, same behavior. |
136
153
 
137
- Skills are reusable workflow instructions that can be triggered explicitly or injected automatically when relevant.
154
+ ### Skills
138
155
 
139
- Bundled skills:
156
+ Skills are reusable, reviewable workflow recipes. Built-in:
140
157
 
141
- | Skill | Use case |
158
+ | Skill | When to use |
142
159
  | --- | --- |
143
- | `superpowers-lite` | Default coding workflow: inspect, plan only when useful, edit narrowly, verify. |
144
- | `grill-me` | Pressure-test plans, PRs, launches, or ideas. |
145
- | `brainstorm` | Explore several reasonable approaches before coding. |
146
- | `writing-plans` | Produce implementation plans with exact files and checks. |
160
+ | `superpowers-lite` | Default coding flow: inspect, plan when needed, edit narrowly, verify. |
161
+ | `grill-me` | Stress-test a plan, PR, release, or idea before committing. |
162
+ | `brainstorm` | Compare options when multiple approaches are reasonable. |
163
+ | `writing-plans` | Generate an implementation plan with file paths and verification steps. |
147
164
 
148
165
  ```bash
149
166
  codemini skill list
150
167
  codemini skill install <path>
151
- codemini skill install --scope=global <path>
152
168
  codemini skill inspect <name>
169
+ codemini skill enable <name>
170
+ codemini skill disable <name>
171
+ codemini skill reindex
153
172
  ```
154
173
 
155
- Routing metadata is kept in a top-level catalog, so third-party `SKILL.md` files can stay unchanged:
174
+ Skills use a flat catalog (`codemini.skills.json`) with lightweight routing metadata — `description`, `mode`, `triggers`, `enabled`, `priority`. Codemini reads only this metadata at startup; the full `SKILL.md` is loaded only when a skill is selected or invoked. If the catalog is missing, the system falls back to `SKILL.md` frontmatter.
156
175
 
157
- ```text
158
- skills/codemini.skills.json
159
- .codemini/skills/codemini.skills.json
160
- ```
176
+ Invoke any enabled skill as a slash command inside a session, or pass the slash command as a one-off prompt:
161
177
 
162
- The catalog stores lightweight routing fields such as `description`, `mode`, `triggers`, `enabled`, and `priority`. Codemini reads that metadata at startup and loads the full `SKILL.md` body only when a skill is selected or invoked. If the catalog is missing or incomplete, Codemini falls back to the skill directory and `SKILL.md` frontmatter.
178
+ ```bash
179
+ # Inside an interactive session
180
+ /grill-me review this release plan before I tag it
181
+ /writing-plans add OAuth refresh-token rotation
182
+
183
+ # One-off invocation from your shell
184
+ codemini '/brainstorm compare SQLite, Postgres, and DuckDB for local analytics'
185
+ codemini '/project-requirements generate a CodeWiki report for this repository'
186
+ ```
163
187
 
164
- ### Souls
188
+ ### Terminal TUI & Web UI
165
189
 
166
- Souls change tone and expression style without changing tool policy or execution behavior.
190
+ Codemini gives you **two surfaces** powered by the same engine.
167
191
 
168
- Built-in presets:
192
+ **Terminal TUI** — rich interactive interface with spinner animations for long-running tasks, syntax-highlighted code blocks, live command output streaming, and a command palette with autocomplete. Runs in any terminal emulator; no separate process needed.
169
193
 
170
- ```text
171
- default, professional, ceo, playful, anime, caveman, pirate
172
- ```
194
+ **Web UI** — full browser interface sharing the same session state:
173
195
 
174
196
  ```bash
175
- codemini config set soul.preset professional
197
+ codemini --web
176
198
  ```
177
199
 
178
- Safe mode normally restricts file tools and absolute shell paths to the current workspace. Add explicit extra roots when a project needs shared assets or sibling repositories:
200
+ Sessions are shared between terminal and browser switch freely. From an active CLI session, type `web` to launch the browser UI.
179
201
 
180
- ```bash
181
- codemini config set policy.allowed_paths '["D:\\shared-assets","E:\\sibling-repo"]'
182
- ```
202
+ Additional Web UI options (port, project directory, session, model) are available via flags like `--port`, `--project`, `--session`, `--model`, `--no-open`.
203
+
204
+ **Souls** — change the agent's tone without changing behavior. Built-in presets: `default`, `professional`, `ceo`, `playful`, `anime`, `caveman`, `pirate`. Configure with `codemini config set soul.preset professional`.
183
205
 
184
- ### Memory And Dream Loop
206
+ ### Memory, Self-Evolution & Dream Loop
185
207
 
186
- Codemini has native memory tools and slash commands:
208
+ Codemini's memory system is designed to **learn from your work**, not just store facts.
187
209
 
188
210
  | Command | Purpose |
189
211
  | --- | --- |
190
- | `/capture <summary>` | Capture a high-signal observation into inbox. |
212
+ | `/capture <summary>` | Record a signal into the inbox. |
191
213
  | `/inbox` | Review pending memory evidence. |
192
214
  | `/dream [--dry-run]` | Consolidate inbox entries into durable user/global/project memory. |
193
- | `/reflect` | Turn a successful workflow into a reviewed `SKILL.md` draft. |
215
+ | `/reflect` | Convert a successful workflow pattern into a reviewable `SKILL.md` — your toolset evolves as you work. |
194
216
 
195
- Inbox is intentionally temporary and noisy. Dream consolidation decides what deserves promotion into longer-term memory.
217
+ The inbox is intentionally noisy. The dream loop determines what deserves promotion into longer-term storage. And `/reflect` closes the loop: a pattern you've repeated successfully becomes a reusable skill, reviewed and versioned alongside your project.
196
218
 
197
- ### Project Index
219
+ Typical reflect loop:
198
220
 
199
- Codemini maintains a lightweight project map under `.codemini/`:
221
+ ```bash
222
+ # 1. Finish a workflow that worked well, then ask Codemini to extract the pattern.
223
+ /reflect preserve the provider tool-call recovery workflow from the last task
200
224
 
201
- | File | Purpose |
202
- | --- | --- |
203
- | `.codemini/project-map.json` | Languages, roots, tests, entry candidates, and repo-level facts. |
204
- | `.codemini/file-index.json` | Imports, exports, functions, classes, and symbol hints. |
225
+ # 2. Review the generated draft in the TUI/Web UI.
226
+ /yes
205
227
 
206
- The index is initialized when entering a project and refreshed after edits/writes/patches.
228
+ # 3. Codemini writes .codemini/skills/provider-tool-call-recovery/SKILL.md
229
+ # and immediately exposes it as a slash skill.
230
+ /provider-tool-call-recovery fix the same issue in the Anthropic adapter
207
231
 
208
- ### Optional Accelerators
232
+ # 4. The same skill can also be launched directly from the shell.
233
+ codemini '/provider-tool-call-recovery audit provider message conversion'
234
+ ```
209
235
 
210
- FFF search acceleration:
236
+ Use `--scope=global` when the workflow should follow you across repositories:
211
237
 
212
238
  ```bash
213
- codemini doctor
239
+ /reflect --scope=global turn the release checklist I just used into a reusable skill
240
+ codemini '/release-checklist prepare a patch release'
214
241
  ```
215
242
 
216
- If `fff-mcp` is present in `PATH`, Codemini can use it for faster `grep`, `glob`, and selected `list` paths. If it is missing, built-in search is used.
243
+ ### Project Index & Code Intelligence
217
244
 
218
- Playwright rendering for JavaScript-heavy pages:
245
+ Codemini builds a lightweight but precise code index for every project you work in. It uses **Tree-sitter AST parsing** to extract symbols — not naive regex or line counting.
219
246
 
220
- ```bash
221
- npm install -g playwright
222
- playwright install chromium
223
- ```
247
+ | File | Content |
248
+ | --- | --- |
249
+ | `.codemini/project-map.json` | Languages, source roots, test directories, entry candidates, repository facts. |
250
+ | `.codemini/file-index.json` | Per-file imports, exports, function and class declarations, interfaces, type aliases — extracted via language-aware AST queries. |
251
+
252
+ The index powers every code-aware tool in the system:
253
+
254
+ - **`grep` and `glob`** use the file map to skip irrelevant directories (node_modules, build artifacts, .git) before touching the filesystem.
255
+ - **`ast_query` / `read_ast_node`** resolve symbol targets to precise line and column ranges, enabling surgical edits without manual offset math.
256
+ - **`read` with AST context** can return enclosing function bodies or class definitions around a cursor position.
257
+
258
+ Index freshness is maintained incrementally: after every `edit`, `write`, or `patch` call, only the affected file is re-parsed and its index entry replaced. No full rebuild on every change.
259
+
260
+ Language support covers JavaScript, TypeScript, TSX, Python, Go, C, C++, Rust, Java, C#, PHP, Ruby, and Bash — each with a dedicated Tree-sitter grammar.
224
261
 
225
262
  ### Data Paths
226
263
 
@@ -230,9 +267,22 @@ playwright install chromium
230
267
  | Project state | `.codemini/` |
231
268
  | Project skills | `.codemini/skills/<name>/SKILL.md` |
232
269
  | Global skills | `<base-config-dir>/skills/<name>/SKILL.md` |
233
- | Windows config | `%APPDATA%\codemini-global\` |
234
- | macOS config | `~/Library/Preferences/codemini-global` |
235
- | Linux/XDG config | `$XDG_CONFIG_HOME/codemini-global` |
270
+ | Windows | `%APPDATA%\codemini-global\` |
271
+ | macOS | `~/Library/Preferences/codemini-global` |
272
+ | Linux / XDG | `$XDG_CONFIG_HOME/codemini-global` |
273
+
274
+ The base config directory can be overridden via the `CODEMINI_GLOBAL_DIR` environment variable.
275
+
276
+ ### Optional Accelerators
277
+
278
+ **FFF search acceleration:** `codemini doctor` checks for `fff-mcp` in the system PATH and uses it for faster `grep`, `glob`, and selected `list` operations. Falls back to built-in search if unavailable.
279
+
280
+ **Playwright rendering** for JavaScript-heavy pages:
281
+
282
+ ```bash
283
+ npm install -g playwright
284
+ playwright install chromium
285
+ ```
236
286
 
237
287
  ### Development
238
288
 
@@ -242,7 +292,7 @@ npm test
242
292
  npm start
243
293
  ```
244
294
 
245
- Build the bundled Web UI:
295
+ Build the Web UI bundle for production:
246
296
 
247
297
  ```bash
248
298
  npm run build:web
@@ -250,9 +300,9 @@ npm run build:web
250
300
 
251
301
  ### Documentation
252
302
 
253
- - [OPERATIONS.md](./OPERATIONS.md) - day-to-day operator guide
254
- - [deployment.md](./deployment.md) - packaging, installation, and deployment
255
- - [Releases](https://github.com/havingautism/Codemini-CLI/releases) - changelog
303
+ - [OPERATIONS.md](./OPERATIONS.md) daily operations manual
304
+ - [deployment.md](./deployment.md) packaging, installation, deployment
305
+ - [Releases](https://github.com/havingautism/Codemini-CLI/releases)
256
306
 
257
307
  ### License
258
308
 
@@ -264,193 +314,229 @@ npm run build:web
264
314
 
265
315
  ## 简体中文
266
316
 
267
- Codemini 是一个本地优先的 coding agent:既有 CLI,也有精致的本地 Web UI;内置上下文压缩、项目索引、Skills、Souls、计划审批、记忆演化和 Windows / PowerShell 友好的执行体验。
317
+ ### Codemini 是什么?
268
318
 
269
- 它的核心判断很简单:coding agent 不应该默认暴露一堆工具、塞满上下文、让用户看不清它做了什么。Codemini 选择更小的默认工具面、更干净的上下文、更可审计的执行链路。
319
+ **一款刻意保持克制的 coding + tasks CLI。** 不仅能写代码——Git 工作流自动化、DevOps 流水线、数据批量处理、系统诊断,它都能干。
270
320
 
271
- ### 为什么看起来更像一个产品
321
+ 兼容 Windows PowerShell、macOS zsh、Linux bash 等各种终端环境。兼容任何 OpenAI 兼容或 Anthropic 的 API,不绑定特定模型或提供商。提供**双界面**——基于 Ink + React 构建的终端 TUI 和浏览器 Web UI——共享同一引擎和会话。
272
322
 
273
- | 你得到什么 | 为什么重要 |
274
- | --- | --- |
275
- | **精简默认工具面** | 模型少犹豫,少乱走,优先做下一件有用的事。 |
276
- | **模型网关可配置** | 支持 OpenAI 兼容接口,也适合内部模型网关。 |
277
- | **内置 Web UI** | 会话、项目、审批、技能、人格、CodeWiki、运行状态集中管理。 |
278
- | **上下文压缩链路** | micro compact 清理旧工具输出,macro compact 生成可继续工作的摘要。 |
279
- | **Windows / PowerShell 一等支持** | 面向真实 Windows 开发机,而不是只适配 Unix demo。 |
280
- | **Skills 和 Souls** | 把稳定工作流沉淀成技能,把回复风格和执行逻辑分开。 |
281
- | **轻量项目索引** | 在 `.codemini/` 里维护事实索引,让模型更快理解仓库。 |
282
- | **安全和审计** | 审批、命令策略、safe mode、todo、计划卡片都内置。 |
323
+ 支持**大小模型协同工作**:配置一个轻量模型处理路由和简单任务,一个大模型负责复杂推理,系统自动调度。
283
324
 
284
- ### 快速开始
325
+ 其他内置能力包括项目索引、持久记忆与 `/reflect` 自我进化、技能工作流、计划模式、审批机制,以及仅改变语气不改变行为的人格预设(Souls)。
285
326
 
286
- 需要 **Node.js 22 或更高版本**。
327
+ 无需 SaaS、无需遥测、无需注册。
287
328
 
288
- ```bash
289
- npm install -g codemini-cli
290
- codemini config set gateway.base_url http://your-gateway/v1
291
- codemini config set gateway.api_key your_token
292
- codemini config set model.name your-model
293
- codemini
294
- ```
329
+ ### 「克制」体现在哪里?
295
330
 
296
- 启动 Web UI:
331
+ 当前多数 AI 编码工具的策略是做加法——不断堆叠工具、上下文、自动化能力。Codemini 选择了相反的方向。
297
332
 
298
- ```bash
299
- codemini --web
300
- ```
333
+ - **依赖极简。** 仅依赖少量精选的 npm 包。没有 Electron、Docker 或 Python 运行时。
334
+ - **上下文预算可控。** 微压缩、工具结果溢出到磁盘、提示预检触发——为控制模型窗口使用而设计。
335
+ - **大小模型协同。** 配置一个轻量模型处理路由和简单任务,一个大模型负责复杂推理,系统自动分派。
336
+ - **审批有度。** 命令按意图分级:只读操作直接放行,破坏性操作暂停确认。阈值由你设定。
337
+ - **技能懒加载。** 注册 1,000 个技能与注册 1 个的开销相同。只有被实际调用的技能才会进入提示上下文。
338
+ - **记忆择优而存,自我进化。** Inbox 本质上是临时草稿箱,Dream 循环决定晋升内容,`/reflect` 把成功工作流沉淀为可复用的 skill。
301
339
 
302
- 新电脑上即使默认接口还没配置好,Web UI 也会先打开,然后在设置里配置 Base URL、API Key 和模型,不会因为默认接口 404 卡住启动。
340
+ 并非功能更少,而是不背负不必要的负担。
303
341
 
304
- ### Web UI
342
+ #### 数据视角:「克制」的实际效果
305
343
 
306
- Web UI npm 包一起发布,本地运行:
344
+ 一个真实项目的首轮 system prompt——包含 AGENTS.md、auto skill、记忆快照和项目上下文——大约消耗 **5,300 tokens**。具体构成如下:
307
345
 
308
- ```bash
309
- codemini --web
310
- codemini --web --port 3210 --project /path/to/project
311
- codemini --web --session <session-id> --model <model-name> --no-open
346
+ ```
347
+ 基础 system prompt 2,703 tokens ████████████████░░░░░░░░░ 51%
348
+ AGENTS.md 项目规则 535 tokens ███░░░░░░░░░░░░░░░░░░░░░ 10%
349
+ auto skill(superpowers) 1,371 tokens ████████░░░░░░░░░░░░░░░░ 26%
350
+ 记忆快照 144 tokens █░░░░░░░░░░░░░░░░░░░░░░░ 3%
351
+ 项目索引片段 447 tokens ██░░░░░░░░░░░░░░░░░░░░░░ 8%
352
+ 回复语言包装 27 tokens ░░░░░░░░░░░░░░░░░░░░░░░░ 1%
353
+ ─────────────────────────────────────────────────────────────────
354
+ 首轮总计 ~5,300 tokens
312
355
  ```
313
356
 
314
- 能力概览:
357
+ 相比之下,许多同类工具在用户发出第一条消息之前,**system prompt 已占用 15K–25K tokens**。每安装一个 skill、每保存一条记忆、每编写一个规则文件,都会无条件注入。
315
358
 
316
- | 区域 | 作用 |
317
- | --- | --- |
318
- | 对话运行时 | 复用 CLI 的会话和配置。 |
319
- | 项目切换 | 不重启进程也能切换仓库和普通会话。 |
320
- | 审批 | 用弹窗/卡片审阅工具调用和计划。 |
321
- | Skills | 创建、查看、安装、启用、禁用可复用工作流。 |
322
- | Souls | 切换表达风格,不影响执行策略。 |
323
- | CodeWiki | 生成项目需求报告,并基于报告做只读问答。 |
324
- | 运行状态 | 展示执行模式、git 分支、版本状态、实时进度和上下文占用。 |
359
+ Codemini 的克制源自架构设计:
325
360
 
326
- 本地开发:
361
+ - **Skill 懒加载。** 安装 10 个 skill 与安装 0 个,system prompt 开销相同。只有被命中的 skill 才会加载完整内容。
362
+ - **记忆有筛选。** Inbox 是临时噪声层,只有经过晋升的记忆才会进入提示上下文。你控制水位。
363
+ - **项目索引紧凑。** 符号映射替代原始文件树。整个仓库仅需数百 token。
364
+ - **无隐藏负担。** 没有遥测脚本、用量追踪,或未经你要求注入的上下文。
365
+
366
+ 核心逻辑很简单:**prompt 税越少,留给实际工作的预算就越多。**
367
+
368
+ ### 快速开始
327
369
 
328
370
  ```bash
329
- cd codemini-web
330
- bun install
331
- bun run dev
371
+ # 全局安装
372
+ npm install -g codemini-cli
373
+
374
+ # 配置网关
375
+ codemini config set gateway.base_url http://127.0.0.1:8000/v1
376
+ codemini config set gateway.api_key 你的 API Key
377
+ codemini config set model.name 你的模型名称
378
+
379
+ # 启动会话
380
+ codemini
332
381
  ```
333
382
 
334
- 构建后单进程运行:
383
+ 三步完成配置,进入交互式会话。
384
+
385
+ ### 不止写代码:自动化任务
386
+
387
+ `codemini run` 可以把任何自然语言任务变成自动化工作流——不需要写脚本。
335
388
 
336
389
  ```bash
337
- cd codemini-web
338
- npm run build
339
- npm run start -- --port 3210
390
+ # 交互式会话
391
+ codemini "查看最近的 Git 提交历史,生成一份 CHANGELOG.md"
392
+
393
+ # 一次性任务
394
+ codemini run "扫描项目中所有 .env 文件,检查是否有硬编码密钥"
395
+
396
+ # 多角色组合 — planner + coder + reviewer 接力
397
+ codemini run --harness coder "重构 auth 模块,抽离中间件"
398
+
399
+ # 流水线 — 多步骤任务,步骤间传递产物
400
+ codemini run --pipeline "升级版本号、更新 CHANGELOG、创建 GitHub release 草稿"
340
401
  ```
341
402
 
342
- ### 命令概览
403
+ 非编码任务举例如下:
343
404
 
344
- | 命令 | 说明 |
405
+ | 任务 | 命令 |
345
406
  | --- | --- |
346
- | `codemini [prompt]` | 启动交互式编码会话。 |
347
- | `codemini chat [prompt]` | 单轮或多轮对话模式。 |
348
- | `codemini run <task>` | 非交互式执行编码任务。 |
349
- | `codemini run --harness <role> <task>` | 用指定 sub-agent 角色执行任务。 |
350
- | `codemini run --pipeline <task>` | 计划、实现、审查流水线。 |
351
- | `codemini --web` | 打开本地 Web UI。 |
352
- | `codemini config set|get|list <key> [value]` | 管理网关、模型、shell、UI、上下文、记忆、人格配置。 |
353
- | `codemini doctor` | 环境诊断。 |
354
- | `codemini skill list|install|enable|disable|inspect|reindex` | 管理内置、项目级、全局 Skills。 |
407
+ | **系统诊断** | `codemini run "检查磁盘使用率、Top 5 内存进程、最近错误日志"` |
408
+ | **Git 批量操作** | `codemini run "把最近 3 commit 压缩成一个,提交信息为 fix: pagination edge cases"` |
409
+ | **数据迁移** | `codemini run "读取 users.csv,标准化邮箱字段,按 ID 去重,写入 users.json"` |
410
+ | **版本发布** | `codemini run --pipeline "升级 patch 版本、更新 CHANGELOG、git tag、构建"` |
411
+ | **依赖审计** | `codemini run "列出所有过时的 npm 包,概述 breaking changes"` |
412
+ | **项目清理** | `codemini run "查找孤立的测试 fixture 文件和临时调试日志"` |
355
413
 
356
- ### 上下文压缩
414
+ `--harness` 参数指定一个**角色**(`planner`、`advisor`、`coder`、`reviewer`、`tester`),每个角色有独立的工具访问权限。`--pipeline` 执行多步骤计划,每步输出自动传入下一步。两种模式让 Codemini 变成无头任务 agent——类似 Claude Code,但完全运行在你的机器上、使用你的模型、遵循你的审批策略。
357
415
 
358
- Codemini 用两阶段 compact 保持长会话可继续:
416
+ ### 功能速览
359
417
 
360
- 1. **Micro compact**:把旧 tool result 正文替换成轻量标记,保留消息顺序。
361
- 2. **Macro compact**:把旧上下文总结成 continuation summary,并保留合法的最近消息窗口。
362
-
363
- compact view 会写入 session,后续提问使用压缩视图继续;完整历史仍留在 session 里。
418
+ | 功能 | 说明 |
419
+ | --- | --- |
420
+ | **🧠 持久记忆** | `/capture` → inbox → dream 整理 → 用户/全局/项目三层记忆。让 agent 记住项目上下文。 |
421
+ | **📂 项目索引** | 自动维护 `.codemini/` 索引,记录语言、符号、导入导出关系。编辑后增量刷新。 |
422
+ | **🛠 技能系统** | 路由元数据与技能体分离。可自行编写 `SKILL.md`,也可使用内置工作流。 |
423
+ | **🔄 自我进化** | `/reflect` 把成功工作流转化为可复用的 `SKILL.md`。你的工具箱随项目成长。 |
424
+ | **⚡ 大小模型协同** | 配置轻量模型做路由与简单任务,大模型做复杂推理,系统自动分派。 |
425
+ | **🖥 终端 TUI** | 富交互终端界面——旋转动画、语法高亮代码块、实时命令输出流、自动补全命令面板。 |
426
+ | **🕸 Web UI** | 浏览器界面,同一引擎。终端与浏览器共享会话,可随时切换。 |
427
+ | **🎭 Souls 人格** | 预设语气(专业、活泼、动漫、原始人……),只改变表达方式,不改变执行策略。 |
428
+ | **📋 计划模式** | 多步骤实施计划,包含文件路径与验证步骤,执行前需确认。 |
429
+ | **🔒 命令审批** | 按风险分级:只读操作直接放行,破坏性操作暂停确认。阈值可配置。 |
430
+ | **💾 会话检查点** | 随时保存、回退、分支会话状态。崩溃或模型异常不丢失上下文。 |
431
+ | **🌍 全平台支持** | Windows PowerShell、macOS zsh、Linux bash——同一套配置,同一套行为。 |
364
432
 
365
433
  ### Skills
366
434
 
367
- Skill 是可复用工作流,可以显式触发,也可以在适合时自动注入。
368
-
369
- 内置 Skills:
435
+ Skills 是可复用、可审阅的工作流配方。内置:
370
436
 
371
437
  | Skill | 适用场景 |
372
438
  | --- | --- |
373
- | `superpowers-lite` | 默认编码流程:先理解、必要时计划、小范围编辑、验证后报告。 |
374
- | `grill-me` | 对方案、PR、发布、想法做压力测试。 |
375
- | `brainstorm` | 多种方案都合理时,先比较选项再动手。 |
376
- | `writing-plans` | 生成带文件路径和验证步骤的实施计划。 |
439
+ | `superpowers-lite` | 默认编码流程:先了解、必要时计划、小范围修改、验证后汇报。 |
440
+ | `grill-me` | 对方案、PR、发布、想法做压力测试,发现潜在问题。 |
441
+ | `brainstorm` | 多种方案难以抉择时,先比较选项再行动。 |
442
+ | `writing-plans` | 生成包含文件路径和验证步骤的实施计划。 |
377
443
 
378
444
  ```bash
379
445
  codemini skill list
380
446
  codemini skill install <path>
381
- codemini skill install --scope=global <path>
382
447
  codemini skill inspect <name>
448
+ codemini skill enable <name>
449
+ codemini skill disable <name>
450
+ codemini skill reindex
383
451
  ```
384
452
 
385
- 路由元数据集中放在顶层 catalog,第三方 `SKILL.md` 可以保持原样:
453
+ 路由元数据集中在顶层 catalog(`codemini.skills.json`),仅存储 `description`、`mode`、`triggers`、`enabled`、`priority` 等轻量字段。启动时不读取完整 `SKILL.md`,仅在被命中或显式调用时才加载。catalog 缺失时回退到目录和 frontmatter。
386
454
 
387
- ```text
388
- skills/codemini.skills.json
389
- .codemini/skills/codemini.skills.json
390
- ```
455
+ 任何启用的 skill 都可以在会话里当作 slash command 调用,也可以作为一次性 prompt 从 shell 直接启动:
391
456
 
392
- catalog 维护 `description`、`mode`、`triggers`、`enabled`、`priority` 等轻量路由字段。Codemini 启动时只读取这些元数据,只有 skill 被命中或显式调用时才读取完整 `SKILL.md`。如果 catalog 缺失或不完整,会回退到 skill 目录和 `SKILL.md` frontmatter。
457
+ ```bash
458
+ # 在交互式会话中
459
+ /grill-me 帮我审一遍这个发布方案再打 tag
460
+ /writing-plans 设计 OAuth refresh-token 轮换方案
393
461
 
394
- ### Souls
462
+ # 从 shell 一次性调用
463
+ codemini '/brainstorm 比较 SQLite、Postgres 和 DuckDB 做本地分析的取舍'
464
+ codemini '/project-requirements 为当前仓库生成一份 CodeWiki 报告'
465
+ ```
395
466
 
396
- Soul 只改变语气和表达风格,不改变工具策略或执行逻辑。
467
+ ### 终端 TUI 与 Web UI
397
468
 
398
- 内置预设:
469
+ Codemini 提供**双界面**,由同一引擎驱动。
399
470
 
400
- ```text
401
- default, professional, ceo, playful, anime, caveman, pirate
402
- ```
471
+ **终端 TUI**——富交互界面,支持长时间任务的旋转动画、语法高亮的代码块、实时命令输出流、以及带自动补全的命令面板。在任何终端模拟器中运行,无需额外进程。
472
+
473
+ **Web UI**——完整的浏览器界面,与会话状态实时同步:
403
474
 
404
475
  ```bash
405
- codemini config set soul.preset professional
476
+ codemini --web
406
477
  ```
407
478
 
408
- Safe mode 默认把文件工具和 shell 绝对路径限制在当前工作区。需要访问共享素材或兄弟仓库时,可以显式加入额外根目录:
479
+ 终端与浏览器共享会话,可自由切换。活动的 CLI 会话中输入 `web` 也可启动 Web UI。
409
480
 
410
- ```bash
411
- codemini config set policy.allowed_paths '["D:\\shared-assets","E:\\sibling-repo"]'
412
- ```
481
+ 更多 Web UI 选项(端口、项目目录、会话、模型等)通过 `--port`、`--project`、`--session`、`--model`、`--no-open` 等参数配置。
413
482
 
414
- ### 记忆与 Dream Loop
483
+ **Souls**——改变 agent 语气的预设(`default`、`professional`、`ceo`、`playful`、`anime`、`caveman`、`pirate`),不影响执行策略。配置:`codemini config set soul.preset professional`。
415
484
 
416
- Codemini 内置记忆工具和斜杠命令:
485
+ ### 记忆、自我进化与 Dream Loop
486
+
487
+ Codemini 的记忆系统设计为**从你的工作中学习**,而不仅仅是存储事实。
417
488
 
418
489
  | 命令 | 作用 |
419
490
  | --- | --- |
420
- | `/capture <summary>` | 捕获高信号观察到 inbox。 |
421
- | `/inbox` | 查看待整理记忆证据。 |
422
- | `/dream [--dry-run]` | inbox 整理进长期/项目记忆。 |
423
- | `/reflect` | 把成功工作流沉淀成可审阅的 `SKILL.md` 草稿。 |
491
+ | `/capture <summary>` | 将高信号观察记录到 inbox。 |
492
+ | `/inbox` | 查看待整理的记忆素材。 |
493
+ | `/dream [--dry-run]` | inbox 整理到用户/全局/项目三层长期记忆。 |
494
+ | `/reflect` | 将成功的工作流模式沉淀为可审阅的 `SKILL.md`——你的工具箱随工作进化。 |
424
495
 
425
- Inbox 是临时的、可能带噪的证据层;Dream consolidation 决定哪些内容值得晋升为长期记忆。
496
+ Inbox 本质上是临时噪声层。Dream 循环决定哪些内容值得晋升。而 `/reflect` 完成了闭环:一个被你反复验证成功的工作模式,变成可复用的 skill,跟项目一起版本化管理。
426
497
 
427
- ### 项目索引
498
+ 典型的 reflect 闭环:
428
499
 
429
- Codemini 会维护 `.codemini/` 轻量索引:
500
+ ```bash
501
+ # 1. 完成一次效果很好的工作流后,让 Codemini 提炼可复用模式。
502
+ /reflect 把刚才 provider tool-call 修复成功的链路沉淀成 skill
430
503
 
431
- | 文件 | 作用 |
432
- | --- | --- |
433
- | `.codemini/project-map.json` | 语言、源码目录、测试目录、入口候选和仓库事实。 |
434
- | `.codemini/file-index.json` | imports、exports、functions、classes 和 symbol 提示。 |
504
+ # 2. TUI/Web UI 中审阅生成的草稿。
505
+ /yes
435
506
 
436
- 进入项目时初始化,编辑/写入/patch 后增量刷新。
507
+ # 3. Codemini 写入 .codemini/skills/provider-tool-call-recovery/SKILL.md
508
+ # 并立即暴露为 slash skill。
509
+ /provider-tool-call-recovery 把同类问题修到 Anthropic adapter
437
510
 
438
- ### 可选增强
511
+ # 4. 也可以从 shell 直接一次性启动这个 skill。
512
+ codemini '/provider-tool-call-recovery 审计 provider message conversion'
513
+ ```
439
514
 
440
- FFF 搜索加速:
515
+ 如果这个工作流应该跨项目复用,可以写成全局 skill:
441
516
 
442
517
  ```bash
443
- codemini doctor
518
+ /reflect --scope=global 把刚才的发布检查流程沉淀成可复用 skill
519
+ codemini '/release-checklist 准备一次 patch release'
444
520
  ```
445
521
 
446
- 如果 `fff-mcp` 在 `PATH` 中,Codemini 会自动用于更快的 `grep`、`glob` 和部分 `list`。缺失时自动回退内置搜索。
522
+ ### 项目索引与代码智能
447
523
 
448
- Playwright 网页渲染:
524
+ Codemini 为每个项目构建轻量但精确的代码索引,核心使用 **Tree-sitter AST 解析**提取符号——而不是简单的正则或行数统计。
449
525
 
450
- ```bash
451
- npm install -g playwright
452
- playwright install chromium
453
- ```
526
+ | 文件 | 内容 |
527
+ | --- | --- |
528
+ | `.codemini/project-map.json` | 语言、源码目录、测试目录、入口候选、仓库事实。 |
529
+ | `.codemini/file-index.json` | 每个文件的 imports、exports、函数和类声明、接口、类型别名——基于语言感知的 AST 查询提取。 |
530
+
531
+ 索引为系统中的每个代码感知工具提供支持:
532
+
533
+ - **`grep` 和 `glob`** 利用文件映射跳过无关目录(node_modules、构建产物、.git),操作前无需触碰文件系统。
534
+ - **`ast_query` / `read_ast_node`** 将符号目标解析为精确的行列范围,实现手术刀式编辑,无需手动偏移计算。
535
+ - **`read` 带 AST 上下文** 可在光标位置附近返回包裹的函数体或类定义。
536
+
537
+ 索引的 freshness 通过增量维护:每次 `edit`、`write` 或 `patch` 调用后,仅重新解析受影响的文件并替换其索引条目。无需每次变更都全量重建。
538
+
539
+ 语言支持覆盖 JavaScript、TypeScript、TSX、Python、Go、C、C++、Rust、Java、C#、PHP、Ruby 和 Bash——每种语言使用独立的 Tree-sitter 语法。
454
540
 
455
541
  ### 数据路径
456
542
 
@@ -460,9 +546,22 @@ playwright install chromium
460
546
  | 项目状态 | `.codemini/` |
461
547
  | 项目 Skills | `.codemini/skills/<name>/SKILL.md` |
462
548
  | 全局 Skills | `<base-config-dir>/skills/<name>/SKILL.md` |
463
- | Windows 配置 | `%APPDATA%\codemini-global\` |
464
- | macOS 配置 | `~/Library/Preferences/codemini-global` |
465
- | Linux/XDG 配置 | `$XDG_CONFIG_HOME/codemini-global` |
549
+ | Windows | `%APPDATA%\codemini-global\` |
550
+ | macOS | `~/Library/Preferences/codemini-global` |
551
+ | Linux / XDG | `$XDG_CONFIG_HOME/codemini-global` |
552
+
553
+ 可通过 `CODEMINI_GLOBAL_DIR` 环境变量覆盖基础配置目录。
554
+
555
+ ### 可选增强
556
+
557
+ **FFF 搜索加速:** `codemini doctor` 会检测 `fff-mcp` 是否在系统 PATH 中,若存在则自动用于加速 `grep`、`glob` 和部分 `list` 操作。未安装时自动回退内置搜索。
558
+
559
+ **Playwright 渲染** 用于 JavaScript 重载页面:
560
+
561
+ ```bash
562
+ npm install -g playwright
563
+ playwright install chromium
564
+ ```
466
565
 
467
566
  ### 开发
468
567
 
@@ -472,7 +571,7 @@ npm test
472
571
  npm start
473
572
  ```
474
573
 
475
- 构建 Web UI
574
+ 构建 Web UI 生产包:
476
575
 
477
576
  ```bash
478
577
  npm run build:web
@@ -480,9 +579,9 @@ npm run build:web
480
579
 
481
580
  ### 文档
482
581
 
483
- - [OPERATIONS.md](./OPERATIONS.md) - 日常操作手册
484
- - [deployment.md](./deployment.md) - 打包、安装、部署
485
- - [Releases](https://github.com/havingautism/Codemini-CLI/releases) - 更新记录
582
+ - [OPERATIONS.md](./OPERATIONS.md) 日常操作手册
583
+ - [deployment.md](./deployment.md) 打包、安装、部署
584
+ - [Releases](https://github.com/havingautism/Codemini-CLI/releases)
486
585
 
487
586
  ### 许可证
488
587