context
Retrieves relevant context for AI responses by analyzing user messages and returning token-efficient, minified information to replace full chat history in prompts.
Instructions
CALL THIS BEFORE EVERY AI RESPONSE to get relevant context.
This is the KEY tool for token-efficient AI interactions. It:
Analyzes the user's message to understand what context is needed
Retrieves only relevant context in a minified, token-efficient format
Replaces the need to include full chat history in prompts
Format options:
'minified': Ultra-compact D:decision|P:preference|M:memory (default, ~200 tokens)
'readable': Line-separated with labels
'structured': JSON-like grouped format
Type codes: W=Workspace, P=Project, D=Decision, M=Memory, I=Insight, T=Task, L=Lesson
Context Pack:
mode='pack' adds code context + distillation (higher credit cost)
Example usage:
User asks "how should I implement auth?"
AI calls context(user_message="how should I implement auth?")
Gets: "W:Maker|P:contextstream|D:Use JWT for auth|D:No session cookies|M:Auth API at /auth/..."
AI responds with relevant context already loaded
This saves ~80% tokens compared to including full chat history.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_message | Yes | The user message to analyze and get context for | |
| workspace_id | No | Workspace ID (UUID). | |
| project_id | No | Project ID (UUID). | |
| max_tokens | No | Maximum tokens for context (default: 800) | |
| format | No | Context format (default: minified) | |
| mode | No | Context pack mode (default: pack when enabled) | |
| distill | No | Use distillation for context pack (default: true) | |
| session_tokens | No | Cumulative session token count for context pressure calculation | |
| context_threshold | No | Custom context window threshold (defaults to 70k) | |
| save_exchange | No | Save this exchange to the transcript for later search (background task) | |
| session_id | No | Session ID for transcript association (required if save_exchange is true) | |
| client_name | No | Client name for transcript metadata (e.g., 'claude', 'cursor') | |
| assistant_message | No | Previous assistant response to save along with user message (for complete exchange capture) |