GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing chatcli.edilsonfreitas.com — Coder Mode (/coder) - ChatCLI The /coder mode is specialized for software engineering tasks with a read, modify, and feedback cycle.
It provides more rigor than /agent, because the assistant follows an output contract so that ChatCLI can execute actions safely (with rollback semantics).
When to UseUse /coder for...Real changes to the repository, running tests/lint/build automatically, applying patches with rollback, iterating until a verifiable result. Use /agent for...High-level conversations, writing text, ideas, plans — without executing code directly. Handoff from chatYou do not have to know in advance that a request needs the workspace. In chat mode the assistant recognizes it (changing code, running or debugging the project, multi-step work in the repository), answers briefly with its understanding, and proposes the switch itself:y, yes, s, sim, ok) enters coder mode with that task, exactly as if you had typed /coder <task>; n / no stays in chat; any other text is a normal chat turn and the proposal is dropped. Plain text never changes mode on its own — you always confirm.
The proposal is only made on an attended interactive session; the gateway, MCP/ACP and one-shot (-p) surfaces never receive it. Set CHATCLI_CHAT_CODER_HANDOFF=false to turn it off (see environment variables).
Engineering FlowMulti-Agent Orchestration/coder includes multi-agent orchestration enabled by default. The orchestrator LLM dispatches specialized agents in parallel:
CHATCLI_AGENT_MAX_WORKERS).
Disable with CHATCLI_AGENT_PARALLEL_MODE=false if needed. See the full documentation.Output ContractThe assistant’s response format in/coder is mandatory:
1 Reasoning Before any action, the assistant writes a short reasoning block (2 to 6 lines).2 Tool Call If it needs to act, it emits a tool_call name="@coder" args="..." with JSON in the args.3 No direct commands It never uses code blocks or direct shell commands — everything goes through @coder.Contract Validation and EnforcementWhen the AI violates the output contract, ChatCLI automatically detects it and injects a format correction feedback message. The turn is reprocessed until the format is correct. The enforcement rules are:
If the AI persists in violating the contract after multiple attempts, ChatCLI aborts the turn and displays a warning to the user. This rarely happens with modern models. agent_coder_validation.go — a dedicated module that inspects each AI response before executing any tool_call. The sequence is:
Internal Difference Between /coder and /agentBoth modes use the same ReAct loop (processAIResponseAndAct). The difference is in configuration, not architecture:
In practice, /coder is /agent with additional guardrails. If you switch from /agent to /coder mid-conversation, the history is preserved — only the validation rules and system prompt change.isCoderMode flag is what activates all the differences. When true:
Task Tracker and ProgressWhen the AI includes a<plan> block with numbered tasks (e.g., “1. Read files\n2. Apply patch\n3. Run tests”), the TaskTracker automatically parses this and creates a TaskPlan:
How it works
Task status
Automatic replanningIf 3 or more tasks fail consecutively, the TaskTracker signalsNeedsReplan = true. ChatCLI then injects a system message asking the AI to reformulate its plan before continuing.
The TaskTracker also computes a signature (hash) of the plan. If the AI changes its plan between turns (e.g., adds or removes tasks), the tracker detects the change and restarts tracking with the new plan.
The TaskTracker is purely informational for the user — it does not block execution. Even if the progress shows “Failed”, the AI may decide to ignore the error and continue. TodoWrite parity —
Beyond the TaskTracker (which automatically extracts tasks from the |
| Operation | Rule |
|---|---|
write --content | JSON text by default; --encoding base64 optional |
patch --search / --replace | JSON text by default; --encoding base64 optional |
patch --diff | Unified diff as text; --diff-encoding base64 optional |
read, search, tree | Not applicable (output is always text) |
--encoding flag--encoding flag controls content interpretation:
text (default): content is interpreted as literal textbase64: content is decoded from base64 before being written# Example: writing plain text (newlines escaped inside the JSON string)
<tool_call name="@coder" args='{"cmd":"write","args":{"file":"main.go","content":"package main\n\nfunc main() {}\n"}}' />
# Example: a binary file with base64
@coder write --file logo.png --content "iVBORw0KGgo..." --encoding base64
Layer 1: Persona or CoderSystemPrompt
--persona senior-go), the persona prompt is used as the base. Otherwise, the default CoderSystemPrompt is used.Layer 2: CoderFormatInstructions
CoderFormatInstructions are appended to the persona prompt. This ensures the persona respects the /coder output contract. When no persona is active, the instructions are already embedded in the CoderSystemPrompt.Layer 3: Workspace Context
contextBuilder:SOUL.md — personality and global guidelinesUSER.md — user preferencesRULES.md — project-specific rulesLayer 4: Tool Context
@coder schema is included: list of subcommands, required flags, and 1-2 examples per subcommand. In /coder mode, this context is reduced compared to /agent to save tokens.Layer 5: Multi-Agent Orchestrator Prompt
CHATCLI_AGENT_PARALLEL_MODE=true), the multi-agent orchestrator prompt is appended with the list of available agents and dispatch instructions.<plan> followed by <tool_call name="@coder">tool_call and execute block format/coder mode uses the @coder plugin, which comes built into ChatCLI — no additional installation required.
/plugin list — @coder appears with the [builtin] tag.| Subcommand | Description |
|---|---|
tree --dir . | List directory tree |
search --term "x" --dir . | Search the codebase |
read --file x | Read file |
write --file x --content "..." | Write file (--encoding base64 optional) |
patch --file x --search "..." --replace "..." | Apply patch |
patch --diff "..." | Apply unified diff (--diff-encoding base64 optional) |
exec --cmd "command" | Execute command |
git-status --dir . | Git status |
git-diff --dir . | Git diff |
git-log --dir . | Git log |
git-changed --dir . | Changed files |
git-branch --dir . | Current branch |
test --dir . | Run tests |
rollback --file x | Revert change |
clean --dir . | Clean backups |
delegate --prompt "..." --tools [...] | Delegate sub-task to a subagent with isolated context — see Subagent Delegation |
/coder mode also receives the CHATCLI_AGENT_TMPDIR variable pointing to the session scratch dir. It is the recommended path for creating temporary scripts and intermediate files without polluting the project.List the tree
tree --dir .Search for occurrences
search --term "FAIL" --dir .Read relevant files
read --file cli/agent_mode.goApply patch
patch --file cli/agent_mode.go --search "..." --replace "..."Run tests
exec --cmd "go test ./..."/coder maximizes parallelism by emitting multiple tool_calls in a single response when operations are independent. For example, when needing to read 3 files, the AI emits 3 tool_call tags at once instead of one per turn.
A failure inside such a batch does not throw the rest away: the failed action reports its error, the read-only siblings still run, and only a mutating sibling (write, exec, patch…) is skipped — with a note saying it was skipped because an earlier action failed — so nothing builds on a broken step. A read-only tool that hits a transient failure (timeout, connection reset, DNS hiccup, 429/5xx) is retried once before the failure reaches the model; mutating tools are never retried, since the first attempt may have landed.
For complex tasks with 3+ independent operations, the AI uses <agent_call> to dispatch specialized agents in parallel via goroutines.
tool_call (just text with a question), ChatCLI detects this and:
Waiting for your response... prompt instead of ending the session+-- RESPONSE
| I need information before proceeding:
| 1. Which database? (PostgreSQL, MySQL, SQLite)
| 2. Which library? (pgx, GORM, sqlx)
| 3. Database host and port?
+--------------------------------------------------
Waiting for your response (--- for multiline, 'exit' to finish): PostgreSQL, pgx, localhost:5432
<plan> + <tool_call> as usual.
--- (``` is also accepted as a fence opener):
Waiting for your response: ---
Multiline mode — type --- on a new line to finish
... [1] PostgreSQL on port 5432
... [2] Host: db.internal
... [3] Use pgx as driver
... [4] Schema: public
... [5] ---
/coder is waiting for your reply uses the same readline engine as chat mode (go-prompt + BracketedPasteParser). That means:
| Feature | Behavior |
|---|---|
| Width | Grows to the real terminal width — no 80-column cap |
| Bracketed paste | Pasted multiline content is preserved (does not submit on the first newline) |
| Editing | Arrows, Home/End, Ctrl+A/E, word navigation (Alt/Ctrl+arrows) |
| Paste detection | Large pastes are captured via placeholder (same mechanism as chat) and expanded before going to the AI |
| Non-TTY stdin (pipes, CI) | Automatic fallback to bufio.Reader — the agent still reads one line per iteration |
golang.org/x/term reader that capped at 80 columns and treated each pasted \n as Enter. If you still see that behavior, update ChatCLI — the chat-parity holds on any modern terminal.exit, quit, or sairCtrl+C/coder system prompt. The AI is instructed not to emit tool_calls when it needs user-provided information, but instead ask the question directly. This ensures ChatCLI detects the question and waits for the response.Can I use JSON in args?
tool_call name="@coder" args='{"cmd":"read","args":{"file":"main.go"}}'When should I use patch --diff?
text or base64.Do I need to install @coder separately?
@coder is a builtin plugin — it comes embedded in the binary. If you install a custom version in ~/.chatcli/plugins/, it will take precedence over the builtin.Is exec safe?
@coder exec blocks dangerous patterns by default. For sensitive commands, prefer using the Git subcommands and test.Is there a read limit?
read --max-bytes, --head, or --tail to control the output size.How does /coder handle AI format errors?
Can I use /coder with a custom persona?
--persona senior-go), the persona prompt is used as the base and CoderFormatInstructions are automatically appended. This ensures the persona respects the /coder output contract without losing its custom personality.What is the Task Tracker?
<plan> block (e.g., “1. Read files\n2. Apply patch”). Each task receives a status (Pending, InProgress, Completed, Failed) that is updated as tool_calls are executed. Progress is displayed in the interface. If 3+ tasks fail, ChatCLI asks the AI to reformulate its plan.Is base64 required for write?
\n, quotes as \") and reaches the disk byte for byte: the parser keeps JSON escapes and backtick spans inside args intact. Use "encoding":"base64" only for binary files or content so dense with quotes and backslashes that escaping it is error-prone.