@iinm/plain-agent 1.7.20 → 1.7.21

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
@@ -255,30 +255,22 @@ Create the configuration.
255
255
  ```
256
256
  </details>
257
257
 
258
-
259
-
260
258
  Run the agent.
261
259
 
262
260
  ```sh
263
261
  plain
262
+ ```
264
263
 
265
- # Or
264
+ ```
266
265
  plain -m <model+variant>
267
266
  ```
268
267
 
269
- Interrupt the agent while it's running:
270
268
  Press **Ctrl-C** to pause auto-approve. The agent will finish the current tool call, then return to the prompt.
271
269
 
272
- (Optional) Set up a sandbox for your project with the `sandbox-configurator` agent.
270
+ Display the help message.
273
271
 
274
272
  ```
275
- /agents:sandbox-configurator Set up a sandbox for this project
276
- ```
277
-
278
- After the agent finishes, run the generated setup script once to build the sandbox image and install dependencies.
279
-
280
- ```sh
281
- ./.plain-agent/setup.sh
273
+ /help
282
274
  ```
283
275
 
284
276
  Run in batch mode (non-interactive).
@@ -291,34 +283,27 @@ plain batch \
291
283
  "Add tests for ..."
292
284
  ```
293
285
 
294
- Display the help message.
295
-
296
- ```
297
- /help
298
- ```
299
-
300
286
  Show daily token costs across sessions. `plain cost` reads
301
287
  `~/.local/share/plain-agent/usage.jsonl`; use `--from` / `--to` to set the
302
288
  period. Currencies are shown separately.
303
289
 
304
290
  ```sh
305
291
  plain cost
292
+ ```
293
+
294
+ ```
306
295
  plain cost --from 2026-04-01 --to 2026-04-30
307
296
  ```
308
297
 
309
- ## Available Tools
298
+ (Optional) Configure plain-agent for your project.
310
299
 
311
- The agent can use the following tools to assist with tasks:
300
+ ```
301
+ /configure Auto-approve file writes and patches
302
+ ```
312
303
 
313
- - **exec_command**: Run a command without shell interpretation.
314
- - **write_file**: Write a file.
315
- - **patch_file**: Patch a file.
316
- - **tmux_command**: Run a tmux command.
317
- - **ask_web**: Use the web search to answer questions that need up-to-date information or supporting sources. (requires Google API key or Vertex AI configuration).
318
- - **ask_url**: Use one or more provided URLs to answer a question. Include the URLs in your question. (requires Google API key or Vertex AI configuration).
319
- - **delegate_to_subagent**: Delegate a subtask to a subagent. The agent switches to a subagent role within the same conversation, focusing on the specified goal.
320
- - **report_as_subagent**: Report completion and return to the main agent. Used by subagents to communicate results and restore the main agent role. After reporting, the subagent's conversation history is removed from the context.
321
- - **compact_context**: Compact the conversation context by discarding prior messages and reloading task state from a memory file. Use when the context has grown large but the task is not yet complete. Can also be invoked via the `/compact` slash command.
304
+ ```
305
+ /configure Set up a sandbox for this project
306
+ ```
322
307
 
323
308
  ## Configuration
324
309
 
@@ -502,6 +487,20 @@ Files are loaded in the following order. Settings in later files override earlie
502
487
  ```
503
488
  </details>
504
489
 
490
+ ## Available Tools
491
+
492
+ The agent can use the following tools to assist with tasks:
493
+
494
+ - **exec_command**: Run a command without shell interpretation.
495
+ - **write_file**: Write a file.
496
+ - **patch_file**: Patch a file.
497
+ - **tmux_command**: Run a tmux command.
498
+ - **ask_web**: Use the web search to answer questions that need up-to-date information or supporting sources. (requires Google API key or Vertex AI configuration).
499
+ - **ask_url**: Use one or more provided URLs to answer a question. Include the URLs in your question. (requires Google API key or Vertex AI configuration).
500
+ - **delegate_to_subagent**: Delegate a subtask to a subagent. The agent switches to a subagent role within the same conversation, focusing on the specified goal.
501
+ - **report_as_subagent**: Report completion and return to the main agent. Used by subagents to communicate results and restore the main agent role. After reporting, the subagent's conversation history is removed from the context.
502
+ - **compact_context**: Compact the conversation context by discarding prior messages and reloading task state from a memory file. Use when the context has grown large but the task is not yet complete. Can also be invoked via the `/compact` slash command.
503
+
505
504
  ## Prompts
506
505
 
507
506
  You can define reusable prompts in Markdown files.
@@ -624,6 +623,7 @@ and send them like regular text.
624
623
  **OpenAI Realtime**
625
624
 
626
625
  ```js
626
+ // ~/.config/plain-agent/config.local.json
627
627
  {
628
628
  "voiceInput": {
629
629
  "provider": "openai",
@@ -637,6 +637,7 @@ and send them like regular text.
637
637
  **Gemini Live**
638
638
 
639
639
  ```js
640
+ // ~/.config/plain-agent/config.local.json
640
641
  {
641
642
  "voiceInput": {
642
643
  "provider": "gemini",
@@ -63,9 +63,10 @@ Present the analysis results and ask the user to confirm. Show:
63
63
  3. **Volume configuration** (e.g., "node_modules + npm cache")
64
64
  4. **Setup install command** (e.g., "npm ci")
65
65
 
66
- Ask only one additional question:
66
+ Ask the following questions one at a time, waiting for the user's answer before proceeding to the next:
67
67
 
68
- > Do you want to mount `~/.gitconfig` into the sandbox? (This allows git commit inside the sandbox.)
68
+ 1. Do you want to mount `~/.gitconfig` into the sandbox? (This allows git commit inside the sandbox.)
69
+ 2. Are there any commands that must run on the host instead of inside the container? (e.g. `gh`, `docker` — tools that require host credentials or sockets.) If so, which ones?
69
70
 
70
71
  ## Step 3: Generate run.sh
71
72
 
@@ -115,7 +116,7 @@ set -eu -o pipefail
115
116
 
116
117
  this_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
117
118
 
118
- # Setup sandbox (install runtime and dependencies with network access)
119
+ # Build Docker image and setup sandbox (install runtime and dependencies with network access)
119
120
  "$this_dir/sandbox/run.sh" --verbose --allow-net 0.0.0.0/0 mise use node@lts
120
121
  "$this_dir/sandbox/run.sh" --verbose --allow-net 0.0.0.0/0 npm ci
121
122
 
@@ -125,21 +126,19 @@ npm ci
125
126
 
126
127
  `--allow-net 0.0.0.0/0` is needed only during setup for downloading packages. It should NOT be in run.sh for normal usage.
127
128
 
128
- ## Step 5: Show config.json Example
129
+ ## Step 5: Update config.json
129
130
 
130
- After generating all files, instruct the user to add the following to their `.plain-agent/config.json`:
131
+ Show the user the following config and explain:
132
+
133
+ - `--skip-build` assumes the image is already built (run `setup.sh` first to build)
134
+ - `--keep-alive 30` reuses the container for 30 seconds between commands for performance
135
+
136
+ If the user specified any unsandboxed commands in Step 2, also include and explain:
137
+
138
+ - They run **unsandboxed** because they need host access.
131
139
 
132
140
  ```json
133
141
  {
134
- "autoApproval": {
135
- "patterns": [
136
- {
137
- "toolName": "exec_command",
138
- "input": { "command": { "$regex": "^(gh|docker)$" } },
139
- "action": "ask"
140
- }
141
- ]
142
- },
143
142
  "sandbox": {
144
143
  "command": ".plain-agent/sandbox/run.sh",
145
144
  "args": ["--skip-build", "--keep-alive", "30"],
@@ -154,7 +153,6 @@ After generating all files, instruct the user to add the following to their `.pl
154
153
  }
155
154
  ```
156
155
 
157
- If the project already has a `.plain-agent/config.json`, show only the keys that should be added/merged. Remind the user:
158
- - `--skip-build` assumes the image is already built (run `setup.sh` first to build)
159
- - `--keep-alive 30` reuses the container for 30 seconds between commands for performance
160
- - `gh` and `docker` run unsandboxed (host access needed), so they should also be set to `ask` in `autoApproval` to avoid being auto-approved alongside other shell commands. Place this `ask` pattern before any broad `allow` pattern for `exec_command`, since `autoApproval` patterns are evaluated in order and the first match wins.
156
+ Adjust the regex to match the commands the user specified. If none, omit `sandbox.rules`.
157
+
158
+ After the user confirms, write the config into `.plain-agent/config.json` (merge if the file already exists).
@@ -0,0 +1,60 @@
1
+ ---
2
+ description: Update plain-agent configuration based on user needs.
3
+ ---
4
+
5
+ Fetch the latest README and help the user configure plain-agent for this project. Before each step, briefly explain to the user what you are about to do and why.
6
+
7
+ ## Security Rule (Non-Negotiable)
8
+
9
+ **Never write credentials** (API keys, tokens, passwords, secrets) into any config file.
10
+
11
+ When a setting requires a credential:
12
+ 1. Tell the user it must go into `.plain-agent/config.local.json`.
13
+ 2. Show the exact JSON snippet they need to add.
14
+ 3. Do not modify that file yourself.
15
+
16
+ If the user wants a setting applied globally (`~/.config/plain-agent/`), show them the exact snippet and tell them to add it manually. Do not access the home directory.
17
+
18
+ ## Step 1: Fetch the Latest README
19
+
20
+ Fetch the latest README from GitHub as the authoritative reference for all configuration options:
21
+
22
+ ```sh
23
+ gh api --method GET -H "Accept: application/vnd.github.v3.raw" "repos/iinm/plain-agent/contents/README.md?ref=main"
24
+ ```
25
+
26
+ ## Step 2: Read the Current Config
27
+
28
+ ```sh
29
+ cat .plain-agent/config.json
30
+ ```
31
+
32
+ ## Step 3: Ask the User What They Want
33
+
34
+ Ask what the user wants to configure. Common topics:
35
+
36
+ - **Model** — which LLM to use (`model` field)
37
+ - **Auto-approval rules** — which tool calls to allow automatically (`autoApproval`)
38
+ - **Sandbox** — isolated execution environment (`sandbox`)
39
+ - **MCP servers** — external tool integrations (`mcpServers`)
40
+ - **Claude Code plugins** — reuse Claude Code plugin prompts/agents (`claudeCodePlugins`)
41
+ - **Voice input** — voice transcription settings (`voiceInput`)
42
+ - **Notifications** — custom notify command (`notifyCmd`)
43
+
44
+ If the request is vague, ask a focused clarifying question before proceeding.
45
+
46
+ **If the user wants to configure Sandbox**: immediately delegate to the `sandbox-configurator` agent and do not proceed further yourself.
47
+
48
+ ## Step 4: Apply Changes
49
+
50
+ Update `.plain-agent/config.json`. Rules:
51
+
52
+ - Merge carefully — preserve all existing keys.
53
+ - Only write to `.plain-agent/config.json`. Never access files outside the project directory.
54
+ - For credential-requiring fields, use a placeholder like `"<YOUR_API_KEY>"` and instruct the user to add the real value to `.plain-agent/config.local.json` themselves.
55
+
56
+ ## Step 5: Summarize
57
+
58
+ 1. Show a diff or summary of what changed.
59
+ 2. If any credentials were skipped, show the snippet the user needs to add to `config.local.json`.
60
+ 3. Tell the user to restart `plain` for changes to take effect.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iinm/plain-agent",
3
- "version": "1.7.20",
3
+ "version": "1.7.21",
4
4
  "description": "A lightweight CLI-based coding agent",
5
5
  "license": "MIT",
6
6
  "type": "module",