mini-coder 0.0.19 → 0.0.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/docs/configs.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  mini-coder supports both its native `.agents` convention and `.claude` layouts for commands, skills, and agents.
4
4
 
5
+ Only commands, skills, agents, and context files are loaded from these roots. Hook directories are ignored.
6
+
7
+ Discovery is not identical for every config type:
8
+
9
+ - **Commands** and **agents** are loaded from the current working directory and the home directory only.
10
+ - **Skills** are loaded from the home directory plus local directories discovered by walking up from the current working directory to the git worktree root.
11
+ - **Context files** are only loaded from the current working directory and the home directory.
12
+
5
13
  ## Supported config roots
6
14
 
7
15
  | Root | Purpose |
@@ -40,23 +48,23 @@ Filename becomes the command name (`review.md` => `/review`).
40
48
 
41
49
  Supported locations:
42
50
 
43
- - `./.agents/skills/<skill-name>/SKILL.md`
44
- - `~/.agents/skills/<skill-name>/SKILL.md`
45
- - `./.claude/skills/<skill-name>/SKILL.md`
46
- - `~/.claude/skills/<skill-name>/SKILL.md`
51
+ - local: `./.agents/skills/<skill-name>/SKILL.md` and `./.claude/skills/<skill-name>/SKILL.md`
52
+ - global: `~/.agents/skills/<skill-name>/SKILL.md` and `~/.claude/skills/<skill-name>/SKILL.md`
53
+
54
+ For local skills, mini-coder searches not just the current working directory, but each ancestor directory up to the git worktree root.
47
55
 
48
56
  Format:
49
57
 
50
58
  ```md
51
59
  ---
52
- name: optional-skill-name
53
- description: Optional help text
60
+ name: required-skill-name
61
+ description: Required help text
54
62
  ---
55
63
 
56
64
  Skill instructions/content.
57
65
  ```
58
66
 
59
- If `name` is omitted, folder name is used.
67
+ Both `name` and `description` are required. Invalid skills are skipped with a warning.
60
68
 
61
69
  ## Agents
62
70
 
@@ -105,5 +113,6 @@ Precedence rules for commands, skills, and agents:
105
113
 
106
114
  1. **Local overrides global**
107
115
  2. At the **same scope** (both local or both global), if `.agents` and `.claude` define the same name, **`.agents` wins**
116
+ 3. For **skills only**, when the same skill name exists in multiple local ancestor directories, the skill nearest to the current working directory wins
108
117
 
109
- When same-scope conflicts are detected for commands, skills, or agents, mini-coder prints a warning and uses the `.agents` version.
118
+ When same-scope `.agents` / `.claude` conflicts are detected for commands, skills, or agents, mini-coder prints a warning and uses the `.agents` version.
@@ -3,6 +3,8 @@
3
3
  A custom agent is a reusable system prompt with an optional model override.
4
4
  You can activate one with `/agent <name>`, and non-`primary` agents are also exposed to the `subagent` tool.
5
5
 
6
+ mini-coder is shell-first, so custom agents should assume repo inspection and verification happen through shell, with targeted edits done via `mc-edit` invoked from shell.
7
+
6
8
  ## Where to put them
7
9
 
8
10
  | Location | Scope |
@@ -39,8 +41,6 @@ Then in the REPL:
39
41
  review the auth module for race conditions
40
42
  ```
41
43
 
42
- You can also mention `@reviewer` in a prompt as a naming convention, and agent names participate in `@` tab completion alongside skills and files.
43
-
44
44
  ## Frontmatter fields
45
45
 
46
46
  | Field | Required | Description |
@@ -60,10 +60,6 @@ File references are resolved before the prompt is sent:
60
60
  @src/auth/session.ts check this file for issues
61
61
  ```
62
62
 
63
- ## Tab completion
64
-
65
- Type `@` and press `Tab` to autocomplete agent names alongside skills and files.
66
-
67
63
  ## Listing agents
68
64
 
69
65
  ```
@@ -2,6 +2,8 @@
2
2
 
3
3
  Custom commands let you define reusable prompts that run as `/command` in the mini-coder REPL.
4
4
 
5
+ mini-coder is shell-first: when a command needs repo inspection or verification, tell it to use shell. When it needs a targeted file edit, tell it to invoke `mc-edit` from shell rather than relying on old local file-edit tools.
6
+
5
7
  ## Where to put them
6
8
 
7
9
  | Location | Scope |
@@ -59,9 +61,9 @@ model: zen/claude-haiku-4-5
59
61
 
60
62
  Search the codebase for: $ARGUMENTS
61
63
 
62
- Use glob, grep, and read tools to explore thoroughly. Report all
64
+ Use shell and skill-loading tools as needed to explore thoroughly. Report all
63
65
  relevant files, key code snippets with line numbers, and a short summary.
64
- Be exhaustive but concise. No edits — read only.
66
+ Be exhaustive but concise. No edits.
65
67
  ```
66
68
 
67
69
  ```
@@ -113,11 +115,11 @@ lightweight tasks regardless of what the session is currently set to.
113
115
 
114
116
  ```md
115
117
  ---
116
- description: Quick grep for a symbol
118
+ description: Quick symbol search
117
119
  model: zen/claude-haiku-4-5
118
120
  ---
119
121
 
120
- Find all usages of $ARGUMENTS across the codebase using grep and glob.
122
+ Find all usages of $ARGUMENTS across the codebase using shell.
121
123
  List each occurrence with file path and line number. No explanations needed.
122
124
  ```
123
125
 
@@ -125,8 +127,7 @@ Large models for deep analysis, small models for search and lookup.
125
127
 
126
128
  ## Precedence
127
129
 
128
- Custom commands shadow built-ins. If you create `.agents/commands/plan.md`
129
- it will replace the built-in `/plan` for that project. The global `/review`
130
+ Custom commands shadow built-ins. The global `/review`
130
131
  command (auto-created at `~/.agents/commands/review.md` on first run) works
131
132
  the same way — a local `.agents/commands/review.md` will override it.
132
133
 
@@ -29,7 +29,7 @@
29
29
  : Display help information.
30
30
 
31
31
  **[prompt]**
32
- : Optional one-shot prompt text before entering interactive mode.
32
+ : Optional one-shot prompt text. Runs once, then exits.
33
33
 
34
34
  ## INTERACTIVE COMMANDS
35
35
  Inside the interactive session, the following slash commands are available:
@@ -61,14 +61,8 @@ Inside the interactive session, the following slash commands are available:
61
61
  **/cache gemini <off|cachedContents/...>**
62
62
  : Attach Google Gemini cached content.
63
63
 
64
- **/plan**
65
- : Toggle read-only planning mode.
66
-
67
- **/ralph**
68
- : Toggle autonomous execution looping.
69
-
70
64
  **/undo**
71
- : Revert the last turn and restore files.
65
+ : Remove the last conversation turn. This does not revert filesystem changes.
72
66
 
73
67
  **/new**
74
68
  : Clear context and start a fresh session.
@@ -88,6 +82,10 @@ Inside the interactive session, the following slash commands are available:
88
82
  **/agent [name]**
89
83
  : Set or clear an active primary custom agent.
90
84
 
85
+ **/review**
86
+ : Custom command that reviews the current session's changes (defined via `.agents/commands/`).
87
+
88
+
91
89
  **/help**
92
90
  : Display command help.
93
91
 
@@ -98,21 +96,22 @@ Inside the interactive session, the following slash commands are available:
98
96
  **Shell Integration**
99
97
  : Prefix user prompts with `!` to run shell commands inline directly into the context.
100
98
 
101
- **File & Agent Referencing**
102
- : Prefix words with `@` to reference files, custom agents, or skills within prompts (supports tab completion).
99
+ **File & Skill Referencing**
100
+ : Prefix words with `@` to reference files or skills within prompts (supports tab completion).
103
101
 
104
102
  ## BUILT-IN TOOLS
105
103
  The agent has access to the following tools:
106
- * **glob**: Discover files by glob pattern across the project.
107
- * **grep**: Search file contents using regular expressions.
108
- * **read**: Read file contents with line-range pagination support.
109
- * **create**: Write a new file or completely overwrite an existing one.
110
- * **replace**: Replace or delete targeted lines using hashline anchors.
111
- * **insert**: Insert new lines before/after an anchor without replacing existing content.
112
- * **shell**: Execute bash commands and capture output.
104
+ * **shell**: Execute bash commands and capture output. Repo inspection and targeted file edits are typically done here via `mc-edit`.
113
105
  * **subagent**: Spawn a focused mini-agent with a prompt.
106
+ * **listSkills**: List discovered skills without loading full skill bodies.
107
+ * **readSkill**: Load one `SKILL.md` on demand.
114
108
  * **webSearch**: Search the internet (requires EXA key).
115
109
  * **webContent**: Fetch full page content from a URL (requires EXA key).
110
+ * **MCP tools**: Connected external tools attached dynamically from configured MCP servers.
111
+
112
+ ## FILE EDIT HELPER
113
+ **mc-edit**
114
+ : Helper command used from shell for one exact-text edit on an existing file. On success it prints a human-readable plain unified diff to stdout followed by a short metadata block (`ok`, `path`, `changed`). If the edit is a no-op, it prints `(no changes)` plus the same metadata. Errors are written to stderr.
116
115
 
117
116
  ## ENVIRONMENT
118
117
  **OPENCODE_API_KEY**
@@ -135,14 +134,13 @@ The agent has access to the following tools:
135
134
 
136
135
  ## FILES & DIRECTORIES
137
136
  **~/.config/mini-coder/**
138
- : Application data directory. Contains `sessions.db` (SQLite database for session history, tool snapshots, MCP server configs, and model metadata), `api.log`, and `errors.log`.
137
+ : Application data directory. Contains `sessions.db` (SQLite database for session history, MCP server configs, and model metadata), `api.log`, and `errors.log`.
139
138
 
140
139
  **.agents/ or .claude/ (Local or Global in ~/)**
141
140
  : Configuration directories for advanced features:
142
141
  * **commands/*.md**: Custom slash commands.
143
142
  * **agents/*.md**: Custom behavioral wrappers or subagents.
144
143
  * **skills/<name>/SKILL.md**: Isolated context/instruction snippets.
145
- * **hooks/post-<tool>**: Executable scripts triggered upon tool execution.
146
144
 
147
145
  **AGENTS.md / CLAUDE.md**
148
146
  : Auto-loaded system context files for project-specific instructions.
@@ -151,8 +149,8 @@ The agent has access to the following tools:
151
149
  * **Multi-Provider LLM Routing**: Automatically discovers API keys to route to OpenCode (Zen), Anthropic, OpenAI, Google/Gemini, or local Ollama instances.
152
150
  * **Session Memory**: Persists conversation history in a local SQLite database, allowing users to resume past sessions effortlessly.
153
151
  * **Subagent Delegation**: Includes a tool to spawn parallel instances of itself to tackle independent subtasks simultaneously (up to 10 levels deep).
154
- * **Autonomous Mode (Ralph)**: An autonomous looping mode that runs tasks in an isolated context loop (up to 20 iterations) until completion.
155
- * **Plan Mode**: A read-only thinking mode utilizing read tools + MCP, safely analyzing code without making mutations or executing shell commands.
156
152
  * **Model Context Protocol (MCP)**: Native support for connecting external tools via MCP servers over HTTP or stdio.
157
153
  * **Prompt Caching**: Configurable caching behaviors for supported providers (OpenAI, Gemini).
158
- * **Undo Functionality**: Roll back the last conversation turn, cleanly restoring previous file states and git history via snapshots.
154
+ * **Undo Functionality**: Remove the last conversation turn from the current session history. It does not restore filesystem changes.
155
+
156
+
package/docs/skills.md CHANGED
@@ -1,28 +1,53 @@
1
1
  # Skills
2
2
 
3
- A skill is a reusable instruction file injected inline into your prompt.
4
- Use `@skill-name` to load it — the content is inserted into the message
5
- before it's sent to the LLM.
3
+ Skills are reusable instruction files discovered automatically from local and global directories.
6
4
 
7
- > **Skills are never auto-loaded.** They must be explicitly referenced
8
- > with `@skill-name` in your prompt. Nothing is injected automatically.
5
+ When a skill tells mini-coder how to work with files, prefer shell for inspection/search/verification and `mc-edit` from shell for targeted edits.
9
6
 
10
- ## Where to put them
7
+ - The model sees **skill metadata only** by default (name, description, source).
8
+ - Full `SKILL.md` content is loaded **on demand**:
9
+ - when explicitly requested with the runtime skill tools (`listSkills` / `readSkill`), or
10
+ - when you reference `@skill-name` in your prompt.
11
11
 
12
- Each skill is a folder containing a `SKILL.md`:
12
+ ## Discovery locations
13
+
14
+ Skills live in folders containing `SKILL.md`:
13
15
 
14
16
  | Location | Scope |
15
17
  |---|---|
16
- | `.agents/skills/<name>/SKILL.md` | Current repo only |
17
- | `~/.agents/skills/<name>/SKILL.md` | All projects (global) |
18
- | `.claude/skills/<name>/SKILL.md` | Current repo only (Claude-compatible) |
19
- | `~/.claude/skills/<name>/SKILL.md` | All projects (global, Claude-compatible) |
18
+ | `.agents/skills/<name>/SKILL.md` | Local |
19
+ | `.claude/skills/<name>/SKILL.md` | Local (Claude-compatible) |
20
+ | `~/.agents/skills/<name>/SKILL.md` | Global |
21
+ | `~/.claude/skills/<name>/SKILL.md` | Global (Claude-compatible) |
20
22
 
21
- Local skills override global ones with the same name. At the same scope, `.agents` wins over `.claude`.
23
+ Local discovery walks up from the current working directory to the git worktree root.
22
24
 
23
- ## Create a skill
25
+ ## Precedence rules
26
+
27
+ If multiple skills share the same `name`, precedence is deterministic:
28
+
29
+ 1. Nearest local directory wins over farther ancestor directories.
30
+ 2. Any local skill wins over global.
31
+ 3. At the same scope/path level, `.agents` wins over `.claude`.
32
+
33
+ ## Frontmatter
34
+
35
+ `SKILL.md` frontmatter supports:
24
36
 
25
- The folder name becomes the skill name (unless overridden by `name:` in frontmatter).
37
+ - `name` (**required**)
38
+ - `description` (**required**)
39
+
40
+ `name` constraints:
41
+
42
+ - lowercase alphanumeric and hyphen format (`^[a-z0-9]+(?:-[a-z0-9]+)*$`)
43
+ - 1–64 characters
44
+
45
+ Unknown frontmatter fields are allowed.
46
+
47
+ If either `name` or `description` is missing, mini-coder skips the skill and prints a warning.
48
+
49
+
50
+ ## Create a skill
26
51
 
27
52
  `.agents/skills/conventional-commits/SKILL.md`:
28
53
 
@@ -34,40 +59,25 @@ description: Conventional commit message format rules
34
59
 
35
60
  # Conventional Commits
36
61
 
37
- All commit messages must follow this format:
38
-
39
- <type>(<scope>): <short summary>
40
-
41
- Types: feat, fix, docs, refactor, test, chore
42
- - Summary is lowercase, no period at the end
43
- - Breaking changes: add `!` after type, e.g. `feat!:`
44
- - Body is optional, wrapped at 72 chars
62
+ Use:
63
+ <type>(<scope>): <short summary>
45
64
  ```
46
65
 
47
- Then in the REPL:
66
+ ## Use a skill explicitly
48
67
 
49
- ```
68
+ ```text
50
69
  @conventional-commits write a commit message for my staged changes
51
70
  ```
52
71
 
53
- The skill content is wrapped in `<skill name="…">…</skill>` tags and
54
- included in the message sent to the LLM.
55
-
56
- ## Frontmatter fields
57
-
58
- | Field | Required | Description |
59
- |---|---|---|
60
- | `name` | No | Skill name for `@` reference. Defaults to folder name. |
61
- | `description` | No | Shown in `/help`. Defaults to name. |
62
-
63
- ## Tab completion
64
-
65
- Type `@` and press `Tab` to autocomplete skill names alongside agents and files.
66
-
67
- ## Listing skills
72
+ `@skill-name` injects the raw skill body wrapped as:
68
73
 
74
+ ```xml
75
+ <skill name="conventional-commits">
76
+ ...
77
+ </skill>
69
78
  ```
70
- /help
71
- ```
72
79
 
73
- Skills are listed in yellow, tagged `(local)` or `(global)`.
80
+ ## Tab completion and help
81
+
82
+ - Type `@` then `Tab` to complete skill names.
83
+ - Run `/help` to list discovered skills with `(local)` / `(global)` tags.
package/package.json CHANGED
@@ -1,32 +1,34 @@
1
1
  {
2
2
  "name": "mini-coder",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "description": "A small, fast CLI coding agent",
5
5
  "module": "src/index.ts",
6
6
  "type": "module",
7
7
  "bin": {
8
- "mc": "dist/mc.js"
8
+ "mc": "dist/mc.js",
9
+ "mc-edit": "dist/mc-edit.js"
9
10
  },
10
11
  "scripts": {
11
12
  "build": "bun run scripts/build.ts",
12
13
  "dev": "bun run src/index.ts",
13
14
  "typecheck": "tsc --noEmit",
14
15
  "lint": "biome check src",
15
- "format": "biome format --write src",
16
+ "format": "biome check --write src",
16
17
  "knip": "knip",
17
18
  "test": "bun test --only-failures",
18
19
  "test:verbose": "bun test",
19
20
  "jscpd": "jscpd src"
20
21
  },
21
22
  "dependencies": {
22
- "@ai-sdk/anthropic": "^3.0.58",
23
- "@ai-sdk/google": "^3.0.43",
24
- "@ai-sdk/openai": "^3.0.41",
25
- "@ai-sdk/openai-compatible": "^2.0.35",
23
+ "@ai-sdk/anthropic": "^3.0.60",
24
+ "@ai-sdk/google": "^3.0.51",
25
+ "@ai-sdk/openai": "^3.0.45",
26
+ "@ai-sdk/openai-compatible": "^2.0.36",
26
27
  "@modelcontextprotocol/sdk": "^1.27.1",
27
- "ai": "^6.0.116",
28
- "ignore": "^7.0.5",
28
+ "ai": "^6.0.127",
29
+ "diff": "^8.0.3",
29
30
  "yoctocolors": "^2.1.2",
31
+ "yoctomarkdown": "^0.0.4",
30
32
  "zod": "^4.3.6"
31
33
  },
32
34
  "devDependencies": {
@@ -36,5 +38,10 @@
36
38
  "knip": "^5.86.0",
37
39
  "typescript": "^5.9.3"
38
40
  },
41
+ "knip": {
42
+ "entry": [
43
+ "src/mc-edit.ts"
44
+ ]
45
+ },
39
46
  "license": "MIT"
40
47
  }
package/research.md ADDED
@@ -0,0 +1,38 @@
1
+ I want your help exploring how could we use yoctocolor to add color ouput to commonly used shell commands. Let's first check the db, check the recent past sessions for a sample. Then check for the shell usage and assert the most common commands
2
+
3
+ Response:
4
+
5
+ ## Shell Usage Analysis (from 101 sessions)
6
+
7
+ Most common commands:
8
+ | Command | Count | Opportunity |
9
+ |---------|-------|-------------|
10
+ | `cat` | 72 | File content preview |
11
+ | `git` | 54 | Status/diff output |
12
+ | `bun` | 32 | Test/build output |
13
+ | `sed` | 29 | Transform preview |
14
+ | `mc-edit` | 26 | File edits |
15
+ | `nl` | 12 | Line numbers |
16
+ | `rg` | 11 | Search matches |
17
+ | `npm` | 9 | Package output |
18
+ | `grep` | 7 | Match highlighting |
19
+ | `ls` | 5 | File listings |
20
+
21
+ ## Current Shell Output Coloring (in `tool-result-renderers.ts`)
22
+
23
+ The shell result renderer already uses yoctocolors:
24
+
25
+ - **Status badges**: `c.green("done")` / `c.red("error")` / `c.yellow("timeout")`
26
+ - **Stderr lines**: `c.red()` for error emphasis
27
+ - **Stdout/stderr line separators**: `c.dim()` or colored pipe character
28
+
29
+ ## Enhancement Opportunities
30
+
31
+ 1. **Command syntax highlighting** - Color `git`, `bun`, `npm` commands differently in the tool call line
32
+ 2. **File path highlighting** - Use `c.cyan()` for paths in output
33
+ 3. **Git diffs from mc-edit** - Render a colored diff
34
+ 4. **Line numbers** - `nl` output could use `c.yellow()` for numbers
35
+ 5. **Git output** - Branch names in `c.cyan()`, commit hashes in `c.yellow()`, file statuses (M/A/D) in color
36
+ 6. **rg/grep matches** - Highlight matching text in `c.greenBright()` or `c.yellow()`
37
+ 7. **Exit code** - Non-zero codes in `c.red()` or `c.yellow()`
38
+ 8. **Test output** - `bun test` results: passes in `c.green()`, fails in `c.red()`, skips in `c.yellow()`
@@ -1,142 +0,0 @@
1
- # Tool Hooks
2
-
3
- A tool hook is an executable script that runs automatically after a specific tool call succeeds. Use hooks to trigger side effects — linting, formatting, logging, notifications — without modifying the agent's behaviour.
4
-
5
- > Hooks fire **after** the tool succeeds. Failures are silently swallowed and never crash the agent.
6
-
7
- ## Where to put them
8
-
9
- Hooks live in a `hooks/` folder inside an `.agents` config root:
10
-
11
- | Location | Scope |
12
- |---|---|
13
- | `.agents/hooks/post-<tool>` | Current repo only |
14
- | `~/.agents/hooks/post-<tool>` | All projects (global) |
15
-
16
- Local hooks take precedence over global ones. The filename must match `post-<tool>` exactly — no extension.
17
-
18
- ## Supported tools
19
-
20
- | Tool | Hook filename |
21
- |---|---|
22
- | `glob` | `post-glob` |
23
- | `grep` | `post-grep` |
24
- | `read` | `post-read` |
25
- | `create` | `post-create` |
26
- | `replace` | `post-replace` |
27
- | `insert` | `post-insert` |
28
- | `shell` | `post-shell` |
29
-
30
- MCP tools are not hookable.
31
-
32
- ## Script requirements
33
-
34
- The script must be executable (`chmod +x`). It can be written in any language — bash, Python, Node, etc. It receives context via environment variables and its exit code is reported in the UI (zero = success, non-zero = failure).
35
-
36
- ## Environment variables
37
-
38
- All hooks receive:
39
-
40
- | Variable | Description |
41
- |---|---|
42
- | `TOOL` | Name of the tool that fired |
43
- | `CWD` | Working directory of the session |
44
-
45
- Plus tool-specific variables:
46
-
47
- ### `post-create`
48
-
49
- | Variable | Description |
50
- |---|---|
51
- | `FILEPATH` | Absolute path of the file written |
52
- | `DIFF` | Unified diff of the change |
53
- | `CREATED` | `true` if the file was newly created, `false` if overwritten |
54
-
55
- ### `post-replace`
56
-
57
- | Variable | Description |
58
- |---|---|
59
- | `FILEPATH` | Absolute path of the file modified |
60
- | `DIFF` | Unified diff of the change |
61
- | `DELETED` | `true` if lines were deleted (no replacement content), `false` otherwise |
62
-
63
- ### `post-insert`
64
-
65
- | Variable | Description |
66
- |---|---|
67
- | `FILEPATH` | Absolute path of the file modified |
68
- | `DIFF` | Unified diff of the change |
69
-
70
- ### `post-shell`
71
-
72
- | Variable | Description |
73
- |---|---|
74
- | `COMMAND` | The shell command that was run |
75
- | `EXIT_CODE` | Exit code of the command |
76
- | `TIMED_OUT` | `true` if the command timed out |
77
- | `STDOUT` | Captured standard output |
78
- | `STDERR` | Captured standard error |
79
-
80
- ### `post-glob`
81
-
82
- | Variable | Description |
83
- |---|---|
84
- | `PATTERN` | The glob pattern that was searched |
85
-
86
- ### `post-grep`
87
-
88
- | Variable | Description |
89
- |---|---|
90
- | `PATTERN` | The regex pattern that was searched |
91
-
92
- ### `post-read`
93
-
94
- | Variable | Description |
95
- |---|---|
96
- | `FILEPATH` | Absolute path of the file read |
97
-
98
- ## Examples
99
-
100
- ### Auto-format on write
101
-
102
- `.agents/hooks/post-create`:
103
-
104
- ```bash
105
- #!/usr/bin/env bash
106
- # Run the project formatter whenever the agent creates or overwrites a file.
107
- bun run format -- "$FILEPATH"
108
- ```
109
-
110
- ```bash
111
- chmod +x .agents/hooks/post-create
112
- ```
113
-
114
- Pair with a matching `post-replace` and `post-insert` to cover all write tools.
115
-
116
- ### Log every shell command
117
-
118
- `~/.agents/hooks/post-shell`:
119
-
120
- ```bash
121
- #!/usr/bin/env bash
122
- # Append a record of every shell command to a global audit log.
123
- echo "$(date -u +%FT%TZ) exit=$EXIT_CODE $COMMAND" >> ~/.config/mini-coder/shell-audit.log
124
- ```
125
-
126
- ```bash
127
- chmod +x ~/.agents/hooks/post-shell
128
- ```
129
-
130
- ### Notify on file write
131
-
132
- `.agents/hooks/post-replace`:
133
-
134
- ```bash
135
- #!/usr/bin/env bash
136
- # macOS notification when the agent edits a file.
137
- osascript -e "display notification \"$FILEPATH\" with title \"mini-coder wrote a file\""
138
- ```
139
-
140
- ## Hook lookup
141
-
142
- Hooks are resolved once at session start and cached in memory — there is no filesystem access per tool call. Changing a hook script takes effect on the next session.