cortec-mcp 0.1.0__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.
- cortec_mcp-0.1.0/.gitignore +41 -0
- cortec_mcp-0.1.0/CORTEC.md +43 -0
- cortec_mcp-0.1.0/PKG-INFO +315 -0
- cortec_mcp-0.1.0/README.md +281 -0
- cortec_mcp-0.1.0/cortec/__init__.py +6 -0
- cortec_mcp-0.1.0/cortec/agents/__init__.py +7 -0
- cortec_mcp-0.1.0/cortec/agents/debug_assistant.py +74 -0
- cortec_mcp-0.1.0/cortec/agents/portfolio.py +100 -0
- cortec_mcp-0.1.0/cortec/agents/pr_assistant.py +123 -0
- cortec_mcp-0.1.0/cortec/cli.py +773 -0
- cortec_mcp-0.1.0/cortec/config.py +94 -0
- cortec_mcp-0.1.0/cortec/conflicts.py +99 -0
- cortec_mcp-0.1.0/cortec/github.py +110 -0
- cortec_mcp-0.1.0/cortec/graph.py +149 -0
- cortec_mcp-0.1.0/cortec/ingest.py +84 -0
- cortec_mcp-0.1.0/cortec/security/__init__.py +1 -0
- cortec_mcp-0.1.0/cortec/security/redactor.py +30 -0
- cortec_mcp-0.1.0/cortec/security/scanner.py +43 -0
- cortec_mcp-0.1.0/cortec/server.py +598 -0
- cortec_mcp-0.1.0/cortec/stackoverflow.py +213 -0
- cortec_mcp-0.1.0/cortec/storage/__init__.py +1 -0
- cortec_mcp-0.1.0/cortec/storage/db.py +277 -0
- cortec_mcp-0.1.0/cortec/storage/vector.py +82 -0
- cortec_mcp-0.1.0/pyproject.toml +55 -0
- cortec_mcp-0.1.0/tests/__init__.py +1 -0
- cortec_mcp-0.1.0/tests/test_agents.py +259 -0
- cortec_mcp-0.1.0/tests/test_conflicts.py +95 -0
- cortec_mcp-0.1.0/tests/test_github.py +174 -0
- cortec_mcp-0.1.0/tests/test_graph.py +224 -0
- cortec_mcp-0.1.0/tests/test_memory_types.py +40 -0
- cortec_mcp-0.1.0/tests/test_security.py +50 -0
- cortec_mcp-0.1.0/tests/test_stackoverflow.py +193 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.pyo
|
|
5
|
+
.venv/
|
|
6
|
+
venv/
|
|
7
|
+
env/
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
*.egg-info/
|
|
11
|
+
.eggs/
|
|
12
|
+
|
|
13
|
+
# Cortec local storage — never commit
|
|
14
|
+
.cortec/
|
|
15
|
+
cortec_data/
|
|
16
|
+
*.db
|
|
17
|
+
*.sqlite
|
|
18
|
+
*.sqlite3
|
|
19
|
+
*.jsonl
|
|
20
|
+
chroma_db/
|
|
21
|
+
|
|
22
|
+
# Secrets — never commit
|
|
23
|
+
.env
|
|
24
|
+
.env.*
|
|
25
|
+
*.pem
|
|
26
|
+
*.key
|
|
27
|
+
*.p12
|
|
28
|
+
secrets.json
|
|
29
|
+
.secrets.baseline
|
|
30
|
+
|
|
31
|
+
# OS
|
|
32
|
+
.DS_Store
|
|
33
|
+
Thumbs.db
|
|
34
|
+
|
|
35
|
+
# IDE
|
|
36
|
+
.vscode/
|
|
37
|
+
.idea/
|
|
38
|
+
*.swp
|
|
39
|
+
|
|
40
|
+
# Logs
|
|
41
|
+
*.log
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# CORTEC.md
|
|
2
|
+
|
|
3
|
+
project: cortec-mcp
|
|
4
|
+
author: Raj Kumar Satya
|
|
5
|
+
version: 0.1.0
|
|
6
|
+
phase: 1
|
|
7
|
+
|
|
8
|
+
## Stack
|
|
9
|
+
- MCP server: FastMCP
|
|
10
|
+
- Vector DB: Chroma
|
|
11
|
+
- Metadata: SQLite
|
|
12
|
+
- Archive: JSONL
|
|
13
|
+
- Secret scan: detect-secrets
|
|
14
|
+
|
|
15
|
+
## Key Decisions
|
|
16
|
+
- Use Chroma over Qdrant for MVP (simpler local setup)
|
|
17
|
+
- Approval mode default: approval_required (never store silently)
|
|
18
|
+
- Confidence scoring: source-based (0.5 to 0.9)
|
|
19
|
+
- summarize_session: extractive MVP, LLM endpoint optional
|
|
20
|
+
- Secret scan runs before every store — no exceptions
|
|
21
|
+
- No external cloud services by default
|
|
22
|
+
|
|
23
|
+
## Confidence Scale
|
|
24
|
+
- 0.9: user confirmed
|
|
25
|
+
- 0.8: GitHub commit or PR
|
|
26
|
+
- 0.7: session summary
|
|
27
|
+
- 0.6: Stack Overflow pattern
|
|
28
|
+
- 0.5: inferred
|
|
29
|
+
|
|
30
|
+
## Privacy Rules
|
|
31
|
+
- All data stays local
|
|
32
|
+
- User can delete any memory
|
|
33
|
+
- User can export all memories
|
|
34
|
+
- Secrets are redacted before storing
|
|
35
|
+
- No telemetry, no analytics, no cloud sync
|
|
36
|
+
|
|
37
|
+
## Phase Roadmap
|
|
38
|
+
- Phase 1: MCP server + RAG + CLI (current)
|
|
39
|
+
- Phase 2: Project memory types + conflict detection
|
|
40
|
+
- Phase 3: GitHub integration
|
|
41
|
+
- Phase 4: Stack Overflow pattern store
|
|
42
|
+
- Phase 5: Knowledge graph
|
|
43
|
+
- Phase 6: Agent workflows
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cortec-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Local-first memory server for developer workflows
|
|
5
|
+
Project-URL: Homepage, https://github.com/rajkumar-prog/cortec-mcp
|
|
6
|
+
Project-URL: Repository, https://github.com/rajkumar-prog/cortec-mcp
|
|
7
|
+
Project-URL: Issues, https://github.com/rajkumar-prog/cortec-mcp/issues
|
|
8
|
+
Author-email: Raj Kumar Satya <rajkumarrapeti@gmail.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
Keywords: ai-tools,claude,developer-tools,local-first,mcp,memory,vector-search
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Requires-Dist: chromadb>=0.5.0
|
|
21
|
+
Requires-Dist: click>=8.1.0
|
|
22
|
+
Requires-Dist: detect-secrets>=1.4.0
|
|
23
|
+
Requires-Dist: fastmcp>=2.0.0
|
|
24
|
+
Requires-Dist: httpx>=0.27.0
|
|
25
|
+
Requires-Dist: networkx>=3.0
|
|
26
|
+
Requires-Dist: pydantic>=2.0.0
|
|
27
|
+
Requires-Dist: rich>=13.0.0
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: bandit>=1.7.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: pip-audit>=2.7.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# Cortec
|
|
36
|
+
|
|
37
|
+
**Local-first memory server for developer workflows.**
|
|
38
|
+
|
|
39
|
+
Cortec runs as an MCP server inside your coding environment. It remembers your project decisions, bugs, fixes, and session context and retrieves exactly the right memory when you need it. Everything stays on your machine.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## The Problem
|
|
44
|
+
|
|
45
|
+
Every developer hits the same wall: you finish a session, start a new one, and spend the first 20 minutes re-explaining what was already figured out. What database you chose and why. What that bug was and how you fixed it. What you decided not to do. That context doesn't live anywhere — it just disappears.
|
|
46
|
+
|
|
47
|
+
## What Cortec Does
|
|
48
|
+
|
|
49
|
+
Cortec stores that context as structured memories and retrieves them semantically when you need them. You ask it a question, it finds the right answer from your own history.
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
cortec remember "We use Chroma for vector storage — simpler local setup than Qdrant" \
|
|
53
|
+
--type decision --project myapp
|
|
54
|
+
|
|
55
|
+
cortec recall "vector database choice"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
╭── 6474b9db score=0.94 confidence=0.7 ──────────────────────────╮
|
|
60
|
+
│ We use Chroma for vector storage — simpler local setup than Qdrant │
|
|
61
|
+
╰── source=session project=myapp 2026-05-25 ─────────────────────╯
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Install
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install cortec-mcp
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
cortec init
|
|
74
|
+
cortec doctor
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Core Features
|
|
80
|
+
|
|
81
|
+
**Secret scanning** — before anything is stored, Cortec scans for API keys, tokens, passwords, and private keys. If it finds one, storage is blocked.
|
|
82
|
+
|
|
83
|
+
**Approval mode** — nothing is stored silently. By default, every memory goes through an approval step before it's indexed.
|
|
84
|
+
|
|
85
|
+
**Conflict detection** — if a new memory contradicts an existing one (Flask vs Django, Chroma vs Qdrant), Cortec flags it and asks you to resolve it before storing.
|
|
86
|
+
|
|
87
|
+
**Source citations** — every recalled memory tells you where it came from, when it was saved, and how confident the match is.
|
|
88
|
+
|
|
89
|
+
**Project isolation** — each project has its own memory space. A recall in one project never pulls from another.
|
|
90
|
+
|
|
91
|
+
**Memory types** — memories are categorized so you can filter by what you need:
|
|
92
|
+
|
|
93
|
+
| Type | What it stores |
|
|
94
|
+
|---|---|
|
|
95
|
+
| `decision` | A choice made about tech, design, or approach |
|
|
96
|
+
| `bug` | A bug or error encountered |
|
|
97
|
+
| `fix` | The solution that worked |
|
|
98
|
+
| `architecture` | A structural or design pattern decision |
|
|
99
|
+
| `preference` | A personal or team preference |
|
|
100
|
+
| `command` | A useful CLI command worth remembering |
|
|
101
|
+
| `dependency` | A library or package decision |
|
|
102
|
+
| `pattern` | A reusable solution pattern, often from Stack Overflow |
|
|
103
|
+
| `portfolio` | Something worth showcasing |
|
|
104
|
+
| `resume` | An achievement or skill |
|
|
105
|
+
| `general` | Anything else |
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## MCP Tools
|
|
110
|
+
|
|
111
|
+
Cortec exposes these tools to your coding environment:
|
|
112
|
+
|
|
113
|
+
| Tool | Description |
|
|
114
|
+
|---|---|
|
|
115
|
+
| `remember` | Store a memory — scans secrets, checks conflicts, gates approval |
|
|
116
|
+
| `recall` | Semantic search across your memory — filter by project and type |
|
|
117
|
+
| `summarize_session` | Summarize and archive a session automatically |
|
|
118
|
+
| `list_memories` | Browse stored memories with citations |
|
|
119
|
+
| `project_context` | Load full project memory grouped by type at session start |
|
|
120
|
+
| `index_github_repo` | Index a repo's commits, PRs, and issues as memories |
|
|
121
|
+
| `link_memory_to_commit` | Link a memory to a specific commit SHA |
|
|
122
|
+
| `commits_for_memory` | Find all memories linked to the same commit |
|
|
123
|
+
| `store_so_pattern` | Fetch a Stack Overflow answer and store it as a pattern |
|
|
124
|
+
| `recall_patterns` | Semantic search over stored Stack Overflow patterns |
|
|
125
|
+
| `build_graph` | Build a knowledge graph for a project and return its summary |
|
|
126
|
+
| `graph_neighbors` | Return memories connected to a given memory within N hops |
|
|
127
|
+
| `link_memories` | Explicitly link two memories in the knowledge graph |
|
|
128
|
+
| `draft_pr_summary` | Draft a PR description from project decisions, fixes, and bugs |
|
|
129
|
+
| `debug_suggest` | Find related bugs, fixes, and patterns for an error message |
|
|
130
|
+
| `build_portfolio` | Aggregate portfolio and resume memories into a Markdown export |
|
|
131
|
+
| `forget` | Permanently delete a memory |
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## CLI
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
cortec remember "text" --type decision --project myapp
|
|
139
|
+
cortec recall "query" --type bug
|
|
140
|
+
cortec approve <id>
|
|
141
|
+
cortec conflicts
|
|
142
|
+
cortec resolve <id>
|
|
143
|
+
cortec status
|
|
144
|
+
cortec export
|
|
145
|
+
cortec doctor
|
|
146
|
+
cortec audit
|
|
147
|
+
cortec github-index owner/repo --project myapp
|
|
148
|
+
cortec github-link <memory_id> <commit_sha>
|
|
149
|
+
cortec so-store https://stackoverflow.com/a/11227902
|
|
150
|
+
cortec so-search "async generator pattern"
|
|
151
|
+
cortec graph-summary --project myapp
|
|
152
|
+
cortec graph-neighbors <memory_id> --depth 2
|
|
153
|
+
cortec graph-link <memory_id_a> <memory_id_b>
|
|
154
|
+
cortec pr-draft --project myapp --context "refactor auth layer"
|
|
155
|
+
cortec debug "TypeError: cannot unpack non-sequence NoneType"
|
|
156
|
+
cortec portfolio --project myapp
|
|
157
|
+
cortec portfolio --markdown
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Confidence Scale
|
|
163
|
+
|
|
164
|
+
Every memory has a confidence score based on its source:
|
|
165
|
+
|
|
166
|
+
| Score | Source |
|
|
167
|
+
|---|---|
|
|
168
|
+
| 0.9 | User confirmed |
|
|
169
|
+
| 0.8 | GitHub commit or PR |
|
|
170
|
+
| 0.7 | Session summary |
|
|
171
|
+
| 0.6 | Stack Overflow pattern |
|
|
172
|
+
| 0.5 | Inferred |
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Current Status
|
|
177
|
+
|
|
178
|
+
**Phases 1–6 are complete.**
|
|
179
|
+
|
|
180
|
+
- MCP server with 17 tools
|
|
181
|
+
- SQLite metadata store + Chroma vector search
|
|
182
|
+
- Secret scanning (15 patterns), approval mode, conflict detection
|
|
183
|
+
- GitHub integration — index commits, PRs, and issues; link memories to commit SHAs
|
|
184
|
+
- Stack Overflow pattern store — fetch answers by URL, store and search locally
|
|
185
|
+
- Knowledge graph — connect memories by explicit links, shared tags, and type; traverse with BFS
|
|
186
|
+
- Agent workflows — PR draft, debug assist, and portfolio builder from memory
|
|
187
|
+
- Full CLI with 21 commands
|
|
188
|
+
- 100 tests passing
|
|
189
|
+
- Local-first — no cloud, no telemetry, no external services
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## GitHub Integration
|
|
194
|
+
|
|
195
|
+
Index any GitHub repo directly into your memory store:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
cortec github-index rajkumar-prog/cortec-mcp --project cortec
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
This pulls recent commits, pull requests, and issues and stores them as searchable memories. Commits get `confidence=0.8` — same as a verified GitHub source.
|
|
202
|
+
|
|
203
|
+
Link a memory you already have to the commit that caused or fixed it:
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
cortec github-link a1b2c3d4 79ac0d5e
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Or use the MCP tools directly from your coding environment — `index_github_repo`, `link_memory_to_commit`, `commits_for_memory`.
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Stack Overflow Pattern Store
|
|
214
|
+
|
|
215
|
+
When a Stack Overflow answer solves your problem, save it so you never search for it again:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
cortec so-store https://stackoverflow.com/a/11227902
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Cortec fetches content from the Stack Overflow URL (answer or question, using the best available answer), strips the HTML, and stores it as a `pattern` memory with `confidence=0.6`. Later, search it semantically:
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
cortec so-search "close file descriptor python"
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Or use the MCP tools directly — `store_so_pattern` and `recall_patterns` — from inside your coding environment.
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Knowledge Graph
|
|
232
|
+
|
|
233
|
+
Memories are connected automatically based on shared tags, memory type, and explicit links. Traverse that graph to discover what else is related to any memory.
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
# See the shape of a project's memory graph
|
|
237
|
+
cortec graph-summary --project myapp
|
|
238
|
+
|
|
239
|
+
# Find what's connected to a specific memory (up to 2 hops away)
|
|
240
|
+
cortec graph-neighbors a1b2c3d4 --depth 2
|
|
241
|
+
|
|
242
|
+
# Manually link two memories you know are related
|
|
243
|
+
cortec graph-link a1b2c3d4 e5f6g7h8
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Edges are weighted by connection strength:
|
|
247
|
+
|
|
248
|
+
| Weight | Reason |
|
|
249
|
+
|---|---|
|
|
250
|
+
| 1.0 | Explicit link (`graph-link` or `link_memories`) |
|
|
251
|
+
| 0.7 | Shared tag |
|
|
252
|
+
| 0.4 | Same memory type within the same project |
|
|
253
|
+
|
|
254
|
+
The `build_graph`, `graph_neighbors`, and `link_memories` MCP tools expose the same capability from inside your coding environment.
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## Agent Workflows
|
|
259
|
+
|
|
260
|
+
Three memory-powered assistants that synthesize stored knowledge into actionable output — no LLM calls, everything runs locally.
|
|
261
|
+
|
|
262
|
+
### PR Draft
|
|
263
|
+
|
|
264
|
+
Pull the latest decisions, fixes, and bugs from memory and get a ready-to-paste PR description:
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
cortec pr-draft --project myapp
|
|
268
|
+
cortec pr-draft --project myapp --context "refactor auth middleware"
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Or call `draft_pr_summary(project, context)` from your MCP environment.
|
|
272
|
+
|
|
273
|
+
### Debug Assist
|
|
274
|
+
|
|
275
|
+
Give Cortec an error message and it searches your stored bugs, fixes, and Stack Overflow patterns for relevant suggestions:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
cortec debug "TypeError: 'NoneType' object is not subscriptable"
|
|
279
|
+
cortec debug "connection refused 5432" --project myapp
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
Results are ranked by semantic score and grouped by type (bug, fix, pattern). Call `debug_suggest(error, project)` from MCP.
|
|
283
|
+
|
|
284
|
+
### Portfolio Builder
|
|
285
|
+
|
|
286
|
+
Aggregate everything worth showcasing into a structured summary or Markdown export:
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
cortec portfolio --project myapp
|
|
290
|
+
cortec portfolio --markdown > portfolio.md
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
Store portfolio items as you work:
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
cortec remember "Built semantic search over 10M tokens in < 200ms" --type portfolio
|
|
297
|
+
cortec remember "Led migration from Django to FastAPI, 3x throughput gain" --type resume
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Call `build_portfolio(project)` from MCP to get the same output programmatically.
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## Privacy
|
|
305
|
+
|
|
306
|
+
- All data stays local — no cloud upload, ever
|
|
307
|
+
- Full export and delete support
|
|
308
|
+
- Per-project memory isolation
|
|
309
|
+
- `.cortec/` folders excluded from git by default
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## License
|
|
314
|
+
|
|
315
|
+
MIT — Raj Kumar Satya
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
# Cortec
|
|
2
|
+
|
|
3
|
+
**Local-first memory server for developer workflows.**
|
|
4
|
+
|
|
5
|
+
Cortec runs as an MCP server inside your coding environment. It remembers your project decisions, bugs, fixes, and session context and retrieves exactly the right memory when you need it. Everything stays on your machine.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## The Problem
|
|
10
|
+
|
|
11
|
+
Every developer hits the same wall: you finish a session, start a new one, and spend the first 20 minutes re-explaining what was already figured out. What database you chose and why. What that bug was and how you fixed it. What you decided not to do. That context doesn't live anywhere — it just disappears.
|
|
12
|
+
|
|
13
|
+
## What Cortec Does
|
|
14
|
+
|
|
15
|
+
Cortec stores that context as structured memories and retrieves them semantically when you need them. You ask it a question, it finds the right answer from your own history.
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
cortec remember "We use Chroma for vector storage — simpler local setup than Qdrant" \
|
|
19
|
+
--type decision --project myapp
|
|
20
|
+
|
|
21
|
+
cortec recall "vector database choice"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
╭── 6474b9db score=0.94 confidence=0.7 ──────────────────────────╮
|
|
26
|
+
│ We use Chroma for vector storage — simpler local setup than Qdrant │
|
|
27
|
+
╰── source=session project=myapp 2026-05-25 ─────────────────────╯
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install cortec-mcp
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
cortec init
|
|
40
|
+
cortec doctor
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Core Features
|
|
46
|
+
|
|
47
|
+
**Secret scanning** — before anything is stored, Cortec scans for API keys, tokens, passwords, and private keys. If it finds one, storage is blocked.
|
|
48
|
+
|
|
49
|
+
**Approval mode** — nothing is stored silently. By default, every memory goes through an approval step before it's indexed.
|
|
50
|
+
|
|
51
|
+
**Conflict detection** — if a new memory contradicts an existing one (Flask vs Django, Chroma vs Qdrant), Cortec flags it and asks you to resolve it before storing.
|
|
52
|
+
|
|
53
|
+
**Source citations** — every recalled memory tells you where it came from, when it was saved, and how confident the match is.
|
|
54
|
+
|
|
55
|
+
**Project isolation** — each project has its own memory space. A recall in one project never pulls from another.
|
|
56
|
+
|
|
57
|
+
**Memory types** — memories are categorized so you can filter by what you need:
|
|
58
|
+
|
|
59
|
+
| Type | What it stores |
|
|
60
|
+
|---|---|
|
|
61
|
+
| `decision` | A choice made about tech, design, or approach |
|
|
62
|
+
| `bug` | A bug or error encountered |
|
|
63
|
+
| `fix` | The solution that worked |
|
|
64
|
+
| `architecture` | A structural or design pattern decision |
|
|
65
|
+
| `preference` | A personal or team preference |
|
|
66
|
+
| `command` | A useful CLI command worth remembering |
|
|
67
|
+
| `dependency` | A library or package decision |
|
|
68
|
+
| `pattern` | A reusable solution pattern, often from Stack Overflow |
|
|
69
|
+
| `portfolio` | Something worth showcasing |
|
|
70
|
+
| `resume` | An achievement or skill |
|
|
71
|
+
| `general` | Anything else |
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## MCP Tools
|
|
76
|
+
|
|
77
|
+
Cortec exposes these tools to your coding environment:
|
|
78
|
+
|
|
79
|
+
| Tool | Description |
|
|
80
|
+
|---|---|
|
|
81
|
+
| `remember` | Store a memory — scans secrets, checks conflicts, gates approval |
|
|
82
|
+
| `recall` | Semantic search across your memory — filter by project and type |
|
|
83
|
+
| `summarize_session` | Summarize and archive a session automatically |
|
|
84
|
+
| `list_memories` | Browse stored memories with citations |
|
|
85
|
+
| `project_context` | Load full project memory grouped by type at session start |
|
|
86
|
+
| `index_github_repo` | Index a repo's commits, PRs, and issues as memories |
|
|
87
|
+
| `link_memory_to_commit` | Link a memory to a specific commit SHA |
|
|
88
|
+
| `commits_for_memory` | Find all memories linked to the same commit |
|
|
89
|
+
| `store_so_pattern` | Fetch a Stack Overflow answer and store it as a pattern |
|
|
90
|
+
| `recall_patterns` | Semantic search over stored Stack Overflow patterns |
|
|
91
|
+
| `build_graph` | Build a knowledge graph for a project and return its summary |
|
|
92
|
+
| `graph_neighbors` | Return memories connected to a given memory within N hops |
|
|
93
|
+
| `link_memories` | Explicitly link two memories in the knowledge graph |
|
|
94
|
+
| `draft_pr_summary` | Draft a PR description from project decisions, fixes, and bugs |
|
|
95
|
+
| `debug_suggest` | Find related bugs, fixes, and patterns for an error message |
|
|
96
|
+
| `build_portfolio` | Aggregate portfolio and resume memories into a Markdown export |
|
|
97
|
+
| `forget` | Permanently delete a memory |
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## CLI
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
cortec remember "text" --type decision --project myapp
|
|
105
|
+
cortec recall "query" --type bug
|
|
106
|
+
cortec approve <id>
|
|
107
|
+
cortec conflicts
|
|
108
|
+
cortec resolve <id>
|
|
109
|
+
cortec status
|
|
110
|
+
cortec export
|
|
111
|
+
cortec doctor
|
|
112
|
+
cortec audit
|
|
113
|
+
cortec github-index owner/repo --project myapp
|
|
114
|
+
cortec github-link <memory_id> <commit_sha>
|
|
115
|
+
cortec so-store https://stackoverflow.com/a/11227902
|
|
116
|
+
cortec so-search "async generator pattern"
|
|
117
|
+
cortec graph-summary --project myapp
|
|
118
|
+
cortec graph-neighbors <memory_id> --depth 2
|
|
119
|
+
cortec graph-link <memory_id_a> <memory_id_b>
|
|
120
|
+
cortec pr-draft --project myapp --context "refactor auth layer"
|
|
121
|
+
cortec debug "TypeError: cannot unpack non-sequence NoneType"
|
|
122
|
+
cortec portfolio --project myapp
|
|
123
|
+
cortec portfolio --markdown
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Confidence Scale
|
|
129
|
+
|
|
130
|
+
Every memory has a confidence score based on its source:
|
|
131
|
+
|
|
132
|
+
| Score | Source |
|
|
133
|
+
|---|---|
|
|
134
|
+
| 0.9 | User confirmed |
|
|
135
|
+
| 0.8 | GitHub commit or PR |
|
|
136
|
+
| 0.7 | Session summary |
|
|
137
|
+
| 0.6 | Stack Overflow pattern |
|
|
138
|
+
| 0.5 | Inferred |
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Current Status
|
|
143
|
+
|
|
144
|
+
**Phases 1–6 are complete.**
|
|
145
|
+
|
|
146
|
+
- MCP server with 17 tools
|
|
147
|
+
- SQLite metadata store + Chroma vector search
|
|
148
|
+
- Secret scanning (15 patterns), approval mode, conflict detection
|
|
149
|
+
- GitHub integration — index commits, PRs, and issues; link memories to commit SHAs
|
|
150
|
+
- Stack Overflow pattern store — fetch answers by URL, store and search locally
|
|
151
|
+
- Knowledge graph — connect memories by explicit links, shared tags, and type; traverse with BFS
|
|
152
|
+
- Agent workflows — PR draft, debug assist, and portfolio builder from memory
|
|
153
|
+
- Full CLI with 21 commands
|
|
154
|
+
- 100 tests passing
|
|
155
|
+
- Local-first — no cloud, no telemetry, no external services
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## GitHub Integration
|
|
160
|
+
|
|
161
|
+
Index any GitHub repo directly into your memory store:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
cortec github-index rajkumar-prog/cortec-mcp --project cortec
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
This pulls recent commits, pull requests, and issues and stores them as searchable memories. Commits get `confidence=0.8` — same as a verified GitHub source.
|
|
168
|
+
|
|
169
|
+
Link a memory you already have to the commit that caused or fixed it:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
cortec github-link a1b2c3d4 79ac0d5e
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Or use the MCP tools directly from your coding environment — `index_github_repo`, `link_memory_to_commit`, `commits_for_memory`.
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Stack Overflow Pattern Store
|
|
180
|
+
|
|
181
|
+
When a Stack Overflow answer solves your problem, save it so you never search for it again:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
cortec so-store https://stackoverflow.com/a/11227902
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Cortec fetches content from the Stack Overflow URL (answer or question, using the best available answer), strips the HTML, and stores it as a `pattern` memory with `confidence=0.6`. Later, search it semantically:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
cortec so-search "close file descriptor python"
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Or use the MCP tools directly — `store_so_pattern` and `recall_patterns` — from inside your coding environment.
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Knowledge Graph
|
|
198
|
+
|
|
199
|
+
Memories are connected automatically based on shared tags, memory type, and explicit links. Traverse that graph to discover what else is related to any memory.
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
# See the shape of a project's memory graph
|
|
203
|
+
cortec graph-summary --project myapp
|
|
204
|
+
|
|
205
|
+
# Find what's connected to a specific memory (up to 2 hops away)
|
|
206
|
+
cortec graph-neighbors a1b2c3d4 --depth 2
|
|
207
|
+
|
|
208
|
+
# Manually link two memories you know are related
|
|
209
|
+
cortec graph-link a1b2c3d4 e5f6g7h8
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Edges are weighted by connection strength:
|
|
213
|
+
|
|
214
|
+
| Weight | Reason |
|
|
215
|
+
|---|---|
|
|
216
|
+
| 1.0 | Explicit link (`graph-link` or `link_memories`) |
|
|
217
|
+
| 0.7 | Shared tag |
|
|
218
|
+
| 0.4 | Same memory type within the same project |
|
|
219
|
+
|
|
220
|
+
The `build_graph`, `graph_neighbors`, and `link_memories` MCP tools expose the same capability from inside your coding environment.
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Agent Workflows
|
|
225
|
+
|
|
226
|
+
Three memory-powered assistants that synthesize stored knowledge into actionable output — no LLM calls, everything runs locally.
|
|
227
|
+
|
|
228
|
+
### PR Draft
|
|
229
|
+
|
|
230
|
+
Pull the latest decisions, fixes, and bugs from memory and get a ready-to-paste PR description:
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
cortec pr-draft --project myapp
|
|
234
|
+
cortec pr-draft --project myapp --context "refactor auth middleware"
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Or call `draft_pr_summary(project, context)` from your MCP environment.
|
|
238
|
+
|
|
239
|
+
### Debug Assist
|
|
240
|
+
|
|
241
|
+
Give Cortec an error message and it searches your stored bugs, fixes, and Stack Overflow patterns for relevant suggestions:
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
cortec debug "TypeError: 'NoneType' object is not subscriptable"
|
|
245
|
+
cortec debug "connection refused 5432" --project myapp
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Results are ranked by semantic score and grouped by type (bug, fix, pattern). Call `debug_suggest(error, project)` from MCP.
|
|
249
|
+
|
|
250
|
+
### Portfolio Builder
|
|
251
|
+
|
|
252
|
+
Aggregate everything worth showcasing into a structured summary or Markdown export:
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
cortec portfolio --project myapp
|
|
256
|
+
cortec portfolio --markdown > portfolio.md
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Store portfolio items as you work:
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
cortec remember "Built semantic search over 10M tokens in < 200ms" --type portfolio
|
|
263
|
+
cortec remember "Led migration from Django to FastAPI, 3x throughput gain" --type resume
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Call `build_portfolio(project)` from MCP to get the same output programmatically.
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Privacy
|
|
271
|
+
|
|
272
|
+
- All data stays local — no cloud upload, ever
|
|
273
|
+
- Full export and delete support
|
|
274
|
+
- Per-project memory isolation
|
|
275
|
+
- `.cortec/` folders excluded from git by default
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## License
|
|
280
|
+
|
|
281
|
+
MIT — Raj Kumar Satya
|