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.
pip install instinct-mcpLive install stats: pypistats.org/packages/instinct-mcp.
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.
instinct observe "seq:lint->fix->lint"
instinct observe "pref:commits=conventional" --cat preference
instinct observe "fix:utf8-encoding-windows" --cat fix_pattern
instinct observe "combo:pytest+coverage" --cat comboPattern prefixes are conventional, not magic: seq:, pref:, fix:, and
combo: keep the store searchable and easier to export.
Full MCP surface is larger than this table. A complete reference belongs in
docs/TOOLS.md (TODO).
| Tool / command | Use it for |
|---|---|
observe |
Record or reinforce one pattern; repeats increment confidence. |
suggest |
Return mature patterns for current agent guidance. |
consolidate |
Promote thresholds and run automatic chain detection. |
session_summary |
End-of-session digest with recent observations and top suggestions. |
detect_chains |
Discover sequential patterns from confidence-log timestamps. |
effectiveness |
Measure which suggestions were reinforced by later observations. |
export_platform |
Export rules for Claude, Cursor, Windsurf, Codex, or CLAUDE.md. |
gc |
Decay stale patterns, find duplicates, clean orphan aliases, rebuild FTS. |
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 3777instinct 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 |
|---|---|---|---|---|---|---|---|
instinct |
Coding-agent behavioural patterns (seq / pref / fix / combo) | Local SQLite WAL | MCP-native + CLI | Yes -- raw -> mature -> rule -> universal |
Yes (universal tier) | Claude, Cursor, Windsurf, Codex, CLAUDE.md, Agent Skills | pip install instinct-mcp (1 line) |
| Mem0 | General LLM memory (chat history, episodic facts) | Pluggable vector backend (Qdrant, pgvector, Chroma, ...) | Python / TS SDK + REST | No tier model; importance scoring | Via user_id / agent_id namespacing |
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 |
| LangMem | Memory utilities for LangChain / LangGraph | BaseStore (pluggable) |
LangChain SDK only | User-managed | Namespace-based | N/A (library) | pip install langmem + LangChain stack |
| claude-mem | 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 | npm install + hook wiring |
| Engram | 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 (brv) |
Not advertised | Yes | Multi-agent compatible | brv CLI install |
| Pieces | 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 |
CLAUDE.md / .cursorrules |
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.
- Package:
instinct-mcp - Python:
>=3.11 - Runtime dependency:
mcp>=1.0.0 - Database: SQLite WAL at
~/.instinct/instinct.db - Config: optional
~/.instinct/config.toml - Current release in this repo:
1.4.1
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.
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.
- 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.