How Ponytail Formats Output for Different AI Hosts: Claude, Codex, Copilot, and Qoder
Ponytail returns structured JSON payloads for Claude and Anthropic Codex when invoked with the --output-format json flag, while delivering raw plain text completions to VS Code Copilot and Qoder hosts that omit formatting flags.
The DietrichGebert/ponytail repository implements host-aware output formatting that adapts its payload structure based on which AI client invokes the tool. This Ponytail output format for AI hosts varies between structured metadata envelopes and direct text streams, depending entirely on the hook manifest configuration each host uses.
Host Detection via Hook Manifests
Ponytail determines its output format by inspecting the hook manifest that triggers its execution. Each AI host maintains a distinct JSON configuration file in the hooks/ directory that defines how Ponytail is activated and whether structured output is requested.
- Claude Code and Codex both reference
hooks/claude-codex-hooks.json - VS Code Copilot uses
hooks/copilot-hooks.json - Qoder relies on
hooks/qoder-hooks.json
These manifests control whether the --output-format json flag is appended to the CLI invocation, which directly determines whether Ponytail receives a parseable JSON envelope or raw text.
JSON Output Format for Claude and Codex
When operating with Claude Code or Anthropic Codex, Ponytail receives structured JSON containing the model completion wrapped with metadata fields critical for benchmarking and cost analysis.
How JSON Mode Is Activated
In hooks/claude-codex-hooks.json, the hook definition passes the --output-format json flag during session initialization. The benchmark runner at benchmarks/agentic/run.py (line 311) demonstrates this invocation pattern:
claude -p --output-format json \
--permission-mode bypassPermissions \
--output-format json
JSON Structure and Metadata
The JSON payload returned by Claude includes fields such as output_tokens, input_tokens, and duration, enabling precise tracking of inference costs and performance characteristics. Ponytail extracts these values—referenced as out_tokens and in_tokens in the benchmark utilities—to log resource consumption alongside the generated content.
Plain Text Output for Copilot and Qoder
For editor-integrated hosts, Ponytail outputs raw plain text that requires no additional parsing before display.
VS Code Copilot Implementation
The hooks/copilot-hooks.json manifest defines sessionStart and userPromptSubmitted commands that invoke ponytail-activate.js without requesting JSON formatting:
{
"sessionStart": [
{
"type": "command",
"bash": "node \"${PLUGIN_ROOT}/hooks/ponytail-activate.js\"",
"powershell": "node \"${PLUGIN_ROOT}\\hooks\\ponytail-activate.js\"",
"timeoutSec": 5
}
]
}
Because Copilot omits the --output-format flag, the model's completion flows directly through standard output as consumable text.
Qoder Hook Configuration
Similarly, hooks/qoder-hooks.json configures a UserPromptSubmit hook and PreToolUse matcher that execute ponytail-mode-tracker.js without structured output parameters:
{
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "node PONYTAIL_DIR/hooks/ponytail-mode-tracker.js"
}
]
}
]
}
Qoder consumes this raw text response directly within its extension interface.
Core Instruction Generation
Regardless of the output envelope style, all hosts receive identical prompt content generated by hooks/ponytail-instructions.js. This script constructs the actual instruction text sent to the model; only the packaging—JSON metadata versus plain text—differs between hosts.
Why Output Formats Differ by Host
The architectural distinction between JSON and plain text reflects fundamental differences in host consumption patterns:
- Claude and Codex operate as agentic systems where automated parsing of
output_tokensandinput_tokensenables programmatic cost tracking and performance benchmarking - Copilot and Qoder function as IDE extensions where human readability takes precedence, and additional JSON parsing would introduce unnecessary latency and complexity
Summary
- Claude and Codex use
hooks/claude-codex-hooks.jsonto trigger Ponytail with--output-format json, receiving structured payloads containing token usage metadata and duration metrics - Copilot relies on
hooks/copilot-hooks.jsonto execute Ponytail scripts without formatting flags, receiving direct text output suitable for immediate editor display - Qoder utilizes
hooks/qoder-hooks.jsonwith plain text hooks likeUserPromptSubmit, consuming raw model completions through standard output - All hosts execute the same underlying instruction generation logic in
hooks/ponytail-instructions.js, differing only in how the response is encapsulated and returned
Frequently Asked Questions
Why does Claude receive JSON while Copilot receives plain text?
Claude and Codex support the --output-format json CLI flag, which Ponytail leverages through their shared hooks/claude-codex-hooks.json manifest to capture structured metadata like token counts and execution duration. Copilot's hooks/copilot-hooks.json does not specify this flag because the VS Code extension expects human-readable text directly from standard output without additional parsing layers.
Can I force JSON output for hosts that default to plain text?
No, the output format is determined by the host's native capabilities and hook manifest configuration. Copilot and Qoder lack native support for structured JSON responses in their current extension architectures, so their respective hooks/copilot-hooks.json and hooks/qoder-hooks.json manifests omit the formatting flag to prevent compatibility issues.
What specific metadata fields are included in the JSON response?
According to the benchmark runner implementation in benchmarks/agentic/run.py, the JSON payload includes output_tokens (also referenced as out_tokens), input_tokens (in_tokens), and duration. These fields enable precise measurement of inference costs and latency during automated benchmarking sessions.
Where are the hook manifest files located in the repository?
The hook configurations reside in the hooks/ directory at the repository root. Claude and Codex share hooks/claude-codex-hooks.json, Copilot uses hooks/copilot-hooks.json, and Qoder references hooks/qoder-hooks.json. The actual instruction generation script used by all hosts is located at hooks/ponytail-instructions.js.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →