Skip to main content
Glama

Compile Context Bundle (Experimental)

context_bundle
Destructive

Compile a versioned context bundle from project memory for a task, with source attribution and a selection/drop audit. Use to inject relevant context into agent sessions without a network call.

Instructions

Experimental Context Bundle v1 compiler. Requires schema_version=1 and a non-blank task. Returns a policy-bounded, source-attributed ContextBundle with a complete selection/drop audit; project is explicit or derived from cwd, and role/risk/token budget have deterministic defaults. Historical as_of_epoch pins and include_superseded=true fail loudly until the canonical loader supports them. This reuses the production SessionStart canonical loader, performs no foreground LLM or network call, and returns canonical load failures as a blocked audited bundle. Its poisoning safety check may quarantine unsafe persisted rows, so callers must not treat it as side-effect-free. The JSON shape is versioned but remains experimental.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdNoWorking directory used for canonical loading and project derivation.
riskNoRisk class: low, medium, or high (default medium).
roleNoAgent role: coder, reviewer, planner, or researcher (default coder).
taskYesTask description used for SessionStart relevance selection.
branchNoOptional Git branch scope filter.
projectNoExact project key/path. Defaults to the project derived from cwd.
worktreeNoOptional worktree identity recorded in the versioned request.
as_of_epochNoAs-of epoch-seconds scope pin. Experimental v1 accepts only 0/omitted until historical canonical loading is implemented.
token_budgetNoTotal token budget for the bundle (default 4000).
schema_versionYesContext Bundle request schema version; v1 requires 1.
include_supersededNoAllow superseded memories in scope. Experimental v1 accepts only false/omitted until canonical loading supports history.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
auditYes
plan_hashYes
preferencesYes
workstreamsYes
memory_indexYes
current_truthYes
degraded_modeYes
schema_versionYes
failure_lessonsYes
recent_sessionsYes
Behavior5/5

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

Description goes beyond annotations by detailing side effects: no foreground LLM/network call, canonical load failures become blocked audited bundles, and poisoning safety may quarantine rows, explicitly advising callers not to treat it as side-effect-free. This exceeds the destructiveHint annotation.

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?

The description is somewhat verbose with repeated warnings (e.g., about historical support) but is organized and not excessively long. It conveys all necessary points without major redundancy.

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

Completeness4/5

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

Given the tool's complexity, the description covers essential aspects: purpose, constraints, failure behavior, side effects, and what it returns. Since an output schema exists, not detailing return structure is acceptable. It is complete enough for agent usage.

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 covers all parameters with descriptions, but the description adds meaningful context: project can be derived from cwd, role/risk/token budget have deterministic defaults, and as_of_epoch/include_superseded fail loudly until supported. This enriches parameter understanding beyond the schema.

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 compiles a Context Bundle v1, specifying verb 'compile' and resource 'ContextBundle', and distinguishes it from sibling tools like timeline and search.

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

Usage Guidelines4/5

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

Provides usage context: experimental, requires schema_version=1, non-blank task, deterministic defaults, and explicitly warns about failure modes for historical pins and include_superseded=true. It also clarifies it uses the production SessionStart loader and performs no foreground LLM/network, but does not explicitly compare to alternatives.

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/majiayu000/remem'

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