min-agent 0.2.1 → 0.4.0
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 +242 -31
- package/dist/agent.js +1233 -485
- package/dist/assistant-stream.js +11 -7
- package/dist/cli/commands/chat.js +10 -0
- package/dist/cli/commands/exec.js +32 -0
- package/dist/cli/commands/history.js +58 -0
- package/dist/cli/commands/index.js +224 -0
- package/dist/cli/commands/init.js +18 -0
- package/dist/cli/commands/mcp.js +173 -0
- package/dist/cli/commands/memory.js +69 -0
- package/dist/cli/commands/models.js +21 -0
- package/dist/cli/commands/permission.js +12 -0
- package/dist/cli/commands/rules.js +33 -0
- package/dist/cli/commands/sandbox.js +13 -0
- package/dist/cli/commands/serve.js +9 -0
- package/dist/cli/commands/setup.js +4 -0
- package/dist/cli/commands/shared.js +16 -0
- package/dist/cli/commands/skills.js +119 -0
- package/dist/cli/commands/update.js +7 -0
- package/dist/cli/commands/write-config.js +30 -0
- package/dist/cli/errors.js +36 -0
- package/dist/cli/exec-prompt.js +26 -0
- package/dist/cli/option-helpers.js +53 -0
- package/dist/cli/program.js +180 -0
- package/dist/cli.js +7 -632
- package/dist/clipboard.js +59 -23
- package/dist/code-mode.js +35 -17
- package/dist/compaction.js +457 -169
- package/dist/config.js +298 -38
- package/dist/confirm.js +105 -9
- package/dist/context-window.js +156 -75
- package/dist/doom-loop.js +268 -26
- package/dist/fetch-timeout.js +152 -0
- package/dist/http-approvals.js +60 -0
- package/dist/http.js +119 -0
- package/dist/instructions.js +72 -33
- package/dist/logger.js +95 -0
- package/dist/markdown.js +35 -50
- package/dist/mcp.js +847 -102
- package/dist/memory.js +128 -45
- package/dist/output.js +42 -31
- package/dist/paste-handler.js +3 -3
- package/dist/permission-cli.js +43 -0
- package/dist/plugins.js +76 -11
- package/dist/pricing.js +119 -0
- package/dist/provider.js +34 -15
- package/dist/question-format.js +60 -0
- package/dist/sandbox-cli.js +82 -0
- package/dist/sandbox.js +403 -0
- package/dist/save-throttle.js +45 -0
- package/dist/serve/common.js +404 -0
- package/dist/serve/routes-chat.js +347 -0
- package/dist/serve/routes-mcp.js +212 -0
- package/dist/serve/routes-memory.js +66 -0
- package/dist/serve/routes-meta.js +205 -0
- package/dist/serve/routes-sessions.js +61 -0
- package/dist/serve/routes-skills.js +70 -0
- package/dist/serve.js +74 -635
- package/dist/sessions.js +197 -15
- package/dist/skills.js +531 -77
- package/dist/synthetic.js +7 -0
- package/dist/title-gen.js +9 -2
- package/dist/token-display.js +36 -0
- package/dist/tool-display.js +178 -0
- package/dist/tool-output.js +53 -46
- package/dist/tools/apply_patch.js +265 -0
- package/dist/tools/atomic-file.js +35 -0
- package/dist/tools/backend.js +61 -0
- package/dist/tools/bash.js +186 -71
- package/dist/tools/code_search.js +13 -6
- package/dist/tools/edit.js +26 -9
- package/dist/tools/explore.js +144 -16
- package/dist/tools/glob.js +7 -3
- package/dist/tools/grep.js +153 -14
- package/dist/tools/index.js +9 -24
- package/dist/tools/question.js +31 -30
- package/dist/tools/read.js +77 -15
- package/dist/tools/search-searxng.js +223 -0
- package/dist/tools/search-serper.js +189 -0
- package/dist/tools/task.js +100 -33
- package/dist/tools/todo.js +178 -67
- package/dist/tools/web_fetch.js +158 -46
- package/dist/tools/web_search.js +217 -29
- package/dist/tools/write.js +34 -11
- package/dist/tui/App.js +89 -6
- package/dist/tui/ConfirmBar.js +57 -4
- package/dist/tui/InputBar.js +504 -44
- package/dist/tui/MessageList.js +674 -20
- package/dist/tui/ModelPicker.js +113 -0
- package/dist/tui/QuestionBar.js +136 -0
- package/dist/tui/SessionPicker.js +79 -0
- package/dist/tui/StatusBar.js +14 -12
- package/dist/tui/agent-runner.js +223 -0
- package/dist/tui/caret-pos.js +177 -0
- package/dist/tui/caret.js +69 -0
- package/dist/tui/click-count.js +13 -0
- package/dist/tui/diff-view.js +61 -0
- package/dist/tui/drag-state.js +49 -0
- package/dist/tui/hydrate.js +129 -0
- package/dist/tui/index.js +189 -31
- package/dist/tui/input-history.js +125 -0
- package/dist/tui/layout.js +88 -0
- package/dist/tui/mouse.js +46 -0
- package/dist/tui/prompt-queue.js +24 -0
- package/dist/tui/selection.js +226 -0
- package/dist/tui/session-switch.js +28 -0
- package/dist/tui/slash-commands.js +106 -0
- package/dist/tui/slash-handler.js +545 -0
- package/dist/tui/text-width.js +113 -0
- package/dist/tui/theme.js +12 -0
- package/dist/tui/token-info.js +7 -0
- package/dist/tui/tool-children.js +19 -0
- package/dist/tui/undo-stack.js +14 -0
- package/dist/tui/use-sgr-mouse.js +29 -0
- package/dist/tui-chat.js +346 -330
- package/dist/updater.js +116 -0
- package/dist/xml-search.js +194 -0
- package/docs/API.md +410 -32
- package/docs/superpowers/plans/2026-08-16-batch1-tui-improvements.md +1510 -0
- package/docs/superpowers/plans/2026-08-16-batch2-cli-tools-api.md +2105 -0
- package/docs/superpowers/plans/2026-08-16-batch3-config-engineering.md +1595 -0
- package/docs/superpowers/plans/2026-08-16-input-caret.md +782 -0
- package/docs/superpowers/plans/2026-08-20-tui-completeness.md +873 -0
- package/docs/superpowers/plans/2026-08-20-unified-tui-default.md +631 -0
- package/docs/superpowers/specs/2026-08-16-batch1-tui-improvements-design.md +183 -0
- package/docs/superpowers/specs/2026-08-16-batch2-cli-tools-api-design.md +220 -0
- package/docs/superpowers/specs/2026-08-16-batch3-config-engineering-design.md +196 -0
- package/docs/superpowers/specs/2026-08-16-input-caret-design.md +63 -0
- package/docs/superpowers/specs/2026-08-17-mouse-selection-design.md +116 -0
- package/docs/superpowers/specs/2026-08-20-config-http-alignment-design.md +47 -0
- package/docs/superpowers/specs/2026-08-20-mcp-plugins-alignment-design.md +37 -0
- package/docs/superpowers/specs/2026-08-20-sandbox-permissions-design.md +68 -0
- package/docs/superpowers/specs/2026-08-20-tui-completeness-design.md +273 -0
- package/docs/superpowers/specs/2026-08-20-unified-tui-default-design.md +165 -0
- package/package.json +12 -8
- package/skills/self-config/SKILL.md +90 -0
- package/skills/self-config/reference.md +149 -0
package/README.md
CHANGED
|
@@ -6,15 +6,17 @@ Minimal AI coding agent for the terminal. Works with any OpenAI-compatible API.
|
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install -g min-agent
|
|
9
|
+
min-agent update # Upgrade to the latest npm release
|
|
9
10
|
```
|
|
10
11
|
|
|
11
12
|
## Quick Start
|
|
12
13
|
|
|
13
14
|
```bash
|
|
14
15
|
min-agent setup # Configure provider
|
|
15
|
-
min-agent
|
|
16
|
-
min-agent
|
|
17
|
-
min-agent
|
|
16
|
+
min-agent # Interactive session
|
|
17
|
+
min-agent "hello" # Interactive session, send immediately
|
|
18
|
+
min-agent exec "hello" # One-shot, then exit
|
|
19
|
+
min-agent exec --resume <id> "continue" # Continue a saved one-shot session
|
|
18
20
|
```
|
|
19
21
|
|
|
20
22
|
---
|
|
@@ -22,38 +24,78 @@ min-agent code # Project-aware coding mode
|
|
|
22
24
|
## Commands
|
|
23
25
|
|
|
24
26
|
```bash
|
|
25
|
-
min-agent
|
|
26
|
-
min-agent
|
|
27
|
-
min-agent
|
|
28
|
-
min-agent
|
|
29
|
-
min-agent
|
|
27
|
+
min-agent # Interactive session
|
|
28
|
+
min-agent "msg" # Interactive session, send immediately
|
|
29
|
+
min-agent exec "msg" # One-shot, then exit
|
|
30
|
+
min-agent exec --resume <id> "msg" # Continue a saved one-shot session
|
|
31
|
+
min-agent -m <model> "msg" # Override model
|
|
32
|
+
min-agent --provider <name> "msg" # Use a specific provider
|
|
33
|
+
min-agent -i img.png "msg" # Attach image
|
|
34
|
+
min-agent --resume <id> # Resume session
|
|
35
|
+
min-agent chat | code # Same as interactive session (compat)
|
|
30
36
|
min-agent setup # Configure API provider
|
|
31
37
|
min-agent models # List available models
|
|
32
38
|
min-agent history # List saved sessions
|
|
39
|
+
min-agent history delete <id> # Delete a session
|
|
40
|
+
min-agent history rename <id> <t> # Rename a session
|
|
41
|
+
min-agent history export <id> [-o file] # Export a session as JSON
|
|
42
|
+
min-agent update # Upgrade to the latest npm release
|
|
33
43
|
min-agent rules # Show loaded rules
|
|
34
44
|
min-agent rules edit # Edit global rules
|
|
35
|
-
min-agent memory # List memories
|
|
36
|
-
min-agent memory add "text" # Save memory
|
|
45
|
+
min-agent memory # List project + global memories
|
|
46
|
+
min-agent memory add "text" # Save memory (project if .min-agent exists)
|
|
47
|
+
min-agent memory add "text" --project
|
|
48
|
+
min-agent memory add "text" --global
|
|
37
49
|
min-agent mcp -h # MCP server management
|
|
38
50
|
min-agent skills -h # Skills management
|
|
51
|
+
min-agent sandbox # Show isolation
|
|
52
|
+
min-agent sandbox off # Write isolation to config and exit
|
|
53
|
+
min-agent --sandbox workspace "msg" # This session only; does not write config
|
|
54
|
+
min-agent sandbox network deny --project
|
|
55
|
+
min-agent permission # Show confirmation mode
|
|
56
|
+
min-agent --permission ask # Write confirmation mode to config and exit
|
|
57
|
+
min-agent --permission accept-edits --project
|
|
58
|
+
min-agent --permission allow-all "msg" # This session only
|
|
39
59
|
min-agent serve # Start HTTP API server
|
|
40
60
|
```
|
|
41
61
|
|
|
42
62
|
## Interactive Commands
|
|
43
63
|
|
|
64
|
+
Type `/` in the interactive session to pop up a command menu (type to filter, Tab/Enter select, Esc close). **↑↓** in the input box recall previously sent messages, skipping slash commands. All commands also work by typing them directly:
|
|
65
|
+
|
|
44
66
|
| Command | Description |
|
|
45
67
|
|---------|-------------|
|
|
46
|
-
| `/
|
|
68
|
+
| `/new` | Start a new session (keeps the current one) |
|
|
47
69
|
| `/compact` | Force compaction |
|
|
48
|
-
| `/model [name]` |
|
|
49
|
-
| `/
|
|
50
|
-
| `/
|
|
70
|
+
| `/model [name]` | Interactive model picker (↑↓ navigate, Enter confirm) |
|
|
71
|
+
| `/provider [name]` | List/switch provider |
|
|
72
|
+
| `/plan` | Toggle read-only plan mode |
|
|
73
|
+
| `/memory [text]` | List/save memory (`--project` writes to this repo) |
|
|
74
|
+
| `/tokens` | Context occupancy, session totals & cost |
|
|
75
|
+
| `/budget [n]` | Show/set cost budget (USD; `--project` writes to this repo) |
|
|
76
|
+
| `/permission` | Show/set confirmation (`ask` / `accept-edits` / `allow-all`; `--project` writes to this repo) |
|
|
77
|
+
| `/sandbox` | Show/set isolation (`off` / `workspace` / `strict`; `--project` writes to this repo) |
|
|
78
|
+
| `/undo` | Undo last turn |
|
|
79
|
+
| `/redo` | Resend last message |
|
|
80
|
+
| `/diff` | Show working tree diff |
|
|
81
|
+
| `/sessions [id]` | List or switch saved sessions |
|
|
82
|
+
| `/resume [id]` | Same as `/sessions` |
|
|
83
|
+
| `/reload` | Reload rules |
|
|
84
|
+
| `/rename <title>` | Rename current session |
|
|
85
|
+
| `/attach <path>` | Attach a local image |
|
|
51
86
|
| `/paste [text]` | Clipboard image |
|
|
87
|
+
| `/mcp` | MCP server status |
|
|
88
|
+
| `/skills` | List skills; `/skills info <name>` to view; `/skills enable\|disable <name>` to toggle |
|
|
89
|
+
| `/models` | List available models |
|
|
52
90
|
| `/path` | Working directory |
|
|
53
91
|
| `/help` | All commands |
|
|
54
92
|
| `/exit` | Exit |
|
|
55
93
|
|
|
56
|
-
**Ctrl+C** interrupts current
|
|
94
|
+
**Ctrl+C** clears the input box and saves it to history (↑ / ↓ to recall). Press **Ctrl+C twice** on an empty input to exit; the current session is saved. While generating, it interrupts the current run. **Ctrl+B** enters message selection mode (arrow keys expand the selection, Enter copies, Esc exits). **↑ / ↓** in the input box recall previously typed or sent messages. **Home / End** move to the start or end of the line.
|
|
95
|
+
|
|
96
|
+
授权确认时 **[y] / [N]** 始终留在窗口底部;详情过长时用 **↑↓** 或 **PageUp / PageDown** 滚动,不必翻到消息区底部。提问输入行同样固定可见。
|
|
97
|
+
|
|
98
|
+
**鼠标** 在消息区拖拽选择文本,松开自动复制;双击选词、三击选中该条可见内容。复制时不含 `>` 与工具前缀。状态栏会短暂提示"已复制"。
|
|
57
99
|
|
|
58
100
|
---
|
|
59
101
|
|
|
@@ -64,52 +106,199 @@ All config in `~/.min-agent/`:
|
|
|
64
106
|
```json
|
|
65
107
|
// ~/.min-agent/config.json
|
|
66
108
|
{
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
109
|
+
"providers": [
|
|
110
|
+
{
|
|
111
|
+
"name": "default",
|
|
112
|
+
"type": "openai-compatible",
|
|
113
|
+
"baseURL": "https://api.openai.com/v1",
|
|
114
|
+
"apiKey": "sk-...",
|
|
115
|
+
"defaultModel": "gpt-5.5",
|
|
116
|
+
"contextWindow": 1000000
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"activeProvider": "default",
|
|
120
|
+
"webSearchURL": "https://your-searxng.example.com",
|
|
121
|
+
"serperApiKey": "your-serper-key",
|
|
74
122
|
"instructions": ["./docs/rules.md"],
|
|
75
|
-
"disabledSkills": []
|
|
123
|
+
"disabledSkills": [],
|
|
124
|
+
"pricing": { "gpt-5.5": { "inputPerMillion": 1.25, "outputPerMillion": 10 } },
|
|
125
|
+
"sampling": { "temperature": 0.7, "maxTokens": 4096 },
|
|
126
|
+
"budget": { "maxCostUSD": 5 }
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Project-level config lives in `.min-agent/config.json`. It can override skill state and selected global settings; API keys stay in `~/.min-agent/config.json` only:
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
// .min-agent/config.json
|
|
134
|
+
{
|
|
135
|
+
"disabledSkills": ["noisy-skill"],
|
|
136
|
+
"enabledSkills": ["skill-disabled-globally"],
|
|
137
|
+
"activeProvider": "default",
|
|
138
|
+
"defaultModel": "gpt-5.5",
|
|
139
|
+
"sampling": { "temperature": 0.4 },
|
|
140
|
+
"budget": { "maxCostUSD": 2 },
|
|
141
|
+
"permission": "ask",
|
|
142
|
+
"sandbox": { "mode": "workspace", "network": "allow" },
|
|
143
|
+
"compaction": { "autoContinue": false }
|
|
76
144
|
}
|
|
77
145
|
```
|
|
78
146
|
|
|
147
|
+
Project values overlay the global file when present (`sampling` / `budget` / `sandbox` / `compaction` / `agent` merge field-by-field). `/budget 5 --project` writes the project budget. `/sandbox workspace --project` writes project isolation. `/permission accept-edits --project` writes project confirmation mode.
|
|
148
|
+
|
|
149
|
+
Isolation is **off by default**. `--permission` / `--yes` only skip confirmations; they do not change isolation.
|
|
150
|
+
|
|
151
|
+
`--permission ask|accept-edits|allow-all` without a message writes config and exits (same as `min-agent permission …`). With a message, `--resume`, `--model`, or `--provider`, it only overrides that session. `--yes` / `-y` is this session only (same as `--permission allow-all`) and does not write config.
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
min-agent permission # show current confirmation mode
|
|
155
|
+
min-agent --permission ask # write global config, then exit
|
|
156
|
+
min-agent --permission accept-edits --project
|
|
157
|
+
min-agent --permission allow-all "msg" # this session only; does not write config
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
`ask` (default) prompts before dangerous operations. `accept-edits` auto-approves file writes and still prompts for dangerous commands. `allow-all` auto-approves everything.
|
|
161
|
+
|
|
162
|
+
Without a message, `--sandbox` / `--network` write config and exit (same as `min-agent sandbox …`). With a message, `--resume`, `--model`, or `--provider`, they only override that session:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
min-agent sandbox # show current isolation
|
|
166
|
+
min-agent --sandbox off # write global config, then exit
|
|
167
|
+
min-agent --sandbox workspace --project
|
|
168
|
+
min-agent --sandbox workspace "msg" # this session only; does not write config
|
|
169
|
+
min-agent sandbox network deny
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
```json
|
|
173
|
+
"sandbox": {
|
|
174
|
+
"mode": "workspace",
|
|
175
|
+
"network": "allow",
|
|
176
|
+
"extraWriteRoots": ["/path/allowed-to-write"],
|
|
177
|
+
"extraReadRoots": []
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
`mode`: `off` (default) | `workspace` (write only in the working directory, plus temp/cache) | `strict` (read and write only there). `extraWriteRoots` / `extraReadRoots` add extra directories when isolation is on. Env: `MIN_AGENT_SANDBOX`, `MIN_AGENT_SANDBOX_NETWORK`.
|
|
182
|
+
|
|
183
|
+
Project memories live in `.min-agent/memory.json`; global memories in `~/.min-agent/memory.json`. The agent reads project first, then global. Saving without `--project` / `--global` uses the project file when `.min-agent/` exists.
|
|
184
|
+
|
|
185
|
+
`pricing` 覆盖模型价格(USD / 1M tokens),用于成本估算;未配置时自动从 models.dev 获取。
|
|
186
|
+
|
|
187
|
+
Multiple providers are supported: add entries to `providers` and set `activeProvider` (or use `min-agent setup`). Old single-provider configs are migrated automatically on first run.
|
|
188
|
+
|
|
189
|
+
`contextWindow` 填写该模型的上下文长度(token)。自定义接口请按实际容量填写,例如 100 万填 `1000000`。未填写时会向接口查询;查不到时按 512k 处理。旧的工具输出会自动省略,避免占满上下文。
|
|
190
|
+
|
|
191
|
+
`sampling` sets defaults for temperature/maxTokens/topP (overridable per request). `budget.maxCostUSD` aborts the current run as soon as cumulative cost exceeds the limit (checked after each model step).
|
|
192
|
+
|
|
193
|
+
A run continues in one model pass until the model finishes, the context fills (~75% of the window), the reply comes back empty, or a tool-only turn has no final answer. Context overflow and empty turns auto-continue up to `agent.maxContinues` times (default 40). Set `agent.autoContinue` to `false` to stop and wait for the next message (web research that has not yet produced the requested file or answer still continues, and further search/fetch calls return a notice to write from what is already known). If `agent.autoContinue` is omitted, `compaction.autoContinue` is used (default true). Optional `agent.maxSteps` is a hard tool-step ceiling for one pass (unset means no ceiling). When the provider answers with an empty stream (HTTP 200 and no content at all — usually an upstream timeout), the same request is re-sent up to `agent.maxEmptyAttempts` times (default 4; first retry immediate, then exponential backoff from `agent.emptyRetryDelayMs`, default 1000 ms) regardless of `autoContinue`, and the run then reports that the provider returned nothing instead of a vague "incomplete". Task lists and the original request are stored with the session and survive compaction. Repeated identical tool calls are stopped. Long stretches of web search/fetch without producing the requested output are redirected to finish the work; further search/fetch calls then return that same notice instead of new results.
|
|
194
|
+
|
|
195
|
+
A turn also has a time / step budget (`agent.turnTimeLimitMs`, default 20 min; `agent.softStepLimit`, default 120 tool steps). When it runs out the model is asked once to wrap up and summarise, then the turn stops — a finished answer is never overridden by the budget. Model requests are guarded by a first-byte timeout (`agent.requestTimeoutMs`, default 180 s) and a stream idle timeout (`agent.streamIdleTimeoutMs`, default 90 s); a stalled request is aborted and retried like an empty reply. Old tool payloads are only trimmed once the context is filling up (60% of the window), biggest first, and each stub keeps the path of the full output on disk so the model can read it again. Sessions are written incrementally during a run, so a crash keeps the work done so far. `bash` commands are killed after `tools.bashTimeoutMs` (default 10 min) unless the call sets its own timeout. Sub-agents (`task`, `explore`) share the parent's research and cost budget; their step ceilings are `agent.subAgentMaxSteps` / `agent.exploreMaxSteps`.
|
|
196
|
+
|
|
197
|
+
Research is judged by what it returns: rounds that bring new URLs or domains are free (up to `agent.researchTotalCap`, default 24 calls per turn), while `agent.researchSteerAfter` (default 3) rounds without a new source steer the model to write, and `agent.researchStopAfter` (default 5) removes `search_web` / `web_fetch` for the rest of the turn.
|
|
198
|
+
|
|
79
199
|
Provider types: `openai-compatible` | `openai` | `ollama`
|
|
80
200
|
|
|
201
|
+
Logs: `~/.min-agent/logs/min-agent.YYYY-MM-DD.log` (rotated daily, kept 7 days). Lines inside a run carry `[run=<id> pass=<n>]`. Set `MIN_AGENT_TRACE=1` to also log a summary of every model request and response (model, message/tool counts, status, time to first byte).
|
|
202
|
+
|
|
203
|
+
Input history: `~/.min-agent/input-history.json` (up to 1000 entries)
|
|
204
|
+
|
|
81
205
|
---
|
|
82
206
|
|
|
83
207
|
## MCP
|
|
84
208
|
|
|
85
209
|
```bash
|
|
86
210
|
min-agent mcp add <name> <cmd...> # Local stdio
|
|
211
|
+
min-agent mcp add <name> <cmd...> --env K=V # Local stdio with env vars
|
|
87
212
|
min-agent mcp add <name> --url <url> --token T # Remote HTTP
|
|
88
|
-
min-agent mcp
|
|
213
|
+
min-agent mcp add <name> --url <url> --sse # Legacy SSE transport
|
|
214
|
+
min-agent mcp add <name> --url <url> --streamable-http # Force streamable HTTP
|
|
215
|
+
min-agent mcp add <name> ... --project # Save to .min-agent/mcp.json (this repo only)
|
|
216
|
+
min-agent mcp add <name> ... --timeout 10000 # Connection/call timeout in ms
|
|
217
|
+
min-agent mcp list # List (name + status + scope)
|
|
89
218
|
min-agent mcp info <name> # Details
|
|
90
|
-
min-agent mcp enable/disable <name...>
|
|
91
|
-
min-agent mcp remove <name>
|
|
219
|
+
min-agent mcp enable/disable <name...> [--project] # Toggle
|
|
220
|
+
min-agent mcp remove <name> [--project] # Remove
|
|
92
221
|
min-agent mcp check # Test connectivity
|
|
93
222
|
```
|
|
94
223
|
|
|
224
|
+
配置合并规则:`~/.min-agent/mcp.json`(全局)与 `.min-agent/mcp.json`(项目)按名称合并,项目条目覆盖同名全局条目;`mcp list` 会标注 `[project]`。
|
|
225
|
+
|
|
226
|
+
Connected servers expose resources and prompts to the agent via `mcp_list_resources` / `mcp_read_resource` / `mcp_list_prompts` / `mcp_get_prompt`. `/mcp` shows counts when a server advertises them.
|
|
227
|
+
|
|
228
|
+
远程服务器如需 OAuth 登录(部分云端 MCP),在 mcp.json 里加 `"oauth": {}`(或用 `"clientId"`/`"clientSecret"`/`"scope"` 显式指定),连接时自动打开浏览器完成授权,令牌缓存在 `~/.min-agent/mcp-oauth/`。`"oauth": false` 关闭。
|
|
229
|
+
|
|
230
|
+
mcp.json 完整字段(`min-agent mcp add` 只生成子集,其余手写):
|
|
231
|
+
|
|
232
|
+
```json
|
|
233
|
+
{
|
|
234
|
+
"mcpServers": {
|
|
235
|
+
"filesystem": {
|
|
236
|
+
"command": ["npx", "-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
|
|
237
|
+
"environment": { "KEY": "VALUE" },
|
|
238
|
+
"enabled": true,
|
|
239
|
+
"connectTimeout": 10000,
|
|
240
|
+
"callTimeout": 30000
|
|
241
|
+
},
|
|
242
|
+
"remote": {
|
|
243
|
+
"url": "https://mcp.example.com/mcp",
|
|
244
|
+
"remoteTransport": "auto",
|
|
245
|
+
"token": "bearer-token",
|
|
246
|
+
"headers": { "X-API-Key": "..." },
|
|
247
|
+
"oauth": {},
|
|
248
|
+
"connectTimeout": 15000,
|
|
249
|
+
"callTimeout": 30000
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
- `remoteTransport`:`auto`(默认,先 streamable-http 再 sse)、`streamable-http`、`sse`
|
|
256
|
+
- `timeout`:连接与调用共用的旧字段;`connectTimeout` / `callTimeout` 可分别覆盖
|
|
257
|
+
- 连接失败时错误信息会带上服务器 stderr 的最后几行,便于排查
|
|
258
|
+
|
|
95
259
|
## Skills
|
|
96
260
|
|
|
97
261
|
```bash
|
|
98
|
-
min-agent skills list # List (
|
|
99
|
-
min-agent skills
|
|
100
|
-
min-agent skills
|
|
262
|
+
min-agent skills list # List (status + scope + description + path)
|
|
263
|
+
min-agent skills list --json # Machine-readable output
|
|
264
|
+
min-agent skills info <name> # Details + content
|
|
265
|
+
min-agent skills info <name> --json # Details as JSON
|
|
266
|
+
min-agent skills new <name> # Create a skill scaffold (.min-agent/skills/<name>/)
|
|
267
|
+
min-agent skills new <name> --global # Create in ~/.agents/skills/<name>/
|
|
268
|
+
min-agent skills disable <name...> # Disable everywhere (global)
|
|
269
|
+
min-agent skills disable <name...> --project # Disable in this repo only
|
|
270
|
+
min-agent skills enable <name...> --project # Re-enable here even if disabled globally
|
|
101
271
|
```
|
|
102
272
|
|
|
103
|
-
|
|
273
|
+
Scope: project state lives in `.min-agent/config.json`, global state in `~/.min-agent/config.json`.
|
|
274
|
+
Project wins over global, so disabling a repo-local skill never affects other repos.
|
|
275
|
+
|
|
276
|
+
In the interactive session: `/skills`, `/skills info <name>`, `/skills disable <name> [--project]`, `/skills enable <name> [--project]`.
|
|
277
|
+
Type `/skills ` and press Tab to complete subcommands and skill names.
|
|
278
|
+
|
|
279
|
+
Create: `min-agent skills new <name>` scaffolds a `SKILL.md` template into `.min-agent/skills/<name>/` (add `--global` for `~/.agents/skills/`), or write it by hand:
|
|
104
280
|
|
|
105
281
|
```markdown
|
|
106
282
|
---
|
|
107
283
|
name: my-skill
|
|
108
284
|
description: What it does
|
|
285
|
+
# optional
|
|
286
|
+
version: 1.0.0
|
|
287
|
+
allowed-tools: [read, grep]
|
|
288
|
+
metadata:
|
|
289
|
+
requires:
|
|
290
|
+
bins: ["some-cli"]
|
|
109
291
|
---
|
|
110
292
|
# Instructions...
|
|
111
293
|
```
|
|
112
294
|
|
|
295
|
+
- `description` may use a YAML block scalar (`|` / `>`) for multi-line text.
|
|
296
|
+
- Discovery paths, in override order: `~/.agents/skills/` → `.min-agent/skills/` → `.agents/skills/` → `.opencode/skills/` → `.claude/skills/`. Symlinked skill directories are followed, so one shared skill library can be linked into several of these.
|
|
297
|
+
- A same-named skill in a later user path overrides the earlier one; within one path the top-level `SKILL.md` wins over a nested copy.
|
|
298
|
+
- Built-in skills shipped with min-agent (including `self-config`, which the agent loads automatically when changing its own settings) are always discovered and win on name over user copies.
|
|
299
|
+
- `MIN_AGENT_SKILLS_DIRS` (path-delimiter separated) replaces the user discovery list; built-in skills still load unless `MIN_AGENT_NO_BUILTIN_SKILLS=1`.
|
|
300
|
+
- Files next to `SKILL.md` (including subdirectories such as `scripts/`) are listed for the agent when the skill loads; `metadata.requires.bins` entries missing from `PATH` are reported.
|
|
301
|
+
|
|
113
302
|
## Rules
|
|
114
303
|
|
|
115
304
|
| Source | Scope |
|
|
@@ -122,6 +311,8 @@ description: What it does
|
|
|
122
311
|
|
|
123
312
|
Custom tools: `.min-agent/tools/*.ts` or `~/.min-agent/tools/*.ts`
|
|
124
313
|
|
|
314
|
+
By default a custom tool asks before it runs. Set `readOnly: true` (or `dangerous: false`) to skip the prompt. Plan mode only keeps `readOnly` custom tools.
|
|
315
|
+
|
|
125
316
|
```typescript
|
|
126
317
|
export const myTool = {
|
|
127
318
|
description: "...",
|
|
@@ -130,6 +321,20 @@ export const myTool = {
|
|
|
130
321
|
}
|
|
131
322
|
```
|
|
132
323
|
|
|
324
|
+
```typescript
|
|
325
|
+
export const dockerPs = {
|
|
326
|
+
description: "List running docker containers",
|
|
327
|
+
readOnly: true,
|
|
328
|
+
parameters: { limit: { type: "number", description: "Max containers to show" } },
|
|
329
|
+
execute: async ({ limit }) => {
|
|
330
|
+
const { execSync } = await import("child_process")
|
|
331
|
+
return execSync(`docker ps --format "table {{.Names}}\t{{.Status}}" --limit ${limit ?? 10}`, {
|
|
332
|
+
encoding: "utf-8",
|
|
333
|
+
})
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
```
|
|
337
|
+
|
|
133
338
|
---
|
|
134
339
|
|
|
135
340
|
## HTTP API
|
|
@@ -147,9 +352,15 @@ Full reference: [docs/API.md](docs/API.md)
|
|
|
147
352
|
| Variable | Description |
|
|
148
353
|
|----------|-------------|
|
|
149
354
|
| `EXA_API_KEY` | Enable Exa code search |
|
|
355
|
+
| `MIN_AGENT_SERPER_API_KEY` | Optional Serper key override for `search_web` (takes precedence over `serperApiKey` in config; a built-in default is used otherwise) |
|
|
356
|
+
| `MIN_AGENT_SEARXNG_URL` | Use SearXNG instead of Serper for `search_web` (takes precedence over `webSearchURL` in config) |
|
|
357
|
+
| `MIN_AGENT_SEARXNG_FALLBACK_ENGINES` | Engines retried when the SearXNG instance's default engines return nothing (default `google,bing`; empty string disables the retry) |
|
|
358
|
+
| `MIN_AGENT_FIRECRAWL_URL` | Firecrawl instance for `web_fetch` (takes precedence over `webFetchURL` in config) |
|
|
359
|
+
| `MIN_AGENT_SKILLS_DIRS` | `:`-separated dirs that replace the user skill discovery list (built-in skills still load) |
|
|
360
|
+
| `MIN_AGENT_NO_BUILTIN_SKILLS` | `1` to skip skills shipped with min-agent |
|
|
150
361
|
| `MIN_AGENT_SHOW_THINKING` | `0` to hide thinking |
|
|
151
362
|
| `MIN_AGENT_SERVE_TOKEN` | API auth token |
|
|
152
|
-
| `MIN_AGENT_SERVE_CORS` | `1` to enable CORS |
|
|
363
|
+
| `MIN_AGENT_SERVE_CORS` | `1` to enable CORS (without a token, only localhost origins are allowed) |
|
|
153
364
|
|
|
154
365
|
## License
|
|
155
366
|
|