Update "lessons%2Fpatterns%2Fsprint-4---new-commands-not-discoverable-until-session-restart.-"

2026-01-28 20:52:03 +00:00
parent 6036d85ff0
commit c5b2103598

@@ -1,4 +1,4 @@
# Sprint 4 - New Commands Not Discoverable Until Session Restart # Sprint 4 - New Commands Not Discoverable Until Cache Clear
## Context ## Context
@@ -15,57 +15,68 @@ Investigation showed:
- File exists at `~/.claude/plugins/marketplaces/.../commands/sprint-diagram.md` - File exists at `~/.claude/plugins/marketplaces/.../commands/sprint-diagram.md`
- YAML frontmatter is correct (identical to working commands) - YAML frontmatter is correct (identical to working commands)
- Other commands (`/sprint-status`, `/sprint-plan`) work fine - Other commands (`/sprint-status`, `/sprint-plan`) work fine
- **Session restart did NOT fix the issue**
## Root Cause ## Root Cause
**Claude Code discovers skills at session start.** Commands added to the installed location DURING a session are NOT discoverable until the session is restarted. **Claude Code caches plugin files at `~/.claude/plugins/cache/`.**
File timestamps revealed: The cache was created on Jan 27 14:58 - BEFORE sprint-diagram was added. Claude Code uses this cached version instead of the installed files, even after session restart.
| File | Modified | Status |
|------|----------|--------|
| sprint-diagram.md | Jan 28 13:46 (during session) | NOT discoverable |
| sprint-status.md | Jan 28 11:03 (before session) | Works |
The Sprint 4 implementation happened, the command was added, but nobody tested it in a NEW session. ```
~/.claude/plugins/cache/leo-claude-mktplace/projman/3.2.0/commands/
├── sprint-status.md ✓ (in cache)
├── sprint-plan.md ✓ (in cache)
├── sprint-close.md ✓ (in cache)
└── sprint-diagram.md ✗ (NOT in cache - added after cache created)
```
**Key insight:** Session restart alone does NOT refresh the cache. The cache persists across sessions.
## Solution ## Solution
1. **Immediate fix**: Restart Claude Code session - new skills will be discovered 1. **Clear the plugin cache:**
2. **No code changes needed** - the command file is correct ```bash
rm -rf ~/.claude/plugins/cache/leo-claude-mktplace/
```
2. **Restart Claude Code** - cache will be rebuilt from installed files
3. **Verify command works:**
```
/sprint-diagram
```
## Prevention ## Prevention
**Add verification checkpoint to sprint-close workflow:** **Add to sprint-close workflow:**
1. **Before marking sprint complete**, if sprint added new commands: 1. If sprint added new commands:
- Document which commands were added - Document which commands were added
- Note: "Verification requires session restart" - **Clear cache before testing:** `rm -rf ~/.claude/plugins/cache/<marketplace>/`
- Create follow-up task: "Verify new commands after restart" - Restart session
2. **After session restart** (next session):
- Test each new command - Test each new command
- Only THEN mark sprint truly verified - Only THEN mark sprint verified
3. **Update sprint-close.md** to include: 2. **Update post-update.sh script** to include cache clearing option
```markdown
## New Command Verification
If this sprint added new commands: 3. **Add to CLAUDE.md mandatory rules:**
1. List new commands in sprint close notes ```
2. Remind user: "New commands require session restart to test" AFTER PLUGIN UPDATES - CLEAR CACHE AND RESTART
3. Create verification task for next session rm -rf ~/.claude/plugins/cache/leo-claude-mktplace/
# Then restart Claude Code
``` ```
## Impact ## Impact
- Hours spent debugging a non-bug - Multiple session restarts didn't fix the issue
- User frustration ("spending hours developing something and find out that was never done properly") - Hours spent debugging
- Sprint 4 marked complete without proper verification - User frustration
- Initial lesson learned was incorrect (said "session restart" when actual fix is "cache clear")
## Tags ## Tags
`verification`, `skill-discovery`, `session-cache`, `workflow-gap`, `sprint-4` `cache`, `skill-discovery`, `plugin-cache`, `workflow-gap`, `sprint-4`, `projman`, `commands`, `debugging`
--- ---
**Tags:** verification, skill-discovery, session-cache, workflow-gap, sprint-4, projman, commands **Tags:** cache, skill-discovery, plugin-cache, workflow-gap, sprint-4, projman, commands, debugging