instinct-mcp 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- instinct_mcp-0.1.1/LICENSE +21 -0
- instinct_mcp-0.1.1/PKG-INFO +253 -0
- instinct_mcp-0.1.1/README.md +235 -0
- instinct_mcp-0.1.1/pyproject.toml +34 -0
- instinct_mcp-0.1.1/setup.cfg +4 -0
- instinct_mcp-0.1.1/src/instinct/__init__.py +2 -0
- instinct_mcp-0.1.1/src/instinct/cli.py +181 -0
- instinct_mcp-0.1.1/src/instinct/server.py +113 -0
- instinct_mcp-0.1.1/src/instinct/store.py +259 -0
- instinct_mcp-0.1.1/src/instinct_mcp.egg-info/PKG-INFO +253 -0
- instinct_mcp-0.1.1/src/instinct_mcp.egg-info/SOURCES.txt +15 -0
- instinct_mcp-0.1.1/src/instinct_mcp.egg-info/dependency_links.txt +1 -0
- instinct_mcp-0.1.1/src/instinct_mcp.egg-info/entry_points.txt +2 -0
- instinct_mcp-0.1.1/src/instinct_mcp.egg-info/requires.txt +1 -0
- instinct_mcp-0.1.1/src/instinct_mcp.egg-info/top_level.txt +1 -0
- instinct_mcp-0.1.1/tests/test_cli.py +160 -0
- instinct_mcp-0.1.1/tests/test_store.py +272 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 WinstonRedGuard
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: instinct-mcp
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Self-learning memory for AI coding agents — pattern detection, confidence scoring, auto-promotion via MCP
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/yakuphanycl/instinct
|
|
7
|
+
Project-URL: Issues, https://github.com/yakuphanycl/instinct/issues
|
|
8
|
+
Keywords: mcp,ai-agent,memory,instinct,claude-code,cursor,goose
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
13
|
+
Requires-Python: >=3.11
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: mcp>=1.0.0
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
|
|
19
|
+
<p align="center">
|
|
20
|
+
<h1 align="center">instinct</h1>
|
|
21
|
+
<p align="center">
|
|
22
|
+
<strong>Self-learning memory for AI coding agents</strong>
|
|
23
|
+
</p>
|
|
24
|
+
<p align="center">
|
|
25
|
+
<a href="https://pypi.org/project/instinct-mcp/"><img alt="PyPI" src="https://img.shields.io/pypi/v/instinct-mcp?color=%2334D058&label=pypi"></a>
|
|
26
|
+
<a href="https://pypi.org/project/instinct-mcp/"><img alt="Python" src="https://img.shields.io/pypi/pyversions/instinct-mcp"></a>
|
|
27
|
+
<a href="https://github.com/yakuphanycl/instinct/blob/master/LICENSE"><img alt="License" src="https://img.shields.io/github/license/yakuphanycl/instinct"></a>
|
|
28
|
+
<a href="https://modelcontextprotocol.io"><img alt="MCP" src="https://img.shields.io/badge/MCP-compatible-blue"></a>
|
|
29
|
+
</p>
|
|
30
|
+
</p>
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
Your AI agent makes the same mistakes twice. It forgets your preferences between sessions. It doesn't learn from repetition.
|
|
35
|
+
|
|
36
|
+
**instinct** fixes this. It observes patterns from your agent sessions, tracks confidence over time, and auto-promotes recurring patterns into suggestions your agent follows — without you repeating yourself.
|
|
37
|
+
|
|
38
|
+
Works with any MCP-compatible agent: **Claude Code**, **Cursor**, **Windsurf**, **Goose**, **Codex**, and others.
|
|
39
|
+
|
|
40
|
+
## How It Works
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
observe track promote suggest
|
|
44
|
+
┌───────┐ ┌───────┐ ┌───────┐ ┌───────┐
|
|
45
|
+
You │Record │ +1 │ Count │ >=5 │Mature │ >=10 │ Rule │
|
|
46
|
+
work │pattern├──────>│ hits ├───────>│suggest├───────>│ auto- │
|
|
47
|
+
└───────┘ └───────┘ └───────┘ │ apply │
|
|
48
|
+
└───────┘
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
1. **Observe** — record patterns as your agent works (tool sequences, preferences, recurring fixes)
|
|
52
|
+
2. **Track** — each re-observation increments confidence
|
|
53
|
+
3. **Promote** — confidence >= 5 becomes `mature` (suggested), >= 10 becomes `rule` (auto-applied)
|
|
54
|
+
4. **Suggest** — mature patterns guide agent behavior without explicit instruction
|
|
55
|
+
|
|
56
|
+
## Install
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install instinct-mcp
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Quick Start
|
|
63
|
+
|
|
64
|
+
### 1. Add to your agent
|
|
65
|
+
|
|
66
|
+
**Claude Code** — add to `.mcp.json` in your project root:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"mcpServers": {
|
|
71
|
+
"instinct": {
|
|
72
|
+
"command": "instinct",
|
|
73
|
+
"args": ["serve"]
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Cursor / Windsurf** — add to your MCP configuration:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"mcpServers": {
|
|
84
|
+
"instinct": {
|
|
85
|
+
"command": "instinct",
|
|
86
|
+
"args": ["serve", "--transport", "sse"]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
That's it. Your agent now has access to 8 tools:
|
|
93
|
+
|
|
94
|
+
| Tool | What it does |
|
|
95
|
+
|------|-------------|
|
|
96
|
+
| `observe` | Record a pattern (auto-increments confidence on repeat) |
|
|
97
|
+
| `suggest` | Get mature patterns to guide current behavior |
|
|
98
|
+
| `list_instincts` | Browse all observed patterns with filters |
|
|
99
|
+
| `get_instinct` | Look up a specific pattern |
|
|
100
|
+
| `consolidate` | Promote patterns that crossed confidence thresholds |
|
|
101
|
+
| `search_instincts` | Full-text search across patterns and metadata |
|
|
102
|
+
| `stats` | Summary statistics of the instinct store |
|
|
103
|
+
| `export_rules` | Export rule-level patterns as structured data |
|
|
104
|
+
|
|
105
|
+
### 2. Watch it learn
|
|
106
|
+
|
|
107
|
+
As you work, your agent starts noticing patterns:
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
Session 1: observe("seq:test->fix->test") → confidence 1 (raw)
|
|
111
|
+
Session 3: observe("seq:test->fix->test") → confidence 3 (raw)
|
|
112
|
+
Session 5: observe("seq:test->fix->test") → confidence 5 (mature ✓)
|
|
113
|
+
suggest() → "When tests fail, apply fix and re-run tests"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
After enough repetitions, instinct starts suggesting the pattern back — your agent adapts to how *you* work.
|
|
117
|
+
|
|
118
|
+
## What Patterns Look Like
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Tool sequences your agent repeats
|
|
122
|
+
instinct observe "seq:lint->fix->lint"
|
|
123
|
+
instinct observe "seq:build->test->deploy"
|
|
124
|
+
|
|
125
|
+
# Your preferences it should remember
|
|
126
|
+
instinct observe "pref:style=black" --cat preference
|
|
127
|
+
instinct observe "pref:commits=conventional" --cat preference
|
|
128
|
+
|
|
129
|
+
# Fixes it keeps rediscovering
|
|
130
|
+
instinct observe "fix:missing-import" --cat fix_pattern
|
|
131
|
+
instinct observe "fix:utf8-encoding-windows" --cat fix_pattern
|
|
132
|
+
|
|
133
|
+
# Tools that work better together
|
|
134
|
+
instinct observe "combo:pytest+coverage" --cat combo
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Naming Convention
|
|
138
|
+
|
|
139
|
+
| Prefix | Use for | Example |
|
|
140
|
+
|--------|---------|---------|
|
|
141
|
+
| `seq:` | Action sequences | `seq:lint->fix->lint` |
|
|
142
|
+
| `pref:` | User preferences | `pref:style=black` |
|
|
143
|
+
| `fix:` | Recurring fixes | `fix:missing-import` |
|
|
144
|
+
| `combo:` | Tool combinations | `combo:pytest+coverage` |
|
|
145
|
+
|
|
146
|
+
## Maturity Levels
|
|
147
|
+
|
|
148
|
+
| Level | Confidence | Behavior |
|
|
149
|
+
|-------|-----------|----------|
|
|
150
|
+
| **raw** | < 5 | Observed, stored, not yet actionable |
|
|
151
|
+
| **mature** | >= 5 | Returned by `suggest()` — agent uses as guidance |
|
|
152
|
+
| **rule** | >= 10 | Exported by `export_rules()` — strong enough to auto-apply |
|
|
153
|
+
|
|
154
|
+
## CLI Reference
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
instinct observe <pattern> # Record/reinforce a pattern
|
|
158
|
+
instinct get <pattern> # Look up a specific pattern
|
|
159
|
+
instinct list # List all instincts
|
|
160
|
+
instinct suggest # Get mature suggestions
|
|
161
|
+
instinct consolidate # Auto-promote by confidence
|
|
162
|
+
instinct decay # Reduce stale patterns (default: 90 days inactive)
|
|
163
|
+
instinct stats # Summary statistics
|
|
164
|
+
instinct export-rules # Export rules as JSON
|
|
165
|
+
instinct delete <pattern> # Remove a pattern
|
|
166
|
+
instinct fingerprint # Print project fingerprint for cwd
|
|
167
|
+
instinct serve # Start MCP server
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
All commands support `--json` for structured output.
|
|
171
|
+
|
|
172
|
+
### Observe Options
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
instinct observe "seq:a->b" \
|
|
176
|
+
--cat sequence # Category: sequence|preference|fix_pattern|combo
|
|
177
|
+
--source claude-code # Which agent/tool recorded this
|
|
178
|
+
--project auto # Project fingerprint (auto-detected from cwd)
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Server Options
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
instinct serve # stdio (default, for Claude Code)
|
|
185
|
+
instinct serve --transport sse # SSE for remote/HTTP clients
|
|
186
|
+
instinct serve --transport streamable-http # Streamable HTTP
|
|
187
|
+
instinct serve --port 3777 # Custom port (default: 3777)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Python Library
|
|
191
|
+
|
|
192
|
+
```python
|
|
193
|
+
from instinct.store import InstinctStore
|
|
194
|
+
|
|
195
|
+
store = InstinctStore() # uses ~/.instinct/instinct.db
|
|
196
|
+
|
|
197
|
+
# Record patterns
|
|
198
|
+
store.observe("seq:test->fix->test", source="my-tool")
|
|
199
|
+
store.observe("seq:test->fix->test") # confidence = 2
|
|
200
|
+
|
|
201
|
+
# Query
|
|
202
|
+
suggestions = store.suggest() # mature+ patterns
|
|
203
|
+
results = store.search("test") # full-text search
|
|
204
|
+
rules = store.export_rules() # rule-level only
|
|
205
|
+
|
|
206
|
+
# Lifecycle
|
|
207
|
+
store.consolidate() # promote by threshold
|
|
208
|
+
store.decay(days_inactive=90) # fade stale patterns
|
|
209
|
+
|
|
210
|
+
# Stats
|
|
211
|
+
print(store.stats())
|
|
212
|
+
# {'total': 42, 'raw': 30, 'mature': 10, 'rules': 2, 'avg_confidence': 4.2, ...}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Custom Database Path
|
|
216
|
+
|
|
217
|
+
```python
|
|
218
|
+
store = InstinctStore(db_path="/path/to/custom.db")
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## Cross-Project Learning
|
|
222
|
+
|
|
223
|
+
instinct hashes your working directory into a project fingerprint. This means:
|
|
224
|
+
|
|
225
|
+
- **Project-specific patterns** are only suggested when you're in that project
|
|
226
|
+
- **Global patterns** (empty project field) are suggested everywhere
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
# See your current project's fingerprint
|
|
230
|
+
instinct fingerprint
|
|
231
|
+
# → a1b2c3d4e5f6
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Storage
|
|
235
|
+
|
|
236
|
+
- **Database:** SQLite at `~/.instinct/instinct.db`
|
|
237
|
+
- **Dependencies:** Only `mcp>=1.0.0`
|
|
238
|
+
- **Size:** ~650 lines of Python, zero bloat
|
|
239
|
+
|
|
240
|
+
## How It Compares
|
|
241
|
+
|
|
242
|
+
| | instinct | Manual CLAUDE.md | .cursorrules |
|
|
243
|
+
|---|---|---|---|
|
|
244
|
+
| Learns automatically | Yes | No | No |
|
|
245
|
+
| Cross-session memory | Yes | Yes | Yes |
|
|
246
|
+
| Confidence scoring | Yes | No | No |
|
|
247
|
+
| Decay of stale patterns | Yes | No | No |
|
|
248
|
+
| Works across agents | Yes (MCP) | Claude only | Cursor only |
|
|
249
|
+
| Requires manual editing | No | Yes | Yes |
|
|
250
|
+
|
|
251
|
+
## License
|
|
252
|
+
|
|
253
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<h1 align="center">instinct</h1>
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>Self-learning memory for AI coding agents</strong>
|
|
5
|
+
</p>
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="https://pypi.org/project/instinct-mcp/"><img alt="PyPI" src="https://img.shields.io/pypi/v/instinct-mcp?color=%2334D058&label=pypi"></a>
|
|
8
|
+
<a href="https://pypi.org/project/instinct-mcp/"><img alt="Python" src="https://img.shields.io/pypi/pyversions/instinct-mcp"></a>
|
|
9
|
+
<a href="https://github.com/yakuphanycl/instinct/blob/master/LICENSE"><img alt="License" src="https://img.shields.io/github/license/yakuphanycl/instinct"></a>
|
|
10
|
+
<a href="https://modelcontextprotocol.io"><img alt="MCP" src="https://img.shields.io/badge/MCP-compatible-blue"></a>
|
|
11
|
+
</p>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
Your AI agent makes the same mistakes twice. It forgets your preferences between sessions. It doesn't learn from repetition.
|
|
17
|
+
|
|
18
|
+
**instinct** fixes this. It observes patterns from your agent sessions, tracks confidence over time, and auto-promotes recurring patterns into suggestions your agent follows — without you repeating yourself.
|
|
19
|
+
|
|
20
|
+
Works with any MCP-compatible agent: **Claude Code**, **Cursor**, **Windsurf**, **Goose**, **Codex**, and others.
|
|
21
|
+
|
|
22
|
+
## How It Works
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
observe track promote suggest
|
|
26
|
+
┌───────┐ ┌───────┐ ┌───────┐ ┌───────┐
|
|
27
|
+
You │Record │ +1 │ Count │ >=5 │Mature │ >=10 │ Rule │
|
|
28
|
+
work │pattern├──────>│ hits ├───────>│suggest├───────>│ auto- │
|
|
29
|
+
└───────┘ └───────┘ └───────┘ │ apply │
|
|
30
|
+
└───────┘
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
1. **Observe** — record patterns as your agent works (tool sequences, preferences, recurring fixes)
|
|
34
|
+
2. **Track** — each re-observation increments confidence
|
|
35
|
+
3. **Promote** — confidence >= 5 becomes `mature` (suggested), >= 10 becomes `rule` (auto-applied)
|
|
36
|
+
4. **Suggest** — mature patterns guide agent behavior without explicit instruction
|
|
37
|
+
|
|
38
|
+
## Install
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install instinct-mcp
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Quick Start
|
|
45
|
+
|
|
46
|
+
### 1. Add to your agent
|
|
47
|
+
|
|
48
|
+
**Claude Code** — add to `.mcp.json` in your project root:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"mcpServers": {
|
|
53
|
+
"instinct": {
|
|
54
|
+
"command": "instinct",
|
|
55
|
+
"args": ["serve"]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Cursor / Windsurf** — add to your MCP configuration:
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"mcpServers": {
|
|
66
|
+
"instinct": {
|
|
67
|
+
"command": "instinct",
|
|
68
|
+
"args": ["serve", "--transport", "sse"]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
That's it. Your agent now has access to 8 tools:
|
|
75
|
+
|
|
76
|
+
| Tool | What it does |
|
|
77
|
+
|------|-------------|
|
|
78
|
+
| `observe` | Record a pattern (auto-increments confidence on repeat) |
|
|
79
|
+
| `suggest` | Get mature patterns to guide current behavior |
|
|
80
|
+
| `list_instincts` | Browse all observed patterns with filters |
|
|
81
|
+
| `get_instinct` | Look up a specific pattern |
|
|
82
|
+
| `consolidate` | Promote patterns that crossed confidence thresholds |
|
|
83
|
+
| `search_instincts` | Full-text search across patterns and metadata |
|
|
84
|
+
| `stats` | Summary statistics of the instinct store |
|
|
85
|
+
| `export_rules` | Export rule-level patterns as structured data |
|
|
86
|
+
|
|
87
|
+
### 2. Watch it learn
|
|
88
|
+
|
|
89
|
+
As you work, your agent starts noticing patterns:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
Session 1: observe("seq:test->fix->test") → confidence 1 (raw)
|
|
93
|
+
Session 3: observe("seq:test->fix->test") → confidence 3 (raw)
|
|
94
|
+
Session 5: observe("seq:test->fix->test") → confidence 5 (mature ✓)
|
|
95
|
+
suggest() → "When tests fail, apply fix and re-run tests"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
After enough repetitions, instinct starts suggesting the pattern back — your agent adapts to how *you* work.
|
|
99
|
+
|
|
100
|
+
## What Patterns Look Like
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Tool sequences your agent repeats
|
|
104
|
+
instinct observe "seq:lint->fix->lint"
|
|
105
|
+
instinct observe "seq:build->test->deploy"
|
|
106
|
+
|
|
107
|
+
# Your preferences it should remember
|
|
108
|
+
instinct observe "pref:style=black" --cat preference
|
|
109
|
+
instinct observe "pref:commits=conventional" --cat preference
|
|
110
|
+
|
|
111
|
+
# Fixes it keeps rediscovering
|
|
112
|
+
instinct observe "fix:missing-import" --cat fix_pattern
|
|
113
|
+
instinct observe "fix:utf8-encoding-windows" --cat fix_pattern
|
|
114
|
+
|
|
115
|
+
# Tools that work better together
|
|
116
|
+
instinct observe "combo:pytest+coverage" --cat combo
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Naming Convention
|
|
120
|
+
|
|
121
|
+
| Prefix | Use for | Example |
|
|
122
|
+
|--------|---------|---------|
|
|
123
|
+
| `seq:` | Action sequences | `seq:lint->fix->lint` |
|
|
124
|
+
| `pref:` | User preferences | `pref:style=black` |
|
|
125
|
+
| `fix:` | Recurring fixes | `fix:missing-import` |
|
|
126
|
+
| `combo:` | Tool combinations | `combo:pytest+coverage` |
|
|
127
|
+
|
|
128
|
+
## Maturity Levels
|
|
129
|
+
|
|
130
|
+
| Level | Confidence | Behavior |
|
|
131
|
+
|-------|-----------|----------|
|
|
132
|
+
| **raw** | < 5 | Observed, stored, not yet actionable |
|
|
133
|
+
| **mature** | >= 5 | Returned by `suggest()` — agent uses as guidance |
|
|
134
|
+
| **rule** | >= 10 | Exported by `export_rules()` — strong enough to auto-apply |
|
|
135
|
+
|
|
136
|
+
## CLI Reference
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
instinct observe <pattern> # Record/reinforce a pattern
|
|
140
|
+
instinct get <pattern> # Look up a specific pattern
|
|
141
|
+
instinct list # List all instincts
|
|
142
|
+
instinct suggest # Get mature suggestions
|
|
143
|
+
instinct consolidate # Auto-promote by confidence
|
|
144
|
+
instinct decay # Reduce stale patterns (default: 90 days inactive)
|
|
145
|
+
instinct stats # Summary statistics
|
|
146
|
+
instinct export-rules # Export rules as JSON
|
|
147
|
+
instinct delete <pattern> # Remove a pattern
|
|
148
|
+
instinct fingerprint # Print project fingerprint for cwd
|
|
149
|
+
instinct serve # Start MCP server
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
All commands support `--json` for structured output.
|
|
153
|
+
|
|
154
|
+
### Observe Options
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
instinct observe "seq:a->b" \
|
|
158
|
+
--cat sequence # Category: sequence|preference|fix_pattern|combo
|
|
159
|
+
--source claude-code # Which agent/tool recorded this
|
|
160
|
+
--project auto # Project fingerprint (auto-detected from cwd)
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Server Options
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
instinct serve # stdio (default, for Claude Code)
|
|
167
|
+
instinct serve --transport sse # SSE for remote/HTTP clients
|
|
168
|
+
instinct serve --transport streamable-http # Streamable HTTP
|
|
169
|
+
instinct serve --port 3777 # Custom port (default: 3777)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Python Library
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
from instinct.store import InstinctStore
|
|
176
|
+
|
|
177
|
+
store = InstinctStore() # uses ~/.instinct/instinct.db
|
|
178
|
+
|
|
179
|
+
# Record patterns
|
|
180
|
+
store.observe("seq:test->fix->test", source="my-tool")
|
|
181
|
+
store.observe("seq:test->fix->test") # confidence = 2
|
|
182
|
+
|
|
183
|
+
# Query
|
|
184
|
+
suggestions = store.suggest() # mature+ patterns
|
|
185
|
+
results = store.search("test") # full-text search
|
|
186
|
+
rules = store.export_rules() # rule-level only
|
|
187
|
+
|
|
188
|
+
# Lifecycle
|
|
189
|
+
store.consolidate() # promote by threshold
|
|
190
|
+
store.decay(days_inactive=90) # fade stale patterns
|
|
191
|
+
|
|
192
|
+
# Stats
|
|
193
|
+
print(store.stats())
|
|
194
|
+
# {'total': 42, 'raw': 30, 'mature': 10, 'rules': 2, 'avg_confidence': 4.2, ...}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Custom Database Path
|
|
198
|
+
|
|
199
|
+
```python
|
|
200
|
+
store = InstinctStore(db_path="/path/to/custom.db")
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Cross-Project Learning
|
|
204
|
+
|
|
205
|
+
instinct hashes your working directory into a project fingerprint. This means:
|
|
206
|
+
|
|
207
|
+
- **Project-specific patterns** are only suggested when you're in that project
|
|
208
|
+
- **Global patterns** (empty project field) are suggested everywhere
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
# See your current project's fingerprint
|
|
212
|
+
instinct fingerprint
|
|
213
|
+
# → a1b2c3d4e5f6
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Storage
|
|
217
|
+
|
|
218
|
+
- **Database:** SQLite at `~/.instinct/instinct.db`
|
|
219
|
+
- **Dependencies:** Only `mcp>=1.0.0`
|
|
220
|
+
- **Size:** ~650 lines of Python, zero bloat
|
|
221
|
+
|
|
222
|
+
## How It Compares
|
|
223
|
+
|
|
224
|
+
| | instinct | Manual CLAUDE.md | .cursorrules |
|
|
225
|
+
|---|---|---|---|
|
|
226
|
+
| Learns automatically | Yes | No | No |
|
|
227
|
+
| Cross-session memory | Yes | Yes | Yes |
|
|
228
|
+
| Confidence scoring | Yes | No | No |
|
|
229
|
+
| Decay of stale patterns | Yes | No | No |
|
|
230
|
+
| Works across agents | Yes (MCP) | Claude only | Cursor only |
|
|
231
|
+
| Requires manual editing | No | Yes | Yes |
|
|
232
|
+
|
|
233
|
+
## License
|
|
234
|
+
|
|
235
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "instinct-mcp"
|
|
7
|
+
version = "0.1.1"
|
|
8
|
+
description = "Self-learning memory for AI coding agents — pattern detection, confidence scoring, auto-promotion via MCP"
|
|
9
|
+
requires-python = ">=3.11"
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
keywords = ["mcp", "ai-agent", "memory", "instinct", "claude-code", "cursor", "goose"]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 3 - Alpha",
|
|
14
|
+
"Intended Audience :: Developers",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Topic :: Software Development :: Libraries",
|
|
17
|
+
]
|
|
18
|
+
license = {text = "MIT"}
|
|
19
|
+
dependencies = [
|
|
20
|
+
"mcp>=1.0.0",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[project.urls]
|
|
24
|
+
Homepage = "https://github.com/yakuphanycl/instinct"
|
|
25
|
+
Issues = "https://github.com/yakuphanycl/instinct/issues"
|
|
26
|
+
|
|
27
|
+
[project.scripts]
|
|
28
|
+
instinct = "instinct.cli:main"
|
|
29
|
+
|
|
30
|
+
[tool.setuptools.packages.find]
|
|
31
|
+
where = ["src"]
|
|
32
|
+
|
|
33
|
+
[tool.pytest.ini_options]
|
|
34
|
+
testpaths = ["tests"]
|