Self-learning memory for AI coding agents — pattern detection, confidence scoring, auto-promotion via MCP
Project description
instinct
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-mcp
Used in the wild: 1,400+ monthly downloads on PyPI as of 2026-04-25.
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 suggest
Suggestions appear once a pattern reaches mature confidence. By default,
mature starts at confidence 5 and rule starts at confidence 10.
What It Learns
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 combo
Pattern prefixes are conventional, not magic: seq:, pref:, fix:, and
combo: keep the store searchable and easier to export.
Tool Surface
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. |
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 3777
How It Compares
CLAUDE.md is good for hand-written rules. instinct is for patterns that should earn their way into rules through repetition.
| Surface | Best fit | Different because |
|---|---|---|
instinct |
Coding-agent pattern memory | Local SQLite, confidence tiers, decay, cross-project promotion, MCP-native — works with any MCP-compatible agent. |
| Mem0 | General LLM memory layer | Broader memory product (chat history, episodic facts); instinct is narrower and coding-agent focused on behavioral patterns. |
| Letta (formerly MemGPT) | Stateful agent runtime | Full agent framework with memory built-in; instinct is a memory-only sidecar you bolt onto your existing agent. |
| LangMem | Memory for LangChain | Tied to LangChain ecosystem; instinct is framework-agnostic via MCP. |
| claude-mem | Claude-specific memory experiments | instinct exposes MCP tools plus CLI exports across Claude, Cursor, Windsurf, Goose, and Codex. |
| Pieces | Developer snippets and workflow context | instinct stores repeated behavioral patterns; Pieces stores artifacts (snippets, links, screenshots). |
CLAUDE.md / .cursorrules |
Hand-written rule files | Flat text, manual maintenance. instinct can export to these formats once a pattern matures. |
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 it back automatically.
When to reach for the others: chat-history recall (Mem0), full agent runtime with built-in memory (Letta), LangChain integration (LangMem), or static hand-curated rules (CLAUDE.md / .cursorrules).
Storage and Runtime
- 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.0
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 checks
All core commands support --json where structured output is useful.
Recent Releases
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file instinct_mcp-1.4.1.tar.gz.
File metadata
- Download URL: instinct_mcp-1.4.1.tar.gz
- Upload date:
- Size: 51.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32a2f45321b44852073e90eb82ce5b92937110bcd55d8b4f61eb0463da5d5c5e
|
|
| MD5 |
6e8835eda0ebf329ee2282886d5f326a
|
|
| BLAKE2b-256 |
47d14a3fb1182b093d6fb10724d3c7603998df9d7dd6df64dc39fa9569def79e
|
File details
Details for the file instinct_mcp-1.4.1-py3-none-any.whl.
File metadata
- Download URL: instinct_mcp-1.4.1-py3-none-any.whl
- Upload date:
- Size: 39.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2bb2e3e5b96f35e05b644bd30a7b14751ed81aa54a2912f34878203d4496603f
|
|
| MD5 |
6f09a8608cda9b09b7e897f53672a48e
|
|
| BLAKE2b-256 |
c7369148356b16e41f9d98463c7f28a1d8f5cae02503c8fd30c7c1dab16a4a9c
|