memkernel 0.2.0__py3-none-any.whl
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.
- memkernel/__init__.py +5 -0
- memkernel/api/__init__.py +2 -0
- memkernel/api/app.py +64 -0
- memkernel/api/routes/__init__.py +2 -0
- memkernel/api/routes/admin.py +44 -0
- memkernel/config.py +56 -0
- memkernel/core/__init__.py +2 -0
- memkernel/core/models.py +143 -0
- memkernel/core/ports.py +95 -0
- memkernel/core/services.py +485 -0
- memkernel/factory.py +71 -0
- memkernel/mcp/__init__.py +2 -0
- memkernel/mcp/server.py +94 -0
- memkernel/mcp/tools/__init__.py +2 -0
- memkernel/mcp/tools/memory.py +148 -0
- memkernel/mcp/tools/wiki.py +59 -0
- memkernel/memory/__init__.py +2 -0
- memkernel/memory/dedup.py +12 -0
- memkernel/memory/lifecycle.py +92 -0
- memkernel/memory/types.py +40 -0
- memkernel/py.typed +0 -0
- memkernel/retrieval/__init__.py +2 -0
- memkernel/retrieval/chunking.py +244 -0
- memkernel/retrieval/embeddings.py +39 -0
- memkernel/retrieval/search.py +235 -0
- memkernel/retrieval/sparse.py +137 -0
- memkernel/storage/__init__.py +3 -0
- memkernel/storage/chroma.py +256 -0
- memkernel/wiki/__init__.py +14 -0
- memkernel/wiki/pages.py +165 -0
- memkernel/wiki/sync.py +228 -0
- memkernel-0.2.0.dist-info/METADATA +327 -0
- memkernel-0.2.0.dist-info/RECORD +37 -0
- memkernel-0.2.0.dist-info/WHEEL +4 -0
- memkernel-0.2.0.dist-info/entry_points.txt +3 -0
- memkernel-0.2.0.dist-info/licenses/LICENSE +201 -0
- memkernel-0.2.0.dist-info/licenses/NOTICE +5 -0
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: memkernel
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Code-aware memory server for AI coding copilots
|
|
5
|
+
License: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
License-File: NOTICE
|
|
8
|
+
Author: EGOGE
|
|
9
|
+
Requires-Python: >=3.11,<3.14
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
16
|
+
Requires-Dist: chromadb (>=1.0,<2)
|
|
17
|
+
Requires-Dist: fastapi (>=0.115,<1)
|
|
18
|
+
Requires-Dist: mcp (>=1.25,<2)
|
|
19
|
+
Requires-Dist: pydantic (>=2.0,<3)
|
|
20
|
+
Requires-Dist: pydantic-settings (>=2.0,<3)
|
|
21
|
+
Requires-Dist: rank-bm25 (>=0.2)
|
|
22
|
+
Requires-Dist: sentence-transformers (>=4.0,<6)
|
|
23
|
+
Requires-Dist: tree-sitter (>=0.22,<1)
|
|
24
|
+
Requires-Dist: tree-sitter-python (>=0.23)
|
|
25
|
+
Project-URL: Repository, https://github.com/gosha70/memkernel
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# MemKernel
|
|
29
|
+
|
|
30
|
+
[](https://github.com/gosha70/memkernel/actions/workflows/ci.yml)
|
|
31
|
+
[](https://pypi.org/project/memkernel/)
|
|
32
|
+
[](pyproject.toml)
|
|
33
|
+
[](LICENSE)
|
|
34
|
+
|
|
35
|
+
Code-aware memory server for AI coding copilots.
|
|
36
|
+
|
|
37
|
+
MemKernel gives Claude Code (and any MCP-compatible copilot) persistent memory across sessions. When Claude compacts context or a session ends, project decisions, conventions, and code understanding are normally lost. MemKernel stores them in a local vector database and retrieves them on demand.
|
|
38
|
+
|
|
39
|
+
**Key differentiator**: MemKernel understands code as code. It uses tree-sitter AST parsing to chunk files at function and class boundaries, embeds chunks with scope context, and provides hybrid search (dense + BM25) for both semantic queries and exact identifier lookup.
|
|
40
|
+
|
|
41
|
+
**Tiered memory (0.2)**: memories live in three tiers with different persistence rules — *working* (the current task, hours), *short-term* (episodes and observations, decays unless recalled) and *long-term* (decisions, conventions, facts, procedures, code; never decays, replaced by supersession). Recall ranks by relevance, recency and importance; `consolidate` and `promote` move what proved useful into long-term memory; an LLM-wiki bridge keeps a human-readable, git-versioned copy of long-term knowledge. Design: [`docs/architecture/memory-tiers.md`](docs/architecture/memory-tiers.md).
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Requirements
|
|
46
|
+
|
|
47
|
+
- Python 3.11 – 3.13
|
|
48
|
+
- [Poetry](https://python-poetry.org) (for development installs)
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Install
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install memkernel
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Or with Poetry:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
poetry add memkernel
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Add to Claude Code
|
|
67
|
+
|
|
68
|
+
### 1. Register the MCP server
|
|
69
|
+
|
|
70
|
+
Add MemKernel to `.claude/settings.json` in your project:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"mcpServers": {
|
|
75
|
+
"memkernel": {
|
|
76
|
+
"command": "memkernel",
|
|
77
|
+
"args": [],
|
|
78
|
+
"env": {
|
|
79
|
+
"MEMKERNEL_PROJECT_ID": "my-project"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Replace `my-project` with a short identifier for the project — memories are isolated per project.
|
|
87
|
+
|
|
88
|
+
### 2. Add memory instructions to CLAUDE.md
|
|
89
|
+
|
|
90
|
+
Copy the contents of [`templates/claude-memory-instructions.md`](templates/claude-memory-instructions.md) into your project's `CLAUDE.md`. This tells Claude when and how to call the memory tools.
|
|
91
|
+
|
|
92
|
+
### 3. (Optional) Install lifecycle hooks
|
|
93
|
+
|
|
94
|
+
Copy the hook scripts from [`templates/hooks/`](templates/hooks/) to `.claude/hooks/` and register them in `.claude/settings.json`:
|
|
95
|
+
|
|
96
|
+
| Hook | Claude Code event | What it does |
|
|
97
|
+
|------|-------------------|--------------|
|
|
98
|
+
| `session-start.py` | `SessionStart` | Consolidates, recovers the latest checkpoint and long-term context, lists promotion candidates |
|
|
99
|
+
| `pre-compact.py` | `PreCompact` | Retains a checkpoint episode, runs a consolidation pass |
|
|
100
|
+
| `post-compact.py` | `PostCompact` | Re-injects the checkpoint, long-term context and promotion candidates |
|
|
101
|
+
|
|
102
|
+
See the Prerequisites section inside each script for the Python environment requirement.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## MCP Tools
|
|
107
|
+
|
|
108
|
+
| Tool | What it does |
|
|
109
|
+
|------|-------------|
|
|
110
|
+
| `retain(content, type, session_id?, checkpoint?, source?, importance?, tags?, supersedes?)` | Store a memory. Returns `ref_id`. Idempotent — identical content + type returns the same `ref_id`. `supersedes` hides the memory it replaces. |
|
|
111
|
+
| `recall(query, type?, tier?, session_id?, checkpoint_only?, top_k?)` | Search by natural language or identifier. Returns lightweight `ArtifactRef` list ranked by relevance + recency + importance. Records an access (reinforces retention). |
|
|
112
|
+
| `get(ref_id)` | Fetch full content of a specific memory. Records an access. |
|
|
113
|
+
| `forget(ref_id)` | Delete a memory from all indexes. |
|
|
114
|
+
| `promote(ref_id, type, content?, importance?, tags?)` | Turn a short-term/working memory into a long-term one (you supply the distilled text). Keeps provenance via `promoted_from`. |
|
|
115
|
+
| `consolidate(session_id?, limit?)` | Purge expired short-term memories and list the ones most worth promoting (ranked by importance × how often they were recalled). |
|
|
116
|
+
| `forget_expired()` | Delete every short-term/working memory whose retention window lapsed. |
|
|
117
|
+
| `wiki_export(wiki_dir?)` | Compile long-term memories without a wiki page into draft markdown pages (`index.md`, `log.md` updated). |
|
|
118
|
+
| `wiki_import(wiki_dir?)` | Index curated wiki pages as long-term memories (idempotent; changed pages supersede). |
|
|
119
|
+
|
|
120
|
+
### Memory types and tiers
|
|
121
|
+
|
|
122
|
+
| Type | Tier | Use for | Default importance | Expiry |
|
|
123
|
+
|------|------|---------|--------------------|--------|
|
|
124
|
+
| `decision` | long-term | Architecture choices, library selections | 0.9 | Never (supersede instead) |
|
|
125
|
+
| `convention` | long-term | Naming rules, code style, project patterns | 0.9 | Never |
|
|
126
|
+
| `fact` | long-term | Durable project facts: build commands, environments, contracts | 0.7 | Never |
|
|
127
|
+
| `procedure` | long-term | How-to that worked: workflows, recipes, verified skills | 0.8 | Never |
|
|
128
|
+
| `code` | long-term | Function/class snapshots, API contracts | 0.6 | Never |
|
|
129
|
+
| `episode` | short-term | Session events, compaction checkpoints | 0.4 | 30 days, extended by every recall |
|
|
130
|
+
| `observation` | short-term | Findings, tool outputs, things noticed | 0.3 | 7 days, extended by every recall |
|
|
131
|
+
| `task` | working | The current goal, plan state, open questions | 0.5 | 24 hours |
|
|
132
|
+
|
|
133
|
+
Retention: `ttl = base_ttl × (1 + access_boost × access_count)`, measured from the later of creation and last access. Long-term memories never expire; a newer memory that `supersedes` an older one hides it from recall.
|
|
134
|
+
|
|
135
|
+
### Session protocol
|
|
136
|
+
|
|
137
|
+
1. **Session start** — `recall(tier="long_term", query=<task>)`, plus the latest checkpoint (`checkpoint_only=true`). The `session-start.py` hook does this and prints promotion candidates.
|
|
138
|
+
2. **While working** — `retain(type="task")` when the plan changes; `retain(type="observation")` for findings; durable knowledge as `decision` / `convention` / `fact` / `procedure`.
|
|
139
|
+
3. **Before compaction** — `retain(type="episode", checkpoint=true)` (the `pre-compact.py` hook) and `consolidate()`.
|
|
140
|
+
4. **After compaction / end of phase** — `promote(ref_id, type, content)` for the candidates worth keeping.
|
|
141
|
+
5. **Curate** — `wiki_export` → review the drafts → `wiki_import`.
|
|
142
|
+
|
|
143
|
+
### Quick examples
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
retain(
|
|
147
|
+
content="We chose PostgreSQL over SQLite because the team needs concurrent writes",
|
|
148
|
+
type="decision",
|
|
149
|
+
session_id="session-2024-06-01"
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
recall(query="database choice", top_k=5)
|
|
153
|
+
|
|
154
|
+
recall(query="session checkpoint", checkpoint_only=True)
|
|
155
|
+
|
|
156
|
+
retain(content="pytest hangs unless MEMKERNEL_PROJECT_ID is set", type="observation", tags=["ci"])
|
|
157
|
+
|
|
158
|
+
consolidate() # -> {"purged": 0, "candidates": [{"ref_id": ..., "access_count": 3, ...}]}
|
|
159
|
+
|
|
160
|
+
promote(ref_id="<candidate>", type="fact", content="CI must export MEMKERNEL_PROJECT_ID before pytest.")
|
|
161
|
+
|
|
162
|
+
retain(content="Use arq, not Celery", type="decision", supersedes="<old decision ref_id>")
|
|
163
|
+
|
|
164
|
+
get(ref_id="<ref_id from recall>")
|
|
165
|
+
|
|
166
|
+
forget(ref_id="<ref_id>")
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Configuration
|
|
172
|
+
|
|
173
|
+
All settings are read from environment variables with the `MEMKERNEL_` prefix, or from a `.env` file.
|
|
174
|
+
|
|
175
|
+
| Variable | Default | Description |
|
|
176
|
+
|----------|---------|-------------|
|
|
177
|
+
| `MEMKERNEL_PROJECT_ID` | `default` | Project namespace — memories are isolated per project |
|
|
178
|
+
| `MEMKERNEL_DEFAULT_SESSION_ID` | `default` | Session tag applied when `session_id` is omitted from `retain` |
|
|
179
|
+
| `MEMKERNEL_CHROMA_PERSIST_PATH` | `.memkernel/chroma` | ChromaDB data directory. Empty string = in-memory (ephemeral) |
|
|
180
|
+
| `MEMKERNEL_CHROMA_COLLECTION_PREFIX` | `memkernel` | Prefix for ChromaDB collection names (`{prefix}_{project_id}`) |
|
|
181
|
+
| `MEMKERNEL_EMBEDDING_MODEL` | `all-MiniLM-L6-v2` | Sentence-transformers model name |
|
|
182
|
+
| `MEMKERNEL_EMBEDDING_DIMENSION` | `384` | Output dimension of the embedding model |
|
|
183
|
+
| `MEMKERNEL_SEARCH_TOP_K` | `5` | Default number of results returned by `recall` |
|
|
184
|
+
| `MEMKERNEL_RRF_K` | `60` | Reciprocal rank fusion constant (higher = flatter score distribution) |
|
|
185
|
+
| `MEMKERNEL_PREVIEW_LENGTH` | `200` | Max characters in the `preview` field of `ArtifactRef` |
|
|
186
|
+
| `MEMKERNEL_CHUNK_SIZE` | `1500` | Max characters per AST chunk (code memories) |
|
|
187
|
+
| `MEMKERNEL_CHUNK_OVERLAP` | `200` | Character overlap between token-based fallback chunks |
|
|
188
|
+
| `MEMKERNEL_EPISODE_TTL_DAYS` | `30` | Base TTL for `episode` memories (short-term) |
|
|
189
|
+
| `MEMKERNEL_OBSERVATION_TTL_DAYS` | `7` | Base TTL for `observation` memories (short-term) |
|
|
190
|
+
| `MEMKERNEL_TASK_TTL_HOURS` | `24` | Base TTL for `task` memories (working) |
|
|
191
|
+
| `MEMKERNEL_ACCESS_BOOST` | `0.5` | Each recall extends a short-term memory's TTL by this fraction of its base TTL |
|
|
192
|
+
| `MEMKERNEL_RECENCY_HALF_LIFE_DAYS` | `7.0` | Recency decay half-life used in recall scoring (short-term tier) |
|
|
193
|
+
| `MEMKERNEL_RECALL_WEIGHT_RELEVANCE` | `1.0` | Weight of hybrid-search relevance in the final recall score |
|
|
194
|
+
| `MEMKERNEL_RECALL_WEIGHT_RECENCY` | `0.3` | Weight of recency in the final recall score |
|
|
195
|
+
| `MEMKERNEL_RECALL_WEIGHT_IMPORTANCE` | `0.3` | Weight of importance in the final recall score |
|
|
196
|
+
| `MEMKERNEL_WIKI_DIR` | `` | Directory of the LLM wiki used by `wiki_export` / `wiki_import` (empty = pass `wiki_dir` explicitly) |
|
|
197
|
+
| `MEMKERNEL_TRANSPORT` | `stdio` | `stdio` or `streamable-http` |
|
|
198
|
+
| `MEMKERNEL_HOST` | `127.0.0.1` | Host for `streamable-http` transport |
|
|
199
|
+
| `MEMKERNEL_PORT` | `8765` | Port for `streamable-http` transport |
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Transports
|
|
204
|
+
|
|
205
|
+
### stdio (default)
|
|
206
|
+
|
|
207
|
+
Used by Claude Code and most MCP clients. The client spawns the server as a subprocess.
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
memkernel # stdio, uses defaults
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Streamable HTTP
|
|
214
|
+
|
|
215
|
+
For persistent server processes or multi-client setups:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
MEMKERNEL_TRANSPORT=streamable-http memkernel
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
The server listens at `http://127.0.0.1:8765/mcp` by default.
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Embedding MemKernel in your own harness
|
|
226
|
+
|
|
227
|
+
```python
|
|
228
|
+
from memkernel.factory import build_service
|
|
229
|
+
from memkernel.core.models import MemoryType
|
|
230
|
+
|
|
231
|
+
svc = build_service() # settings from MEMKERNEL_* env vars
|
|
232
|
+
svc.retain("Use Postgres", MemoryType.DECISION)
|
|
233
|
+
for ref in svc.recall("database"):
|
|
234
|
+
print(ref.tier, ref.score, ref.preview)
|
|
235
|
+
report = svc.consolidate() # {"purged": n, "candidates": [...]}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
`build_service()` is the supported entry point; the MCP server, the admin API and the hook templates all use it. Integration notes for `code-copilot-team` and `haa` are in [`docs/integration/harness-integration.md`](docs/integration/harness-integration.md).
|
|
239
|
+
|
|
240
|
+
## LLM wiki bridge
|
|
241
|
+
|
|
242
|
+
Long-term memory has a human-readable twin: a markdown wiki in the [LLM Wiki](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f) pattern (`index.md`, `log.md`, typed pages with cited sources — the same schema as `code-copilot-team/knowledge/wiki`).
|
|
243
|
+
|
|
244
|
+
- `wiki_export` compiles every long-term memory that has no page yet into a **draft** page under `decisions/`, `concepts/` or `workflows/`, with the required sections and a `memkernel://<project>/<ref_id>` citation. Existing pages are never overwritten.
|
|
245
|
+
- `wiki_import` indexes curated pages as long-term memories so `recall` finds the reviewed version; a changed page supersedes its earlier memory.
|
|
246
|
+
|
|
247
|
+
Set `MEMKERNEL_WIKI_DIR` (for example `knowledge/wiki`) or pass `wiki_dir` to the tools. Rationale and the proposed standalone `ai-wiki` repo: [`docs/adr/ADR-008-llm-wiki-as-semantic-layer.md`](docs/adr/ADR-008-llm-wiki-as-semantic-layer.md).
|
|
248
|
+
|
|
249
|
+
## Admin API
|
|
250
|
+
|
|
251
|
+
A FastAPI admin server provides health and stats endpoints (independent of MCP):
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
uvicorn memkernel.api.app:app --host 127.0.0.1 --port 8766
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
| Endpoint | Description |
|
|
258
|
+
|----------|-------------|
|
|
259
|
+
| `GET /health` | Server health and memory count |
|
|
260
|
+
| `GET /stats` | Total memory count, per-type and per-tier breakdown, growth rate, last recall latency |
|
|
261
|
+
| `GET /collections` | List ChromaDB collections |
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Development
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
git clone https://github.com/gosha70/memkernel
|
|
269
|
+
cd memkernel
|
|
270
|
+
poetry install
|
|
271
|
+
poetry run pytest --tb=short -q # full test suite
|
|
272
|
+
poetry run pytest -m "not slow" -q # skip slow tests
|
|
273
|
+
ruff check . && mypy src/ # lint + type check
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
CI runs on every push and PR: lint, type check, tests (≥ 80% coverage), security scan, and build verification.
|
|
277
|
+
|
|
278
|
+
### Releasing
|
|
279
|
+
|
|
280
|
+
Releases are published to PyPI by [`.github/workflows/release.yml`](.github/workflows/release.yml) using trusted publishing (no token in the repo). To cut a release:
|
|
281
|
+
|
|
282
|
+
1. Set `version` in `pyproject.toml` and move the `[Unreleased]` entries in [`CHANGELOG.md`](CHANGELOG.md) under the new version.
|
|
283
|
+
2. Merge to `main` with CI green.
|
|
284
|
+
3. Tag and push: `git tag -a v0.2.0 -m "memkernel 0.2.0" && git push origin v0.2.0`.
|
|
285
|
+
|
|
286
|
+
The workflow refuses a tag that does not match the `pyproject.toml` version, builds the sdist and wheel, smoke-installs the wheel, and uploads through the `pypi` environment.
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## Architecture
|
|
291
|
+
|
|
292
|
+
```
|
|
293
|
+
src/memkernel/
|
|
294
|
+
├── mcp/ # MCP server + tool definitions (memory tools, wiki tools)
|
|
295
|
+
├── core/ # Domain models (tiers, types), MemoryService, ports (interfaces)
|
|
296
|
+
├── storage/ # ChromaDB adapter
|
|
297
|
+
├── retrieval/ # AST chunking, embeddings, hybrid search (dense + BM25 + RRF + rescoring)
|
|
298
|
+
├── memory/ # Lifecycle: TTL/decay policies, retention, deduplication
|
|
299
|
+
├── wiki/ # LLM-wiki bridge: page model, export, import
|
|
300
|
+
├── api/ # FastAPI admin endpoints
|
|
301
|
+
├── factory.py # build_service() — the supported embedding entry point
|
|
302
|
+
└── config.py # Pydantic settings
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
Ports-and-adapters design: `core/` depends only on protocols in `core/ports.py`, never on concrete backends. Storage and embedding backends are swappable.
|
|
306
|
+
|
|
307
|
+
Further reading: [`docs/architecture/memory-tiers.md`](docs/architecture/memory-tiers.md) (design), [`docs/research/memory-literature-review.md`](docs/research/memory-literature-review.md) (HRM, JEPA, MemGPT, Mem0, Zep, HippoRAG, Generative Agents, Titans, …), [`docs/research/sibling-projects.md`](docs/research/sibling-projects.md) (what is shared with rlm-studio, document-assistant, ragkit, code-copilot-team, haa), [`docs/adr/`](docs/adr/), [`docs/roadmap.md`](docs/roadmap.md).
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## Related projects
|
|
312
|
+
|
|
313
|
+
MemKernel is the memory component of a small family of projects by the same author; each is usable on its own.
|
|
314
|
+
|
|
315
|
+
| Project | Role | Relationship |
|
|
316
|
+
|---|---|---|
|
|
317
|
+
| [ai-wiki](https://github.com/gosha70/ai-wiki) | LLM-maintained markdown wiki (ingest / promote / query / lint) | the human-readable form of long-term memory; `wiki_export` / `wiki_import` speak its page schema (ADR-008) |
|
|
318
|
+
| [rlm-studio](https://github.com/gosha70/rlm-studio) | Recursive Language Models workbench: Direct / RAG / RLM / auto over large documents | the document layer; planned `document` memory type and `ask()` tool (ADR-009) |
|
|
319
|
+
| [code-copilot-team](https://github.com/gosha70/code-copilot-team) | Enforceable harness configuration for Claude Code, Pi and other copilots | consumes MemKernel through MCP and hooks |
|
|
320
|
+
| [haa](https://github.com/gosha70/haa) | Home-built AI coding harness, future component assembler | consumes MemKernel in-process through `build_service()` |
|
|
321
|
+
|
|
322
|
+
The cross-repository sequence is in [`docs/roadmap.md`](docs/roadmap.md).
|
|
323
|
+
|
|
324
|
+
## License
|
|
325
|
+
|
|
326
|
+
Apache-2.0. See [`LICENSE`](LICENSE) and [`NOTICE`](NOTICE). Changes are tracked in [`CHANGELOG.md`](CHANGELOG.md).
|
|
327
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
memkernel/__init__.py,sha256=XTJrttz6-zHFgI9CRc0J6z8zxQ09qVZ3KsK6o2c0fBw,157
|
|
2
|
+
memkernel/api/__init__.py,sha256=mNHcp80cLqGmoFQTxAA2FPr0mVvvEektDQrE-1sMapo,65
|
|
3
|
+
memkernel/api/app.py,sha256=JXA84sDC7FfagiNVKyYwpqE0R94XopQw3HRi_NJwoxo,1805
|
|
4
|
+
memkernel/api/routes/__init__.py,sha256=mNHcp80cLqGmoFQTxAA2FPr0mVvvEektDQrE-1sMapo,65
|
|
5
|
+
memkernel/api/routes/admin.py,sha256=jYnyiG3BQJ9MGrJGj9ptgn6l3rAybGR77Y2fR4tcxFM,1232
|
|
6
|
+
memkernel/config.py,sha256=nyXLK71jjt6Dn3MFscc8ve7GKzhM_BDNgTr8KcZObKw,2003
|
|
7
|
+
memkernel/core/__init__.py,sha256=mNHcp80cLqGmoFQTxAA2FPr0mVvvEektDQrE-1sMapo,65
|
|
8
|
+
memkernel/core/models.py,sha256=5-0zGmAQmlI2Z9CfQB8-UmJRaI-kSig6tjxpoIHvvaQ,4466
|
|
9
|
+
memkernel/core/ports.py,sha256=XA-6HsSoUPBLr0d_LU2AkUAgo-Nf2S60tscOo5Pvc4E,2567
|
|
10
|
+
memkernel/core/services.py,sha256=Im2u8zpsoUVpgXruo2NICLRm2Da9rqJoCL8Se_VDIqI,19613
|
|
11
|
+
memkernel/factory.py,sha256=eOydzAmopdx2jUiuO64v_2LSdU5hhjHWydN8OzHe4kc,2469
|
|
12
|
+
memkernel/mcp/__init__.py,sha256=mNHcp80cLqGmoFQTxAA2FPr0mVvvEektDQrE-1sMapo,65
|
|
13
|
+
memkernel/mcp/server.py,sha256=1BW5U17RIIFKQz3IlMtSwbcyE27T7Od9TU2wE9HLI9w,2964
|
|
14
|
+
memkernel/mcp/tools/__init__.py,sha256=mNHcp80cLqGmoFQTxAA2FPr0mVvvEektDQrE-1sMapo,65
|
|
15
|
+
memkernel/mcp/tools/memory.py,sha256=PRQFIl-hFGPoF6Ggifd5MlxSSIOUBtx8M-rxiPpAlyw,5365
|
|
16
|
+
memkernel/mcp/tools/wiki.py,sha256=kPtHwrtKbd5awCSjZwCQymgGjbRxmW4AfEbccGvfiJE,2388
|
|
17
|
+
memkernel/memory/__init__.py,sha256=mNHcp80cLqGmoFQTxAA2FPr0mVvvEektDQrE-1sMapo,65
|
|
18
|
+
memkernel/memory/dedup.py,sha256=ErzESPmD5M9_o7OYSGzwJnYOAQrQ9OeYR0BhsP7RZ6s,348
|
|
19
|
+
memkernel/memory/lifecycle.py,sha256=ChNMwu0JwBMGha9S0YtPh4o3DUkNOzV4783qU-FEQzM,3125
|
|
20
|
+
memkernel/memory/types.py,sha256=0x5vOi1M69jERa2esctywEwU0crdc1CuTLoJpxuOAmc,1519
|
|
21
|
+
memkernel/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
+
memkernel/retrieval/__init__.py,sha256=mNHcp80cLqGmoFQTxAA2FPr0mVvvEektDQrE-1sMapo,65
|
|
23
|
+
memkernel/retrieval/chunking.py,sha256=R2F8GDL6mfoC-N4RVDn6vp6QzQqIZvj_Snetyu5kLRA,9266
|
|
24
|
+
memkernel/retrieval/embeddings.py,sha256=_M_AEuzyv8IcY-qa4FugNfUI30RDnDBCreCDvRVygRQ,1397
|
|
25
|
+
memkernel/retrieval/search.py,sha256=-stsVD_gYwoPIE-9DmcrgfziP6Aj_Nr6erJwY-FHSfM,8596
|
|
26
|
+
memkernel/retrieval/sparse.py,sha256=kxVpFyVWyvz-LOuZclzXybKVltmNObPpdoCDx0A2byE,5172
|
|
27
|
+
memkernel/storage/__init__.py,sha256=RLpLupS7t-et_gBEABe9nsqKS_XyRbbQUBPEDOFxkXc,103
|
|
28
|
+
memkernel/storage/chroma.py,sha256=sc3WDLO6kXj_G00Y8RvH-4eWgYkdBJbl2W-lrE3hhgM,9893
|
|
29
|
+
memkernel/wiki/__init__.py,sha256=823r2kQbfaERZi2jsQhgaq4Q9wuWPvSHXgOfbgE-2yQ,678
|
|
30
|
+
memkernel/wiki/pages.py,sha256=SCuECfwY7_4IPL7SD3algUUGg8ylUIqUySFOJ5TXS0g,5444
|
|
31
|
+
memkernel/wiki/sync.py,sha256=RhCdcoi1ljDYbI3nYJ1dxALTAiL-qFvlsZBKc5ha0lo,9242
|
|
32
|
+
memkernel-0.2.0.dist-info/METADATA,sha256=jaIqSt1DdC_uKi_mXQjx9pqScOQFTchLiabDA5tjbrA,16578
|
|
33
|
+
memkernel-0.2.0.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
|
|
34
|
+
memkernel-0.2.0.dist-info/entry_points.txt,sha256=KZGxB8VPItkaN4fXH0-jWWplwM5rs5ztsE4It5n3YQI,55
|
|
35
|
+
memkernel-0.2.0.dist-info/licenses/LICENSE,sha256=SSOs-lvqojzz5yjB5evje2DcUkBGNev_WqGbTzRFOjc,11302
|
|
36
|
+
memkernel-0.2.0.dist-info/licenses/NOTICE,sha256=BG9b13wDE8o9WmloH8MTzNiD2c45hTCE0Df9QdzMOLc,136
|
|
37
|
+
memkernel-0.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 EGOGE
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|