Forensic Healing Protocol
Phase 0: Target Acquisition
You MUST first resolve the user's input to a concrete file path:
- Validation: Check if the input is already a valid absolute or relative path.
- Search: If it's a name (e.g., "manage-healing"), use
find_by_nameto locate theSKILL.mdor component definition. - Ambiguity Resolution: If multiple files match, pick the one in
plugins/that matches the component type (Agent, Skill, Command).
Phase 1: Evidence Retrieval (Forensics)
You MUST analyze the "Black Box" of the failure by reading the following state files:
- The Pulse:
.cattoolkit/context/context.log(Find the exact timestamp of the error). - The Memory:
.cattoolkit/context/scratchpad.md(Check the agent's intent vs. its tool usage). - The Guard:
hooks/hooks.json(Verify if a hook intercepted the tool call). - The Manifesto: The failing
SKILL.md,agent.md, orcommand.md.
Phase 2: Diagnosis (Drift Detection)
Compare the Tool Prompt (from context.log) against the Instructions (from the manifesto).
- Hallucination: The model used a tool argument not defined in the skill.
- Interception: A hook returned a
blockstatus that the agent didn't handle. - Instruction Drift: The skill provides an example that is incompatible with the current toolkit version.
Phase 3: The Healing Fix
DO NOT revert files. Update the logic to be more resilient:
- Correct the Example: Update the Markdown code block to show the correct tool signature.
- Harden Constraints: Add a
## Constraintssection with specificMUST NOTinstructions addressing the error. - Path Sanitization: If the error was a "File Not Found," add a "Context Discovery" step to the protocol.
Phase 4: Prevention (Immunization)
Update the component's Description keywords to better match its actual successful triggers, and add a "Troubleshooting" section to the bottom of the component's file documenting this fix.
Reference Assets
- bootstrap-protocol.md: Protocol for initializing healing environment
- Cross-skill standards: Refer to the
toolkit-registryskill’sstandards-communicationreference when you need shared policies. - diagnosis-patterns.md: Common error patterns
- bootstrap.sh: Environment setup script