golem-cli-structured-output

Parse Golem CLI structured output in JSON, YAML, and TOON formats.

1.5k|212|Updated Nov 24, 2023
One-click install
npx skills add https://github.com/golemcloud/golem --skill golem-cli-structured-output
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golem-cli-structured-output
Source: https://github.com/golemcloud/golem/tree/main/golem-skills/skills/common/golem-cli-structured-output
Command: npx skills add https://github.com/golemcloud/golem --skill golem-cli-structured-output

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Building scripts, coding agents, or test harnesses that consume Golem CLI output requires understanding its structured output contract: the --format flag, the $type discriminator, schema discovery, and stream framing. This Skill provides the parsing rules so tools interpret CLI output correctly instead of scraping human-readable text.

Core Features & Use Cases

  • Structured Format Guidance: Explains how to request JSON, YAML, or TOON output via the global --format flag and why stdout carries the payload while stderr carries logs.
  • Schema Discovery: Covers golem output-schema for listing $type values and fetching focused, pruned JSON Schemas for specific output types.
  • Stream and Multi-Document Parsing: Details single, stream, and multi-document output modes, including TOON @toon/@end framing and line-delimited JSON streams.
  • Use Case: You are writing a coding agent that invokes golem agent list and golem deploy. Use this Skill to branch on $type values, fetch focused schemas with golem output-schema --type, and parse streamed agent.oplog entries line by line.

Quick Start

Ask the AI to write a script that runs golem agent list with JSON output and parses the result using the $type field and output-schema metadata.

Frequently Asked Questions about golem-cli-structured-output

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I get JSON output from the Golem CLI?

Pass the global --format flag before the command, for example golem --format json agent list. The structured payload is written to stdout while logs and diagnostics go to stderr, so parse only stdout.

How do I discover the schema of Golem CLI output types?

Run golem output-schema --types to list known $type values, then golem output-schema --type <TYPE> for a focused, pruned JSON Schema. Focused schemas include only the definitions referenced by the selected types, keeping context small for coding agents.

What is the $type field in Golem CLI output?

Every structured output document has a top-level $type field acting as a stable discriminator, such as agent.list or deploy.plan. Branch on $type before reading command-specific fields, and use x-golem-command metadata to map types to commands.

How do I parse streaming output from golem agent stream?

With compact JSON format, each streamed document is emitted as one JSON line, so parse stdout line by line until EOF. For pretty-json, YAML, or TOON, parse stdout as a sequence or framed stream rather than a single object.

Why are secrets masked in Golem CLI structured output?

Most secret-bearing outputs are masked by default; pass --show-secrets only when raw values are intentionally needed. The exception is golem api-token new, which emits the token once because it cannot be retrieved later.

Can I combine --format json with interactive CLI modes?

No. Interactive terminal modes such as agent list --refresh continuously redraw the terminal and are text-only, so they cannot be combined with structured formats like JSON, YAML, or TOON.