| name | self-heal |
| description | Diagnose and fix problems in {{portalName}}'s configuration and runtime |
Self-Heal Skill
Trigger
This skill activates when {{portalName}} is experiencing issues, errors, or unexpected behavior. It also activates when the user asks to diagnose problems, check system health, or fix something that is not working.
Diagnostic Steps
Work through these checks in order. Stop and fix issues as you find them.
1. Check Gateway Logs
Read ~/.jinn/logs/gateway.log and look for:
- Error messages or stack traces
- Repeated failures or crash loops
- Connection refused or timeout errors
- Out of memory warnings
- Unhandled promise rejections
Summarize any problems found to the user.
2. Validate Configuration
Read ~/.jinn/config.yaml and verify:
- The file is valid YAML (no syntax errors)
- The
gateway.port field is a valid number (default 7777)
- Required sections are present:
gateway (with port) and engines (with a default and a config block for that engine)
engines.default is one of: claude, codex, antigravity
- The default engine has a model set under
engines.<name>.model (e.g. engines.claude.model)
- No duplicate keys or malformed values
3. Verify Engine Availability
Check that the configured AI engine is installed and accessible:
- For Claude: run
claude --version and confirm it returns a version number
- For Codex: run
codex --version and confirm it returns a version number
- For Antigravity (Gemini models): confirm the configured
engines.antigravity.bin is on the PATH
If the engine command is not found, inform the user that the engine is not installed or not on their PATH.
4. Check Session Database
Look at the session registry for stuck sessions:
- Read the session registry at
~/.jinn/sessions/registry.db (SQLite)
- Look for sessions with status
running that have not been updated recently (more than 30 minutes old)
- These may be stuck and need to be reset
5. Check Disk and Temp Files
- Check if
~/.jinn/tmp/ contains stale files that should be cleaned up
- Large or numerous temp files can cause issues
Common Fixes
Restart Gateway
If the gateway appears to be in a bad state (crash loops, unresponsive, port conflicts):
Tell the user to run:
jinn stop && jinn start
Clear Temp Directory
If temp files are stale or causing issues:
Delete all contents of ~/.jinn/tmp/ but keep the directory itself.
Fix Malformed JSON
If any JSON file (board.json, jobs.json, etc.) is malformed:
- Read the raw file content.
- Attempt to identify the syntax error (missing comma, bracket, quote).
- Fix the error and parse to verify.
- Write the corrected JSON back to the file.
- If the file is unrecoverable, back it up as
<filename>.bak and create a fresh default (empty array [] for boards and job files).
Fix Malformed YAML
If any YAML file (config.yaml, employee personas) is malformed:
- Read the raw file content.
- Attempt to identify the syntax error (indentation, missing colon, bad quoting).
- Fix the error and validate.
- Write the corrected YAML back to the file.
- If unrecoverable, back it up and inform the user what fields need to be re-entered.
Reset Stuck Sessions
If sessions are stuck in running status:
- Identify the stuck sessions (running for more than 30 minutes with no updates).
- Update their status to
failed or cancelled in the session registry.
- Report which sessions were reset.
Fix Port Conflicts
If the gateway cannot bind to its configured port:
- Check if another process is using the port:
lsof -i :<port>
- If another {{portalName}} instance is running, tell the user to stop it first.
- If a different process is using the port, suggest changing the port in
config.yaml.
Reference
For understanding {{portalName}}'s architecture and component relationships, refer to the documentation in ~/.jinn/docs/ if available.
Error Handling
- If log files do not exist, note that logging may not be configured and skip that check.
- If config.yaml does not exist, this is likely a fresh install - suggest running the onboarding process instead.
- Always back up files before modifying them during repair.
- Report all findings clearly to the user, even if no issues are found (a clean bill of health is useful information).