agentleFS
happycapy-aihappycapy-ai/Happycapy-skills/skills/capy-cortex/SKILL.md

capy-cortex

Skill137 starsChanged 6 months agoMITView on GitHub

Autonomous learning system - learns from mistakes, reflects on sessions, and gets smarter over time. The AI brain.

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Stop: Extracts corrections and preferences from conversation

    line 19

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Capy Cortex - Autonomous Learning System

You have a persistent learning brain powered by SQLite + FTS5 + sklearn TF-IDF. Knowledge is automatically loaded via hooks. This file describes manual operations.

Architecture

  • Database: ~/.claude/skills/capy-cortex/cortex.db (SQLite + FTS5 + WAL)
  • Hooks (automatic, never call manually):
    • SessionStart: Loads anti-patterns, preferences, principles
    • UserPromptSubmit: Retrieves task-relevant rules via FTS5
    • PreToolUse(Bash): Blocks known dangerous commands
    • PostToolUseFailure: Records errors as anti-patterns
    • Stop: Extracts corrections and preferences from conversation
  • Scripts (for manual/scheduled use):
    • cortex.py: Core engine (retrieve, add rules, stats)
    • reflect.py: Deep session analysis
    • consolidate.py: Cluster rules into principles (sklearn)
    • bootstrap.py: Mine historical sessions

Manual Commands

# Check system health
python3 ~/.claude/skills/capy-cortex/scripts/cortex.py stats

# Retrieve rules for a topic
python3 ~/.claude/skills/capy-cortex/scripts/cortex.py retrieve "react typescript"

# Add a rule manually
python3 ~/.claude/skills/capy-cortex/scripts/cortex.py add-rule "Always use TypeScript strict mode" "best_practice"

# Add an anti-pattern
python3 ~/.claude/skills/capy-cortex/scripts/cortex.py add-ap "Never force push to main" "critical"

# Add a preference
python3 ~/.claude/skills/capy-cortex/scripts/cortex.py add-pref "User prefers functional components over class components"

# Run consolidation (clusters rules into principles)
python3 ~/.claude/skills/capy-cortex/scripts/consolidate.py

# Retrain TF-IDF model
python3 ~/.claude/skills/capy-cortex/scripts/cortex.py retrain

# Apply confidence decay
python3 ~/.claude/skills/capy-cortex/scripts/cortex.py decay

How It Learns

  1. Automatic (via hooks): Errors are captured, corrections noted, preferences extracted
  2. Reflection: Deep analysis of session transcripts extracts patterns
  3. Consolidation: sklearn clustering groups similar rules into principles
  4. Decay: Old, unreinforced rules fade; validated rules strengthen
  5. Retrieval: Two-stage FTS5 + TF-IDF returns only relevant knowledge (O(1) context)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

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.