Self Repair
This skill enables crocbot to safely repair and refactor its own codebase using Claude Code (claude) as a high-thinking-budget sub-agent.
Overview
Self-repair uses a specialized command configuration to ensure Claude Code operates with maximum analytical depth and bypasses routine permission prompts to maintain momentum during autonomous sessions.
Workspace Awareness
The sub-agent is aware of two critical paths:
- •Source Code:
{projectRoot}(where repairs/exploration happen) - •Identity Workspace:
{workspaceDir}(where research, reports, and persistent documentation are stored)
Workflow
1. Launching a Repair or Research Session
Always use the following command structure. Replace <instructions> with the specific task.
# Launch Claude Code with high thinking budget and identity workspace awareness
# Always use pty:true and background:true for autonomous work
bash pty:true workdir:{projectRoot} background:true command:"claude -p 'Use maximum thinking budget for this prompt and make sure you output a detailed summary end of response. You have permission to write files directly to my identity workspace at {workspaceDir}/ for reporting or research purposes. Instructions: <instructions>' --dangerously-skip-permissions"
2. Full Lifecycle (Repair, Build, Redeploy)
When a sub-agent is tasked with modifying the code, it must follow this completion sequence:
- •Modify Code: Apply the requested fixes/refactors.
- •Build: Run
pnpm buildto ensure the changes are valid and compiled. - •Redeploy: Once the build succeeds, it must restart the gateway service:
bash
systemctl --user restart crocbot-gateway
- •Continuity: The sub-agent should understand that restarting the gateway will terminate its parent session. It should finalize its report/summary BEFORE the restart command.
2. Monitoring Progress
Once the session is launched, monitor the output using the process tool:
# Check logs process action:log sessionId:XXX # Check if finished process action:poll sessionId:XXX
3. Verification
Once the sub-agent completes the task, review the summary provided by Claude Code to verify the changes.
Safety Rules
- •Targeted Scope: Always set the
workdirto{projectRoot}. - •Deduplication: Before starting a new repair session, check
process action:listto ensure a similar session isn't already running. - •Reporting: Always provide the user with the final "detailed summary" generated by Claude Code.