-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Summary
After installing the Superpowers plugin, all skills appear to be fully loaded at session startup rather than using progressive disclosure, consuming ~22k tokens (11% of the 200k context window) immediately. This contradicts both the Anthropic documentation on
progressive skill loading and creates unnecessary context pressure.
## Environment
- **Claude Code Version**: Latest (claude-sonnet-4-5-20250929)
- **Superpowers Version**: 4.0.3
- **Platform**: macOS (Darwin 24.6.0)
- **Installation Method**: Plugin marketplace
## Expected Behavior
Based on [Anthropic's Agent Skills documentation](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview.md), skills should follow a three-phase progressive disclosure model:
1. **Discovery (Startup)**: Only frontmatter (name + description) loaded (~100 tokens per skill)
2. **Activation (On-demand)**: Full SKILL.md loaded when skill is triggered
3. **Execution (As-needed)**: Supporting files loaded when referenced
**Expected startup cost**: ~1,400 tokens (14 skills × 100 tokens for metadata)
## Actual Behavior
All Superpowers skills are fully loaded at startup with complete SKILL.md content:
```
writing-skills: 5.6k tokens
test-driven-development: 2.4k tokens
systematic-debugging: 2.4k tokens
subagent-driven-development: 2.4k tokens
receiving-code-review: 1.5k tokens
dispatching-parallel-agents: 1.5k tokens
using-git-worktrees: 1.3k tokens
finishing-a-development-branch: 993 tokens
verification-before-completion: 966 tokens
using-superpowers: 896 tokens
writing-plans: 785 tokens
requesting-code-review: 636 tokens
brainstorming: 566 tokens
executing-plans: 506 tokens
──────────────────────────────────────────
Total: ~22k tokens
```
**Actual startup cost**: ~22k tokens (15.7x more than expected)
## Evidence
### Mathematical Proof
From `/context` command output at session start:
```
Total context usage: 82,000 tokens
Known components:
- System prompt: 3,500 tokens
- System tools: 17,400 tokens
- Custom agents: 15 tokens
- Memory files: 30 tokens
- Messages: 1,200 tokens
─────────────────────────────────────
Subtotal: 22,145 tokens
Unexplained gap: 59,855 tokens
Skills total size: 22,448 tokens (37.5% of gap)
```
The 22k token gap matches the sum of all SKILL.md file sizes, confirming full content is loaded.
### File Size Verification
```bash
# writing-skills SKILL.md
wc -c ~/.claude/plugins/cache/superpowers-marketplace/superpowers/4.0.3/skills/writing-skills/SKILL.md
22463 bytes → ~5.6k tokens ✓
# test-driven-development SKILL.md
wc -c ~/.claude/plugins/cache/superpowers-marketplace/superpowers/4.0.3/skills/test-driven-development/SKILL.md
9867 bytes → ~2.4k tokens ✓
```
Token counts in `/context` exactly match full SKILL.md file sizes.
### Session Start Hook Review
Examined `hooks/session-start.sh` - it only injects `using-superpowers` content directly:
```bash
using_superpowers_content=$(cat "${PLUGIN_ROOT}/skills/using-superpowers/SKILL.md")
```
This explains `using-superpowers` (896 tokens), but the other 21k tokens suggest all skills are registered elsewhere in the Skill tool definition.
## Impact
### Current Impact
- **11% baseline context usage** before any actual work
- **133k → 111k effective context** after subtracting preloaded skills
- **Reduced headroom** for complex conversations requiring deep context
### At Scale
- Each additional skill costs its full SKILL.md size in baseline context
- Users with custom skills face multiplicative context pressure
- Long conversations compact sooner due to reduced effective context
## Questions
1. **Is this intentional?** Does Superpowers deliberately preload all skills for reliability/performance?
2. **Where does this happen?** Where in the codebase are skills registered with their full content?
3. **Can it be optimized?** Could we defer full loading until skill activation?
4. **Is there configuration?** Can users control which skills preload vs. lazy-load?
## Potential Solutions
### Option 1: True Progressive Disclosure
- Register only metadata in Skill tool definition at startup
- Load full SKILL.md on first invocation (current documented behavior)
- **Savings**: 20.6k tokens (from 22k → 1.4k)
### Option 2: Tiered Loading
- Core skills (brainstorming, TDD, debugging): Preload
- Specialized skills (git-worktrees, finishing-branch): Lazy-load
- **Savings**: ~10-15k tokens
### Option 3: User Configuration
- Add `.claude-plugin/config.json` with `preloadSkills: []` array
- Let users choose which skills warrant preloading
- **Savings**: Varies by user preference
## Additional Context
### Related Issues
- #87 discusses token optimization in plan generation
- This issue focuses on baseline/startup token consumption
### Workarounds Attempted
- Reviewed plugin configuration (no relevant settings found)
- Checked for cache issues (skills consistently preloaded)
- Investigated progressive disclosure documentation (behavior doesn't match)
### Test Case
To reproduce, run immediately after installing Superpowers:
```bash
# Start fresh session
claude
# Check context usage before any skill invocation
/context
```
You'll see all skills showing their full SKILL.md token counts, not metadata-only counts.
---
**Note**: This analysis was done with a clean Superpowers installation from the plugin marketplace. The issue is consistently reproducible across fresh sessions.
coderabbitai
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working