openclaw - 💡(How to fix) Fix RFC: standardize --json envelope shape across list-style subcommands (agents/sessions/models/cron/nodes/skills) [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#77943Fetched 2026-05-06 06:18:56
View on GitHub
Comments
1
Participants
2
Timeline
1
Reactions
2
Author
Timeline (top)
commented ×1

Root Cause

We ship a desktop frontend (Crystal: https://github.com/jvpflum/Crystal) on top of OpenClaw with ~30 views that consume these subcommands. We currently maintain ~12 different defensive shape-coercion blocks. This is a paper-cut for every frontend / CI / SDK author that wraps the CLI.

Happy to draft the schema + back-compat flag if the design lands.

Code Example

const items = Array.isArray(data) ? data : (data.items ?? data.agents ?? data.sessions ?? data.jobs ?? data.cron ?? []);

---

{
  "$schema": "https://openclaw.ai/schemas/list-v1.json",
  "version": "1",
  "kind": "agents",
  "count": 42,
  "items": [ {} ],
  "meta": { "//": "command-specific extras like sessions.path, sessions.activeMinutes" }
}
RAW_BUFFERClick to expand / collapse

Version

openclaw 2026.4.20 (115f05d), also matches behavior described in the 2026.5.4 CHANGELOG.

Problem

Different --json subcommands return different envelope shapes for "list things":

CommandShape
openclaw agents list --jsonbare array [ {...}, ... ]
openclaw sessions --json{ "path": "...", "count": N, "activeMinutes": null, "sessions": [...] }
openclaw models list --json{ "count": N, "models": [ {...} ] }
openclaw cron list --json (per downstream consumers)array OR {jobs: [...]} OR {cron: [...]}
openclaw nodes list --jsonarray OR {nodes: [...]}
openclaw skills list --jsonarray OR {skills: [...]}

(The bottom three are inferred from defensive duck-typing in our consumer code; the top three I just verified live on 2026.4.20.)

This forces every JSON consumer to write something like:

const items = Array.isArray(data) ? data : (data.items ?? data.agents ?? data.sessions ?? data.jobs ?? data.cron ?? []);

which both ages poorly and silently swallows real errors.

Proposal

Standardize --json list output on a versioned envelope, e.g.:

{
  "$schema": "https://openclaw.ai/schemas/list-v1.json",
  "version": "1",
  "kind": "agents",
  "count": 42,
  "items": [ {} ],
  "meta": { "//": "command-specific extras like sessions.path, sessions.activeMinutes" }
}

Migration path:

  • One release ships both shapes; new shape is opt-in via --json-envelope=v1.
  • One release flips the default; old shape stays available via --json-envelope=legacy.
  • One release removes legacy.

Why this matters

We ship a desktop frontend (Crystal: https://github.com/jvpflum/Crystal) on top of OpenClaw with ~30 views that consume these subcommands. We currently maintain ~12 different defensive shape-coercion blocks. This is a paper-cut for every frontend / CI / SDK author that wraps the CLI.

Happy to draft the schema + back-compat flag if the design lands.

Related

Closed #73077 ("parent CLI commands exit 1 when invoked without a subcommand") and the ongoing CLI-stabilization theme suggest this is in scope.

extent analysis

TL;DR

Standardize the --json list output to a versioned envelope to simplify JSON consumer code and reduce errors.

Guidance

  • Identify the different --json subcommands that return varying envelope shapes and prioritize standardization for each.
  • Consider implementing a versioned envelope schema, such as the proposed list-v1.json, to provide a consistent output format.
  • Develop a migration path to introduce the new envelope shape, including opt-in and opt-out mechanisms, to ensure a smooth transition for existing consumers.
  • Evaluate the impact of standardization on downstream consumers, such as the Crystal desktop frontend, and gather feedback from relevant stakeholders.

Example

{
  "$schema": "https://openclaw.ai/schemas/list-v1.json",
  "version": "1",
  "kind": "agents",
  "count": 42,
  "items": [ {} ],
  "meta": { "//": "command-specific extras like sessions.path, sessions.activeMinutes" }
}

Notes

The proposed standardization may require significant changes to existing code and may not be feasible for all subcommands or consumers. It is essential to carefully plan and test the migration path to minimize disruptions.

Recommendation

Apply workaround by standardizing the --json list output to a versioned envelope, as this will simplify JSON consumer code and reduce errors, making it easier to maintain and extend the OpenClaw CLI.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix RFC: standardize --json envelope shape across list-style subcommands (agents/sessions/models/cron/nodes/skills) [1 comments, 2 participants]