C:/Program Files/Git/compact slash command not available in in-process agent team teammates
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
When using agent teams (CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1), typing /compact in an in-process teammate's chat window does not trigger compaction. Instead, the agent interprets it as a regular text message and writes a summary as conversational output — no actual compaction occurs.
Auto-compaction (at the configured threshold) works correctly in teammates. Only manual /compact is affected.
Expected Behavior
/compact should trigger actual context compaction in teammate sessions, same as it does in the main orchestrator session. This is important for managing token costs in long-running team sessions with 1M context windows.
Steps to Reproduce
- Start Claude Code with
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - Create a team and spawn a teammate
- Focus on the teammate's chat
- Type
/compact - Observe: the agent writes a summary as text output instead of compacting
Analysis (from reading the bundled source)
Looking at cli.js in the npm package, it appears that in-process agent sessions are initialized with commands: [] (empty array), which excludes all slash commands including /compact.
Auto-compaction works because it runs in the main generation loop independently of the commands array. Manual /compact doesn't work because the command isn't registered in the agent's session.
The compact command itself has no agent-specific gate — its only check is !DISABLE_COMPACT. The limitation comes from the empty commands array passed during agent session setup.
Environment
- Claude Code v2.1.76 (native installer, Windows)
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1- In-process teammate mode (not tmux)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗