.claude/skills/context-attribution/SKILL.md
Estimate per-turn token attribution across 6 categories in Claude Code sessions to show where context budget is spent
npx skillsauth add oimiragieo/agent-studio context-attributionInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Estimate per-turn token attribution across 6 categories in Claude Code sessions. Based on claude-devtools visible context tracker.
Skill({ skill: 'context-attribution' });
Use when: context pressure is high, optimizing CLAUDE.md sizes, understanding which tool calls consume the most tokens, debugging context overflow.
| Category | Detection Pattern | Typical % |
| ----------------- | ---------------------------------------------------- | --------- |
| CLAUDE.md files | System messages with claudeMd or CLAUDE.md content | 20-40% |
| @-mentioned files | Read tool results triggered by user file references | 10-20% |
| Tool outputs | All tool_result content blocks | 15-30% |
| AI thinking/text | Assistant message content (text + thinking blocks) | 10-25% |
| Team coordination | Messages containing <teammate-message> XML | 0-15% |
| User messages | User role messages (prompts, follow-ups) | 5-15% |
# Find most recent session
SESSION=$(ls -t ~/.claude/projects/$(pwd | sed 's|/|-|g; s|^-||')/*.jsonl | head -1)
For each message, classify into one of the 6 categories and estimate tokens:
# Count user messages (Category 6)
grep '"role":"user"' "$SESSION" | grep -v '"tool_result"' | wc -l
# Count tool results (Categories 2-3)
grep '"type":"tool_result"' "$SESSION" | wc -l
# Count assistant output (Category 4)
grep '"role":"assistant"' "$SESSION" | wc -l
# Check for team messages (Category 5)
grep 'teammate-message' "$SESSION" | wc -l
Use the usage field from each assistant turn for accurate counts. Fall back to chars/4 when unavailable.
Turn | CLAUDE.md | Files | Tools | AI Out | Team | User | Total
-----|-----------|-------|-------|--------|------|------|------
1 | 12,400 | 0 | 0 | 800 | 0 | 200 | 13,400
2 | 0 | 3,200 | 1,500 | 2,100 | 0 | 150 | 6,950
... | ... | ... | ... | ... | ... | ... | ...
Report which category consumes the most tokens and suggest optimizations (e.g., reduce CLAUDE.md size, compress tool outputs).
Before starting: ```bash cat .claude/context/memory/learnings.md cat .claude/context/memory/decisions.md ```
After completing:
ASSUME INTERRUPTION: Your context may reset. If it's not in memory, it didn't happen.
tools
Comprehensive biosignal processing toolkit for analyzing physiological data including ECG, EEG, EDA, RSP, PPG, EMG, and EOG signals. Use this skill when processing cardiovascular signals, brain activity, electrodermal responses, respiratory patterns, muscle activity, or eye movements. Applicable for heart rate variability analysis, event-related potentials, complexity measures, autonomic nervous system assessment, psychophysiology research, and multi-modal physiological signal integration.
tools
Comprehensive toolkit for creating, analyzing, and visualizing complex networks and graphs in Python. Use when working with network/graph data structures, analyzing relationships between entities, computing graph algorithms (shortest paths, centrality, clustering), detecting communities, generating synthetic networks, or visualizing network topologies. Applicable to social networks, biological networks, transportation systems, citation networks, and any domain involving pairwise relationships.
data-ai
Molecular featurization for ML (100+ featurizers). ECFP, MACCS, descriptors, pretrained models (ChemBERTa), convert SMILES to features, for QSAR and molecular ML.
development
Run Python code in the cloud with serverless containers, GPUs, and autoscaling. Use when deploying ML models, running batch processing jobs, scheduling compute-intensive tasks, or serving APIs that require GPU acceleration or dynamic scaling.