feat(buzz-cli): render an agent-friendly command tree in --help - #7584
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🔐 Codex Security Review
|
`buzz --help` listed 23 group names with nothing under them, so finding `buzz messages send` cost a second --help call and learning that `buzz canvas set` exists at all cost a third. Agents paid that per group, which is why the ACP base prompt carries a hand-maintained command table instead — and that table has already drifted to 16 of 23 groups. Render the whole tree from clap's own command definition so it cannot drift: `--help` now shows every subcommand under every group (199 lines), while `-h` keeps the group-level summary. This reformats the existing surface and adds no new data. A follow-up removes the table from the base prompt. Signed-off-by: Salman Mohammed <smohammed@squareup.com>
016c9b7 to
629f06e
Compare
wesbillman
left a comment
There was a problem hiding this comment.
Carl, an automated reviewer, commenting via Wes’s GitHub account.
Review clear: no blocking findings
Reviewed head 629f06e3377b2b3a99727b02dfd73825af2e0dff against base d074576871a66c72e4a9eb5ad59ec0b22a7f0081.
- The change supports the agent-first discovery contract: root long help walks the authoritative clap command tree, including third-level repository commands, while short help remains group-level. The wider short-help alignment is intentional; the base-prompt rewrite is outside this PR.
- Traced the standalone CLI and MCP bundled
buzzentry points, root/group/leaf help construction, argument conversion, error/exit routing, command dispatch, ordering/filtering, description wrapping, and the seven new help tests. An independent parser-compatibility source pass also found no blocker. No wire, authorization, persistence, or desktop/mobile UI changes require expansion into those service workflows. - Validation is source-only. No checkout, build, test, or PR-code execution was performed. Runtime output and the author's test claims were not independently verified; CI analysis was unavailable through the installed tooling. This is a
COMMENTEDreview, not GitHub approval.
wesbillman
left a comment
There was a problem hiding this comment.
Carl, an automated reviewer, commenting via Wes’s GitHub account.
No blocking findings. Reviewed head 629f06e3377b2b3a99727b02dfd73825af2e0dff against base/merge-base d074576871a66c72e4a9eb5ad59ec0b22a7f0081.
- Built both revisions locally with the pinned toolchain. A 737-case differential probe covered all 145 command paths: nested
-h,--help,help <path>, missing arguments, and invalid flags retain their prior output and exit behavior. Additional valid relay-command inputs reached the same authentication boundary without making relay requests. - The root tree exactly matches the recursively discovered base inventory, including order and third-level commands: 23 groups, 145 total entries. Root
--helpandhelpagree;-hremains group-only. Long help is 12,974 bytes / 199 lines, below the repository MCP shell’s truncation thresholds. Configured credential sentinels remain hidden. Independent formatter review also found no defects. - Release-package feature resolution does not enable clap
wrap_help. The wider short-help layout is intentional; removing the ACP prompt inventory is correctly left to the follow-up.
Validation limits: this was a local macOS debug-binary/source review, not a live-relay or cross-platform runtime exercise. I did not rerun the broad unit suite. At the CI snapshot, Rust lint passed and several test/build lanes were still pending; current-range security review also remained a separate merge gate. This is a review comment, not an approval.
…table The base prompt carried a `Group | Key commands` table — a second copy of a surface that already documents itself, and one nothing ties to the parser. It had already drifted: it listed 16 of the CLI's 23 groups (missing `emoji`, `gifs`, `notes`, `patches`, `media`, `moderation`, `pack`) and 50 of the 91 subcommands under the groups it did list. The adjacent exit-code line stopped at 4; the CLI has a 5th (write conflict). Now that `buzz --help` renders the full command tree in one invocation (#7584, generated from clap's own definition so it cannot drift), replace the table with a pointer to it, fix the exit codes, and note that `--format compact` is a global flag. Everything after the table is kept: it is non-discoverable semantics `--help` cannot express. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Salman Mohammed <smohammed@squareup.com>
…table (#7586) ## Summary The ACP base prompt carried a `Group | Key commands` table for the `buzz` CLI — a second copy of a surface that already documents itself, with nothing tying it to the parser. It had already drifted: 16 of the CLI's 23 groups (missing `emoji`, `gifs`, `notes`, `patches`, `media`, `moderation`, `pack`) and 50 of the 91 subcommands under the groups it did list. The adjacent exit-code line stopped at 4; the CLI has a 5th (5 = write conflict, NIP-33 LWW). #7584 was the prerequisite: `buzz --help` now renders the full command tree — every group, its subcommands, and their descriptions — in one invocation (199 lines, 13 KB), generated from clap's own command definition, so it cannot drift. `buzz -h` still prints the group-level summary. Pointing the prompt at `--help` was not viable before that, because discovering `buzz messages send` cost a second call and discovering `buzz canvas set` exists cost a third. So this replaces the table with a pointer to `buzz --help`, fixes the exit codes, and adds the one CLI ergonomic that `--help` does not make obvious (`--format compact` is a global flag that goes before the subcommand). Everything after the table is kept verbatim — it is the non-discoverable semantics `--help` cannot express: multiline content through stdin, the `BUZZ_AUTH_TAG` requirement for agent drafts, `--channel` on `pr open`, the `link` field, mention and assignment rules. Signed-off-by: Salman Mohammed <smohammed@squareup.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* origin/main: Configure ACP session scope per agent (#7578) refactor(buzz-acp): point agents at buzz --help instead of a command table (#7586) feat(buzz-cli): render an agent-friendly command tree in --help (#7584) fix(avatars): scale agent squircles from normalized paths (#7307) fix(mobile): bind same-name mentions to exact selected identities (#7385) fix(desktop): isolate quota backoff and reuse channel discovery rosters (#6998) test(desktop): isolate login-shell probe measurements (#7570) feat(git): add default-branch management to relay and CLI (#7562) fix(acp): integrate the Buzz Pi adapter fork (#7552) fix(markdown): align mention chip wrapping (#7501) fix(relay): reject presence updates when Redis storage fails (#7532) fix(desktop): let inbox title and message author names truncate under narrow panes (#7550) fix(buzz-acp): report missing models without retrying (#7538) fix(desktop): require a Codex adapter with Astra support (#7427) fix(desktop): order unnamed roster members by full canonical npub (#7503) fix(mobile): standardize public-key identity display on npub (#7493) fix(desktop): npub identity controls across profile, agents, and workflows (#7489) fix(desktop): npub identity displays for mention, member, and workflow surfaces (#7495) fix(desktop): shared npub identity foundation (canonicalNpub, PubKey gate, strict parser) (#7488) fix(mobile): render push notification sender identity as npub (#7494) Signed-off-by: Sol <478bb5a31222ea2b28a3d1afb8b1d598940628f19c2a87efc3c4b822299eeec6@buzz.block.builderlab.xyz> # Conflicts: # desktop/src-tauri/src/commands/media_download.rs

Summary
crates/buzz-acp/src/base_prompt.mdcarries a hand-maintainedGroup | Key commandstable of thebuzzCLI. It is a second copy of a surface that already documents itself, and it has drifted: it lists 16 of the CLI's 23 groups (missingemoji,gifs,notes,patches,media,moderation,pack) and omits roughly two-thirds of the subcommands under the groups it does list. Nothing in it is wrong — it is incomplete, and structurally destined to stay that way, because nothing ties it to the parser. Every agent turn also carries the whole inventory whether or not the task touches the CLI at all.The reason the base prompt duplicates that inventory is that
buzz --helpwas not good enough to lean on. It listed 23 group names with nothing under them, so findingbuzz messages sendcost a second--helpcall and learning thatbuzz canvas setexists at all cost a third. An agent paying per group reasonably prefers a stale table it already has.This PR fixes the help output so the prompt can point at it instead.
buzz --helpnow prints the whole tree — every group, its subcommands, and their descriptions — in one invocation:Before
After
The tree is walked from clap's own command definition (
get_subcommands,get_about,get_visible_aliases,is_hide_set,get_display_order), so it cannot drift from the commands that exist — mergingorigin/mainmid-review addedrepos default-branch get/set, and it appeared in the tree with no edit here. No new dependencies. Amp's CLI does the same thing, and its layout is what the column formatting follows.Wiring uses clap's existing short/long help split rather than a custom help path:
-hkeeps the group-level summary viaafter_help,--helpgets full depth viaafter_long_help. The roothelp_templatedrops{subcommands}so the group list is not printed twice, and spells out theCommands:/Options:headings itself, because the{options}and{subcommands}tags emit no heading of their own. Long help is 199 lines / 12.7 KB, comfortably underbuzz-dev-mcp's output caps (50 KB / 2000 lines), so it is not tail-truncated for agents.This change is formatting only: it adds no new data and no new commands.
--versionstill does not exist, and is deliberately left out — the crate version is not bumped, so the flag would report a number that means nothing.Follow-up PR removes the
Group | Key commandstable frombase_prompt.md, replacing it with a pointer atbuzz --helpplus the corrected exit codes (the prompt currently stops at 4; the CLI has a 5th, write conflict). Everything else in that section stays — it is all non-discoverable semantics that--helpcannot express. That PR will carry its own known risk (the table is also an inventory: it is how an agent learnsbuzz canvasexists without being told to look) and will be validated against thebenchmarks/buzz-datasettasks, which grade behavior that comes from the production base prompt rather than the task instruction.Related issue
None found.
Testing
cargo test -p buzz-cli— 473 pass, 7 new inhelp_tree.rs.cargo clippy -p buzz-cli --all-targets -- -D warnings,cargo fmt --check, andjust file-size-checkclean. All pre-push lanes green.The new assertions are column-exact, and I falsified them rather than assuming they bite: shifting the description column from 32 to 30 fails 4 of the 7. That matters because clap runs
StyledStr::wrapoverafter_help, which is a no-op only because this crate builds clap without thewrap_helpfeature. If workspace feature unification ever enables it — the same mechanism behind the rustls double-provider workaround inbuzz-cli/src/lib.rs— clap reflows the tree and destroys the alignment. A loosercontains("send")assertion would not notice.Verified by hand on the built binary: third-level nesting renders (
repos protect,repos default-branch); theemojidescription that used to overflow 100 columns now wraps into the description column;buzz messages --helpandbuzz help messagesare unchanged; and the error paths still exit 1 with JSON on stderr for both a bad flag and a missing subcommand.One behavior change worth a reviewer's eye:
buzz -hnow uses the same 32-column description alignment as--helpinstead of clap's auto-fit 12-column layout. Same 37 lines, wider. Happy to revert that one line if you'd rather short help stay narrow.🤖 Generated with Claude Code