Files
cleveragents-core/docs/reference/session_cli.md
T
freemo 0382b2f722
CI / build (push) Successful in 18s
CI / lint (push) Failing after 18s
CI / helm (push) Successful in 23s
CI / quality (push) Successful in 35s
CI / typecheck (push) Failing after 45s
CI / coverage (push) Has been skipped
CI / benchmark-regression (push) Has been skipped
CI / security (push) Failing after 52s
CI / unit_tests (push) Failing after 1m50s
CI / docker (push) Has been skipped
CI / benchmark-publish (push) Has been cancelled
CI / integration_tests (push) Has been cancelled
CI / e2e_tests (push) Has been cancelled
CI / status-check (push) Has been cancelled
docs: update changelog and CLI reference docs for 2026-04-02 merged PRs
- CHANGELOG: add Fixed entries for PRs #1574, #1570, #1569, #1547, #1548,
  #1522, #1524, #1525, #1520, #1553 covering rich output panels for session,
  actor, and plan commands, plus version commit SHA and provider fix
- docs/reference/session_cli.md: document new rich output panels for
  session create (Settings, Actor Details), session list (Name column,
  Summary panel), session show (Automation field), session delete
  (Deletion Summary, Cleanup panels); update export to document --format md
- docs/reference/actor_cli.md: document new rich output panels for
  actor remove (Actor Removed, Impact, Cleanup) and actor list (Summary panel)
- docs/reference/plan_cli.md: document new rich output for plan list
  (Elapsed column, Filters panel, Summary panel)
- docs/reference/cli_system_commands.md: document commit SHA resolution
  order (CLEVERAGENTS_COMMIT env var → git rev-parse → 'unknown')

ISSUES CLOSED: #1574 #1570 #1569 #1547 #1548 #1522 #1524 #1525 #1520 #1553
2026-04-02 23:06:12 +00:00

273 lines
6.9 KiB
Markdown

# Session CLI Reference
The `agents session` command group manages **sessions** — persistent conversation threads tied to orchestrator actors.
## Commands
| Command | Description |
|---------|-------------|
| `agents session create` | Create a new interactive session |
| `agents session list` | List all sessions |
| `agents session show` | Show session details and recent messages |
| `agents session delete` | Delete a session permanently |
| `agents session export` | Export a session as JSON or Markdown |
| `agents session import` | Import a session from JSON |
| `agents session tell` | Send a message to a session |
---
## `agents session create`
Create a new interactive session, optionally bound to an orchestrator actor.
```bash
agents session create [--actor <ACTOR>] [--format <FORMAT>]
```
### Options
| Flag | Description |
|------|-------------|
| `--actor` | Orchestrator actor name in `namespace/name` format |
| `--format`, `-f` | Output format: `json`, `yaml`, `plain`, `table`, `rich` (default: `rich`) |
### Rich Output Panels
The `rich` format renders three panels:
- **Session** — session ID, actor, namespace, and creation timestamp.
- **Settings** — automation profile, streaming, context, memory, and max history.
- **Actor Details** — provider, model, temperature, and context window (only shown when an actor is bound).
Followed by a `✓ OK Session created` success message.
### Example
```bash
agents session create --actor openai/gpt-4
agents session create --format json
```
---
## `agents session list`
List all sessions with message counts and timestamps.
```bash
agents session list [--format <FORMAT>]
```
### Options
| Flag | Description |
|------|-------------|
| `--format`, `-f` | Output format (default: `rich`) |
### Rich Output
The `rich` format renders a sessions table with columns: **ID**, **Name**, **Actor**,
**Messages**, and **Updated**. After the table, a **Summary** panel is shown with:
| Field | Description |
|-------|-------------|
| Total | Number of sessions |
| Most Recent | Name or truncated ID of the most recently updated session |
| Oldest | Name or truncated ID of the oldest session |
| Total Messages | Sum of messages across all sessions |
| Storage | Estimated storage used |
Followed by a `✓ OK N sessions listed` success message.
### JSON Output Shape
```json
{
"sessions": [
{
"id": "01HXYZ...",
"name": "my-session",
"actor": "openai/gpt-4",
"messages": 5,
"updated": "2026-04-02T21:56:04"
}
],
"summary": {
"total": 1,
"most_recent": "my-session",
"oldest": "my-session",
"total_messages": 5,
"storage": "0 KB"
}
}
```
---
## `agents session show`
Show session details including recent messages, linked plans, and token usage.
```bash
agents session show <SESSION_ID> [--format <FORMAT>]
```
### Arguments
| Argument | Description |
|----------|-------------|
| `SESSION_ID` | The ULID of the session to display |
### Options
| Flag | Description |
|------|-------------|
| `--format`, `-f` | Output format (default: `rich`) |
### Rich Output Panels
- **Session Summary** — session ID, actor, namespace, message count, created/updated timestamps, and **Automation** profile.
- **Recent Messages** — table of the last 5 messages (role, content preview, timestamp).
- **Linked Plans** — list of plan IDs linked to this session (if any).
- **Token Usage** — input tokens, output tokens, and estimated cost.
- **Cost Budget** — total cost, max cost, utilization percentage, and remaining budget (if a budget is configured).
Followed by a `✓ OK Session details loaded` success message.
---
## `agents session delete`
Delete a session permanently. A confirmation prompt is shown unless `--yes` is provided.
```bash
agents session delete <SESSION_ID> [--yes]
```
### Arguments
| Argument | Description |
|----------|-------------|
| `SESSION_ID` | The ULID of the session to delete |
### Options
| Flag | Short | Description |
|------|-------|-------------|
| `--yes` | `-y` | Skip confirmation prompt |
### Rich Output Panels
After deletion, the `rich` format renders:
- **Deletion Summary** — session ID, messages removed, storage freed, and plans orphaned.
- **Cleanup** — backup status, log preservation, context cleared, and checkpoint status.
Followed by a `✓ OK Session deleted` success message.
---
## `agents session export`
Export a session as JSON or Markdown to a file or stdout.
```bash
agents session export <SESSION_ID> [--output <FILE>] [--force] [--format <FORMAT>]
```
### Arguments
| Argument | Description |
|----------|-------------|
| `SESSION_ID` | The ULID of the session to export |
### Options
| Flag | Short | Description |
|------|-------|-------------|
| `--output` | `-o` | Output file path (default: stdout) |
| `--force` | | Overwrite existing output file |
| `--format` | | Export format: `json` (default, re-importable) or `md` (Markdown transcript, lossy) |
### Notes
- Parent directories are created automatically when writing to a file.
- Without `--force`, the command refuses to overwrite an existing file.
- The exported JSON includes a `sha256:`-prefixed checksum for integrity validation.
- The `md` format produces a human-readable Markdown transcript with session metadata,
full message history (role/timestamp/content), and linked plan references. It cannot
be re-imported.
### Examples
```bash
# Export as JSON (default)
agents session export 01HXYZ... -o session.json
# Export as Markdown transcript
agents session export 01HXYZ... --format md -o session.md
# Overwrite existing file
agents session export 01HXYZ... -o session.json --force
```
---
## `agents session import`
Import a session from a JSON file previously exported with `session export`.
```bash
agents session import --input <FILE>
```
### Options
| Flag | Short | Description |
|------|-------|-------------|
| `--input` | `-i` | Input JSON file path (required) |
### Notes
- Validates schema version and SHA-256 checksum.
- Imported sessions receive fresh ULIDs to avoid ID collisions.
---
## `agents session tell`
Send a message to a session and receive an assistant response.
```bash
agents session tell --session <SESSION_ID> [--actor <ACTOR>] [--stream] <PROMPT>
```
### Arguments
| Argument | Description |
|----------|-------------|
| `PROMPT` | The message text to send |
### Options
| Flag | Description |
|------|-------------|
| `--session` | Target session ULID (required) |
| `--actor` | Override actor for this message |
| `--stream` | Stream the response in real-time |
### Notes
- Both user and assistant messages are persisted with sequence ordering.
- The session's `updated_at` timestamp is refreshed after each message.
---
## Error Handling
| Error | Cause |
|-------|-------|
| `SessionNotFoundError` | The specified session ID does not exist |
| `SessionExportError` | Export operation failed |
| `SessionImportError` | Import failed due to bad schema or corrupt data |