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
claudeCLI, which may use Claude Code credentials the user already has signed in — Cortex does not handle those credentials directly.Rate limits: depend on the
claudeCLI 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
claudeCLI 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
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The 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. | |
| project | No | Project 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
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |