Skip to main content

How Termyte works

Capture

Each integration turns its event into the same basic shape. Termyte removes common secret patterns before writing it to SQLite. If the agent supplies an event ID, Termyte uses that ID to ignore replays. Otherwise it uses a hash of the redacted content together with the session, event type, and timestamp. The same database transaction records useful views of prompts, completed tools, shell commands, and captured file reads or modifications.

Background work

The foreground hook writes the event and schedules durable work. At session end, the installed runtime queues one job to process the full session. A detached termyte-worker claims jobs under a lease, retries failures, and turns captured work into observations and reusable memories. Failed jobs remain visible in diagnostics. Semantic processing has two validated stages. First, redacted traces are sent to the selected provider to extract structured observations. After those observations are stored and indexed with trace provenance, the provider consolidates related observations into memories linked to both the observations and their source traces. In agent mode, the worker reuses existing authentication through one-shot non-interactive CLI calls: claude -p, codex exec, or opencode run --format json. API mode uses an OpenAI-compatible endpoint. Capture-only mode stores events without running either synthesis stage.

Work Threads and sessions

A Work Thread stores the current objective, requirements, ordered steps, decisions, failures, evidence, transitions, checkpoints, and handoffs. Updates use a version number so an older process cannot silently replace newer work. One agent session can contain more than one episode. A prompt that clearly starts a new task closes the active episode and starts another. Failed command evidence can also close an episode. Each episode stays linked to its traces, evidence, and Work Thread. A step becomes verified only with passing evidence and explicit user authority. A task cannot complete while required work remains unverified.

Returning context

When exactly one active Work Thread exists for a repository, Termyte puts that state first. Older summaries, observations, and memories are supporting context. Referenced files are checked against the current workspace and Git state. Retrieval is scoped, budgeted, and may return nothing when the available material is not useful. An episode outcome can point to the context shown during that work. Termyte uses explicit feedback, the outcome, and recorded evidence to label a context effect as helped, hurt, or unknown. This makes the result inspectable. It does not prove that the context caused the outcome.