FIELD GUIDE / SESSIONS

Long work.
Measured context.

Sessions store messages and events in local SQLite. Compaction, repository map, prompt-cache accounting, parallel read-only tools, and durable async turns keep long work useful — without inventing provider savings or Harbor Index scores.

Compaction · map · cache · parallel reads · durable jobs

Measured session.compaction events, extractive /map, provider-reported cache counters when adapters set them, concurrent list/read/search with ordered transcript append, and Prefer: respond-async recovery after restart.

Local session store

  • Create a session by choosing an existing workspace directory. The canonical path is stored with the session.
  • State and creation events write in one transaction. SSE events use monotonic IDs so clients can resume from a cursor.
  • Chat messages are capped at 1 MiB (1,048,576 bytes) of text. That is not Muse’s advertised token context window.
  • Fork a session with POST /v1/sessions/{id}/fork (or/fork in the TUI) to copy its history into a new session. Delete one with DELETE /v1/sessions/{id} or d twice in the Sessions dialog; deletion removes the session's stored state and never touches workspace files.

Repository map

An Aider-style extractive map ranks workspace files for context selection. In the TUI, run /map. HTTP: GET /v1/sessions/{id}/workspace/map. Capabilities: workspace.repository_map / session.repository_map. This is not a full semantic code index.

Adaptive compaction

When measured context grows large for an in-flight provider request, Veasel can compact extractively and emit a session.compaction event with measured bytes before/after. Optional summarizer:

VEASEL_SESSION_COMPACTION_SUMMARIZER=extractive   # default
VEASEL_SESSION_COMPACTION_SUMMARIZER=native       # structured local summary
VEASEL_SESSION_COMPACTION_SUMMARIZER=llm         # optional provider summary

LLM mode falls back on error, empty, or growth. Capability session.compaction.summarizer when enabled. Not provider-native compaction APIs; not invented cost. Details: session-compaction-summarizer.md.

Prompt-cache accounting

When providers report cache read/write tokens, Veasel persists them (sessions.usage.prompt_cache) and surfaces them on /usage and operation resources. Anthropic Messages emit cache_control markers by default; OpenAI Chat/Responses emit prompt_cache_key by default for catalog endpoints — hits remain provider-reported only. No invented % savings.

Parallel read-only tools

Multi-tool rounds of workspace list/read/search run concurrently with ordered transcript append. Skill load, edits, shell, and MCP stay sequential. Mid-flight work interrupted by a restart is fail-closed as uncertain — never silently replayed.

Cost schedule honesty

USD cost appears only when every reported turn matches the pinned schedule (embedded from tools/cost-schedule/schedule.json, overridable via env). Otherwise cost stays unavailable. Veasel does not invent prices, Harbor Index scores, or cross-agent rankings.

Durable async turns

Clients that send Prefer: respond-async get a durable operation ID (at most 32 queued rows per session). Queued turns resume after restart when the request, workspace, and model still validate. autonomous:true rows are not claimed unless the server opted in with VEASEL_ALLOW_AUTONOMOUS_EXECUTION=1 (same gate as the HTTP turn path); otherwise they cancel without starting work. If the process dies after a worker claimed the turn, startup marks it uncertain and never replays provider calls or tool effects. Inspect the workspace before retrying.

Git worktrees

Manage linked worktrees for a session workspace through the local API or headless CLI. Listing reads the repository git directory (no git subprocess); add/remove/lock/unlock use argv-only git worktree.

veasel worktrees list
veasel worktrees add --path /abs/path --branch main
veasel worktrees add --path /abs/path --new-branch feature/x
veasel worktrees lock --path /abs/path --reason "hold review"
veasel worktrees unlock --path /abs/path
veasel worktrees remove --path /abs/path

HTTP under /v1/sessions/{id}/workspace/git/worktrees. Pass --session to reuse an existing session, or --workspace to create one.

API and headless Troubleshooting