auto-learning
Skill0 starsChanged 5 months agoMITView on GitHub
Instinct-based learning system that observes sessions via hooks and evolves patterns into skills/commands/agents. Use when the user asks about learned instincts, wants to analyze session patterns, sets up auto-learning or observation hooks, or runs /idev:instinct-status, /idev:instinct-export, /idev:instinct-import, or /idev:evolve.
In this repository38 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- api-contract-validationSkill
- architecture-scannerSkill
- auto-approve-policySkill
- backend-patternsSkill
- branch-syncSkill
- browser-testSkill
- browseSkill
- build-checkSkill
- cache-refreshSkill
- codebase-explainerSkill
- coding-standardsSkill
- commit-styleSkill
- context-switchingSkill
- continuous-learningSkill
- db-preflightSkill
- env-preflightSkill
- eval-harnessSkill
- feature-completenessSkill
- file-indexSkill
- frontend-patternsSkill
- function-extractSkill
- idev-initSkill
- import-graphSkill
- lessons-learnedSkill
- post-creation-verifySkill
- pre-ship-verifySkill
- project-mapSkill
- self-reviewSkill
- session-resumeSkill
- skill-benchmarkSkill
- skilloptSkill
- smart-contextSkill
- strategic-compactSkill
- task-journalSkill
- tdd-workflowSkill
- test-coverageSkill
- test-mapSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 108
Run it directly with:
- Distinctive: line 201
Confidence increases: when a pattern is repeatedly observed, the user doesn't correct the behavior, or similar instincts from other sources …
- Very specific: line 203
Confidence decreases: when the user explicitly corrects the behavior, the pattern isn't observed for extended periods (see …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Auto-Learning - Instinct-Based Architecture
A learning system that turns Claude Code sessions into reusable knowledge through atomic "instincts" - small learned behaviors with confidence scoring.
The Instinct Model
An instinct is a small learned behavior:
---
id: prefer-functional-style
trigger: "when writing new functions"
confidence: 0.7
domain: "code-style"
source: "session-observation"
---
# Prefer Functional Style
## Action
Use functional patterns over classes when appropriate.
## Evidence
- Observed 5 instances of functional pattern preference
- User corrected class-based approach to functional on 2025-01-15Properties:
- Atomic — one trigger, one action
- Confidence-weighted — 0.3 = tentative, 0.9 = near certain
- Domain-tagged — code-style, testing, git, debugging, workflow, etc.
- Evidence-backed — tracks what observations created it
How It Works
Session Activity
│
│ PreToolUse/PostToolUse hooks (observe.sh → observe.py)
▼
┌─────────────────────────────────────────┐
│ observations.jsonl │
│ (tool calls + outcomes, redacted) │
└─────────────────────────────────────────┘
│
│ Observer loop (start-observer.sh, headless Haiku)
▼
┌─────────────────────────────────────────┐
│ instincts/personal/ │
│ atomic instincts with confidence │
└─────────────────────────────────────────┘
│
│ /idev:evolve clusters
▼
┌─────────────────────────────────────────┐
│ evolved/ │
│ skills / commands / agents │
└─────────────────────────────────────────┘Quick Start
1. Enable Observation (opt-in)
The observation hooks are pre-registered by the plugin's hooks/hooks.json (PreToolUse/PostToolUse, all tools) but off by default — observe.sh exits instantly unless the global opt-in flag ~/.claude/homunculus/enabled exists. Enable with:
/idev:hooks enable observerDisable with /idev:hooks disable observer. No settings.json editing, takes effect immediately, and the toggle is global (observations span all projects).
observe.sh is a thin wrapper that pipes the hook JSON to observe.py (the canonical implementation). The pre/post argument tells it the hook phase; if omitted, it falls back to the hook_event_name field in the payload. The hook truncates inputs/outputs at 5000 chars, redacts secret-looking values, honors capture_tools/ignore_tools from config.json, and rotates observations.jsonl into observations.archive/ past max_file_size_mb.
2. Initialize Directory Structure
mkdir -p ~/.claude/homunculus/{instincts/{personal,inherited},evolved/{agents,skills,commands}}
touch ~/.claude/homunculus/observations.jsonl3. Run the Observer Agent (Optional)
The observer runs in the background, analyzing observations every 5 minutes (and on SIGUSR1 from the hook). It only archives observations after a successful analysis that produced an instinct:
"${CLAUDE_PLUGIN_ROOT}/skills/auto-learning/agents/start-observer.sh" # start
"${CLAUDE_PLUGIN_ROOT}/skills/auto-learning/agents/start-observer.sh" status # check
"${CLAUDE_PLUGIN_ROOT}/skills/auto-learning/agents/start-observer.sh" stop # stopCLI and Commands
scripts/instinct-cli.py manages the instinct store. Four plugin commands wrap it:
| Command | CLI invocation | Description |
/idev:instinct-status | instinct-cli.py status | Show all instincts with confidence, by domain |
/idev:instinct-export | instinct-cli.py export [--domain] [--min-confidence] [--output] | Export sanitized instincts for sharing |
/idev:instinct-import | instinct-cli.py import <file-or-url> [--dry-run] [--force] [--min-confidence] | Import instincts; updates existing ids in place |
/idev:evolve | instinct-cli.py evolve [--generate] | Print instinct clusters; Claude writes the evolved files |
Run it directly with:
python3 "${CLAUDE_PLUGIN_ROOT}/skills/auto-learning/scripts/instinct-cli.py" statusConfiguration
config.json (in this skill's directory) is the source of truth:
{
"version": "2.0",
"observation": {
"enabled": true,
"store_path": "~/.claude/homunculus/observations.jsonl",
"max_file_size_mb": 10,
"archive_after_days": 7,
"capture_tools": ["Edit", "Write", "Bash", "Read", "Grep", "Glob"],
"ignore_tools": ["TodoWrite"]
},
"instincts": {
"personal_path": "~/.claude/homunculus/instincts/personal/",
"inherited_path": "~/.claude/homunculus/instincts/inherited/",
"min_confidence": 0.3,
"auto_approve_threshold": 0.7,
"confidence_decay_rate": 0.02,
"max_instincts": 100
},
"observer": {
"enabled": false,
"model": "haiku",
"run_interval_minutes": 5,
"min_observations_to_analyze": 20,
"patterns_to_detect": [
"user_corrections",
"error_resolutions",
"repeated_workflows",
"tool_preferences",
"file_patterns"
]
},
"evolution": {
"cluster_threshold": 3,
"evolved_path": "~/.claude/homunculus/evolved/",
"auto_evolve": false
}
}Field reference:
observation.enabled— master switch for the observation hook (falsedisables capture)observation.capture_tools— if non-empty, ONLY these tools are observedobservation.ignore_tools— tools never observed (checked before capture_tools)observation.max_file_size_mb— observations.jsonl rotates to the archive past this sizeobservation.archive_after_days— retention hint for archived observationsinstincts.min_confidence— floor for keeping an instinctinstincts.auto_approve_threshold— confidence at which an instinct applies without askinginstincts.confidence_decay_rate— weekly decay when a pattern stops being observedinstincts.max_instincts— cap on the instinct store; prune lowest-confidence firstobserver.enabled— whether the background observer should runobserver.min_observations_to_analyze— observations required before an analysis run (read by start-observer.sh)evolution.cluster_threshold— instincts required to form an evolution clusterevolution.auto_evolve— if true, evolution may be proposed without an explicit /idev:evolve
You can also disable capture entirely by creating ~/.claude/homunculus/disabled.
File Structure
~/.claude/homunculus/
├── observations.jsonl # Current session observations
├── observations.archive/ # Rotated + processed observations
├── observer.log # Background observer log
├── instincts/
│ ├── personal/ # Auto-learned instincts
│ └── inherited/ # Imported from others
└── evolved/
├── agents/ # Evolved specialist agents
├── skills/ # Evolved skills
└── commands/ # Evolved commandsConfidence Scoring
| Score | Meaning | Behavior |
| 0.3 | Tentative | Suggested but not enforced |
| 0.5 | Moderate | Applied when relevant |
| 0.7 | Strong | Auto-approved for application |
| 0.9 | Near-certain | Core behavior |
Confidence increases when a pattern is repeatedly observed, the user doesn't correct the behavior, or similar instincts from other sources agree.
Confidence decreases when the user explicitly corrects the behavior, the pattern isn't observed for extended periods (see confidence_decay_rate), or contradicting evidence appears.
Privacy
- Observations stay local on your machine
- The hook redacts secret-looking values (api keys, tokens, passwords) before writing
- Export sanitizes absolute file paths and secrets; only instinct patterns are shared
- You control what gets exported
Architecture inspired by the Homunculus continuous-learning project.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

