Skip to content
Agent Orchestration
Agent

session-system

Sessions are stored per project data directory, not directly in the genome root. The data directory contains session metadata, event logs, project memory files, and per-session subprocess logs.

From plugin
sprout
11336 skills36 agents

How it fires

How this agent gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.

Context preview

The summary Claude sees to decide when to auto-load this agent.

Sessions are stored per project data directory, not directly in the genome root. The data directory contains session metadata, event logs, project memory files, and per-session subprocess logs.

Agent definition

session-system.md

Session System

Sessions are stored per project data directory, not directly in the genome root. The data directory contains session metadata, event logs, project memory files, and per-session subprocess logs.

Storage Layout

Common paths:

  • `sessions/{sessionId}.meta.json`
  • `logs/{sessionId}.jsonl`
  • `logs/{sessionId}/...` for child handle or process logs
  • `memory/*.md` for project-memory documents

Source of truth:

  • `src/util/project-id.ts`
  • `src/host/session-metadata.ts`
  • `src/host/logger.ts`

Metadata

Metadata stores session id, root agent, status, turn/context counts, model selection, resolved model, timestamps, and cached root memory surfacing data. If a previous run crashed while status was `running`, resume marks it `interrupted` before starting new work.

Source of truth:

  • `src/host/session-metadata.ts`
  • `src/host/session-metadata-updater.ts`
  • `test/host/session-metadata.test.ts`

Event Logs

Agents emit structured events such as session start/end, perceive, recall, plan start/end, act start/end, verify, warnings, errors, and learn events. The current event taxonomy lives in source, not this document.

Source of truth:

  • `src/kernel/types.ts:EventKind`
  • `src/agents/events.ts`
  • `src/host/event-bus.ts`

Replay And Resume

Resume reconstructs message history from the JSONL event log, loads metadata for model selection and cached memory surface, extracts child handles, and loads session plus child event logs for the UI.

Source of truth:

  • `src/host/resume.ts`
  • `src/kernel/event-replay.ts`
  • `src/host/cli-resume.ts`
  • `src/host/session-state.ts`

Compaction

There are two compaction concepts:

  • Conversation compaction summarizes message history during a live session.
  • Memory-log compaction removes archived/superseded long-term memory rows after

git history contains their audit trail.

Source of truth:

  • `src/host/compaction.ts`
  • `src/host/session-controller.ts`
  • `src/genome/genome.ts:compactMemoryLog()`

Memory Collapse

After a completed root run, session events can be summarized into a segment and extracted memories. This uses configured memory summary/extraction models and records project activity.

Source of truth:

  • `src/core/session-collapse.ts`
  • `src/genome/segments.ts`
  • `src/genome/projects.ts`
  • `src/host/session-controller.ts:collapseMemoryAfterRun()`

Safe Inspection

Session JSONL can contain large prompts, tool calls, and full LLM messages. Prefer metadata-first filtering and command-runner extraction over loading raw logs directly into an agent context.

Read more
Ships withsprout

A self-improving, multi-agent AI system that decomposes tasks and delegates to specialist agents. Sprout is an autonomous coding assistant built on a recursive agent architecture — where every action is a goal-directed delegation to a subagent.

Get the whole plugin

Other agents on sprout.