OpenACP/docs/guide/usage.md

122 lines
4.2 KiB
Markdown
Raw Permalink Normal View History

# Usage
## CLI Commands
```bash
openacp # Start (first run: setup wizard)
openacp start # Start as background daemon
openacp stop # Stop daemon
openacp status # Show daemon status
openacp logs # Tail daemon logs
openacp config # Interactive config editor
openacp update # Update to latest version
openacp reset # Delete all data and start fresh
openacp --foreground # Force foreground mode
```
## Daemon Mode
OpenACP can run as a background daemon:
```bash
openacp start # Start daemon
openacp stop # Stop daemon
openacp status # Check if running
openacp logs # Tail logs
```
On macOS, auto-start is supported via LaunchAgent. Enable it in `openacp config` → Run Mode → Enable auto-start.
## CLI API Commands
Control sessions from the terminal. Requires a running daemon.
```bash
openacp api new [agent] [workspace] # Create a new session
openacp api status # List active sessions
openacp api session <id> # Show session details
openacp api send <id> <prompt> # Send prompt to session
openacp api cancel <id> # Cancel a session
openacp api agents # List available agents
openacp api health # System health check
openacp api config # Show runtime config
openacp api restart # Restart daemon
```
Sessions created via CLI also appear as Telegram/Discord topics, so you can continue the conversation there.
## Telegram Commands
| Command | Description |
|---------|-------------|
| `/new [agent] [workspace]` | Create a new session (new topic) |
| `/newchat` | New session, same agent & workspace |
| `/cancel` | Cancel current session |
| `/status` | Show session or system status |
| `/agents` | List available agents |
| `/help` | Show help |
| `/menu` | Show menu keyboard |
## Examples
```
/new claude my-app → Claude in ~/openacp-workspace/my-app/
/new codex api-server → Codex in ~/openacp-workspace/api-server/
/new claude ~/code/project → Absolute path
/new → Default agent and workspace
```
## Session Flow
1. `/new claude my-project` — creates a new forum topic + spawns agent
2. Send your coding request
3. Agent responds with streaming text, tool calls, code
4. Permission needed → inline buttons (Allow / Always Allow / Reject)
5. File written → "View file" link opens Monaco Editor in browser
6. `/cancel` to stop, `/new` for another session
## Workspaces
| Input | Resolves to |
|-------|-------------|
| (none) | `~/openacp-workspace/` |
| `my-app` | `~/openacp-workspace/my-app/` |
| `~/code/project` | `~/code/project/` |
| `/absolute/path` | `/absolute/path/` |
Base directory is configurable via `workspace.baseDir` in config.
## Session Persistence & Resume
Sessions survive OpenACP restarts:
1. Session data is persisted to `~/.openacp/sessions.json`
2. After a restart, existing Telegram topics remain
3. Send a message in an old topic → **lazy resume** kicks in:
- Agent subprocess respawns with the same session ID
- Agent reconnects to its internal state
- Your message is forwarded to the resumed agent
4. Sessions older than `sessionStore.ttlDays` (default: 30) are cleaned up
Resume works for sessions with status `active` or `finished`. Cancelled/error sessions are not resumable.
## Skill Commands
AI agents can publish available skills (like `/compact`, `/review`, `/debug`). When they do:
- An inline keyboard with skill buttons is pinned in the session topic
- Click a skill button to invoke it
- Skills update dynamically as the agent's capabilities change
## Multiple Sessions
Run sessions in parallel — each `/new` creates a separate topic with its own agent subprocess. Limited by `security.maxConcurrentSessions` (default: 5).
## Assistant
The **Assistant topic** is an always-on AI helper:
- Knows your available agents and commands
- Helps create sessions interactively
- Provides guidance on OpenACP usage
- Shows a menu keyboard on startup