context-assembler
FreeNo executable scriptsNot checkedAssembles relevant context for agent spawns with prioritized ranking. Ranks packages by relevance, enforces token budgets with graduated zones, captures error…
About this skill
Context-Assembler Skill
You are the context-assembler skill. When invoked, you assemble relevant context packages for agent spawns, prioritizing by relevance and respecting token budgets.
When to Invoke This Skill
Invoke this skill when:
- Orchestrator prepares to spawn an agent and needs relevant context
- Any agent mentions "assemble context", "get context packages", or "context-assembler"
- Preparing developer/QA/tech lead spawns with session context
- Need to check for relevant error patterns before agent spawn
Do NOT invoke when:
- No active orchestration session exists
- Manually reading specific files (use Read tool directly)
- Working outside BAZINGA orchestration
Your Task
When invoked, execute these steps in order:
Step 1: Determine Context Parameters
Extract from the calling request or infer from conversation:
session_id: Current orchestration session (REQUIRED)group_id: Task group being processed (OPTIONAL - use empty string "" if not provided)agent_type: Target agent - developer/senior_software_engineer/qa_expert/tech_lead/investigator (REQUIRED)model: Model being used - haiku/sonnet/opus or full model ID (OPTIONAL, for token budgeting)current_tokens: Current token usage in conversation (OPTIONAL, for zone detection)iteration: Current iteration number (optional, default 0)include_reasoning: Whether to include prior agent reasoning for handoff (OPTIONAL)- DEFAULT BEHAVIOR: Automatically
truewhen reasoning context is beneficial:qa_expert,tech_lead: ALWAYS (handoff recipients)senior_software_engineer: ALWAYS (escalation needs prior context)investigator: ALWAYS (debugging needs full context)developer: Wheniteration > 0(retry needs prior reasoning; first attempt has none)
- Explicitly set to
falseto disable reasoning for any agent
- DEFAULT BEHAVIOR: Automatically
reasoning_level: Level of detail for reasoning retrieval (OPTIONAL)minimal: 400 tokens - key decisions onlymedium: 800 tokens - decisions + approach (DEFAULT)full: 1200 tokens - complete reasoning chain
If session_id or agent_type are missing, check recent conversation context or ask the orchestrator.
Step 2: Load Configuration and Check FTS5
Step 2a: Load retrieval limit for this agent type:
# Extract retrieval limit for the specific agent type
AGENT_TYPE="developer" # Replace with actual agent_type
# Pass AGENT_TYPE via command-line argument (not string interpolation)
LIMIT=$(cat bazinga/skills_config.json 2>/dev/null | python3 -c "
import sys, json
agent = sys.argv[1] if len(sys.argv) > 1 else 'developer'
defaults = {'developer': 3, 'senior_software_engineer': 5, 'qa_expert': 5, 'tech_lead': 5, 'investigator': 5}
try:
c = json.load(sys.stdin).get('context_engineering', {})
limits = c.get('retrieval_limits', {})
print(limits.get(agent, defaults.get(agent, 3)))
except:
print(defaults.get(agent, 3))
" "$AGENT_TYPE" 2>/dev/null || echo 3)
echo "Retrieval limit for $AGENT_TYPE: $LIMIT"
Default limits: developer=3, senior_software_engineer=5, qa_expert=5, tech_lead=5, investigator=5
Step 2b: FTS5 availability:
FTS5 is assumed unavailable (requires special SQLite build). Always use heuristic fallback in Step 3b for ranking.
# FTS5 disabled by default - use heuristic ranking
FTS5_AVAILABLE="false"
echo "FTS5_AVAILABLE=$FTS5_AVAILABLE (heuristic fallback enabled)"
Step 2c: Determine token zone and budget:
# Token estimation with tiktoken (with fallback to character estimation)
# Input: MODEL, CURRENT_TOKENS (from Step 1)
MODEL="sonnet" # or "haiku", "opus", or full model ID
CURRENT_TOKENS=0 # Current usage if known, else 0
# IMPORTANT: Use eval to capture output as shell variables
eval "$(python3 -c "
import sys, json
try:
import tiktoken
HAS_TIKTOKEN = True
except ImportError:
HAS_TIKTOKEN = False
# Model context limits (conservative estimates)
MODEL_LIMITS = {
'haiku': 200000, 'claude-3-5-haiku': 200000,
'sonnet': 200000, 'claude-sonnet-4-20250514': 200000, 'claude-3-5-sonnet': 200000,
'opus': 200000, 'claude-opus-4-20250514': 200000
}
# Read safety margin from config (default 15%)
try:
with open('bazinga/skills_config.json') as f:
cfg = json.load(f).get('context_engineering', {})
SAFETY_MARGIN = cfg.get('token_safety_margin', 0.15)
except:
SAFETY_MARGIN = 0.15
model = sys.argv[1] if len(sys.argv) > 1 else 'sonnet'
current = int(sys.argv[2]) if len(sys.argv) > 2 else 0
# Normalize model name (longest key first to avoid partial matches)
model_key = model.lower()
for key in sorted(MODEL_LIMITS.keys(), key=len, reverse=True):
if key in model_key:
model_key = key
break
limit = MODEL_LIMITS.get(model_key, 200000)
effective_limit = int(limit * (1 - SAFETY_MARGIN))
# Calculate REMAINING budget (not total)
remaining_budget = max(0, effective_limit - current)
usage_pct = (current / e
Install context-assembler in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
BashReadBundled files
FAQ
What does the context-assembler skill do?
Assembles relevant context for agent spawns with prioritized ranking. Ranks packages by relevance, enforces token budgets with graduated zones, captures error patterns for learning, and supports configurable per-agent retrieval limits.
How do I install the context-assembler skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the context-assembler skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
by Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
by Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
by Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
by Anthropic