memorykit 0.6.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.
@@ -0,0 +1,233 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+ # Temporary file for partial code execution
204
+ tempCodeRunnerFile.py
205
+
206
+ # Ruff stuff:
207
+ .ruff_cache/
208
+
209
+ # PyPI configuration file
210
+ .pypirc
211
+
212
+ # Marimo
213
+ marimo/_static/
214
+ marimo/_lsp/
215
+ __marimo__/
216
+
217
+ # Streamlit
218
+ .streamlit/secrets.toml
219
+
220
+ # Claude Code plugin cache / local validation
221
+ .claude/
222
+ *.tq
223
+ *.tvim
224
+
225
+ # rtk (Rust Token Killer) local config — machine-specific, not published
226
+ .rtk/
227
+
228
+ # Internal dev process artifacts (brainstorm specs / implementation plans) — kept local, not published
229
+ docs/superpowers/
230
+
231
+ # MemPalace per-project files (issue #185)
232
+ mempalace.yaml
233
+ entities.json
@@ -0,0 +1,230 @@
1
+ # Changelog
2
+
3
+ ## 0.6.0 — 2026-08-09
4
+
5
+ - **Package the memory contract, validator, and MCP server as `memorykit`, ready
6
+ to publish to PyPI** (ADR-0006 item 3, ADR-0009). Nothing is uploaded yet and
7
+ the name is unclaimed; publishing is a separate, deliberate act. The
8
+ implementation moved to
9
+ `src/memorykit/{provider,mcp}.py` and is installable as `memorykit`, which
10
+ provides the `memorykit` and `memorykit-mcp` console scripts. The package has
11
+ **no Python package dependencies** — that property is what makes this unit
12
+ separable from the plugin at all, and it is now enforced by a test rather than
13
+ a convention. It is not free of *system* dependencies: `validate` and
14
+ `capture` shell out to `git check-ref-format`, so `git` must be on `PATH`.
15
+ That is documented rather than removed, because reimplementing Git's refname
16
+ rules would be an unreviewed reimplementation and skipping the check would
17
+ silently weaken provenance.
18
+ - The two files moved whole. `memory-provider.py` was not split along its
19
+ contract/validator/provider/CLI seams: `capture` needs the review-state
20
+ machine, and the MCP server needs the provider, so no narrower cut is a
21
+ working unit. Single-file-ness is a property of that script, not an accident.
22
+ - `scripts/memory-provider.py` and `mcp/server.py` remain as launchers, so
23
+ `hooks/hooks.json`, `.mcp.json`, the slash commands, and every reference doc
24
+ keep working unchanged. Unlike the `indexkit` launcher, these prefer the
25
+ **bundled** source over an installed package, so plugin version X always runs
26
+ provider version X.
27
+ - Fix `_indexkit_root()`, which resolved a fixed `parents[2]`. That is correct
28
+ for at most one of the two deployment shapes; it now walks ancestors for a
29
+ directory that actually contains the launcher, and finds nothing (rather than
30
+ something wrong) in `site-packages`.
31
+
32
+ ## 0.5.5 — 2026-08-09
33
+
34
+ - Correct the `rag` provider reference, which described a bootstrapped venv as
35
+ the only runtime and `doctor` as verifying that venv. `indexkit` is published
36
+ on PyPI, and `doctor` reports `ready` for a packaged install too, so agents
37
+ loading this reference were giving stale `uv`-only instructions. Also record
38
+ the one asymmetry that survives: the launcher prefers an existing venv over
39
+ `PATH`, so a packaged install does not displace a stale venv.
40
+
41
+ ## 0.5.4 — 2026-08-08
42
+
43
+ - Assess criteria 2 and 5 explicitly for adrkit. The table claimed criteria
44
+ "1, 3, 6–12" (nine) while the conclusion said 11 of 12, leaving 2 and 5
45
+ silently unclassified. Both pass; the qualification is now internally complete.
46
+
47
+ ## 0.5.3 — 2026-08-08
48
+
49
+ - Record adrkit in the provider decision table as a peer corpus rather than a
50
+ provider, with the trust-model reason it cannot be one and the promotion path
51
+ from a `type: decision` record to a ratified ADR (ADR-0003).
52
+
53
+ ## 0.5.2 — 2026-08-08
54
+
55
+ - Fix a real failure in the pre-rename compatibility path. `store_env` and the
56
+ runtime probe set only `CONTEXT_KIT_INDEXKIT_HOME`, but a legacy `bin/rag`
57
+ launcher — which `_bundled_executable` can legitimately resolve — reads only
58
+ `CONTEXT_KIT_LOCAL_RAG_HOME`. With `CONTEXT_KIT_DATA` redirected to the
59
+ isolated provider store, that launcher looked for its venv inside the store
60
+ and failed. Both names are now exported to the same resolved path.
61
+ - Restore pre-rename CHANGELOG entries to their original wording, so an old
62
+ release's notes remain usable for diagnosing that version.
63
+
64
+ ## 0.5.1 — 2026-08-08
65
+
66
+ - Move the `rag` provider's tested-version pin to indexkit 0.6.x, the release
67
+ this adapter is exercised against.
68
+
69
+ ## 0.5.0 — 2026-08-08
70
+
71
+ - Track the `local-rag` → `indexkit` rename (ADR-0007) without breaking existing
72
+ installs. Provider resolution now accepts both names: `CONTEXT_KIT_INDEXKIT_BIN`
73
+ with `CONTEXT_KIT_RAG_BIN` as fallback, both `indexkit` and `rag` on PATH, and
74
+ either sibling plugin directory.
75
+ - Add declarative `legacy_bin_env` / `legacy_executables` to `ProviderSpec`, so the
76
+ migration is provider data rather than branching in the resolver.
77
+ - The `rag` provider identifier is unchanged; existing configuration keeps working.
78
+
79
+ ## 0.4.0 — 2026-08-05
80
+
81
+ - **Correct a documented falsehood.** Several docs claimed GitHub Copilot does
82
+ not run Claude hooks. Verified false against a live Copilot CLI install
83
+ (1.0.79): Copilot loads a plugin's `hooks/hooks.json` using the same
84
+ PascalCase event names, honors an `additionalContext` string on stdout, and
85
+ bootstraps plugin data at `~/.copilot/plugin-data/<marketplace>/<plugin>/`.
86
+ APM still does not deploy hooks. Docs now state the real host matrix.
87
+ - `wake` is now a provider-neutral session digest built from local records
88
+ rather than a MemPalace passthrough. Records are the system of record and a
89
+ provider store is a projection of them, so the digest is identical under
90
+ `none`, `rag`, and `mempalace`. It is bounded by record count and character
91
+ budget, ordered by recency, flags drifted or missing sources, and offers
92
+ `--format text` for injection.
93
+ - Add a `SessionStart` hook that emits that digest as `additionalContext`, so
94
+ reviewed memory primes a session on both hosts that load hooks. Gated on its
95
+ own `CONTEXT_KIT_MEMORY_RECALL_ON_START` switch rather than on
96
+ `AUTO_CAPTURE`, because reading is not writing, and it degrades to `{}`
97
+ rather than ever failing a session start.
98
+ - Add `audit`, a store-wide sweep for records whose cited source drifted or
99
+ vanished. It reports and proposes an exact `record-state` command; unlike
100
+ MemPalace's `sync` it never prunes, because evidence is the reason a memory
101
+ can be trusted later and a moved file is not proof a decision was wrong.
102
+ - Tool-level hooks are deliberately **not** used. Measured on a real Copilot
103
+ corpus, `preToolUse` and `postToolUse` fire 23,683 and 35,083 times against
104
+ ~1,800 for the session boundaries, so hooking them would spawn a process per
105
+ tool call to capture noise, and would amount to the continuous transcript
106
+ harvesting the memory contract forbids.
107
+ - Drop the obsolete `wake-up` capability probe. `wake` is now built from local
108
+ records for every provider, so requiring `wake-up` would refuse a MemPalace
109
+ install over a command the adapter never calls. Delegation is not restored:
110
+ MemPalace's `wake-up` returns its own mined L0/L1 context, which is
111
+ unreviewed, and returning it would violate the active-only, reviewed-only
112
+ recall contract.
113
+ - Fix venv resolution for the `rag` provider on Copilot. 0.3.0 dropped
114
+ `CLAUDE_PLUGIN_DATA` because it is plugin-scoped, but that also lost the
115
+ ability to locate the dependency. Both hosts lay plugin data out as
116
+ `<root>/<plugin>`, so local-rag's home is resolved as a **sibling** of
117
+ memory's, and only when it exists.
118
+
119
+ ## 0.3.0 — 2026-08-04
120
+
121
+ - Add an optional stdio MCP server (`mcp/server.py` plus `.mcp.json`) exposing
122
+ `memory_recall`, `memory_capture`, and `memory_review`, so hosts that consume
123
+ skills plus MCP rather than Claude plugins can use durable memory. Standard
124
+ library only, no daemon, no Claude hooks. It shells out to
125
+ `memory-provider.py` with exact argv so the CLI and MCP paths cannot drift.
126
+ - The MCP surface can propose memory but **cannot activate it**: `capture`
127
+ derives initial state from frontmatter, so the server refuses any record that
128
+ is not `review: proposed`. `sync-provider`, `record-state` promotion, backup
129
+ pruning, session mining, and destructive operations are not exposed.
130
+ - Add `propose-from-session`, which extracts the human-visible conversation
131
+ from GitHub Copilot CLI logs into reviewable
132
+ `context-kit/memory-candidate-v1` candidates. It proposes rather than
133
+ captures: a transcript is not an atomic memory, so authoring a record stays
134
+ an explicit judgment step and nothing mined can enter active recall on its
135
+ own. Dry run is the default.
136
+ - Session extraction keeps only top-level turns. A `user.message` is human
137
+ only when it carries neither `parentAgentTaskId` nor a `source` field;
138
+ `assistant.message` requires neither `parentToolCallId` nor
139
+ `parentAgentTaskId`. Measured across a real 115-session corpus, 611 of 729
140
+ user events were subagent task prompts and 94 were generated context,
141
+ leaving 24 genuine human turns — filtering only on a `skill-` prefix would
142
+ keep 657 and misattribute authorship roughly 27-fold. `reasoningText`,
143
+ `reasoningOpaque`, and `transformedContent` are never extracted.
144
+ - Mining scans for credential shapes and blocks the write on a finding;
145
+ `--redact` masks the spans and records a count. Repository, branch, and HEAD
146
+ anchors are required and never invented, and candidates are project-isolated
147
+ and write-once.
148
+ - Add a first-party `rag` memory provider backed by the bundled `local-rag`
149
+ plugin, so **offline semantic recall no longer requires an external memory
150
+ provider**. MemPalace becomes genuinely optional rather than the only route
151
+ to meaning-based recall. Ollama remains a required local runtime for
152
+ embeddings, and `uv` is needed once to bootstrap the venv.
153
+ - Declare a hard dependency on `local-rag` in `plugin.json` and `apm.yml`, so
154
+ installing `memory` deploys the retrieval engine on every host.
155
+ - Generalize the provider layer behind a declarative `ProviderSpec`. The
156
+ projection, staging, atomic swap, projection marker, receipt, and backup
157
+ pruning path is now shared by every provider. MemPalace behavior is unchanged
158
+ and its test suite is the regression guard.
159
+ - `search` under `rag` binds hits back to local records, returning review,
160
+ freshness, `source`, and `source_hash` with each result, and reports hits it
161
+ cannot bind in `unmatched_hits` instead of dropping them.
162
+ - `search` degrades explicitly: when a provider is unreachable it falls back to
163
+ lexical local search annotated with `degraded_from`, `degraded_reason`, and
164
+ `degraded_detail`. Reconciliation is checked first, so a stale index refuses
165
+ rather than being masked by a quiet fallback.
166
+ - `wake` reports `not-applicable` under `rag` without invoking the provider.
167
+ - `doctor` verifies the local-rag runtime before probing the CLI and refuses
168
+ with the exact bootstrap command when the venv is missing or stale, closing
169
+ the gap on hosts that do not run Claude's `SessionStart` hook. `doctor
170
+ --bootstrap` builds it in place. The check applies only when the bundled
171
+ `bin/rag` launcher is in use; a user-supplied `CONTEXT_KIT_RAG_BIN` manages
172
+ its own runtime and is not gated.
173
+ - Receipts now carry a provider-neutral `store_path`, and `provider` reflects
174
+ the configured provider. MemPalace receipts keep the `palace_path` key for
175
+ continuity. The `recovery_status` value `restored-to-live-palace` is now
176
+ `restored-to-live-store`.
177
+ - `capture` and `archive-handoff` record provider receipts for any configured
178
+ provider, not only MemPalace.
179
+
180
+ ## 0.2.3 — 2026-08-04
181
+
182
+ - Shorten the `memory-workflows` skill trigger to free aggregate discovery budget for the new
183
+ `token-economics` components. Scope and routing are unchanged; the removed
184
+ text was enumeration detail already covered in the skill body, and the
185
+ catalog budget stays at 4096 characters rather than being raised.
186
+
187
+ ## 0.2.2 — 2026-07-27
188
+
189
+ - Shorten the discovery description(s) to free aggregate budget for the new
190
+ `corpus-review` components. Triggers and scope are unchanged; the catalog
191
+ budget is fixed, so every addition competes for the same remainder.
192
+
193
+ ## 0.2.1 — 2026-07-25
194
+
195
+ - Adopt the evidence forms `verify` now defines for the `## Evidence` section,
196
+ so provenance stays citable across the `verify` → `context-handoff` → `memory`
197
+ chain. A bare command name is no longer an accepted source pointer; an
198
+ observed result needs its observation source — `command-id=<allowlist key>` or
199
+ `tool=<approved tool>@<target>` — plus an artifact pointer.
200
+
201
+ ## 0.2.0 — 2026-07-19
202
+
203
+ - Add append-only review and freshness events over immutable memory records,
204
+ including sequenced replay, validated transitions, and stale-lock recovery.
205
+ - Restrict active recall and provider projections to effective
206
+ `accepted/current` records while preserving inactive history for audit.
207
+ - Add immutable provider receipts and guarded `sync-provider` dry-run/apply
208
+ reconciliation with staged project-isolated palaces, backups, and
209
+ live-palace projection markers.
210
+ - Require explicit provider synchronization after eligible captures or state
211
+ changes; capture, handoff archival, and lifecycle hooks never mutate the
212
+ provider palace. Opt-in hooks queue payloads locally for explicit review.
213
+ - Harden MemPalace compatibility checks against the tested 3.6.x CLI surface
214
+ and add an opt-in real-CLI smoke test.
215
+ - Document project-scoped, server-enforced read-only GitHub Copilot MCP setup,
216
+ provider qualification criteria, and the design-only status of Memora.
217
+
218
+ ## 0.1.0 — 2026-07-19
219
+
220
+ - Add the provider-neutral `context-kit/memory-v1` record contract.
221
+ - Add capture, recall, review, and explicit handoff archival workflows.
222
+ - Add a tested Python 3 standard-library adapter for a separately installed
223
+ MemPalace CLI with project-isolated storage and exact-argv execution.
224
+ - Derive collision-resistant project storage keys and publish write-once records
225
+ atomically under concurrent capture.
226
+ - Enforce project provenance, complete record and handoff structure, empty
227
+ allowlist boundaries, and local-only recall without MemPalace.
228
+ - Add opt-in Claude Stop, PreCompact, and detached SessionEnd capture hooks.
229
+ - Adopt Memora-inspired primary memories, cue anchors, freshness states,
230
+ supersession history, rank-fusion guidance, and propose-only consolidation.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mark Beacom
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.