instinct
The instinct server is a self-learning memory system for AI coding agents that records behavioral patterns, scores them by confidence, and surfaces mature guidance back through MCP.
Core Pattern Management
observe– Record or reinforce a behavioral pattern (tool sequences, user preferences, recurring fixes, combos); repeated observations increment confidencesuggest– Retrieve mature patterns (confidence ≥ 5) to guide current agent behavior, sorted by confidencelist_instincts– Browse all recorded patterns including low-confidence seedlings, with filters for category, project, and minimum confidenceget_instinct– Fetch the full record for a single pattern by its exact keysearch_instincts– Full-text search across pattern keys, metadata, and explain text using SQLite FTS5
Learning & Promotion
consolidate– Re-evaluate and promote patterns across tiers (raw→mature→rule→universal) based on confidence thresholds; also runs chain detection and rebuilds FTS indexdetect_chains– Automatically mine the observation log to discover sequential tool-chain patterns (seq:A->B)session_summary– End-of-session digest showing recent activity, top mature suggestions, and store stats (also runs consolidate)
Analytics & Monitoring
stats– Total patterns, level distribution, category breakdown, average/peak confidenceeffectiveness– Measure how often suggested patterns were later reinforced by anobserve()calltrending– Rank patterns by observation velocity within a time windowhistory– Show how a single pattern's confidence evolved over time
Export & Integration
export_rules– Export rule-level and universal patterns as structured JSONexport_claude_md– Render rule-level patterns as Markdown ready to paste intoCLAUDE.mdinject_claude_md– Idempotently write rule-level patterns into an existingCLAUDE.mdfile via marker tagsexport_skill– Package rules as aSKILL.mdfile in the anthropics/skills formatexport_platform– Render rules in platform-specific formats: Cursor (.cursorrules), Windsurf (.windsurfrules), Codex (AGENTS.md), or Claude MD
Import & Bulk Operations
import_patterns– Bulk-insert many patterns in one callimport_claude_md– Parse an existingCLAUDE.mdfile and ingest its instinct patterns to bootstrap the store
Store Maintenance
alias_pattern– Redirect future observations of one pattern key onto another (merge duplicates without losing confidence)find_duplicates– Detect near-identical pattern keys using token overlap similarity scoringgc/housekeep– Run all store maintenance: decay stale patterns, merge near-duplicates, clean orphan aliases, and rebuild the FTS index
Integrates with GitHub Actions for CI/CD workflows and Dependabot for dependency updates, with repository health monitoring and protected branch management.
Provides CI/CD workflow integration with automated testing and security scanning through GitHub Actions workflows.
Supports export and import of patterns to/from Markdown files (CLAUDE.md, SKILL.md) for agent instruction formatting.
Supports pattern detection for pytest testing workflows, including test sequences and combination patterns with coverage tools.
Provides Python-specific pattern learning and memory capabilities for AI coding agents working with Python projects and tools.
Uses SQLite for pattern storage with full-text search capabilities, backup/restore functionality, and database health management.
Supports TOML configuration format for MCP server setup with certain AI agent clients like Codex CLI.
instinct
💡 Found this useful? ⭐ Star the repo (helps others find it) and subscribe to weekly detection-engineering writeups at Detection Frontier.
Self-learning memory for AI coding agents: record repeated patterns, score them by confidence, and surface mature guidance back through MCP.
Records tool sequences, user preferences, recurring fixes, and useful tool combinations.
Promotes repeated observations from
rawtomature,rule, and cross-projectuniversal.Exports learned rules for Claude, Cursor, Windsurf, Codex, CLAUDE.md, and Agent Skills.
Current release: 1.4.1 (April 2026; transferred to WRG-11 org). Python >=3.11. SQLite WAL storage at ~/.instinct/instinct.db. Single runtime dep (mcp>=1.0.0).
pip install instinct-mcpLive install stats: pypistats.org/packages/instinct-mcp.
Quick Start
For Claude Code:
pip install instinct-mcp
claude mcp add instinct -- instinct serve
instinct observe "seq:test->fix->test"Then ask your agent for suggestions, or run:
instinct suggestSuggestions appear once a pattern reaches mature confidence. By default,
mature starts at confidence 5 and rule starts at confidence 10.
What It Learns
You feed instinct one observe call per recurring behaviour you want it to remember.
Each call increments confidence on the matching pattern; once confidence reaches the
mature threshold (default: 5), the pattern shows up in suggest and can be exported
back into your agent's rule files. Four prefix conventions help organise + search the
store:
instinct observe "seq:lint->fix->lint" # tool-sequence patterns
instinct observe "pref:commits=conventional" # user preferences
instinct observe "fix:utf8-encoding-windows" # recurring fixes
instinct observe "combo:pytest+coverage" # tool combinationsPattern prefixes are conventional, not magic: seq:, pref:, fix:, and
combo: keep the store searchable and easier to export. Add --cat <category>
to override the auto-inferred category if needed.
Tool Surface
A representative slice of the MCP tool surface; see the CLI Reference section below for the complete command list.
Tool / command | Use it for |
| Record or reinforce one pattern; repeats increment confidence. |
| Return mature patterns for current agent guidance. |
| Promote thresholds and run automatic chain detection. |
| End-of-session digest with recent observations and top suggestions. |
| Discover sequential patterns from confidence-log timestamps. |
| Measure which suggestions were reinforced by later observations. |
| Export rules for Claude, Cursor, Windsurf, Codex, or CLAUDE.md. |
| Decay stale patterns, find duplicates, clean orphan aliases, rebuild FTS. |
MCP Client Setup
Claude Code project-level .mcp.json:
{
"mcpServers": {
"instinct": {
"command": "instinct",
"args": ["serve"]
}
}
}Codex CLI:
[mcp_servers.instinct]
command = "instinct"
args = ["serve"]Cursor / Windsurf / HTTP clients:
{
"mcpServers": {
"instinct": {
"command": "instinct",
"args": ["serve", "--transport", "sse"]
}
}
}Server options:
instinct serve # stdio, default
instinct serve --transport sse # SSE
instinct serve --transport streamable-http # streamable HTTP
instinct serve --port 3777How It Compares
instinct is one of several memory layers for AI agents. The categories overlap, but
each project optimises for something different. This table is a head-to-head feature
matrix; raw adoption metrics, source URLs, and methodology live in
docs/comparison-benchmarks.md.
Project | Primary surface | Storage | Protocol | Confidence tiers / auto-promote | Cross-project promotion | Export targets | Setup friction |
| Coding-agent behavioural patterns (seq / pref / fix / combo) | Local SQLite WAL | MCP-native + CLI | Yes -- | Yes (universal tier) | Claude, Cursor, Windsurf, Codex, CLAUDE.md, Agent Skills |
|
General LLM memory (chat history, episodic facts) | Pluggable vector backend (Qdrant, pgvector, Chroma, ...) | Python / TS SDK + REST | No tier model; importance scoring | Via | SDK consumption (no flat-file export) | SDK + backend choice | |
Letta (formerly MemGPT) | Stateful agent runtime with built-in memory | Postgres / SQLite via runtime | Letta SDK + REST + MCP | Managed by agent (memory blocks) | Agent-level isolation | N/A (runtime, not exporter) | Server / Docker, framework-level |
Memory utilities for LangChain / LangGraph |
| LangChain SDK only | User-managed | Namespace-based | N/A (library) |
| |
Session capture + AI-compressed context re-injection | Local context files | Claude Code hooks + multi-tool | No tier model; full-session capture | Per-project session files | Context files for Claude / Codex / Copilot / Gemini / OpenCode |
| |
Persistent memory for coding agents (generic) | Local SQLite + FTS5 | MCP + HTTP + CLI + TUI | No (raw storage) | Per-project DB | Generic memory store | Single Go binary | |
ByteRover CLI (formerly Cipher) | Portable memory layer for autonomous coding agents | Local + cloud hybrid | MCP + CLI ( | Not advertised | Yes | Multi-agent compatible |
|
Developer snippets and workflow artefacts | Local Pieces OS + optional cloud | Proprietary SDK + IDE extensions | ML-tagged (not user-visible tier model) | Yes | IDE-native panels | Desktop app + IDE plugin | |
| Hand-written rule files | Flat text in repo | Loaded by the agent | Manual (you decide what's a rule) | Manual (you copy the file) | Itself a target format | Edit a file |
When to reach for instinct: your agent makes the same correction or follows the same workflow more than 3 times and you don't want to keep retyping. instinct records once, promotes after repetition, and surfaces the pattern back automatically through MCP.
Where instinct loses today (honest delta):
Adoption / maturity. instinct is new (April 2026, 2 GitHub stars at time of writing). Mem0, Letta, and claude-mem each have 5-6 figures of stars and years of iteration. If you need a battle-tested project with a large community, instinct is not it yet.
Chat-history recall. Mem0 stores episodic conversational facts and recalls them by query. instinct does not store conversation turns; it stores repeated behavioural patterns.
Full agent runtime. Letta gives you the whole agent loop (planner, memory, tools, state). instinct is a memory-only sidecar; you still bring your own agent.
LangChain-native integration. LangMem ships first-class
BaseStoreadapters and reducers for LangGraph. instinct is framework-agnostic via MCP, which costs you some LangChain-specific ergonomics.Session capture and replay. claude-mem snapshots and compresses entire Claude Code sessions for later context injection. instinct stores only the patterns the agent (or you) chose to
observe.Snippets and artefacts. Pieces stores code snippets, screenshots, and links. instinct stores patterns, not artefacts.
If any of those is your primary need, reach for the project that owns it. Reach for instinct when you want a small, local, MCP-native pattern store that promotes repeated behaviours into exportable rules.
Storage and Runtime
Package:
instinct-mcpPython:
>=3.11Runtime dependency:
mcp>=1.0.0Database: SQLite WAL at
~/.instinct/instinct.dbConfig: optional
~/.instinct/config.tomlCurrent release in this repo:
1.4.1
CLI Reference
instinct observe <pattern> # record/reinforce
instinct suggest # mature suggestions
instinct list # browse all patterns
instinct history <pattern> # confidence timeline
instinct effectiveness # suggestion confirmation rates
instinct export-platform codex # export for an agent/editor
instinct gc # decay + dedup + cleanup
instinct doctor # DB health checksAll core commands support --json where structured output is useful.
Recent Releases
1.4.1: repository transferred toWRG-11org + URL/metadata refresh (no behavioural changes).1.4.0: auto-chain detection and effectiveness scoring.1.3.0: platform export, MCP prompts, andgc.1.2.0: auto-promote on observe, confidence history, universal rules, CLAUDE.md import.1.1.0: Agent Skill export, CLAUDE.md injection, near-duplicate detection.
See CHANGELOG.md.
Repository Health
CI matrix: Python 3.11-3.14 on Ubuntu and Windows.
CodeQL security scanning on push and pull request.
Dependabot tracks GitHub Actions and pip updates weekly.
Published on PyPI, MCP Registry, and Glama.
License
Maintenance
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/WRG-11/instinct'
If you have feedback or need assistance with the MCP directory API, please join our Discord server