Skip to content

bb CLI: human output of many commands is raw JSON.stringify, identical to --json, with epoch timestamps (thread history, project history, machine show, ...) #2052

Open

Description

@SawyerHood

Summary

Many bb CLI commands print the raw SDK result as JSON.stringify(result, null, 2) in the human (no --json) mode. The output is byte-for-byte identical with and without --json. The --json flag is therefore meaningless on these commands, and the default output is verbose nested JSON with epoch-millisecond timestamps. Agents call these commands inside long contexts, and the pretty-printed JSON spends many tokens and recalls badly.

Reported by Cole in the Discord bug forum post "Token and LLM recall inefficiency for bb cli" (2026-08-19). The example there was bb thread history thr_siptvrc76v, which printed a 9 KB pretty JSON array. Cole also noted that the human outputs show Date.now() epoch numbers instead of relative or ISO dates.

Versions and environment

  • bb 0.39.0, from source at 23a4eaed886ced7bbb69b49dfa7b01349312cc98 (main)
  • Linux 7.0.0-29-generic, Node from the repo toolchain
  • Reporter (Cole) saw the same output on the released CLI.

Steps to reproduce

# any thread with history; get one with `bb thread list`
bb thread history thr_f3ndpkf6iz --limit 1 | wc -c
bb thread history thr_f3ndpkf6iz --limit 1 --json | wc -c
diff <(bb thread history thr_f3ndpkf6iz --limit 1) <(bb thread history thr_f3ndpkf6iz --limit 1 --json) && echo IDENTICAL

bb machine show bee
bb thread tabs show thr_f3ndpkf6iz
bb project history proj_3azzxemfid

Expected vs actual

Actual:

$ bb thread history thr_f3ndpkf6iz --limit 1 | wc -c
196
$ bb thread history thr_f3ndpkf6iz --limit 1 --json | wc -c
196
$ diff ... && echo IDENTICAL
IDENTICAL

$ bb thread history thr_f3ndpkf6iz
[
  {
    "id": "phist_nisrgxjasn",
    "createdAt": 1784845035019,
    "input": [
      {
        "type": "text",
        "text": "what is the status",
        "mentions": []
      }
    ]
  },
  ...

$ bb machine show bee
{
  "id": "host_j8fm4di6ds",
  "name": "bee",
  "type": "persistent",
  "status": "connected",
  "maxPermissionMode": "full",
  "lastSeenAt": 1787248793022,
  "lastRejectedProtocolVersion": null,
  "createdAt": 1784415215437,
  "updatedAt": 1787248793022
}

Expected: a compact human format when --json is absent, like bb thread list and bb machine list already do. For example, one line per history entry with a relative or ISO time and the prompt text, such as:

phist_nisrgxjasn  2026-07-23T01:23:55Z (3 weeks ago)  what is the status
phist_sj8cpvb4ax  2026-07-23T00:29:33Z (3 weeks ago)  what is taking so long now

--json keeps the full machine-readable shape.

Evidence

Commands whose human path is the JSON fallback (each one calls outputJson(opts, result) and then prints the same JSON.stringify(result, null, 2)):

Found with grep -rn "JSON.stringify([a-zA-Z]*, null, 2)" apps/cli/src minus the outputJson helper. Timestamps in all of these are epoch milliseconds (createdAt, lastSeenAt, updatedAt), which no reader, human or model, can convert in their head.

Investigation thread: thr_z5jrf23w43.

What you ruled out

Suggested priority and effort

Medium priority: every agent that uses these commands pays the token cost on every call, and --json advertises a distinction that does not exist. Workaround: pipe through jq. Effort: low to medium per command; a shared helper for tables, relative/ISO time, and a --json passthrough would cover all of the sites above. Cole offered to help design the LLM-facing format.

AGENT GENERATED: by Claude Opus 5

Activity

  1. added theissue type on Aug 20, 2026
  2. colelawrence commented on Aug 20, 2026

    @colelawrence

    I feel like the output design can be refined still, for example, I wouldn't include ids

    phist_nisrgxjasn  2026-07-23T01:23:55Z (3 weeks ago)  what is the status
    phist_sj8cpvb4ax  2026-07-23T00:29:33Z (3 weeks ago)  what is taking so long now
    

    ->

    (3 weeks ago)
    2026-07-23T01:23:55Z  what is the status
    2026-07-23T00:29:33Z  what is taking so long now
    

    Where you can group messages by N days ago up until 2 weeks -> N weeks ago up until 2 months -> N months ago up until 2 years -> N years ago

    Another idea here that can be very nice, is that you don't expose those IDs because you have the timestamps and you can expose the agent to retrieve the thread message details by timestamp or by id, and --after=[ISO|phist_] & --before=[ISO|phist_] kinda makes sense

  3. SawyerHood commented on Aug 24, 2026

    @SawyerHood
    CollaboratorAuthor

    ---Auto-Generated---

    Reproduction & root-cause report: https://get-bb.github.io/reports/issues/2052.html

    • Verdict: REPRODUCED · root-cause confidence: high
    • Root cause (short): 16 bb inspect commands (thread history/search/queue list/tabs show, project history/branches/paths/files/commands, machine show, machine provider-cli status, terminal show, settings show/keyboard list/usage/version) have no human renderer: after the outputJson() --json check they fall through to the identical console.log(JSON.stringify(result, null, 2)) (printHumanJson in apps/cli/src/commands/thread/organization.ts L71-73 and bare calls in project.ts/machine.ts/terminal.ts/settings.ts), so the default output is the raw SDK response with epoch-ms timestamps; placeholders since fc77a6e (Expose end-user features through SDK and CLI #638), untouched on origin/main.
    • Proposed fix: In apps/cli only (no protocol change): delete printHumanJson and every bare console.log(JSON.stringify(result, null, 2)) that follows an outputJson() check, and add a lint-style vitest that greps apps/cli/src for that pattern outside helpers.ts and thread log --format json; add shared formatters in helpers.ts (formatTimestamp(ms|iso, now) -> "2026-08-24T17:31:27Z (3m ago)" generalising formatMachineLastSeen with Cole's day/week/month/year buckets, plus a key/value printer); then give each command a real human rendering: thread/project history as one line per entry " " grouped under…
    • Caveats: Investigation worktree HEAD was 21cb6b6 (3 commits past base 494f665; diff touches only tests and one settings component, apps/cli byte-identical to base). terminal show was verified by code only, not exercised live. The issue's claim that bb thread log's events path is a JSON fallback is refuted: L485 only runs under --format json/--json and the default is a compact timeline. The Discord "9 K…

    The report is self-contained: copy-paste repro steps with the test or script inline, expected vs actual output, screenshots where the bug is visual, and code permalinks at the base commit. It was independently re-executed by a second agent (see its Verification section).

    AGENT GENERATED: by Claude Code

  4. added
    confirmed-repro
    on Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliconfirmed-repro

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions