Agent Tool Output
Load: npx cyberplace@<version> governance show agent-tool-output
Rules for scripts, hooks, and CLIs that AI agents invoke. Apply when authoring skill scripts/ or documenting CLI commands in SKILL.md.
Agent-native tools
Section titled “Agent-native tools”For skill scripts/, hook runtime commands, and any tool where the primary consumer is always an agent.
Stdout is the machine contract
Section titled “Stdout is the machine contract”- Emit one JSON value per run, or silence on success with no payload
- Use
process.stdout.write(JSON.stringify(result) + '\n')— neverconsole.logfor contract output - No prose, tables, progress bars, or ANSI decoration on stdout in default mode
Stderr is human/diagnostic
Section titled “Stderr is human/diagnostic”- Use
console.warn,console.error, orprocess.stderr.writefor diagnostics - Gate tables, progress, and verbose human output behind a
--verboseflag
Files hold durable state
Section titled “Files hold durable state”- Write artifacts to disk; stdout JSON names paths or fields only
- Agents read artifact files by path from stdout JSON — not by scraping stdout prose
Skills present; tools record
Section titled “Skills present; tools record”SKILL.mdtells the agent which file or JSON field to read- The agent summarizes results for the user — the tool does not format user-facing prose on stdout
Non-interactive paths
Section titled “Non-interactive paths”- Document
--yesor an equivalent non-interactive flag when the tool can prompt - Never put interactive prompts on stdout
- Agents must be able to run the tool without human input
Exit codes
Section titled “Exit codes”0= success- Non-zero = failure; include a concise error on stderr
Dual-audience CLI
Section titled “Dual-audience CLI”For command-line tools used by both humans and agents.
Default stdout = human-readable
Section titled “Default stdout = human-readable”Tables, aligned fields, and prose summaries are fine for interactive terminal use.
--format agent = agent contract
Section titled “--format agent = agent contract”- Agents must pass
--format agentwhen they need output optimized for LLM reasoning --format agentis terse, structured text — lower token cost and better reasoning than JSON--format jsonis for non-LLM machine consumers (scripts, pipelines)SKILL.mdmust instruct agents to use--format agent, not to parse default prose or tables--jsonis a deprecated alias for--format json
Errors and verbosity
Section titled “Errors and verbosity”- Errors and validation failures go to stderr
- Optional human status goes to stderr when
--verboseis set
SKILL.md authoring
Section titled “SKILL.md authoring”When a skill documents commands agents run:
- Tell agents which flag to use:
--format agentfor LLM consumption,--format jsonfor non-LLM - Do not instruct agents to parse default stdout prose, summary tables, or generic “script output” as data
- Prefer: “read
<artifact-path>” or “run with--format agent” or “run with--format jsonand parse the array”