Skip to main content
Glama

session_state

Save, load, or list orchestrator session snapshots to resume workflows after crashes, restarts, or pauses without re-planning or re-running completed modules.

Instructions

Save, load, or list orchestrator session snapshots for resumability. Lets a /forge workflow survive a crash, conversation restart, or an intentional pause — the next invocation can pick up exactly where the previous one left off, without re-planning or re-running completed modules.

Behaviour:

  • MUTATION on save, READ on load and list.

  • State lives at .forge/state/<runId>.json. Writes use atomic tmp + rename semantics so a crash mid-save can never leave a partial file on disk.

  • runId is guarded against path traversal via _RUN_ID_PATTERN (/^[\w.-]{1,128}$/).

  • Every save stamps the state with a fresh lastUpdatedAt ISO timestamp; list sorts most-recent first using this field.

  • No authentication, no network, no rate limits.

Use when:

  • The orchestrator has just completed a phase transition (plan approved, first parallel batch finished, module escalated) and wants to persist progress in case the session drops.

  • A fresh Claude Code session wants to resume an abandoned run: call session_state({ action: "list" }), find the most recent run with completedCount < totalCount, then session_state({ action: "load", runId: "..." }).

  • A user has invoked /forge-status and the orchestrator is computing the summary.

Do NOT use for:

  • Per-module retry state — that's iteration_state.

  • Cross-run learned patterns — that's memory_save.

  • Ephemeral progress for the statusline — the server writes /tmp/forge-status.json automatically on every tool call; don't duplicate it here.

Returns: save: { saved: true, runId, lastUpdatedAt } load: { found: true, ...state } when the file exists, { found: false, runId } when it does not. list: { sessions: [{ runId, lastUpdatedAt, currentPhase, completedCount, totalCount }, ...] } sorted by lastUpdatedAt descending.

Example: session_state({ action: "save", runId: "2026-04-15-1", state: { currentPhase: "execute", moduleStatuses: { m1: "done", m2: "running", m3: "pending" }, completedModules: ["m1"], startedAt: "2026-04-15T10:00:00Z" } }) → { "saved": true, "runId": "2026-04-15-1", "lastUpdatedAt": "..." }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYessave = persist state, load = restore state, list = show all sessions
runIdNoRun ID (required for save/load, ignored for list)
stateNoOrchestrator state to persist (for save). Expected shape: {runId, planPath, currentPhase, moduleStatuses: {[moduleId]: status}, retryCounts: {[moduleId]: number}, completedModules: [string], startedAt, lastUpdatedAt}
Behavior5/5

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

With no annotations provided, the description carries the full burden and delivers exceptional behavioral transparency. It details mutation/read behavior per action, file storage location, atomic write semantics, runId validation pattern, timestamp stamping, sorting behavior, and explicitly states 'No authentication, no network, no rate limits.' This provides complete behavioral understanding beyond what parameters alone would convey.

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

Conciseness5/5

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

The description is perfectly structured with clear sections (Behaviour, Use when, Do NOT use for, Returns, Example). Every sentence earns its place by providing essential information without redundancy. The front-loaded purpose statement immediately communicates the tool's value, followed by organized details.

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

Completeness5/5

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

Given the tool's complexity (3 parameters, no output schema, no annotations), the description provides complete context. It covers purpose, behavior, usage guidelines, parameter semantics, return values, and includes a detailed example. The description fully compensates for the lack of output schema and annotations, making the tool completely understandable.

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?

With 100% schema description coverage, the baseline is 3, but the description adds significant value. It explains the expected shape of the state parameter with detailed field descriptions, clarifies when runId is required/ignored, and provides a comprehensive example showing parameter usage. This goes well beyond what the schema provides alone.

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

Purpose5/5

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

The description clearly states the tool's purpose with specific verbs (save, load, list) and resource (orchestrator session snapshots). It distinguishes from siblings by explicitly mentioning what NOT to use it for (iteration_state, memory_save), showing clear differentiation from other tools on the server.

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

Usage Guidelines5/5

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

The description provides explicit 'Use when' scenarios with three concrete examples and 'Do NOT use for' guidance with three specific alternatives. It clearly defines when to use this tool versus sibling tools like iteration_state and memory_save, offering comprehensive usage guidance.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TT-Wang/forge'

If you have feedback or need assistance with the MCP directory API, please join our Discord server