# TriSeek v0.4.2

v0.4.2 ships the Context Portability layer: snapshot a session in one harness, resume it in another with primed memo, frecency, and search reuse.

## Highlights

- Added work-session tracking through `session_open`, `session_status`, `session_list`, and `session_close`, persisted under the daemon and shared across harnesses.
- Added `session_snapshot` to capture the working set, action log, frecency state, git state, and pinned snippets to disk.
- Added `session_resume` to prime daemon memo/frecency/search-reuse state and emit a markdown hydration payload for the next harness.
- Added `triseek pack export` and `triseek pack import` for portable `.tcp` snapshot archives.
- Added `triseek brief` with `no-inference`, `local-model`, and `cloud-model` modes. In v0.4.2 all three modes validate and write the no-inference template; model-backed summarization is not wired to external endpoints yet.

## New MCP Tools

| Tool | Purpose | Response envelope |
|---|---|---|
| `session_open` | Open or reopen a portable work session for the current repo. | `{ "session": { "schema_version", "session_id", "goal", "repo_root", "status", "created_at", "updated_at" } }` |
| `session_status` | Inspect a session and its action-log size. | `{ "session": { ... }, "action_log_size": 3 }` |
| `session_list` | List portable sessions for the current repo. | `{ "sessions": [{ ... }] }` |
| `session_close` | Mark a session `resolved` or `abandoned`. | `{ "session": { ... } }` |
| `session_handoff` | Convenience MCP wrapper: create a snapshot, then close the current session as resolved. | Same envelope as `session_snapshot`. |
| `session_snapshot` | Persist a snapshot directory for a session. | `{ "snapshot_id", "snapshot_dir", "manifest": { ... } }` |
| `session_snapshot_list` | List snapshot manifests, optionally filtered by session. | `{ "snapshots": [{ ... }] }` |
| `session_snapshot_get` | Read a full snapshot envelope. | `{ "snapshot": { "manifest", "working_set", "action_log", "pinned_snippets" } }` |
| `session_snapshot_diff` | Compare two snapshots. | `{ "diff": { "added_files", "removed_files", "changed_files", "added_searches", "removed_searches" } }` |
| `session_resume` | Prime daemon state from a snapshot and return a hydration payload. | `{ "session_id", "payload_markdown", "payload_token_estimate", "hydration_report", "searches" }` |

## New CLI Commands

| Command | Purpose | Example |
|---|---|---|
| `triseek snapshot create` | Create a snapshot for a session. | `triseek snapshot create --session session_123 --source-harness claude_code .` |
| `triseek snapshot list` | List snapshots in the daemon store. | `triseek snapshot list` |
| `triseek snapshot show` | Print a full snapshot. | `triseek snapshot show snap_123` |
| `triseek snapshot diff` | Compare two snapshots. | `triseek snapshot diff snap_a snap_b` |
| `triseek resume` | Prepare a snapshot for resume and optionally write the hydration payload. | `triseek resume snap_123 --write-to AGENTS.md` |
| `triseek handoff` | Create a snapshot and briefing for a target harness. | `triseek handoff codex --from claude_code` |
| `triseek pack export` | Export a snapshot directory as a `.tcp` archive. | `triseek pack export snap_123 --output handoff.tcp` |
| `triseek pack import` | Import a `.tcp` archive into the local snapshot store. | `triseek pack import handoff.tcp` |
| `triseek brief` | Write `briefing.md` into a snapshot directory. | `triseek brief snap_123 --mode no-inference` |

## Storage Additions

- `<daemon_dir>/sessions/sessions.json` — schema version `1`; the persistent session index.
- `<daemon_dir>/sessions/<session_id>/action_log.jsonl` — schema version `1` entries; ordered append-only action log.
- `<daemon_dir>/snapshots/<snapshot_id>/manifest.json` — schema version `1`; snapshot identity, repo, git, harness, generation, and context epoch metadata.
- `<daemon_dir>/snapshots/<snapshot_id>/working_set.json` — schema version `1`; files read, searches run, and frecency top-N.
- `<daemon_dir>/snapshots/<snapshot_id>/action_log.jsonl` — schema version `1`; copied action log for the session.
- `<daemon_dir>/snapshots/<snapshot_id>/pinned_snippets.json` and `pinned_snippets/<sha>.txt` — content-addressed pinned snippets only.
- `<daemon_dir>/snapshots/<snapshot_id>/git_state.json` — commit and dirty-file state.
- `<daemon_dir>/snapshots/<snapshot_id>/briefing.md` — optional, written by `triseek brief` or `triseek handoff`.

## Migration Notes

Purely additive. No existing tools changed shape. Upgrading from v0.4.1 requires no action.

## What Did Not Ship In This Release

- Cross-machine resume. v0.4.2 is same-machine only.
- Automatic snapshotting via harness hooks. Snapshotting is manual or initiated by `triseek handoff`.
- Team-shared packs. Packs are single-user artifacts tied to a local repo checkout.
- First-class portability adapters for OpenCode, Pi, Cursor, Cline, or other MCP hosts. Claude Code and Codex are the supported adapter flows in v0.4.2; other harnesses can use the CLI manually.
- Model-backed briefing summarization. `local-model` and `cloud-model` modes are accepted, but still fall back to the no-inference template in v0.4.2.
- Eval harness.
- Replay and audit verbs.

## Acceptance Demo

```sh
# In Claude Code
triseek daemon start
triseek install claude-code
triseek install codex

# Open a session through MCP, work normally, then snapshot it.
triseek snapshot create --session session_123 --source-harness claude_code .
triseek brief <snapshot_id> --mode no-inference
triseek pack export <snapshot_id> --output triseek-handoff.tcp

# On the same machine, import and resume for Codex.
triseek pack import triseek-handoff.tcp
triseek resume <snapshot_id> --write-to AGENTS.md
```

## Validation

- `cargo fmt --all --check`
- `cargo clippy --workspace --all-targets --locked -- -D warnings`
- `cargo test --workspace --locked`
- CI smoke builds on Linux, macOS, and Windows
