* origin/cli-agent-parity:
docs: add sprout-cli section and common gotchas to AGENTS.md
style: fix rustfmt formatting in channels.rs and messages.rs
fix(cli): fix search p-gate, visibility filter, and forum post routing
docs: update TESTING.md runbooks for normalized CLI output
style: fix rustfmt formatting in sprout-cli
fix(cli): address review findings — data correctness, DRY, determinism
fix(cli): normalize output and fix wrong Nostr kinds across all commands
Brings the agent skill file to parity with all 62 CLI subcommands
across 13 command groups after PR #612's output normalization and bug
fixes. Adds 5 missing command groups (social, repos, upload, mem,
pack), 5 missing subcommands in existing groups (channels update/
add-member/remove-member, workflows update/delete), missing flags
(--file, --mention, --kinds, --depth-limit, --limit), fixes output
contract inaccuracies (channels get pubkey field, workflows list
pubkey, exit code 5, feed description), and restructures the Quick
Reference table by output pattern for scannability.
Three bugs found during E2E testing against a local relay:
1. `messages search` sent no `kinds` filter, triggering the relay's
p-gate (403). Now sends `kinds: [9, 40002, 45001, 45003]` matching
the MCP server's search implementation.
2. `channels list --visibility open` always returned `[]` because the
filter checked for `["visibility", "open"]` tags, but the relay
emits `["public"]`/`["private"]` per NIP-29. Rewritten to match
the relay's actual tag convention.
3. `--kind` flag on `messages send` was dead code (`#[allow(dead_code)]`).
Now routes to `build_forum_post` (kind 45001) and `build_forum_comment`
(kind 45003) SDK builders, enabling forum voting via CLI.
TESTING.md updated with relay behavior notes for channels leave
(last-owner guard), workflows trigger (DB indexing delay), workflows
update (missing --channel flag), and corrected expected error messages.
channels/workflows/DMs create responses now return entity IDs
(channel_id, workflow_id, dm_id) instead of bare id. All write
commands return {event_id, accepted, message}. canvas get outputs
raw markdown, not JSON. users get always returns an array.
Add expected-output comments throughout so testers can verify
correctness without reading the source.
Crossfire review (Codex + Gemini) surfaced 15 issues the Claude agents
missed. Critical: p-tag role read from wrong index (empty relay_url at
index 2 vs actual role at index 3), cmd_open_dm panics on malformed
pubkey, users get returns inconsistent types, channels query wrong Nostr
kind (41 vs 39000). Also: DM open now parses relay-assigned channel_id,
canvas not-found returns null, thread filter restricts to message kinds,
query() delegates to query_multi(), normalize_events takes &[Value],
extract_channel_metadata and print_create_response DRY helpers,
workflows get normalized, empty reaction content defaults to "+",
reactions sorted deterministically.
Comprehensive audit revealed the CLI queried wrong Nostr kinds (channels
list used kind:39002 instead of 41, dms list used 41010 instead of 41001,
workflow runs used 46020 instead of [46001,46002,46003]), used wrong tag
filters (#h instead of #d), discarded generated IDs from create commands,
and returned raw Nostr events with sig fields instead of structured data.
Adds query_multi() for compound queries, normalize_write_response() for
consistent {event_id, accepted, message} write output, normalize_events()
for stripping sig and reshaping reads, and extract_d_tag/extract_p_tags
helpers. All 25+ write handlers and 10+ read handlers now produce
structured output matching the MCP server.
Four inaccuracies in nest_skill.md caught by comparing against CLI source:
1. canvas get returns a JSON array of kind:40100 events (markdown in
`content`), not a plain markdown string. Agents parsing this as a
raw string would get the Nostr event wrapper, not the content.
2. reactions get returns a raw JSON array of kind:7 events, not the
aggregated {"reactions": [...]} shape. No aggregation happens in
cmd_get_reactions.
3. Error stderr category field values were placeholder text ("input error",
"network/relay error") instead of the actual enum values emitted by
error.rs: user_error, relay_error, network_error, auth_error, key_error.
4. set-presence documents as working but cmd_set_presence has an explicit
comment noting it always fails — kind:20001 is ephemeral and the relay
rejects it over HTTP POST. Added a "this will fail" caveat.
Also fixes a permission gap in nest.rs: create_dir_all(".claude/skills/
sprout-cli") created the intermediate .claude/ and .claude/skills/ dirs
with umask-default permissions (typically 755), but only the final
sprout-cli/ dir was chmod'd to 700. Lock down all three dirs in the
skill path, matching how NEST_DIRS are handled. Test updated to assert
all three dirs get 700 on Unix.
Docstring for ensure_nest_at updated to mention SKILL.md.