@coder is the engineering suite used by Coder Mode (/coder). It provides actions for reading/searching files, safely applying patches, running commands, and reverting changes.
@coder is a builtin plugin — it comes embedded in the ChatCLI binary and works immediately, without installation. If you need a custom version, simply place the binary in ~/.chatcli/plugins/ and it will take precedence over the builtin. When removed, the builtin returns automatically on the next /plugin reload.Quick Reference
All subcommands and their most commonly used flags at a glance:Argument Formats
@coder accepts two argument formats: JSON and CLI-style. Both are equivalent.
- JSON Format (recommended)
- CLI-style Format
args attribute of a <tool_call>. The structure is:Subcommands — Complete Reference
read -- Read Files
read -- Read Files
write -- Write Files
write -- Write Files
.bak backup of the existing file before overwriting.Flags
Examples
- JSON
- CLI-style
write (also patch and multipatch), ChatCLI runs the language server over the touched files and appends any findings to the tool result as a [DIAGNOSTICS] block — so a broken edit is caught immediately, in the same turn, instead of turns later when a test fails. It is silent on clean files, capped at 5 files / 3000 characters, and disabled with CHATCLI_CODER_AUTODIAG=off. A language server must be available for the file’s language (see LSP Diagnostics).patch -- Apply Patches
patch -- Apply Patches
Flags
--search + --replace) or diff mode (--diff). Do not combine both.Search/Replace Mode
- JSON
- CLI-style
Unified Diff Mode
- JSON
- CLI-style
tree -- Directory Structure
tree -- Directory Structure
search -- Full-Text Search
search -- Full-Text Search
outline -- File Symbol Skeleton
outline -- File Symbol Skeleton
go/ast: functions with their receiver, structs, interfaces, consts, vars); for Python, JS/TS/JSX, Java, Ruby, Rust, Kotlin, C# and PHP a pattern-based outline recognizes the common declaration forms. Read-only.Flags
Examples
- JSON
- CLI-style
map -- Repository Structure Map
map -- Repository Structure Map
.git, node_modules, vendor, dist, build, hidden files and *_test.go. Read-only. Use it to orient yourself in a large codebase without reading whole files.Flags
Examples
- JSON
- CLI-style
exec -- Execute Commands
exec -- Execute Commands
test -- Run Tests
test -- Run Tests
git-status -- Repository Status
git-status -- Repository Status
Examples
- JSON
- CLI-style
git-diff -- Pending Differences
git-diff -- Pending Differences
git-log -- Commit History
git-log -- Commit History
git-changed -- Changed Files
git-changed -- Changed Files
rollback -- Revert Changes
rollback -- Revert Changes
clean -- Remove Backups
clean -- Remove Backups
checkpoint -- Shadow-git Snapshots
checkpoint -- Shadow-git Snapshots
.bak rollback — it covers multi-file edits and exec side effects, not just a single file.A checkpoint is taken automatically before every mutating subcommand (write, patch, multipatch, exec). The snapshot lives in a separate GIT_DIR under ~/.chatcli/checkpoints/<hash> with your workspace as its work tree, so your own .git is never touched and your project’s .gitignore is honored.Flags
Examples
- JSON
- CLI-style
--restore never deletes files added after the snapshot; it only rewinds what the snapshot tracked. It goes through the security gate; --list and --create are read-only.git is not installed, and switched off entirely with CHATCLI_CODER_CHECKPOINTS=off.They are also bounded: workspaces as broad as your home directory (or any directory containing it) are never auto-snapshotted — hashing that much of the disk would freeze every command — and each snapshot runs under a hard deadline (10s automatic, 60s for an explicit checkpoint create, overridable in seconds via CHATCLI_CODER_CHECKPOINT_TIMEOUT). Repeated snapshot failures back off exponentially and, after three in a row, disable automatic snapshots for the rest of the session with a one-line warning.Transactional multipatch
When a refactor needs to touch multiple files as one unit (rename an identifier propagated across 5 files, update an import in every consumer, etc.), usemultipatch instead of chaining patch calls. The contract:
Phase 1 — validation (no writes)
search→replace in memory, and verifies the search text is still present after prior in-flight edits to the same file. A failure on any edit aborts the transaction before any disk write.Phase 2 — commit
Concurrency
search→replace exactly once (strings.Replace with n=1). To replace multiple occurrences in the same file, declare multiple edits. Per-edit base64 encoding is supported ("encoding":"base64") for payloads with non-UTF8 bytes.Backup System
@coder implements an automatic backup system to protect against unwanted changes.
Write or Patch
write or patch, the plugin checks whether the target file already exists.Backup Creation
.bak extension (e.g., main.go -> main.go.bak).Change Application
Rollback Available
rollback --file main.go to restore the previous version from the .bak file.Cleanup
clean to remove all .bak files when you no longer need the backups.Path Validation and Security
@coder applies several security validations to all file paths:
Workspace Boundary
../../etc/passwd).Symlink Resolution
Sensitive Paths
/etc/shadow, /etc/passwd) are blocked by default, preventing read or write operations.Dangerous Commands
exec subcommand filters known destructive patterns such as rm -rf /, dd, fork bombs, and others. These commands are rejected before execution.Complete Usage Example (in /coder)
In/coder mode, the assistant responds with a reasoning block followed by a tool_call. Here is a complete engineering workflow:
JSON Recovery and Robust Parsing
@coder includes a JSON recovery system that automatically fixes malformed arguments generated by LLMs:
7 Recovery Strategies
Escaped Quotes in Shell
exec --cmd "echo \"hello\"".Unicode Quote Normalization
Concurrent Execution
Important Notes
@coder appears in /plugin list with the [builtin] tag. It cannot be uninstalled via /plugin uninstall.Plugin @coder FAQ
Does @coder accept JSON in args?
Does @coder accept JSON in args?
When to use patch --diff vs --search/--replace?
When to use patch --diff vs --search/--replace?
--search/--replace for simple, targeted substitutions at a single location in the file. Use --diff when you need to apply multiple changes at once or when the change involves adding/removing lines in different sections of the file. The diff can be encoded as text or base64.Is exec dangerous?
Is exec dangerous?
@coder exec blocks dangerous patterns by default, such as rm -rf /, dd targeting disk devices, and fork bombs. The protection is automatic and requires no configuration.Is there a read limit?
Is there a read limit?
--max-bytes 200000 (200KB). You can also use --head or --tail to read only portions of the file. This prevents very large outputs from overwhelming the model’s context window.What happens if I write to the same file twice?
What happens if I write to the same file twice?
.bak backup is overwritten on each operation. Only the version immediately before the last write will be available for rollback. If you need full history, use git for version management.Can I use @coder outside of /coder mode?
Can I use @coder outside of /coder mode?
@coder plugin can be invoked in any mode that supports tool_calls. The /coder mode simply configures the system prompt to guide the model to use @coder as its primary tool.How do I replace the builtin @coder with a custom version?
How do I replace the builtin @coder with a custom version?
~/.chatcli/plugins/ directory. It will take precedence over the builtin. To revert to the builtin, remove the custom binary and run /plugin reload.Is --encoding base64 necessary?
Is --encoding base64 necessary?
write and patch when the content contains special characters, quotes, backslashes, or multiple lines. Base64 completely eliminates JSON escaping issues.Next steps
Coder Mode
/coder orchestrates @coder in a full ReAct loop.Coder Security
Enhanced Permissions
JSON Recovery
File Staleness
Cookbook: Fix tests
@coder to autonomously fix tests.