Script-Backed Fallback for Prompt-Layer File Checks¶
Problem¶
/vt-v-start SKILL.md instructed Claude to check for .cwp-checkpoint.yaml before running
start_scanner.py. If the checkpoint existed, Claude was supposed to show a P0 resume banner.
The script had no awareness of the checkpoint. This meant: - The check depended entirely on Claude following the SKILL.md instruction correctly - Any variation in prompt execution caused checkpoint detection to silently fail - Users would see no P0 banner and miss in-progress CWP resume cues
Solution¶
Add scan_checkpoint(repo_root) to start_scanner.py:
def scan_checkpoint(repo_root: Path) -> Optional[dict]:
"""Read .cwp-checkpoint.yaml if present — enables P0 resume detection in the script."""
checkpoint_file = repo_root / '.cwp-checkpoint.yaml'
if not checkpoint_file.exists():
return None
try:
data = yaml.safe_load(checkpoint_file.read_text(encoding='utf-8'))
return data if isinstance(data, dict) else None
except (yaml.YAMLError, OSError):
return None
Wire through compute_priority() as a new optional parameter:
def compute_priority(..., checkpoint: Optional[dict] = None) -> dict:
# P0: Resume checkpoint (highest — before git branch P0)
if checkpoint:
actions.append({'priority': 'P0', 'label': 'Resume ...', ...})
# P0: In-flight git branch
...
The checkpoint banner also renders in format_markdown() before the status table.
Pattern: Script-Backed Prompt Fallback¶
For any "if file exists, show as high priority" instruction in SKILL.md prompts:
- Back it with a script function that reads the file and returns structured data
- Thread the data through the main processing function (priority, formatting)
- Keep the SKILL.md instruction for context and documentation — but it becomes a user-facing explanation, not the sole enforcement mechanism
This ensures the behavior is reproducible even when prompt execution is imperfect.
Prevention¶
Whenever a SKILL.md says "before running the script, check for X" — that check should also exist inside the script. The rule of thumb:
If losing the prompt instruction would silently break a key UX behavior, the behavior must also be implemented in the script.