Skip to main content
Glama

context_assemble

Assembles relevant memories, project playbook, and prior sessions into a focused briefing for any query. Get context tailored to your question without reading raw files.

Instructions

Assemble a query-tailored context briefing from all available knowledge.

This is the highest-value Cortex tool. It gathers the relevant subset of memories, the project's playbook, and related session transcripts, then uses Claude Haiku to synthesise a focused markdown briefing for the given query. The result is a ready-to-read summary, NOT a raw memory dump — usually 300-800 tokens of distilled relevant knowledge.

Behaviour:

  • Read-only with respect to the Cortex memory store. Bumps access telemetry on memories it reads (same as memory_recall).

  • No authentication required by Cortex itself. The optional Haiku synthesis step shells out to the local claude CLI, which may use Claude Code credentials the user already has signed in — Cortex does not handle those credentials directly.

  • Rate limits: depend on the claude CLI backend in the healthy path. In degraded mode (claude CLI missing), there are no rate limits at all — Cortex just returns raw materials.

  • Data access scope: reads ~/obsidian-brain/cortex/memories/, ~/obsidian-brain/cortex/playbooks/.md, ~/.cortex/search.db, and ~/.claude/projects/ transcripts. If the claude CLI is invoked, the gathered materials (up to 50KB) are sent to Haiku via that subprocess — which in turn sends them to Anthropic's API under the user's existing Claude Code session. In degraded mode nothing leaves the machine.

  • Latency: 3-15 seconds with Haiku; <500ms in degraded mode.

  • Not idempotent at the Haiku level: the same query can produce slightly different briefings across calls due to Haiku sampling. The underlying memory retrieval step IS deterministic.

  • Failure modes: returns "" on genuinely empty vaults. Never raises to the caller; Haiku failures silently fall back to returning the raw materials.

Use context_assemble when:

  • Starting a new session and you want the assistant loaded with context before the first real question (the auto-recall hook does this on UserPromptSubmit, but you can also call it manually)

  • Onboarding to a project mid-session — ask "what do I know about X?"

  • Before making a decision in an area where prior decisions exist

Do NOT use for:

  • Simple keyword lookups (use memory_recall — faster, no LLM call)

  • Listing memories (use memory_list)

  • Finding a specific past conversation (use transcript_search)

Degraded mode: if the claude CLI is not available on the host, this tool falls back to returning the raw materials (playbook + ranked memories) without Haiku synthesis, so it always returns SOMETHING useful.

Returns: A markdown briefing tailored to the query. Length is typically 300-800 tokens, with headers, bullet lists, and cross-references to memory IDs where relevant.

Example: context_assemble( query="help me fix the auth flow on staging", project="my-webapp", ) → returns a brief covering: the RS256 JWT decision, the known bcrypt.compare gotcha, a link to the staging-specific env var issue from last month, etc.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe question or task you want context for. Typically this is the user's first message in a new session — the assembler will pull relevant memories and synthesise a focused briefing tailored to what they asked.
projectNoProject scope for the assembly. "default" pulls from cross-project memories. A specific project name pulls that project's playbook + memories + session history.default

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

With no annotations provided, the description fully discloses behavioral traits: read-only nature, telemetry bumps, authentication details, rate limits, data access scope, latency, idempotency, failure modes. This level of detail exceeds what annotations would typically provide.

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 well-structured with sections, bullet points, and an example. It is front-loaded with a clear one-sentence summary. Every sentence adds essential information, matching the tool's complexity without unnecessary verbosity.

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?

The description covers all essential aspects: purpose, usage guidelines, behavioral details, parameters with example, return value specification, failure modes, and degraded mode. An output schema exists, but the description still provides necessary context on return format and typical content length.

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?

Input schema has 100% coverage with clear descriptions for both parameters. The description adds value by providing usage context, an example call, and clarifying the 'project' parameter's default behavior. However, the schema already does most of the work, so a 4 is appropriate.

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: 'Assemble a query-tailored context briefing from all available knowledge.' It distinguishes from sibling tools by explaining it gathers memories, playbook, and transcripts, then synthesizes with Haiku. The verb 'assemble' and resource 'context briefing' are specific and unique.

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?

Explicit guidance on when to use (starting a session, onboarding, decision-making) and when not to use (simple keyword lookups → memory_recall, listing memories → memory_list, finding past conversation → transcript_search). Also mentions degraded mode behavior, ensuring the agent knows the tool always returns something useful.

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/memem'

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