honcho/honcho-cli
Aakash Kattelu 0d57df430e
feat(cli): add `honcho session view` transcript command (#1006)
* feat(cli): add `honcho session view` transcript command

Adds a read-only transcript view for a session, with three paging modes:
a tail window (`--last N`, the default), server pages (`--page N --size M`),
and the whole conversation (`--all`). `--reverse` selects newest-first in
every mode, `--ids` exposes message IDs, and `-p` scopes to one peer.
JSON mode emits the same shape as `message list`.

The renderer is deliberately literal: content and identifiers go through
`rich.text.Text` rather than Markdown or console markup, so newlines, tag
delimiters like `<thinking>`, and bracketed text survive intact — this is a
debugging surface, so it has to show what was actually stored. Timestamps
are converted to UTC (not just stripped of their offset) and keep
millisecond precision. Nothing is truncated with an ellipsis: a displayed
message ID is always usable with `honcho message get`.

Flags are validated before the client is built, and the session is
constructed directly instead of via the get-or-create `client.session()`,
so an invalid or mistyped invocation never reaches — or creates — anything
server-side. `--size` is bounded locally to the server's 100-item ceiling
rather than surfacing a raw 422, and the "more:" hint echoes back the size
and ordering actually in use so following it lands on the adjacent window.

Also fixes `honcho message list --last N`, which stopped at the first page
of 50: both commands now share the page-walking helper, so the same flag
returns the same window either way.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* docs(cli): regenerate command reference for `session view`

Adds the generated `session view` accordion to the docs snippet and points
the session-debugging workflows at it. Trims the docstring to plain prose —
the RST double-backticks were rendering literally in `--help`, where every
other command uses unmarked flag names — and stops the generator emitting a
trailing blank line that tripped end-of-file-fixer on every regeneration.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(cli): carry invocation scope into the next-page hint

Addresses CodeRabbit review on #1006.

The "more:" hint echoed only `--page`, `--size`, and `--reverse`, so copying
it off a scoped invocation dropped `-w`, `-p`, and `--ids` — landing on a
different workspace or an unfiltered transcript. Hint construction moves into
`_next_page_command` in the command module, which knows the invocation; the
renderer now just prints the string it's handed and no longer needs to know
CLI flag syntax. Only flags passed explicitly are echoed, since anything from
the environment or config resolves the same way on the next run.

Also rejects non-positive `--last` on `honcho message list`, which slice
semantics turned into a silently empty result. `session view` already errored
on it; the two now agree.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(cli): read next-page hint scope from effective flag overrides

Addresses the second CodeRabbit pass on #1006.

`-w`/`-p` parse at group and top level as well as command level, all landing
in `_global_overrides`, so reading the command-level params dropped the scope
from `honcho session -w ws2 view ...`. The hint now reads the effective
overrides via a new `get_flag_overrides()`, which deliberately excludes
environment and config values since those resolve the same way on the next run.

Also shell-quotes the hint's identifiers with `shlex.join`. Note this is
hardening rather than a live injection fix: the API constrains IDs to
`^[a-zA-Z0-9_-]+$`, so an ID carrying a space or metacharacter fails the fetch
before any hint is printed. `validate_resource_id` is looser than the server
though, so quoting is the cheaper invariant to hold locally.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-11 10:12:16 -04:00
..
scripts feat(cli): add `honcho session view` transcript command (#1006) 2026-08-11 10:12:16 -04:00
src/honcho_cli feat(cli): add `honcho session view` transcript command (#1006) 2026-08-11 10:12:16 -04:00
tests feat(cli): add `honcho session view` transcript command (#1006) 2026-08-11 10:12:16 -04:00
CHANGELOG.md feat(cli): add `honcho session view` transcript command (#1006) 2026-08-11 10:12:16 -04:00
README.md feat(cli): add `honcho session view` transcript command (#1006) 2026-08-11 10:12:16 -04:00
pyproject.toml chore: updating cli version 0.1.2 (#921) 2026-07-20 15:05:04 -04:00
uv.lock chore(docs): Release Candidate for v3.0.10 (#813) 2026-06-15 17:19:51 -04:00

README.md

██╗  ██╗ ██████╗ ███╗   ██╗ ██████╗██╗  ██╗ ██████╗
██║  ██║██╔═══██╗████╗  ██║██╔════╝██║  ██║██╔═══██╗
███████║██║   ██║██╔██╗ ██║██║     ███████║██║   ██║
██╔══██║██║   ██║██║╚██╗██║██║     ██╔══██║██║   ██║
██║  ██║╚██████╔╝██║ ╚████║╚██████╗██║  ██║╚██████╔╝
╚═╝  ╚═╝ ╚═════╝ ╚═╝  ╚═══╝ ╚═════╝╚═╝  ╚═╝ ╚═════╝

honcho-cli

A terminal for Honcho — memory that reasons.

Install

As a standalone tool (recommended):

uv tool install honcho-cli

Quick Start

honcho init        # confirm/set apiKey + Honcho URL in ~/.honcho/config.json
honcho doctor      # verify your config + connectivity
honcho             # show banner + command list

honcho init reads apiKey and environmentUrl from the top-level of ~/.honcho/config.json (the same file other Honcho tools — plugins, host integrations — share). If both are present, it confirms them with you; if either is missing (or you decline), it prompts for the missing value(s) and writes them back. Host-specific entries under hosts are left untouched.

Per-command scoping (workspace / peer / session) is handled via -w / -p / -s flags or HONCHO_* env vars — not persisted as CLI defaults.

Commands

Onboarding

Command Description
honcho init Confirm/set apiKey + environmentUrl in ~/.honcho/config.json
honcho doctor Health check: config, connectivity, workspace, peer, queue

Workspaces

Command Description
honcho workspace list List accessible workspaces
honcho workspace create <id> Create or get a workspace
honcho workspace inspect Peers, sessions, config for a workspace
honcho workspace search <query> Search messages across workspace
honcho workspace queue-status Deriver queue status (filter with --observer / --sender)
honcho workspace delete <id> Delete a workspace. Use --dry-run to preview, --cascade to also delete sessions, --yes to skip the confirm prompt

Peers

Command Description
honcho peer list List peers in the workspace
honcho peer create <id> Create or get a peer
honcho peer inspect <id> Card, session count, recent conclusions
honcho peer card <id> Raw peer card content
honcho peer chat <query> Query the dialectic about a peer (peer via -p / HONCHO_PEER_ID)
honcho peer representation <id> Formatted representation
honcho peer search <query> Search a peer's messages (peer via -p / HONCHO_PEER_ID)
honcho peer get-metadata <id> / set-metadata Metadata operations

Sessions

Command Description
honcho session list List sessions in the workspace (filter with --peer/-p)
honcho session create <id> Create or get a session (optionally --peers to add peers, --metadata)
honcho session inspect <id> Peers, message count, summaries, config
honcho session view <id> Transcript table (--last N, --page N --size M, --all, --reverse, --ids, -p)
honcho session context <id> What an agent would see
honcho session summaries <id> Short + long summaries
honcho session peers <id> / add-peers / remove-peers Peer management
honcho session search <id> <query> Search messages in a session
honcho session representation <id> Peer representation in a session
honcho session get-metadata <id> / set-metadata Metadata operations
honcho session delete <id> Destructive; requires --yes

Messages

Command Description
honcho message list List messages in a session (session via -s / HONCHO_SESSION_ID)
honcho message create <content> Create a message (requires --peer/-p, session via -s)
honcho message get <id> Get a single message (session via -s / HONCHO_SESSION_ID)

Conclusions (observations)

Command Description
honcho conclusion list List conclusions (filter with --observer / --observed)
honcho conclusion search <query> Semantic search (filter with --observer / --observed)
honcho conclusion create Create a conclusion
honcho conclusion delete <id> Delete a conclusion

Config

Command Description
honcho config Show current config (API key redacted)

Agent Usage

All commands output JSON when stdout isn't a TTY, or when --json is forced. Collection commands emit JSON arrays, and single-resource commands emit JSON objects:

honcho peer list --json
honcho workspace inspect --json | jq '.peers'
honcho doctor --json              # machine-parseable health checklist

Errors are structured:

{
  "error": {
    "code": "PEER_NOT_FOUND",
    "message": "Peer 'abc' not found in workspace 'my-ws'",
    "details": {"workspace_id": "my-ws", "peer_id": "abc"}
  }
}

Non-interactive onboarding:

# Pre-seed via flags / env vars; init still prompts for anything missing
HONCHO_API_KEY=hch-v3-xxx honcho init --base-url https://api.honcho.dev

Agent skill

honcho-cli ships with a skill that teaches agents the right commands and conventions for inspecting and debugging a Honcho deployment. Install it anywhere skills are accepted (Claude Code, other skill-aware agents):

npx skills add plastic-labs/honcho

The picker lists every skill for Honcho — select honcho-cli .

Environment Variables

All HONCHO_* env vars work at runtime — no config file required.

Precedence (highest first): flag → env var → config file → default.

Variable Flag Description
HONCHO_API_KEY --api-key (init) Admin JWT
HONCHO_BASE_URL --base-url (init) API URL
HONCHO_WORKSPACE_ID -w / --workspace Workspace scope
HONCHO_PEER_ID -p / --peer Peer scope
HONCHO_SESSION_ID -s / --session Session scope
HONCHO_JSON --json Force JSON output (1 / true)
# Per-command flags
honcho peer card -w prod -p user

# Or export once per shell
export HONCHO_WORKSPACE_ID=prod
export HONCHO_PEER_ID=user
honcho peer card

# One-off against a different server
HONCHO_BASE_URL=http://localhost:8000 honcho workspace list

# CI/CD — env vars only, no config file needed
export HONCHO_API_KEY=hch-v3-xxx
export HONCHO_BASE_URL=https://api.honcho.dev
honcho workspace list

Configuration

The CLI shares ~/.honcho/config.json with sibling Honcho tools. It owns two top-level keys: apiKey and environmentUrl (the full Honcho API URL, e.g. https://api.honcho.dev or http://localhost:8000). Everything else at the top level — hosts, sessions, saveMessages, sessionStrategy, etc. — is left untouched.

{
  "apiKey": "hch-v3-...",
  "environmentUrl": "https://api.honcho.dev",
  "hosts": { "claude_code": { "...": "..." } }
}

workspace_id / peer_id / session_id are per-command only — never persisted to the config file.

Development

Install from source in editable mode so changes are picked up live:

git clone https://github.com/plastic-labs/honcho
cd honcho
uv tool install --force --editable --from ./honcho-cli honcho-cli

Re-run any time — changes to honcho-cli/src/ are reflected immediately without reinstalling.

License

MIT