Add startup session name flag

closes #5153
This commit is contained in:
Mario Zechner
2026-05-29 11:40:44 +02:00
parent 0c448e12e8
commit ce554ad3de
11 changed files with 208 additions and 2 deletions

View File

@@ -136,6 +136,7 @@ Sessions are saved automatically:
```bash
pi -c # Continue most recent session
pi -r # Browse previous sessions
pi --name "my task" # Set session display name at startup
pi --session <path|id> # Open a specific session
```

View File

@@ -13,6 +13,7 @@ pi --mode rpc [options]
Common options:
- `--provider <name>`: Set the LLM provider (anthropic, openai, google, etc.)
- `--model <pattern>`: Model pattern or ID (supports `provider/id` and optional `:<thinking>`)
- `--name <name>` / `-n <name>`: Set the session display name at startup
- `--no-session`: Disable session persistence
- `--session-dir <path>`: Custom session storage directory
@@ -694,7 +695,7 @@ Response:
}
```
The current session name is available via `get_state` in the `sessionName` field.
The current session name is available via `get_state` in the `sessionName` field. To set the initial name when starting RPC mode, pass `--name <name>` or `-n <name>` to the `pi --mode rpc` process.
### Commands

View File

@@ -282,7 +282,7 @@ Set `label` to `undefined` to clear a label.
### SessionInfoEntry
Session metadata (e.g., user-defined display name). Set via `/name` command or `pi.setSessionName()` in extensions.
Session metadata (e.g., user-defined display name). Set via `/name`, `--name` / `-n`, or `pi.setSessionName()` in extensions.
```json
{"type":"session_info","id":"k1l2m3n4","parentId":"j0k1l2m3","timestamp":"2024-12-03T14:35:00.000Z","name":"Refactor auth module"}

View File

@@ -10,6 +10,7 @@ Sessions auto-save to `~/.pi/agent/sessions/`, organized by working directory. E
pi -c # Continue most recent session
pi -r # Browse and select from past sessions
pi --no-session # Ephemeral mode; do not save
pi --name "my task" # Set session display name at startup
pi --session <path|id> # Use a specific session file or partial session ID
pi --fork <path|id> # Fork a session file or partial session ID into a new session
```
@@ -56,6 +57,13 @@ Use `/name <name>` to set a human-readable session name:
/name Refactor auth module
```
Set the name at startup with `--name` or `-n`:
```bash
pi --name "Refactor auth module"
pi --name "CI audit" -p "Review this build failure"
```
Named sessions are easier to find in `/resume` and `pi -r`.
## Branching with `/tree`

View File

@@ -76,6 +76,7 @@ Sessions are saved automatically to `~/.pi/agent/sessions/`, organized by workin
pi -c # Continue most recent session
pi -r # Browse and select a session
pi --no-session # Ephemeral mode; do not save
pi --name "my task" # Set session display name at startup
pi --session <path|id> # Use a specific session file or session ID
pi --fork <path|id> # Fork a session into a new session file
```
@@ -178,6 +179,7 @@ cat README.md | pi -p "Summarize this text"
| `--fork <path\|id>` | Fork a session file or partial UUID into a new session |
| `--session-dir <dir>` | Custom session storage directory |
| `--no-session` | Ephemeral mode; do not save |
| `--name <name>`, `-n <name>` | Set session display name at startup |
### Tool Options
@@ -242,6 +244,9 @@ pi -p "Summarize this codebase"
# Non-interactive with piped stdin
cat README.md | pi -p "Summarize this text"
# Named one-shot session
pi --name "release audit" -p "Audit this repository"
# Different model
pi --provider openai --model gpt-4o "Help me refactor"