Skip to main content
Glama

brain_session

Destructive

Open or close an agent's working session to load full context at conversation start and persist executive state, critique, and cross-agent sync at close.

Instructions

Open or close the agent's working session. Call phase='start' once at the beginning of every conversation, before any other brain tool; call phase='end' once when the user signals they are done. Not for single facts (brain_remember).

    start returns the whole context block: the cron daily brief with a stale flag,
    executive state (objective, missions, pending decisions; a note instead when the file
    has none of those sections), the mental models when configured (one that was cut says
    so), a keyword search per top mission, the staged-inbox count, and `recovery` when the
    previous session never closed.

    end drains the capture queue when one is configured, appends a close line to today's
    session archive, replaces executive_state and session_critique with the bodies you
    pass (the file each replaces is kept beside it as `.prev.md`), writes the cross-agent
    sync file from your body or a stub built from this session's brain_remember calls,
    reports which trait signals moved, and writes the clean-close marker. `warning` in
    the reply means the executive_state you passed lacks the sections start reads: call
    end again with them. A second end overwrites the first.

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": {
      "phase": "<phase>"
    },
    "name": "brain_session"
  }
}

Input Schema

NameRequiredDescriptionDefault
syncNoend only: full markdown body of the cross-agent sync note.
phaseYes'start' or 'end'.
critiqueNoend only: full markdown body that replaces session_critique. Omitted: left unchanged.
session_idNoCaller's session id; omit to keep the one the server opened.
executive_stateNoend only: full markdown body that replaces executive_state. Keep the `## Primary Objective`, `## Top Missions` and `## Pending Decisions` headings: start reads those. Omitted: left unchanged.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.9.0
    • changedInput schema / properties / critique / description
      Previous value: -"end only: full markdown body that replaces session_critique."New value: +"end only: full markdown body that replaces session_critique. Omitted: left unchanged."
    • changedInput schema / properties / executive_state / description
      Previous value: -"end only: full markdown body that replaces executive_state."New value: +"end only: full markdown body that replaces executive_state. Keep the `## Primary Objective`, `## Top Missions` and `## Pending Decisions` headings: start reads those. Omitted: left unchanged."
  2. Changed5 schema fields changedv0.2.6
    • addedInput schema / properties / critique / description
      Added value: +"end only: full markdown body that replaces session_critique."
    • addedInput schema / properties / executive_state / description
      Added value: +"end only: full markdown body that replaces executive_state."
    • addedInput schema / properties / phase / description
      Added value: +"'start' or 'end'."
    • addedInput schema / properties / session_id / description
      Added value: +"Caller's session id; omit to keep the one the server opened."
    • addedInput schema / properties / sync / description
      Added value: +"end only: full markdown body of the cross-agent sync note."
  3. First observedv0.1.0

TDQS

A4.6/5.0
Behavior4/5

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

Annotations declare destructiveHint=true, idempotentHint=false and readOnlyHint=false; the description corroborates and enriches this by disclosing that end replaces executive_state and session_critique while keeping the old file as `.prev.md`, that a second end overwrites the first, and that `warning` signals a malformed executive_state requiring a re-call. It stops short of stating failure/auth modes for start, so it is not flawless, but it substantially exceeds annotation coverage.

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

Conciseness4/5

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

Front-loaded with the action and its timing, then organized into a start-returns block and an end-does block, so it is easy to scan. It is on the long side and repeats some return-shape detail that an output schema already covers, which costs it a point.

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?

For a five-parameter mutation tool with destructive semantics, the definition covers lifecycle timing, side effects, file backups, the malformed-state recovery loop, and repeat-call behavior. Given that an output schema exists, no call-critical information is missing.

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 goes beyond it: `phase` has no enum yet the text pins its two legal values, and the interaction between the `sync`/`critique`/`executive_state` bodies and what they replace (or leave unchanged when omitted) is spelled out, including the required headings start depends on.

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 first sentence names a concrete verb (open/close) and object (the agent's working session), and the closing line explicitly excludes a sibling use case: "Not for single facts (brain_remember)." An agent can distinguish it from brain_remember/brain_recall without opening any schema.

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?

It gives explicit when-to-use instructions for both modes — phase='start' once at the beginning of every conversation, before any other brain tool; phase='end' once when the user signals they are done — and names the alternative for single facts. Both the positive condition and the exclusion are stated.

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