Context Tree — Retrieval Skill
You have access to a context tree that indexes the user's stored context (memories, tool configs, project details, preferences, etc.). Use it to pull only the relevant context for each request instead of loading everything.
How It Works
The context tree is a navigation index, not the storage itself. It contains short summaries and references to full context chunks stored separately. Your job is to read the tree, decide which chunks are relevant, and pull only those.
Retrieval Procedure
Step 1: Read the tree
Read tree.json. It contains a map of nodes, each with:
- •
summary— short description of what context this branch covers - •
tags— keywords for quick matching - •
children— sub-branches (if any) - •
chunk_ids— references to full context files (leaf nodes) - •
total_tokens— approximate token count of the referenced chunks
The root node's summary gives you an overview of all available context.
Step 2: Select relevant branches
Given the user's request, decide which branches are relevant:
- •Match by summary and tags — scan summaries and tags for relevance to the request.
- •Apply the chunk threshold — check
config.jsonforchunk_threshold(default: 4000 tokens).- •If a branch's
total_tokens<= threshold: pull all its chunks directly. - •If a branch's
total_tokens> threshold AND it has children: drill into children and repeat. - •If a branch's
total_tokens> threshold AND no children: pull its chunks anyway (it's a leaf).
- •If a branch's
- •Skip irrelevant branches entirely — don't pull context that clearly doesn't relate to the request.
Step 3: Pull the chunks
For each selected chunk_id, read the corresponding file from the chunks/ directory (e.g., chunks/chunk_001.md).
Step 4: Use the context
Include the retrieved chunks as context for handling the user's request. Do not include chunks that aren't relevant — less noise means better results.
Rules
- •Two-call target: Aim to complete navigation in a single read (tree.json + selected chunks), then handle the task. Avoid multi-round drilling unless the tree is very large.
- •Don't guess: If a summary is ambiguous, pull the chunk to check rather than assuming relevance.
- •Prefer recall over precision: It's better to pull a slightly-irrelevant chunk than to miss a relevant one. Missed context is a silent failure.
- •Respect token budgets: If the request is simple and you already have enough context, stop pulling.
File Layout
├── SKILL.md # This file (instructions)
├── config.json # Settings
├── tree.json # Summary tree (navigation index)
└── chunks/ # Full context chunks
├── chunk_001.md
├── chunk_002.md
└── ...