Skip to content

docs(ai-sessions): document the new ai CLI surface (org + user sessions, attach, chat, auth claude)#189

Merged
maximelb merged 3 commits intomasterfrom
cli-v2-ai-attach
Apr 20, 2026
Merged

docs(ai-sessions): document the new ai CLI surface (org + user sessions, attach, chat, auth claude)#189
maximelb merged 3 commits intomasterfrom
cli-v2-ai-attach

Conversation

@maximelb
Copy link
Copy Markdown
Contributor

@maximelb maximelb commented Apr 18, 2026

Summary

Documents the AI Sessions CLI surface shipping in python-limacharlie#278. The CLI now spans both ownership models the backend supports — org-owned (automation, started via ai start-session or DR rules) and user-owned (interactive chat, started via ai chat) — so the docs treat both as first-class.

docs/9-ai-sessions/cli.md

  • New "Two session ownership models" section near the top — table comparing org vs user sessions across creation command, owner field, Anthropic credential source, lifecycle group, and what ai session attach --interactive actually does for each.
  • Existing org-side reference preserved: ai session list/get/history/terminate, ai session attach, ai start-session with the full override flag surface (model, turns, budgets, ttl, one-shot, permission mode, allow/deny tool lists, plugins, env merge, credential overrides).
  • New ai auth claude sectionstatus, login (browser OAuth flow with code prompt), set-key (literal, hive://secret/, or --key-from-stdin), logout. Documents the ErrNoClaudeCredentials failure path and the 5-minute OAuth-flow TTL.
  • New ai chat section — opening prompt as PROMPT arg only (stdin reserved for the interactive loop), three-step flow (status → register → create → attach), full flag table, interactive controls cross-link, re-attach guidance.
  • New ai chats section — lifecycle counterpart to ai session (list/get/history/terminate) but routed at /v1/sessions/*. Subcommand-by-subcommand parity table; explicit note that the two ownership models' command groups are disjoint.
  • WebSocket URL paths corrected from the legacy /v1/sessions/{id}/ws and /v1/org/sessions/{id}/ws forms to the GCP-LB-routable /v1/ws/sessions/{id} and /v1/ws/org/sessions/{id} forms.
  • "Endpoint selection and fallback" tip clarifying when --interactive actually accepts your input (only user-owned sessions; org sessions auto-fall back to read-only by design).
  • Start-and-attach example in the ai start-session section drops the now-misleading --interactive flag.

docs/9-ai-sessions/user-sessions.md

  • Tip box retargeted from ai session attach --interactive to ai chat as the natural one-step CLI entry point for user-owned interactive sessions.

docs/6-developer-guide/sdk-overview.md

  • AI Sessions section restructured to show both ownership paths side by side (org via ai start-session + ai session, user via ai auth claude + ai chat + ai chats), with a short note on --interactive's read-only fallback for org sessions.

mkdocs.yml

  • (From earlier commit) AI Sessions nav already includes the new Command Line Interface page.

Cross-linked PRs

Test plan

  • Internal-link + anchor validator (custom Python script) passes for all changed files.
  • mkdocs build --strict locally — verify no broken internal links once mkdocs is installed in the build env.
  • Skim the rendered 9-ai-sessions/cli.md page for formatting (especially the ownership-model table, the new section anchors used by cross-links, and the tip-box rendering).
  • Click through every cross-link (cli.mduser-sessions, dr-sessions, api-reference, sdk-overview).

…tart-session` overrides

Adds a dedicated CLI reference page for AI Sessions and cross-links
from the surrounding pages:

- New `docs/9-ai-sessions/cli.md` covering `ai session list/get/history/terminate`,
  `ai session attach` (flags, interactive controls, 403 fallback, output format
  with colour-coded message table), and `ai start-session` with its full
  override flag set (model, max-turns, max-budget-usd, task-budget-tokens,
  ttl-seconds, one-shot, permission-mode, allowed/denied-tools, plugin, env,
  anthropic-key, lc-api-key, lc-uid).
- mkdocs.yml nav: add the new Command Line Interface entry under AI Sessions.
- user-sessions.md: add a tip box pointing to the CLI attach command
  alongside the existing WebSocket example.
- dr-sessions.md: note at the end of Example 5 that the same `ai_agent`
  Hive record can be reused as a CLI template via `ai start-session`.
- 6-developer-guide/sdk-overview.md: add an AI Sessions section under
  Commands with the common invocations and a cross-link to the new page.

Cross-links:
  * python-limacharlie: refractionPOINT/python-limacharlie#278
  * lc-ai: (see matching PR)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…fix WS paths

Three sets of changes to docs/9-ai-sessions/cli.md and the
surrounding pages, matching the additions in
refractionPOINT/python-limacharlie#278:

* New "Two session ownership models" section near the top of cli.md
  spelling out the org-vs-user split, since the CLI now has parallel
  command groups for each (`ai start-session` + `ai session` for
  org-owned; `ai chat` + `ai chats` for user-owned).

* New `ai auth claude {status,login,set-key,logout}`, `ai chat`, and
  `ai chats {list,get,history,terminate}` sections covering the
  user-owned interactive chat path.  Clarifies that `ai chat`
  requires a per-user Claude credential (set via `auth claude`) and
  that `ai chats` is the lifecycle counterpart to `ai session` for
  user-owned sessions, with sessions of one ownership model being
  invisible to the other group's commands.

* WebSocket URL paths corrected from the legacy `/v1/sessions/{id}/ws`
  and `/v1/org/sessions/{id}/ws` forms (which are unreachable through
  the GCP load balancer and return 404) to the new
  `/v1/ws/sessions/{id}` and `/v1/ws/org/sessions/{id}` forms the LB
  actually routes to the interaction-proxy.

Plus knock-on edits:
- "Endpoint selection and fallback" gains a tip box explaining that
  `--interactive` only sends prompts for user-owned sessions; org
  sessions transparently fall back to read-only by design.
- The start-and-attach example under `ai start-session` no longer
  passes `--interactive`, since that flag is moot for the org-owned
  session it just created.
- user-sessions.md tip retargeted from `ai session attach
  --interactive` to `ai chat` (the natural CLI entry point now).
- sdk-overview.md AI Sessions section restructured to show both
  ownership paths side by side with the credential setup step.

Cross-links:
  * python-limacharlie: refractionPOINT/python-limacharlie#278

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@maximelb maximelb changed the title docs(ai-sessions): document limacharlie ai session attach and ai start-session overrides docs(ai-sessions): document the new ai CLI surface (org + user sessions, attach, chat, auth claude) Apr 19, 2026
…`ai session attach` / `ai chat`

Matches refractionPOINT/python-limacharlie@4f1e200, which cleaned up
the pretty-printed live stream so `ai chat` is actually readable:

- Plumbing `system` subtypes (credential_diagnostics, model_set,
  hook_started, autoinit_loaded, ttl_added_to_system_prompt, ...),
  `session_status` startup pings and `usage_delta` frames are hidden
  by default.
- Empty assistant-tool-use-only frames, user tool_result wrappers and
  summary-less `result` pings are skipped.
- Timestamps are abbreviated to `HH:MM:SS`.
- A new `--verbose`/`-v` flag on both `ai session attach` and
  `ai chat` restores the firehose (useful when debugging session
  startup or correlating with server logs).

Changes in docs/9-ai-sessions/cli.md:

- Flag tables for `ai session attach` and `ai chat` gain a
  `--verbose`/`-v` row that cross-links the new "Default noise
  filter" subsection.
- New "Default noise filter" subsection under "Output format"
  enumerates the filtered types / subtypes / empty-frame rules and
  calls out that the same set is used by `ai session history` /
  `ai chats history`.
- The existing one-liner under `ai session history` now cross-links
  the shared filter section so readers see both surfaces share it.
- Output-format section notes that timestamps default to `HH:MM:SS`
  and `--verbose` preserves the full ISO-8601 value.

No behavioural change elsewhere — `--raw` semantics, endpoint
selection, interactive controls and the colour-coded table are
unchanged.

Cross-links:
  * python-limacharlie: refractionPOINT/python-limacharlie@4f1e200

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@maximelb maximelb requested a review from steveatlc April 20, 2026 21:52
@maximelb maximelb added the to-code-review Used to tag PRs that are force-pushed and will need to be reviewed after the fact. label Apr 20, 2026
@maximelb maximelb marked this pull request as ready for review April 20, 2026 21:52
@maximelb maximelb merged commit 5d32650 into master Apr 20, 2026
2 checks passed
@maximelb maximelb deleted the cli-v2-ai-attach branch April 20, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

to-code-review Used to tag PRs that are force-pushed and will need to be reviewed after the fact.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant