Power Steering Troubleshooting¶
Ahoy! This guide helps ye fix common power steering issues, particularly the infinite loop bug that was plaguing the system.
Quick Diagnosis¶
If power steering seems stuck or repeatin' messages, run the diagnostic command:
This checks yer power steering state health and shows:
- Current counter values
- Session ID consistency
- State file integrity
- Recent save/load operations
Common Issues¶
Issue: Counter Not Incrementing (Infinite Loop)¶
Symptoms:
- Same guidance message appears repeatedly
- Power steering never stops after first display
- State counter stays at 0 or doesn't increment
Cause: State persistence failures due to cloud sync conflicts, atomic write issues, or file system problems.
Solution (Fixed in v0.9.1+):
The fix includes:
- Atomic writes with fsync: Forces disk writes to complete
- Retry logic: Handles cloud sync delays automatically
- Verification reads: Confirms state was saved correctly
- Defensive validation: Catches corrupted state data
Check your version:
If ye're on v0.9.0 or earlier, upgrade:
Issue: State File Corruption¶
Symptoms:
- Power steering crashes with validation errors
- Diagnostic shows "invalid state" warnings
- Counter resets unexpectedly
Diagnosis:
Look fer:
save_success: false- Write failuresload_success: false- Read failuresvalidation_failed: true- Corrupted data
Solution:
The fix automatically handles corrupted state:
- Detects invalid counter values (negative or null)
- Logs corruption event to diagnostics
- Resets to safe default state
- Continues operation without crashing
Manual reset (if needed):
Power steering will create fresh state on next run.
Issue: Messages Not Customized¶
Symptoms:
- Generic messages appear instead of context-specific guidance
- Check results not reflected in guidance text
- All messages look identical
Cause (Pre-v0.9.1): Message customization logic wasn't properly integrated with check results.
Solution (Fixed):
The fix ensures:
- Check results are captured accurately
- Messages are customized based on actual check outcomes
- Context-specific guidance appears at the right time
Verify the fix: Trigger power steering in different contexts and observe message variations based on:
- File modification status
- Workflow compliance
- Quality check results
Diagnostic Logs¶
Understanding Diagnostic Output¶
Diagnostic logs be written to .claude/runtime/power-steering/{session_id}/diagnostic.jsonl with this structure:
{
"timestamp": "2025-12-17T19:30:00Z",
"operation": "state_save",
"counter_before": 0,
"counter_after": 1,
"session_id": "20251217_193000",
"file_path": ".claude/runtime/power-steering/20251217_193000/state.json",
"save_success": true,
"verification_success": true,
"retry_count": 0
}
Key fields:
operation: What happened (state_save, state_load, validation)counter_before/after: Track counter changessave_success: Whether write completedverification_success: Whether verification read workedretry_count: How many retries were needed
Common Log Patterns¶
Healthy operation:
{"operation": "state_save", "save_success": true, "verification_success": true, "retry_count": 0}
{"operation": "state_load", "load_success": true, "validation_passed": true}
Cloud sync retry (normal):
Corruption detected:
{"operation": "state_load", "load_success": true, "validation_failed": true, "reason": "negative_counter"}
{"operation": "state_reset", "counter_reset_to": 0}
Manual Recovery¶
If automatic recovery doesn't work:
Step 1: Stop Claude Code¶
Exit yer current session to prevent concurrent writes.
Step 2: Clear State¶
Step 3: Restart¶
Start a fresh Claude Code session. Power steering will initialize cleanly.
Step 4: Verify¶
Should show fresh state with counter at 0.
Prevention¶
The fix includes prevention measures, but ye can help:
- Avoid concurrent sessions: Don't run multiple Claude Code instances in the same repo
- Wait fer cloud sync: If usin' Dropbox/iCloud, let files sync before starting
- Keep updated: Always run latest amplihack version
- Check diagnostics periodically: Run
/amplihack:ps-diagnoseto catch issues early
Getting Help¶
If issues persist after these steps:
- Capture diagnostic output:
- Gather logs:
- Create a GitHub issue with:
- amplihack version (
amplihack --version) - Diagnostic output
- Compressed logs
- Description of the problem
Repository: https://github.com/rysweet/MicrosoftHackathon2025-AgenticCoding/issues
Related Documentation¶
- Power Steering Overview - What power steering does
- Architecture - How the system works
- Configuration - Customization options