ultraworkers / ultraworkers/claw-code

Add structured (JSON) output for tool/agent integration

Open
#3,262 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
195k
Forks
108k
PR merge metrics
No merged PRs in 30d

Description

What

A machine-readable output mode for claw -- a --json (or --format json) flag that emits a structured final result instead of (or alongside) raw stdout.

Ideally:

  • a single final JSON envelope with at least: the result/assistant text, an exit/outcome status, and token usage + cost when available; and/or
  • a newline-delimited JSON (NDJSON) event stream for progress, terminated by the final result object (the shape codex exec --json and opencode run --format json already use).

Why

Tools that drive a coding agent as a non-interactive subprocess need machine-parseable output to integrate it reliably. kazi (an open-source reconciliation controller that drives a coding agent in a loop until a goal's predicates are objectively true) supports multiple harnesses as config-driven profiles -- claude, opencode, codex, and others -- by parsing each harness's structured output for the result and token/cost usage.

Because claw currently emits only raw stdout with no structured envelope, its integration is necessarily best-effort: the raw text can be captured as the result, but there is no reliable way to extract the outcome status or token/cost. A --json mode would let claw be driven as a first-class, cost-accountable harness the same way codex/opencode are.

Suggested shape (for reference)

claw <prompt> --json
# -> {"result": "...", "status": "ok", "usage": {"input_tokens": N, "output_tokens": M, "cost_usd": X}}

Matching the codex/opencode NDJSON convention would let existing parsers be reused. Happy to share how the kazi profile contract works if useful. Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no implementation files, tests, or entry points; begin by locating the claw CLI output path and existing argument parsing. Done means a documented --json or --format json mode emits a machine-readable final result with status and available usage or cost data, optionally following the referenced NDJSON convention.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.