Claude Code MIT Python ChromaDB 10 Hooks
cortex

The first Claude Code plugin where agents write their own agents and skills auto-generate from your tech stack. Persistent vector memory, 10-hook lifecycle, self-managing agent fleets, and auto-skill discovery.

10
Hook Events
13
Hook Scripts
50+
Frameworks
6
MCP Tools
4
MCP Resources
View on GitHub Installation Guide
๐Ÿง 

Smart Recall with Keyword Boost

First message loads all project memories with progressive disclosure (250-char summaries). "Remember" queries get boosted thresholds (0.75-0.85) and more results.

๐Ÿค–

Self-Managing Agents

Agents are bootstrapped from cortex knowledge, evaluated on usage, updated with new insights, and retired when obsolete. Full lifecycle.

๐Ÿ“š

Auto-Skill Discovery

Detects 50+ frameworks (FastAPI, Next.js, Flask, Go, Rust, etc.) from project markers and auto-generates slash-command skills with best practices. Manual /cortex discover adds web research.

๐Ÿงฌ

Agent Context Injection

When any subagent spawns, domain-relevant memories are injected via SubagentStart hook. Agents start with knowledge, not from scratch.

๐Ÿงน

Memory Hygiene

Daily automated dedup, path validation, recall tracking, and consolidation. Designed for long-running projects — never deletes based on age.

๐Ÿ”—

MCP Resources

Reference memories inline with @memory://project/name. 4 resource endpoints for on-demand context loading.

๐Ÿ›ก๏ธ

Safety Guardrails

Audit trail for all operations, soft-delete with backup, content size limits, agent hard caps, path traversal protection.

๐Ÿท๏ธ

Auto Project Tagging

PreToolUse hook detects project from working directory and auto-tags every memory_store call. No manual project scoping needed.

๐Ÿ“‹

Global Behavioral Rules

Ships with config/CLAUDE.md and config/cortex-memory.md — global rules that teach Claude to always search memory before saying "I don't know".

๐Ÿ’พ

Persistent Agent Memory

All agents have memory: user or memory: project scope. They accumulate knowledge across sessions in their own MEMORY.md files.

Full Session Lifecycle

Session Start
  โ”œโ”€โ”€ cleanup.sh          prune stale data
  โ”œโ”€โ”€ agent_bootstrap.sh  create agents from cortex (daily)
  โ”œโ”€โ”€ memory_hygiene.sh   dedup + consolidate (daily)
  โ””โ”€โ”€ skill_discover.sh   detect tech stack + generate skills (weekly)

Every Message
  โ””โ”€โ”€ recall.sh           smart recall + keyword boost + progressive disclosure

Agent Spawned
  โ”œโ”€โ”€ agent_context_inject.sh  inject domain memories
  โ””โ”€โ”€ agent_track.sh           log to usage ledger

Context Compressed
  โ”œโ”€โ”€ compact_save.sh      extract memories + fleet management
  โ””โ”€โ”€ post_compact_save.sh extract from compressed summary

Every cortex Tool Call
  โ””โ”€โ”€ cortex_pretool_enrich.sh  auto-tag project + audit

Session Paused
  โ”œโ”€โ”€ learn.sh             prompt to save learnings
  โ””โ”€โ”€ fleet_eval_stop.sh   fleet health check

Session Ended
  โ””โ”€โ”€ session_end_cleanup.sh  save summary + cleanup

Hook Coverage

Hook EventScriptWhat It Does
UserPromptSubmitrecall.shSmart recall with keyword boost + progressive disclosure
PreToolUsecortex_pretool_enrich.shAuto-tag project + audit log for cortex ops
PostToolUse(Agent)agent_track.shTrack agent spawns in usage ledger
SubagentStartagent_context_inject.shInject domain memories into spawned agents
PreCompactcompact_save.shExtract memories + create/evaluate agents
PostCompactpost_compact_save.shExtract from compressed summary
SessionStart (x4)cleanup + bootstrap + hygiene + skill_discoverPrune, create agents, dedup memories, generate skills
SessionEndsession_end_cleanup.shSave session summary + cleanup
Stop (x2)learn + fleet_eval_stopSave learnings + fleet health check

Quick Install

1. Clone & Install

git clone https://github.com/digin1/cortex.git ~/.claude/skills/cortex
pip install chromadb

2. Initialize Database

python3 -c "import chromadb; c=chromadb.PersistentClient(path='$HOME/.claude/cortex-db'); c.get_or_create_collection('claude_memories'); print('OK')"

3. Configure Hooks

Copy the hooks configuration from the README into your ~/.claude/settings.json.

4. Install Global Behavioral Rules

cp ~/.claude/skills/cortex/config/CLAUDE.md ~/.claude/CLAUDE.md
mkdir -p ~/.claude/rules
cp ~/.claude/skills/cortex/config/cortex-memory.md ~/.claude/rules/cortex-memory.md

5. Restart Claude Code

๐Ÿง  85 memories (39 project, 17 feedback, 18 reference, 1 user) across 4 projects
๐Ÿค– 10 agents (5 project + 5 global) | 5 spawns today | health 4.2/5
๐Ÿ“š 3 skills (2 project + 1 global)

Safety Guardrails

Audit Trail

Every store, update, and delete logged to .cortex_audit.jsonl with timestamps

Soft Delete

Deleted memory content archived to audit log before removal

Content Limits

Max 5000 chars per memory, 200 total memories, agent hard caps

No Age Deletion

Designed for long-running projects. Memories never removed for being old

Path Protection

os.path.realpath() validation + directory whitelisting on all agent ops

Semantic Dedup

0.55 for agents, 0.15 for memories, 0.35 for hygiene merges