cont/docs/configuration.md
2026-09-15 14:15:55 +01:00

68 lines
4.6 KiB
Markdown

# Storage, search, and privacy
## Session discovery
`cont` reads the agents' central stores, not every folder on your disk. Each session's recorded working directory supplies its location in the picker. Discovery includes sessions from all locations; the initial **view** is scoped to your current directory.
| Agent | Default store | Resume command |
| --- | --- | --- |
| Pi | `~/.pi/agent/sessions/**/*.jsonl` | `pi --session <absolute-file>` |
| Claude Code | `~/.claude/projects/*/*.jsonl` | `claude --resume <id>` |
| Codex | `~/.codex/sessions/**/*.jsonl` | `codex resume <id>` |
| OpenCode | `~/.local/share/opencode/opencode*.db` | `opencode --session <id>` |
| Oh My Pi | `~/.omp/agent/sessions/**/*.jsonl` | `omp --resume <absolute-file>` |
### Overrides
- **Pi:** honors `PI_CODING_AGENT_DIR` and `PI_CODING_AGENT_SESSION_DIR`.
- **Claude Code:** honors `CLAUDE_CONFIG_DIR`.
- **Codex:** honors `CODEX_HOME`; names also come from `session_index.jsonl` beside the session root.
- **OpenCode:** honors `XDG_DATA_HOME` and `OPENCODE_DB`. Relative database names resolve beneath its data directory. Resuming sets `OPENCODE_DB` to the selected store, including custom/channel databases.
- **OMP:** also scans `${XDG_DATA_HOME:-~/.local/share}/omp/sessions` for migrated stores. Its shared `PI_CODING_AGENT_DIR` override is deliberately not auto-used: that would mislabel Pi history as OMP. Use `--omp-dir` for custom/profile stores. The active OMP configuration/profile is inherited when resuming.
Repeatable `--pi-dir`, `--claude-dir`, `--codex-dir`, and `--omp-dir` add **session/project storage roots**, not working directories. `--opencode-db` adds a SQLite file.
```sh
cont --all --omp-dir /path/to/omp/sessions
cont --all --opencode-db /path/to/opencode.db
```
### Format support
- Claude subagent logs/sidechain messages and Codex sessions marked as subagents are excluded. Codex archived sessions are not scanned by default.
- OpenCode's current SQLite format is supported; older pre-SQLite JSON stores are not. Reads use a read-only transaction and include committed WAL contents. Child/archived sessions, synthetic/ignored parts, assistant messages, and tool output are excluded.
- OMP supports legacy header titles, current title slots/renames, and human attribution.
- Malformed JSONL records and incomplete live-write tails are skipped. Changed files are retried on refresh. The picker never rewrites session logs or changes OpenCode database records.
## Search ranking
1. Exact title phrases, with exact titles and prefixes first.
2. Titles containing every query word, in any order.
3. Fuzzy title matches using Nucleo's Unicode-aware subsequence matcher.
4. Human messages containing the phrase or every query word, in any order, **within one message**.
Recency breaks ties. Named/renamed titles take precedence over the first human prompt. Search is case-insensitive; fuzzy title matching supports accent normalization. Message search is literal, not semantic or typo-correcting. Assistant replies, tools, images, compaction summaries, and recognized injected notifications are not searched. Human text is not truncated for indexing.
## Cache and privacy
The TUI opens immediately, loads cached results, and refreshes changed files in a background worker. JSONL parsing is parallel; unchanged files are detected by nanosecond mtime and size. OpenCode cache invalidation checks both database and WAL metadata, so it catches new messages and renames before checkpointing. Deleted files/sessions are removed during refresh. **Ctrl-R** rescans; there is no watcher or daemon.
Cache location:
```text
${XDG_CACHE_HOME:-~/.cache}/cont/sessions-v1.json
```
Use `RESUME_CACHE_DIR` to choose a dedicated alternative directory.
**The cache contains metadata and human messages in plaintext.** Directory/file permissions are `0700`/`0600` on Unix, and writes are atomic. Nothing is sent over the network. Don't share the cache or commit it to a repository.
- `--no-cache`: don't read or write a cache.
- `--rebuild`: force a fresh parse.
- Delete the cache directory to remove copied text; the next launch rebuilds it.
## Resume behavior
Enter restores the terminal, changes to the session's original working directory, and launches the matching agent. On Unix, `exec` gives the agent the existing terminal directly.
The picker does not fork sessions, change your parent shell's directory, or add permission-bypass flags. Agents must be on `PATH`; their normal configuration and trust checks apply. Missing directories are reported rather than silently resuming elsewhere. `--print` prints the selected command without executing it.