Instinct-based learning system that observes sessions via hooks, creates atomic instincts with confidence scoring, and evolves them into skills/commands/agents.
40
40%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Advisory
Suggest reviewing before use
A background agent that analyzes observations from Claude Code sessions to detect patterns and create instincts.
/analyze-patternsReads observations from ~/.claude/homunculus/observations.jsonl:
{"timestamp":"2025-01-22T10:30:00Z","event":"tool_start","session":"abc123","tool":"Edit","input":"..."}
{"timestamp":"2025-01-22T10:30:01Z","event":"tool_complete","session":"abc123","tool":"Edit","output":"..."}
{"timestamp":"2025-01-22T10:30:05Z","event":"tool_start","session":"abc123","tool":"Bash","input":"npm test"}
{"timestamp":"2025-01-22T10:30:10Z","event":"tool_complete","session":"abc123","tool":"Bash","output":"All tests pass"}Look for these patterns in observations:
When a user's follow-up message corrects Claude's previous action:
→ Create instinct: "When doing X, prefer Y"
When an error is followed by a fix:
→ Create instinct: "When encountering error X, try Y"
When the same sequence of tools is used multiple times:
→ Create workflow instinct: "When doing X, follow steps Y, Z, W"
When certain tools are consistently preferred:
→ Create instinct: "When needing X, use tool Y"
Creates/updates instincts in ~/.claude/homunculus/instincts/personal/:
---
id: prefer-grep-before-edit
trigger: "when searching for code to modify"
confidence: 0.65
domain: "workflow"
source: "session-observation"
---
# Prefer Grep Before Edit
## Action
Always use Grep to find the exact location before using Edit.
## Evidence
- Observed 8 times in session abc123
- Pattern: Grep → Read → Edit sequence
- Last observed: 2025-01-22Initial confidence based on observation frequency:
Confidence adjusts over time:
Given observations:
{"event":"tool_start","tool":"Grep","input":"pattern: useState"}
{"event":"tool_complete","tool":"Grep","output":"Found in 3 files"}
{"event":"tool_start","tool":"Read","input":"src/hooks/useAuth.ts"}
{"event":"tool_complete","tool":"Read","output":"[file content]"}
{"event":"tool_start","tool":"Edit","input":"src/hooks/useAuth.ts..."}Analysis:
When instincts are imported from Skill Creator (repo analysis), they have:
source: "repo-analysis"source_repo: "https://github.com/..."These should be treated as team/project conventions with higher initial confidence (0.7+).