anthropics / anthropics/claude-code
Invoked skill not re-attached after manual /compact; only the summary's paraphrase survives
- Dominant language
- Python
- Stars
- 145k
- Forks
- 23.1k
- PR merge metrics
- PR metrics pending
Description
## Summary
The skills docs say compaction re-attaches the most recent invocation of each skill after the summary (first 5,000 tokens each, 25,000 combined). In my session that did not happen after a manual `/compact`. The only trace of the skill that survived was the compaction summary's paraphrase of it, and the paraphrase lost a detail that mattered.
## Environment
- Claude Code 2.1.270, macOS, model claude-fable-5-1
- Session running as a Claude Code background job
- One project skill, `.claude/skills//SKILL.md`, 5,279 bytes (about 1,300 tokens), invoked by me as a slash command at the start of the session
## What happened
1. I invoked the skill. It ran a long code walkthrough for a few hours.
2. I ran `/compact` (transcript metadata: trigger "manual", preTokens 213,828, postTokens 8,106).
3. After the summary, no `invoked_skills` block or skill content was present. The transcript has no such block at any point after the compaction boundary.
4. The model continued from the summary's paraphrase of the skill. The skill says to use "a background subagent" for silent file writes. The paraphrase said "background subagents". The model then spawned a new subagent for every write and ended the session with ten idle ones.
## Expected
Per https://code.claude.com/docs/en/skills ("Auto-compaction carries invoked skills forward within a token budget"), the skill should have been re-attached after the summary. The skill is small and was the only one invoked, so the budget was not a factor.
## Questions and suggestions
- Is re-attach meant to apply to manual `/compact` as well as auto-compaction? The doc sentence names only auto-compaction. If manual is excluded on purpose, the doc could say so.
- Does session kind matter? This was a background job session.
- Whatever the cause, a skill the user invoked is standing instruction for the session, like CLAUDE.md. A summary's paraphrase is not a safe substitute. If re-attaching the body is unwanted in some modes, at least listing the active skills by path in the summary so the model can re-read them would avoid this class of drift.
Related: #82144, #83306, #85138 (all about how replay behaves once it happens), #74990 (catalog reminder dropped after compaction).
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the skills documentation and the manual `/compact` entry point, then reproduce the reported behavior using a project skill at `.claude/skills//SKILL.md` in a background job session. Compare the transcript before and after the compaction boundary, including whether an `invoked_skills` block appears. Done means the documented behavior is restored or the manual/background-session limitation is clearly documented and covered by an appropriate regression check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100