Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

context-assembler

БесплатноБез исполняемых скриптовНе проверен

Assembles relevant context for agent spawns with prioritized ranking. Ranks packages by relevance, enforces token budgets with graduated zones, captures error…

mehdicот mehdic★ 23 звезды на GitHub4 установки в других каталогах

Об этом скилле

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 true when 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: When iteration > 0 (retry needs prior reasoning; first attempt has none)
    • Explicitly set to false to disable reasoning for any agent
  • reasoning_level: Level of detail for reasoning retrieval (OPTIONAL)
    • minimal: 400 tokens - key decisions only
    • medium: 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
Полный SKILL.md на GitHub

Установить context-assembler в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Bash
Read

Вложенные файлы

references/usage.md

FAQ

Что делает скилл context-assembler?

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.

Как установить скилл context-assembler?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл context-assembler запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить context-assembler с