/loop skill loses skill name after first iteration — 'unknown skill' on repeat

Resolved 💬 3 comments Opened Mar 28, 2026 by chalie-ai Closed Mar 31, 2026

Bug Description

The /loop skill works correctly on the first iteration but fails on all subsequent iterations with the error:

unknown skill: 

Note the empty string after the colon — the skill name that /loop is supposed to re-invoke is lost between iterations.

Steps to Reproduce

  1. Have a custom skill defined in .claude/commands/ (e.g., build.md)
  2. Run /loop 10m /build
  3. First iteration executes /build correctly
  4. After the interval, the next iteration fails with unknown skill:
  5. Every subsequent iteration also fails with the same error

Expected Behavior

Each iteration should invoke the specified skill (/build) with the same behavior as the first iteration.

Likely Cause

After the first iteration completes (especially for long-running skills that produce significant output), context compression appears to drop the loop's internal state — specifically the skill name it needs to re-invoke. The Skill tool then receives an empty string as the skill name.

Workaround

Use a shell loop with the CLI instead of the built-in /loop:

while true; do claude -p "/build" --allowedTools '*'; sleep 600; done

Each invocation gets a fresh context, avoiding the state loss.

Environment

  • Claude Code CLI (latest)
  • macOS (Darwin 25.3.0)
  • Custom skills in .claude/commands/

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗