CLI Design Patterns for AI Agents: Misconceptions and Practical Approaches

CLI Interface Protocol Clarification
The biggest misconception from Part 1 was that "CLI" meant giving an LLM a Linux terminal. CLI is actually an interface protocol: text command in → text result out. Implementation can happen in two ways:
- As a binary or script in the shell's PATH — becomes a CLI tool that runs in a real shell
- As a command parser inside your code — when the LLM outputs
run(command="weather --city Tokyo"), you parse the string and execute it directly in your application code with no shell involved
The key is making the LLM feel like it's using a CLI. In the author's system, most commands never touch the OS — they're Go functions dispatched by a command router. Only commands that genuinely need a real OS (running scripts, installing packages) go to an isolated micro-VM. The agent doesn't know and doesn't care which layer handles its command.
Agent-Friendly CLI Design Principles
Two Core Philosophies
Philosophy 1: Unix-Style Help Design
tool --help→ list of top-level commandstool <command> --help→ specific parameters and usage for that subcommand
This allows the agent to discover capabilities on demand without stuffing all documentation into context upfront.
Philosophy 2: Tips Thinking
Every response — especially errors — should include guidance that reduces unnecessary exploration.
Bad example:
> cat photo.png [error] binary file
Good example:
> cat photo.png [error] cat: binary file detected (image/png, 182KB). Use: see photo.png (view image) Or: cat -b photo.png (base64 encode)
Why this matters: invalid exploration wastes tokens. In multi-turn conversations, this waste accumulates — every failed attempt stays in context, consuming attention and inference resources for every subsequent turn. A single helpful hint can save significant tokens across the rest of the conversation.
Safe CLI Design
When CLI commands involve dangerous or irreversible operations, the tool itself should provide safety mechanisms.
Dry-Run / Change Preview — Preventing Mistakes
For operations within the agent's authority but with hard-to-reverse consequences. The goal is to let the agent (or human) see what will happen before committing.
> dns update --zone example.com --record A --value 1.2.3.4 ⚠ DRY RUN: A record for example.com: 5.6.7.8 → 1.2.3.4 Propagation: ~300s. Not instantly reversible. To execute: add --confirm
The preview should clearly show what the current state is and what it will change to. The agent confirms with --confirm.
Human Authorization — Operations Beyond the Agent's Autonomy
For operations requiring human judgment or approval — no matter how confident the agent is, it cannot complete these on its own.
Approach 1: Blocking Push Approval
> pay --amount 500 --to vendor --reason "office supplies for Q2" ⏳ Approval required. Notification sent to your device. Waiting for response... ✓ Approved. Payment of $500 completed. [exit:0 | 7.2s]
Like Apple's device login verification — the CLI sends a push notification directly to the human's device with full context (amount, recipient, reason). The CLI blocks until the human approves or rejects, then returns the result to the agent.
Approach 2: Verification Code / 2FA
> transfer --from savings --to checking --amount 10000 ⚠ This operation requires 2FA verification. Reason: transferring $10,000 between accounts. A code has been sent to your authenticator. Re-run with: --otp <code>
📖 Read the full source: r/LocalLLaMA
👀 See Also

Five Common OpenClaw Configuration Issues That Inflate API Costs
A Reddit post identifies five configuration problems in OpenClaw setups that lead to excessive API credit consumption, including using expensive models for routine tasks, missing budget limits, open gateways, unmanaged memory, and unaudited skills.

12GB VRAM Benchmarks: Running Qwen 3.6 and Gemma 4 Models on a RTX 4070 Super
A Reddit user shares detailed speed benchmarks for Qwen3.6-35B-A3B, Qwen3.6-27B, Gemma 4 26B, and Gemma 4 31B on a 12GB RTX 4070 Super using llama.cpp with optimized settings.

OpenClaw Agent Cost Analysis: From $340 to $112 Monthly with Five Optimizations
A developer tracked 18,000 API calls across four OpenClaw agents for 30 days, finding 70% of tasks didn't need GPT-4.1. By implementing prompt caching, shortening system prompts, batching analytics, switching to cheaper models, and adding max token limits, costs dropped from $340 to $112 monthly.

CLAUDE.md Files Are Often Organized for Developers, Not AI Models – Here's Why That Matters
CLAUDE.md files commonly place Hard Rules at line 47, after background and tech stack. By the time the model reads constraints, it has already constructed conflicting assumptions. A better structure puts hard rules first.