codemini-cli 0.5.10 → 0.5.12

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.
Files changed (59) hide show
  1. package/OPERATIONS.md +242 -242
  2. package/README.md +588 -588
  3. package/codemini-web/dist/assets/{highlighted-body-OFNGDK62-7HL7yft8.js → highlighted-body-OFNGDK62-B-G99D0A.js} +1 -1
  4. package/codemini-web/dist/assets/{index-BK75hMb2.js → index-DIGUEzan.js} +108 -108
  5. package/codemini-web/dist/assets/index-Dkq1DdDX.css +2 -0
  6. package/codemini-web/dist/assets/mermaid-GHXKKRXX-va2Kl89u.js +1 -0
  7. package/codemini-web/dist/index.html +35 -23
  8. package/codemini-web/lib/approval-manager.js +32 -32
  9. package/codemini-web/lib/runtime-bridge.js +17 -11
  10. package/codemini-web/server.js +534 -205
  11. package/deployment.md +212 -212
  12. package/package.json +2 -2
  13. package/skills/brainstorm/SKILL.md +77 -77
  14. package/skills/codemini.skills.json +40 -40
  15. package/skills/grill-me/SKILL.md +30 -30
  16. package/skills/superpowers-lite/SKILL.md +82 -82
  17. package/src/cli.js +74 -74
  18. package/src/commands/chat.js +210 -210
  19. package/src/commands/run.js +313 -313
  20. package/src/commands/skill.js +438 -304
  21. package/src/commands/web.js +57 -57
  22. package/src/core/agent-loop.js +980 -980
  23. package/src/core/ast.js +309 -307
  24. package/src/core/chat-runtime.js +6261 -6253
  25. package/src/core/command-evaluator.js +72 -72
  26. package/src/core/command-loader.js +311 -311
  27. package/src/core/command-policy.js +301 -301
  28. package/src/core/command-risk.js +156 -156
  29. package/src/core/config-store.js +286 -285
  30. package/src/core/constants.js +18 -1
  31. package/src/core/context-compact.js +365 -365
  32. package/src/core/default-system-prompt.js +114 -107
  33. package/src/core/dream-audit.js +105 -105
  34. package/src/core/dream-consolidate.js +229 -229
  35. package/src/core/dream-evaluator.js +185 -185
  36. package/src/core/fff-adapter.js +383 -383
  37. package/src/core/memory-store.js +543 -543
  38. package/src/core/project-index.js +737 -548
  39. package/src/core/project-instructions.js +98 -98
  40. package/src/core/provider/anthropic.js +514 -514
  41. package/src/core/provider/openai-compatible.js +501 -501
  42. package/src/core/reflect-skill.js +178 -178
  43. package/src/core/reply-language.js +40 -40
  44. package/src/core/session-store.js +474 -474
  45. package/src/core/shell-profile.js +237 -237
  46. package/src/core/shell.js +323 -323
  47. package/src/core/soul.js +69 -69
  48. package/src/core/system-prompt-composer.js +52 -52
  49. package/src/core/tool-args.js +199 -154
  50. package/src/core/tool-output.js +184 -184
  51. package/src/core/tool-result-store.js +206 -206
  52. package/src/core/tools.js +3024 -2893
  53. package/src/core/version.js +11 -11
  54. package/src/tui/chat-app.js +5173 -5171
  55. package/src/tui/tool-activity/presenters/misc.js +30 -30
  56. package/src/tui/tool-activity/presenters/system.js +20 -20
  57. package/templates/project-requirements/report-shell.html +582 -582
  58. package/codemini-web/dist/assets/index-BSdIdn3L.css +0 -2
  59. package/codemini-web/dist/assets/mermaid-GHXKKRXX-Dg9qh8mg.js +0 -1
package/README.md CHANGED
@@ -1,588 +1,588 @@
1
- <p align="center">
2
- <img src="./codemini-web/codemini_logo.png" alt="Codemini logo" width="132" height="132" />
3
- </p>
4
-
5
- <h1 align="center">Codemini CLI</h1>
6
-
7
- <p align="center">
8
- <b>An extremely restrained coding + tasks CLI.</b><br />
9
- Every platform. Every terminal. Minimal by design.
10
- </p>
11
-
12
- <p align="center">
13
- <a href="https://www.npmjs.com/package/codemini-cli"><img alt="npm version" height="24" src="https://img.shields.io/npm/v/codemini-cli?style=flat&logo=npm&logoColor=white&label=npm&labelColor=0f172a&color=cb3837"></a>
14
- <a href="https://nodejs.org"><img alt="node version" height="24" src="https://img.shields.io/badge/node-%3E%3D22-339933?style=flat&logo=nodedotjs&logoColor=white&labelColor=0f172a"></a>
15
- <a href="./LICENSE"><img alt="license" height="24" src="https://img.shields.io/badge/license-MIT-2563eb?style=flat&labelColor=0f172a"></a>
16
- <a href="#web-ui"><img alt="web ui included" height="24" src="https://img.shields.io/badge/Web%20UI-included-7c3aed?style=flat&logo=googlechrome&logoColor=white&labelColor=0f172a"></a>
17
- <a href="#quick-start"><img alt="quick start" height="24" src="https://img.shields.io/badge/quick%20start-3%20commands-f97316?style=flat&logo=rocket&logoColor=white&labelColor=0f172a"></a>
18
- </p>
19
-
20
- <p align="center">
21
- <a href="#english">English</a>
22
- ·
23
- <a href="#简体中文">简体中文</a>
24
- ·
25
- <a href="#web-ui">Web UI</a>
26
- ·
27
- <a href="./OPERATIONS.md">Operator Guide</a>
28
- ·
29
- <a href="./deployment.md">Deployment</a>
30
- </p>
31
-
32
- ---
33
-
34
- <a id="english"></a>
35
-
36
- ## English
37
-
38
- ### What is Codemini?
39
-
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.
41
-
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.
43
-
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.
45
-
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.
47
-
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.
49
-
50
- No SaaS. No telemetry. No mandatory registration.
51
-
52
- ### Why "Restrained"?
53
-
54
- Many coding agents pursue an ever-expanding surface — more tools, more context, more automation. Codemini takes the opposite approach.
55
-
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.
62
-
63
- It is not about delivering less capability. It is about eliminating what you should not have to carry.
64
-
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:
68
-
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
78
- ```
79
-
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.
81
-
82
- Codemini's restraint is architectural:
83
-
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
92
-
93
- ```bash
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
104
- ```
105
-
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.
111
-
112
- ```bash
113
- # Interactive session (chat)
114
- codemini "Summarize the recent Git history and write a CHANGELOG.md"
115
-
116
- # One-off task
117
- codemini run "Find all .env files in this repo and check for hardcoded secrets"
118
-
119
- # Multi-role harness — planner + coder + reviewer in sequence
120
- codemini run --harness coder "Refactor the auth module to extract middleware"
121
-
122
- # Pipeline — sequential steps with artifact passing
123
- codemini run --pipeline "Bump version, update CHANGELOG, and create a GitHub release draft"
124
- ```
125
-
126
- Common non-coding task examples:
127
-
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"` |
136
-
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.
138
-
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. |
153
-
154
- ### Skills
155
-
156
- Skills are reusable, reviewable workflow recipes. Built-in:
157
-
158
- | Skill | When to use |
159
- | --- | --- |
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. |
164
-
165
- ```bash
166
- codemini skill list
167
- codemini skill install <path>
168
- codemini skill inspect <name>
169
- codemini skill enable <name>
170
- codemini skill disable <name>
171
- codemini skill reindex
172
- ```
173
-
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.
175
-
176
- Invoke any enabled skill as a slash command inside a session, or pass the slash command as a one-off prompt:
177
-
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
- ```
187
-
188
- ### Terminal TUI & Web UI
189
-
190
- Codemini gives you **two surfaces** powered by the same engine.
191
-
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.
193
-
194
- **Web UI** — full browser interface sharing the same session state:
195
-
196
- ```bash
197
- codemini --web
198
- ```
199
-
200
- Sessions are shared between terminal and browser — switch freely. From an active CLI session, type `web` to launch the browser UI.
201
-
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`.
205
-
206
- ### Memory, Self-Evolution & Dream Loop
207
-
208
- Codemini's memory system is designed to **learn from your work**, not just store facts.
209
-
210
- | Command | Purpose |
211
- | --- | --- |
212
- | `/capture <summary>` | Record a signal into the inbox. |
213
- | `/inbox` | Review pending memory evidence. |
214
- | `/dream [--dry-run]` | Consolidate inbox entries into durable user/global/project memory. |
215
- | `/reflect` | Convert a successful workflow pattern into a reviewable `SKILL.md` — your toolset evolves as you work. |
216
-
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.
218
-
219
- Typical reflect loop:
220
-
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
224
-
225
- # 2. Review the generated draft in the TUI/Web UI.
226
- /yes
227
-
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
231
-
232
- # 4. The same skill can also be launched directly from the shell.
233
- codemini '/provider-tool-call-recovery audit provider message conversion'
234
- ```
235
-
236
- Use `--scope=global` when the workflow should follow you across repositories:
237
-
238
- ```bash
239
- /reflect --scope=global turn the release checklist I just used into a reusable skill
240
- codemini '/release-checklist prepare a patch release'
241
- ```
242
-
243
- ### Project Index & Code Intelligence
244
-
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.
246
-
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.
261
-
262
- ### Data Paths
263
-
264
- | Scope | Path |
265
- | --- | --- |
266
- | Global sessions | `<base-config-dir>/sessions/` |
267
- | Project state | `.codemini/` |
268
- | Project skills | `.codemini/skills/<name>/SKILL.md` |
269
- | Global skills | `<base-config-dir>/skills/<name>/SKILL.md` |
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
- ```
286
-
287
- ### Development
288
-
289
- ```bash
290
- npm install
291
- npm test
292
- npm start
293
- ```
294
-
295
- Build the Web UI bundle for production:
296
-
297
- ```bash
298
- npm run build:web
299
- ```
300
-
301
- ### Documentation
302
-
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)
306
-
307
- ### License
308
-
309
- [MIT](./LICENSE)
310
-
311
- ---
312
-
313
- <a id="简体中文"></a>
314
-
315
- ## 简体中文
316
-
317
- ### Codemini 是什么?
318
-
319
- **一款刻意保持克制的 coding + tasks CLI。** 不仅能写代码——Git 工作流自动化、DevOps 流水线、数据批量处理、系统诊断,它都能干。
320
-
321
- 兼容 Windows PowerShell、macOS zsh、Linux bash 等各种终端环境。兼容任何 OpenAI 兼容或 Anthropic 的 API,不绑定特定模型或提供商。提供**双界面**——基于 Ink + React 构建的终端 TUI 和浏览器 Web UI——共享同一引擎和会话。
322
-
323
- 支持**大小模型协同工作**:配置一个轻量模型处理路由和简单任务,一个大模型负责复杂推理,系统自动调度。
324
-
325
- 其他内置能力包括项目索引、持久记忆与 `/reflect` 自我进化、技能工作流、计划模式、审批机制,以及仅改变语气不改变行为的人格预设(Souls)。
326
-
327
- 无需 SaaS、无需遥测、无需注册。
328
-
329
- ### 「克制」体现在哪里?
330
-
331
- 当前多数 AI 编码工具的策略是做加法——不断堆叠工具、上下文、自动化能力。Codemini 选择了相反的方向。
332
-
333
- - **依赖极简。** 仅依赖少量精选的 npm 包。没有 Electron、Docker 或 Python 运行时。
334
- - **上下文预算可控。** 微压缩、工具结果溢出到磁盘、提示预检触发——为控制模型窗口使用而设计。
335
- - **大小模型协同。** 配置一个轻量模型处理路由和简单任务,一个大模型负责复杂推理,系统自动分派。
336
- - **审批有度。** 命令按意图分级:只读操作直接放行,破坏性操作暂停确认。阈值由你设定。
337
- - **技能懒加载。** 注册 1,000 个技能与注册 1 个的开销相同。只有被实际调用的技能才会进入提示上下文。
338
- - **记忆择优而存,自我进化。** Inbox 本质上是临时草稿箱,Dream 循环决定晋升内容,`/reflect` 把成功工作流沉淀为可复用的 skill。
339
-
340
- 并非功能更少,而是不背负不必要的负担。
341
-
342
- #### 数据视角:「克制」的实际效果
343
-
344
- 一个真实项目的首轮 system prompt——包含 AGENTS.md、auto skill、记忆快照和项目上下文——大约消耗 **5,300 tokens**。具体构成如下:
345
-
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
355
- ```
356
-
357
- 相比之下,许多同类工具在用户发出第一条消息之前,**system prompt 已占用 15K–25K tokens**。每安装一个 skill、每保存一条记忆、每编写一个规则文件,都会无条件注入。
358
-
359
- Codemini 的克制源自架构设计:
360
-
361
- - **Skill 懒加载。** 安装 10 个 skill 与安装 0 个,system prompt 开销相同。只有被命中的 skill 才会加载完整内容。
362
- - **记忆有筛选。** Inbox 是临时噪声层,只有经过晋升的记忆才会进入提示上下文。你控制水位。
363
- - **项目索引紧凑。** 符号映射替代原始文件树。整个仓库仅需数百 token。
364
- - **无隐藏负担。** 没有遥测脚本、用量追踪,或未经你要求注入的上下文。
365
-
366
- 核心逻辑很简单:**prompt 税越少,留给实际工作的预算就越多。**
367
-
368
- ### 快速开始
369
-
370
- ```bash
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
381
- ```
382
-
383
- 三步完成配置,进入交互式会话。
384
-
385
- ### 不止写代码:自动化任务
386
-
387
- `codemini run` 可以把任何自然语言任务变成自动化工作流——不需要写脚本。
388
-
389
- ```bash
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 草稿"
401
- ```
402
-
403
- 非编码任务举例如下:
404
-
405
- | 任务 | 命令 |
406
- | --- | --- |
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 文件和临时调试日志"` |
413
-
414
- `--harness` 参数指定一个**角色**(`planner`、`advisor`、`coder`、`reviewer`、`tester`),每个角色有独立的工具访问权限。`--pipeline` 执行多步骤计划,每步输出自动传入下一步。两种模式让 Codemini 变成无头任务 agent——类似 Claude Code,但完全运行在你的机器上、使用你的模型、遵循你的审批策略。
415
-
416
- ### 功能速览
417
-
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——同一套配置,同一套行为。 |
432
-
433
- ### Skills
434
-
435
- Skills 是可复用、可审阅的工作流配方。内置:
436
-
437
- | Skill | 适用场景 |
438
- | --- | --- |
439
- | `superpowers-lite` | 默认编码流程:先了解、必要时计划、小范围修改、验证后汇报。 |
440
- | `grill-me` | 对方案、PR、发布、想法做压力测试,发现潜在问题。 |
441
- | `brainstorm` | 多种方案难以抉择时,先比较选项再行动。 |
442
- | `writing-plans` | 生成包含文件路径和验证步骤的实施计划。 |
443
-
444
- ```bash
445
- codemini skill list
446
- codemini skill install <path>
447
- codemini skill inspect <name>
448
- codemini skill enable <name>
449
- codemini skill disable <name>
450
- codemini skill reindex
451
- ```
452
-
453
- 路由元数据集中在顶层 catalog(`codemini.skills.json`),仅存储 `description`、`mode`、`triggers`、`enabled`、`priority` 等轻量字段。启动时不读取完整 `SKILL.md`,仅在被命中或显式调用时才加载。catalog 缺失时回退到目录和 frontmatter。
454
-
455
- 任何启用的 skill 都可以在会话里当作 slash command 调用,也可以作为一次性 prompt 从 shell 直接启动:
456
-
457
- ```bash
458
- # 在交互式会话中
459
- /grill-me 帮我审一遍这个发布方案再打 tag
460
- /writing-plans 设计 OAuth refresh-token 轮换方案
461
-
462
- # 从 shell 一次性调用
463
- codemini '/brainstorm 比较 SQLite、Postgres 和 DuckDB 做本地分析的取舍'
464
- codemini '/project-requirements 为当前仓库生成一份 CodeWiki 报告'
465
- ```
466
-
467
- ### 终端 TUI 与 Web UI
468
-
469
- Codemini 提供**双界面**,由同一引擎驱动。
470
-
471
- **终端 TUI**——富交互界面,支持长时间任务的旋转动画、语法高亮的代码块、实时命令输出流、以及带自动补全的命令面板。在任何终端模拟器中运行,无需额外进程。
472
-
473
- **Web UI**——完整的浏览器界面,与会话状态实时同步:
474
-
475
- ```bash
476
- codemini --web
477
- ```
478
-
479
- 终端与浏览器共享会话,可自由切换。活动的 CLI 会话中输入 `web` 也可启动 Web UI。
480
-
481
- 更多 Web UI 选项(端口、项目目录、会话、模型等)通过 `--port`、`--project`、`--session`、`--model`、`--no-open` 等参数配置。
482
-
483
- **Souls**——改变 agent 语气的预设(`default`、`professional`、`ceo`、`playful`、`anime`、`caveman`、`pirate`),不影响执行策略。配置:`codemini config set soul.preset professional`。
484
-
485
- ### 记忆、自我进化与 Dream Loop
486
-
487
- Codemini 的记忆系统设计为**从你的工作中学习**,而不仅仅是存储事实。
488
-
489
- | 命令 | 作用 |
490
- | --- | --- |
491
- | `/capture <summary>` | 将高信号观察记录到 inbox。 |
492
- | `/inbox` | 查看待整理的记忆素材。 |
493
- | `/dream [--dry-run]` | 将 inbox 整理到用户/全局/项目三层长期记忆。 |
494
- | `/reflect` | 将成功的工作流模式沉淀为可审阅的 `SKILL.md`——你的工具箱随工作进化。 |
495
-
496
- Inbox 本质上是临时噪声层。Dream 循环决定哪些内容值得晋升。而 `/reflect` 完成了闭环:一个被你反复验证成功的工作模式,变成可复用的 skill,跟项目一起版本化管理。
497
-
498
- 典型的 reflect 闭环:
499
-
500
- ```bash
501
- # 1. 完成一次效果很好的工作流后,让 Codemini 提炼可复用模式。
502
- /reflect 把刚才 provider tool-call 修复成功的链路沉淀成 skill
503
-
504
- # 2. 在 TUI/Web UI 中审阅生成的草稿。
505
- /yes
506
-
507
- # 3. Codemini 写入 .codemini/skills/provider-tool-call-recovery/SKILL.md
508
- # 并立即暴露为 slash skill。
509
- /provider-tool-call-recovery 把同类问题修到 Anthropic adapter
510
-
511
- # 4. 也可以从 shell 直接一次性启动这个 skill。
512
- codemini '/provider-tool-call-recovery 审计 provider message conversion'
513
- ```
514
-
515
- 如果这个工作流应该跨项目复用,可以写成全局 skill:
516
-
517
- ```bash
518
- /reflect --scope=global 把刚才的发布检查流程沉淀成可复用 skill
519
- codemini '/release-checklist 准备一次 patch release'
520
- ```
521
-
522
- ### 项目索引与代码智能
523
-
524
- Codemini 为每个项目构建轻量但精确的代码索引,核心使用 **Tree-sitter AST 解析**提取符号——而不是简单的正则或行数统计。
525
-
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 语法。
540
-
541
- ### 数据路径
542
-
543
- | 范围 | 路径 |
544
- | --- | --- |
545
- | 全局会话 | `<base-config-dir>/sessions/` |
546
- | 项目状态 | `.codemini/` |
547
- | 项目 Skills | `.codemini/skills/<name>/SKILL.md` |
548
- | 全局 Skills | `<base-config-dir>/skills/<name>/SKILL.md` |
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
- ```
565
-
566
- ### 开发
567
-
568
- ```bash
569
- npm install
570
- npm test
571
- npm start
572
- ```
573
-
574
- 构建 Web UI 生产包:
575
-
576
- ```bash
577
- npm run build:web
578
- ```
579
-
580
- ### 文档
581
-
582
- - [OPERATIONS.md](./OPERATIONS.md) — 日常操作手册
583
- - [deployment.md](./deployment.md) — 打包、安装、部署
584
- - [Releases](https://github.com/havingautism/Codemini-CLI/releases)
585
-
586
- ### 许可证
587
-
588
- [MIT](./LICENSE)
1
+ <p align="center">
2
+ <img src="./codemini-web/codemini_logo.png" alt="Codemini logo" width="132" height="132" />
3
+ </p>
4
+
5
+ <h1 align="center">Codemini CLI</h1>
6
+
7
+ <p align="center">
8
+ <b>An extremely restrained coding + tasks CLI.</b><br />
9
+ Every platform. Every terminal. Minimal by design.
10
+ </p>
11
+
12
+ <p align="center">
13
+ <a href="https://www.npmjs.com/package/codemini-cli"><img alt="npm version" height="24" src="https://img.shields.io/npm/v/codemini-cli?style=flat&logo=npm&logoColor=white&label=npm&labelColor=0f172a&color=cb3837"></a>
14
+ <a href="https://nodejs.org"><img alt="node version" height="24" src="https://img.shields.io/badge/node-%3E%3D22-339933?style=flat&logo=nodedotjs&logoColor=white&labelColor=0f172a"></a>
15
+ <a href="./LICENSE"><img alt="license" height="24" src="https://img.shields.io/badge/license-MIT-2563eb?style=flat&labelColor=0f172a"></a>
16
+ <a href="#web-ui"><img alt="web ui included" height="24" src="https://img.shields.io/badge/Web%20UI-included-7c3aed?style=flat&logo=googlechrome&logoColor=white&labelColor=0f172a"></a>
17
+ <a href="#quick-start"><img alt="quick start" height="24" src="https://img.shields.io/badge/quick%20start-3%20commands-f97316?style=flat&logo=rocket&logoColor=white&labelColor=0f172a"></a>
18
+ </p>
19
+
20
+ <p align="center">
21
+ <a href="#english">English</a>
22
+ ·
23
+ <a href="#简体中文">简体中文</a>
24
+ ·
25
+ <a href="#web-ui">Web UI</a>
26
+ ·
27
+ <a href="./OPERATIONS.md">Operator Guide</a>
28
+ ·
29
+ <a href="./deployment.md">Deployment</a>
30
+ </p>
31
+
32
+ ---
33
+
34
+ <a id="english"></a>
35
+
36
+ ## English
37
+
38
+ ### What is Codemini?
39
+
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.
41
+
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.
43
+
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.
45
+
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.
47
+
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.
49
+
50
+ No SaaS. No telemetry. No mandatory registration.
51
+
52
+ ### Why "Restrained"?
53
+
54
+ Many coding agents pursue an ever-expanding surface — more tools, more context, more automation. Codemini takes the opposite approach.
55
+
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.
62
+
63
+ It is not about delivering less capability. It is about eliminating what you should not have to carry.
64
+
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:
68
+
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
78
+ ```
79
+
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.
81
+
82
+ Codemini's restraint is architectural:
83
+
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
92
+
93
+ ```bash
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
104
+ ```
105
+
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.
111
+
112
+ ```bash
113
+ # Interactive session (chat)
114
+ codemini "Summarize the recent Git history and write a CHANGELOG.md"
115
+
116
+ # One-off task
117
+ codemini run "Find all .env files in this repo and check for hardcoded secrets"
118
+
119
+ # Multi-role harness — planner + coder + reviewer in sequence
120
+ codemini run --harness coder "Refactor the auth module to extract middleware"
121
+
122
+ # Pipeline — sequential steps with artifact passing
123
+ codemini run --pipeline "Bump version, update CHANGELOG, and create a GitHub release draft"
124
+ ```
125
+
126
+ Common non-coding task examples:
127
+
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"` |
136
+
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.
138
+
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. |
153
+
154
+ ### Skills
155
+
156
+ Skills are reusable, reviewable workflow recipes. Built-in:
157
+
158
+ | Skill | When to use |
159
+ | --- | --- |
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. |
164
+
165
+ ```bash
166
+ codemini skill list
167
+ codemini skill install <path>
168
+ codemini skill inspect <name>
169
+ codemini skill enable <name>
170
+ codemini skill disable <name>
171
+ codemini skill reindex
172
+ ```
173
+
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.
175
+
176
+ Invoke any enabled skill as a slash command inside a session, or pass the slash command as a one-off prompt:
177
+
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
+ ```
187
+
188
+ ### Terminal TUI & Web UI
189
+
190
+ Codemini gives you **two surfaces** powered by the same engine.
191
+
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.
193
+
194
+ **Web UI** — full browser interface sharing the same session state:
195
+
196
+ ```bash
197
+ codemini --web
198
+ ```
199
+
200
+ Sessions are shared between terminal and browser — switch freely. From an active CLI session, type `web` to launch the browser UI.
201
+
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`.
205
+
206
+ ### Memory, Self-Evolution & Dream Loop
207
+
208
+ Codemini's memory system is designed to **learn from your work**, not just store facts.
209
+
210
+ | Command | Purpose |
211
+ | --- | --- |
212
+ | `/capture <summary>` | Record a signal into the inbox. |
213
+ | `/inbox` | Review pending memory evidence. |
214
+ | `/dream [--dry-run]` | Consolidate inbox entries into durable user/global/project memory. |
215
+ | `/reflect` | Convert a successful workflow pattern into a reviewable `SKILL.md` — your toolset evolves as you work. |
216
+
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.
218
+
219
+ Typical reflect loop:
220
+
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
224
+
225
+ # 2. Review the generated draft in the TUI/Web UI.
226
+ /yes
227
+
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
231
+
232
+ # 4. The same skill can also be launched directly from the shell.
233
+ codemini '/provider-tool-call-recovery audit provider message conversion'
234
+ ```
235
+
236
+ Use `--scope=global` when the workflow should follow you across repositories:
237
+
238
+ ```bash
239
+ /reflect --scope=global turn the release checklist I just used into a reusable skill
240
+ codemini '/release-checklist prepare a patch release'
241
+ ```
242
+
243
+ ### Project Index & Code Intelligence
244
+
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.
246
+
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.
261
+
262
+ ### Data Paths
263
+
264
+ | Scope | Path |
265
+ | --- | --- |
266
+ | Global sessions | `<base-config-dir>/sessions/` |
267
+ | Project state | `.codemini/` |
268
+ | Project skills | `.codemini/skills/<name>/SKILL.md` |
269
+ | Global skills | `<base-config-dir>/skills/<name>/SKILL.md` |
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
+ ```
286
+
287
+ ### Development
288
+
289
+ ```bash
290
+ npm install
291
+ npm test
292
+ npm start
293
+ ```
294
+
295
+ Build the Web UI bundle for production:
296
+
297
+ ```bash
298
+ npm run build:web
299
+ ```
300
+
301
+ ### Documentation
302
+
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)
306
+
307
+ ### License
308
+
309
+ [MIT](./LICENSE)
310
+
311
+ ---
312
+
313
+ <a id="简体中文"></a>
314
+
315
+ ## 简体中文
316
+
317
+ ### Codemini 是什么?
318
+
319
+ **一款刻意保持克制的 coding + tasks CLI。** 不仅能写代码——Git 工作流自动化、DevOps 流水线、数据批量处理、系统诊断,它都能干。
320
+
321
+ 兼容 Windows PowerShell、macOS zsh、Linux bash 等各种终端环境。兼容任何 OpenAI 兼容或 Anthropic 的 API,不绑定特定模型或提供商。提供**双界面**——基于 Ink + React 构建的终端 TUI 和浏览器 Web UI——共享同一引擎和会话。
322
+
323
+ 支持**大小模型协同工作**:配置一个轻量模型处理路由和简单任务,一个大模型负责复杂推理,系统自动调度。
324
+
325
+ 其他内置能力包括项目索引、持久记忆与 `/reflect` 自我进化、技能工作流、计划模式、审批机制,以及仅改变语气不改变行为的人格预设(Souls)。
326
+
327
+ 无需 SaaS、无需遥测、无需注册。
328
+
329
+ ### 「克制」体现在哪里?
330
+
331
+ 当前多数 AI 编码工具的策略是做加法——不断堆叠工具、上下文、自动化能力。Codemini 选择了相反的方向。
332
+
333
+ - **依赖极简。** 仅依赖少量精选的 npm 包。没有 Electron、Docker 或 Python 运行时。
334
+ - **上下文预算可控。** 微压缩、工具结果溢出到磁盘、提示预检触发——为控制模型窗口使用而设计。
335
+ - **大小模型协同。** 配置一个轻量模型处理路由和简单任务,一个大模型负责复杂推理,系统自动分派。
336
+ - **审批有度。** 命令按意图分级:只读操作直接放行,破坏性操作暂停确认。阈值由你设定。
337
+ - **技能懒加载。** 注册 1,000 个技能与注册 1 个的开销相同。只有被实际调用的技能才会进入提示上下文。
338
+ - **记忆择优而存,自我进化。** Inbox 本质上是临时草稿箱,Dream 循环决定晋升内容,`/reflect` 把成功工作流沉淀为可复用的 skill。
339
+
340
+ 并非功能更少,而是不背负不必要的负担。
341
+
342
+ #### 数据视角:「克制」的实际效果
343
+
344
+ 一个真实项目的首轮 system prompt——包含 AGENTS.md、auto skill、记忆快照和项目上下文——大约消耗 **5,300 tokens**。具体构成如下:
345
+
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
355
+ ```
356
+
357
+ 相比之下,许多同类工具在用户发出第一条消息之前,**system prompt 已占用 15K–25K tokens**。每安装一个 skill、每保存一条记忆、每编写一个规则文件,都会无条件注入。
358
+
359
+ Codemini 的克制源自架构设计:
360
+
361
+ - **Skill 懒加载。** 安装 10 个 skill 与安装 0 个,system prompt 开销相同。只有被命中的 skill 才会加载完整内容。
362
+ - **记忆有筛选。** Inbox 是临时噪声层,只有经过晋升的记忆才会进入提示上下文。你控制水位。
363
+ - **项目索引紧凑。** 符号映射替代原始文件树。整个仓库仅需数百 token。
364
+ - **无隐藏负担。** 没有遥测脚本、用量追踪,或未经你要求注入的上下文。
365
+
366
+ 核心逻辑很简单:**prompt 税越少,留给实际工作的预算就越多。**
367
+
368
+ ### 快速开始
369
+
370
+ ```bash
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
381
+ ```
382
+
383
+ 三步完成配置,进入交互式会话。
384
+
385
+ ### 不止写代码:自动化任务
386
+
387
+ `codemini run` 可以把任何自然语言任务变成自动化工作流——不需要写脚本。
388
+
389
+ ```bash
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 草稿"
401
+ ```
402
+
403
+ 非编码任务举例如下:
404
+
405
+ | 任务 | 命令 |
406
+ | --- | --- |
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 文件和临时调试日志"` |
413
+
414
+ `--harness` 参数指定一个**角色**(`planner`、`advisor`、`coder`、`reviewer`、`tester`),每个角色有独立的工具访问权限。`--pipeline` 执行多步骤计划,每步输出自动传入下一步。两种模式让 Codemini 变成无头任务 agent——类似 Claude Code,但完全运行在你的机器上、使用你的模型、遵循你的审批策略。
415
+
416
+ ### 功能速览
417
+
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——同一套配置,同一套行为。 |
432
+
433
+ ### Skills
434
+
435
+ Skills 是可复用、可审阅的工作流配方。内置:
436
+
437
+ | Skill | 适用场景 |
438
+ | --- | --- |
439
+ | `superpowers-lite` | 默认编码流程:先了解、必要时计划、小范围修改、验证后汇报。 |
440
+ | `grill-me` | 对方案、PR、发布、想法做压力测试,发现潜在问题。 |
441
+ | `brainstorm` | 多种方案难以抉择时,先比较选项再行动。 |
442
+ | `writing-plans` | 生成包含文件路径和验证步骤的实施计划。 |
443
+
444
+ ```bash
445
+ codemini skill list
446
+ codemini skill install <path>
447
+ codemini skill inspect <name>
448
+ codemini skill enable <name>
449
+ codemini skill disable <name>
450
+ codemini skill reindex
451
+ ```
452
+
453
+ 路由元数据集中在顶层 catalog(`codemini.skills.json`),仅存储 `description`、`mode`、`triggers`、`enabled`、`priority` 等轻量字段。启动时不读取完整 `SKILL.md`,仅在被命中或显式调用时才加载。catalog 缺失时回退到目录和 frontmatter。
454
+
455
+ 任何启用的 skill 都可以在会话里当作 slash command 调用,也可以作为一次性 prompt 从 shell 直接启动:
456
+
457
+ ```bash
458
+ # 在交互式会话中
459
+ /grill-me 帮我审一遍这个发布方案再打 tag
460
+ /writing-plans 设计 OAuth refresh-token 轮换方案
461
+
462
+ # 从 shell 一次性调用
463
+ codemini '/brainstorm 比较 SQLite、Postgres 和 DuckDB 做本地分析的取舍'
464
+ codemini '/project-requirements 为当前仓库生成一份 CodeWiki 报告'
465
+ ```
466
+
467
+ ### 终端 TUI 与 Web UI
468
+
469
+ Codemini 提供**双界面**,由同一引擎驱动。
470
+
471
+ **终端 TUI**——富交互界面,支持长时间任务的旋转动画、语法高亮的代码块、实时命令输出流、以及带自动补全的命令面板。在任何终端模拟器中运行,无需额外进程。
472
+
473
+ **Web UI**——完整的浏览器界面,与会话状态实时同步:
474
+
475
+ ```bash
476
+ codemini --web
477
+ ```
478
+
479
+ 终端与浏览器共享会话,可自由切换。活动的 CLI 会话中输入 `web` 也可启动 Web UI。
480
+
481
+ 更多 Web UI 选项(端口、项目目录、会话、模型等)通过 `--port`、`--project`、`--session`、`--model`、`--no-open` 等参数配置。
482
+
483
+ **Souls**——改变 agent 语气的预设(`default`、`professional`、`ceo`、`playful`、`anime`、`caveman`、`pirate`),不影响执行策略。配置:`codemini config set soul.preset professional`。
484
+
485
+ ### 记忆、自我进化与 Dream Loop
486
+
487
+ Codemini 的记忆系统设计为**从你的工作中学习**,而不仅仅是存储事实。
488
+
489
+ | 命令 | 作用 |
490
+ | --- | --- |
491
+ | `/capture <summary>` | 将高信号观察记录到 inbox。 |
492
+ | `/inbox` | 查看待整理的记忆素材。 |
493
+ | `/dream [--dry-run]` | 将 inbox 整理到用户/全局/项目三层长期记忆。 |
494
+ | `/reflect` | 将成功的工作流模式沉淀为可审阅的 `SKILL.md`——你的工具箱随工作进化。 |
495
+
496
+ Inbox 本质上是临时噪声层。Dream 循环决定哪些内容值得晋升。而 `/reflect` 完成了闭环:一个被你反复验证成功的工作模式,变成可复用的 skill,跟项目一起版本化管理。
497
+
498
+ 典型的 reflect 闭环:
499
+
500
+ ```bash
501
+ # 1. 完成一次效果很好的工作流后,让 Codemini 提炼可复用模式。
502
+ /reflect 把刚才 provider tool-call 修复成功的链路沉淀成 skill
503
+
504
+ # 2. 在 TUI/Web UI 中审阅生成的草稿。
505
+ /yes
506
+
507
+ # 3. Codemini 写入 .codemini/skills/provider-tool-call-recovery/SKILL.md
508
+ # 并立即暴露为 slash skill。
509
+ /provider-tool-call-recovery 把同类问题修到 Anthropic adapter
510
+
511
+ # 4. 也可以从 shell 直接一次性启动这个 skill。
512
+ codemini '/provider-tool-call-recovery 审计 provider message conversion'
513
+ ```
514
+
515
+ 如果这个工作流应该跨项目复用,可以写成全局 skill:
516
+
517
+ ```bash
518
+ /reflect --scope=global 把刚才的发布检查流程沉淀成可复用 skill
519
+ codemini '/release-checklist 准备一次 patch release'
520
+ ```
521
+
522
+ ### 项目索引与代码智能
523
+
524
+ Codemini 为每个项目构建轻量但精确的代码索引,核心使用 **Tree-sitter AST 解析**提取符号——而不是简单的正则或行数统计。
525
+
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 语法。
540
+
541
+ ### 数据路径
542
+
543
+ | 范围 | 路径 |
544
+ | --- | --- |
545
+ | 全局会话 | `<base-config-dir>/sessions/` |
546
+ | 项目状态 | `.codemini/` |
547
+ | 项目 Skills | `.codemini/skills/<name>/SKILL.md` |
548
+ | 全局 Skills | `<base-config-dir>/skills/<name>/SKILL.md` |
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
+ ```
565
+
566
+ ### 开发
567
+
568
+ ```bash
569
+ npm install
570
+ npm test
571
+ npm start
572
+ ```
573
+
574
+ 构建 Web UI 生产包:
575
+
576
+ ```bash
577
+ npm run build:web
578
+ ```
579
+
580
+ ### 文档
581
+
582
+ - [OPERATIONS.md](./OPERATIONS.md) — 日常操作手册
583
+ - [deployment.md](./deployment.md) — 打包、安装、部署
584
+ - [Releases](https://github.com/havingautism/Codemini-CLI/releases)
585
+
586
+ ### 许可证
587
+
588
+ [MIT](./LICENSE)