Skip to main content
Glama

session

Persists and restores task context as one living Markdown note per line of work, letting agents save progress, resume tasks, and archive completed work.

Instructions

Keep the session state: one living note per line of work in sesiones//.

Only this tool writes there (revise and remember refuse it). The state in use is the one this process saved or restored, else the newest active state of the same worktree (project_dir). save: create or rewrite the whole state. Target: note, else the current state, else a new one (needs title); to start another line of work, archive the current state first. A note that was archived becomes active again. body replaces the body (a leading "# title" line is dropped); a credential in title, body, files or session is refused (invalid_argument). Returns {"path", "created", "missing_sections"} plus "template_hint" when a long body lacks template sections; it never refuses for format. plan (a slug of the plan tool) links the state to its plan; without it the state keeps its plan, else takes the plan this process saved last for the worktree. The extractor passes until (the last transcript time it read) and the next extraction order starts there, not at saved_at; any later save drops it. show: {"found", "path", "task_title", "saved_at", "content"} (plus "extracted_until" when the extractor saved last). Never writes. restore: the state as context, made current: {"found", "path", "task_title", "saved_at", "content", "source"}. Without a state it falls back to the deprecated checkpoint when [checkpoint] state_glob is set (adds "deprecated"). template: {"type", "sections", "skeleton"} of type (default "session"). archive: set status archived on note (default the current state); never deletes. Returns {"path", "changed"}. States more than [session] archive_days (7) days after their saved_at are archived by the maintenance of the first welcome. Hook actions: gate (only with hook_event="PreCompact") blocks a manual /compact once when the state was not saved in 5+ messages; capture (PostCompact) puts summary in the "Resumen de compactación" section of the state, credentials redacted, creating «Sesión » if there is none; end (SessionEnd) keeps transcript for the next restore after /clear (only when reason is "clear" or empty). restore with source and a transcript adds "extract", the order to launch the episteme:extractor agent, when [session] extract is on.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "action": "<action>"
    },
    "name": "session"
  }
}

Input Schema

NameRequiredDescriptionDefault
bodyNosave: the whole state, following the session template (replaces it).
noteNosave, archive: path of a state; default is the current state.
planNosave: slug of the plan of the task; default keeps the state's plan.
typeNotemplate: memory type; default "session".
filesNosave: files the task touches (globs allowed).
titleNosave: the task in a few words; needed to create a state.
untilNosave with origin="extractor": the digest's "hasta" (ISO); the next extraction starts there.
actionYesOne of: save, show, restore, template, archive, capture, end, gate.
originNosave: "agent" (default) or "extractor"; goes to saved_by.
reasonNoend: why the session ended (${reason}).
sourceNorestore: "compact" or "clear" (${source}) from the hook.
projectNoProject; defaults to --project.
sessionNoClaude Code session id (hooks pass ${session_id}); metadata for save.
summaryNocapture: the compaction summary (${compact_summary}).
triggerNogate: "manual" or "auto" (${trigger}).
hook_eventNoOnly for Claude Code hooks: ${hook_event_name}. Omit otherwise.
transcriptNoend, restore: path of the session transcript (${transcript_path}).
project_dirNoAbsolute project directory (hooks pass ${cwd}); picks the worktree.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.16.0

TDQS

A4.1/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations supplied, the description carries the full burden and does so: it discloses injected-credential refusal (invalid_argument), that show never writes, that archive never deletes, that states older than [session] archive_days (7) are auto-archived by maintenance, the until/extractor offset interaction, and the exact return payload per action. These are side effects and invariants an agent could not infer from the schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The core statement is front-loaded and action segments are prefixed with "save:", "show:", etc., but the body is one long run-on block of nested clauses that is costly to parse for an 8-action tool. Little is pure filler, yet the packing hurts scannability.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an 18-parameter, 8-action tool with no output schema, the description is unusually complete: it names return shapes for save/show/restore/template/archive and describes hook-action behavior. Minor gaps remain, such as what gate returns and how capture reports failure.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, and the description adds genuine cross-parameter meaning on top: body replaces the body and drops a leading "# title" line, title is required only to create a new state, and plan defaults to the state's existing plan or the last plan this process saved for the worktree. The until/origin interaction is also explained, which is not derivable from the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: it keeps session state as one living note per line of work under sesiones/<project>/. It also differentiates itself from siblings explicitly ("Only this tool writes there (revise and remember refuse it)") and enumerates its actions. Dense, run-together prose costs it a point, but an agent can tell what it owns.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives concrete when-to-use rules per action: save's target resolution chain, "to start another line of work, archive the current state first", restore's fallback to the deprecated checkpoint only when [checkpoint] state_glob is set, and hook actions gated on hook_event. It stops short of stating when NOT to use the tool versus siblings like checkpoint or context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.