palimnex 2.8.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.
- palimnex/CHANGELOG.md +272 -0
- palimnex/README.md +328 -0
- palimnex/__init__.py +10 -0
- palimnex/__main__.py +4 -0
- palimnex/_offline_fixtures.py +63 -0
- palimnex/_offline_redis.py +416 -0
- palimnex/adapters.py +244 -0
- palimnex/api.py +219 -0
- palimnex/audit.py +374 -0
- palimnex/cache_v3.py +2455 -0
- palimnex/challenge.py +81 -0
- palimnex/core.py +3471 -0
- palimnex/documents.py +394 -0
- palimnex/durable.py +3438 -0
- palimnex/evaluation/v25.json +27 -0
- palimnex/evaluation/v26.json +19 -0
- palimnex/experience.py +283 -0
- palimnex/identity.py +110 -0
- palimnex/integrity.py +122 -0
- palimnex/locators.py +150 -0
- palimnex/longitudinal.py +210 -0
- palimnex/mcp_server.py +74 -0
- palimnex/onboarding.py +413 -0
- palimnex/portable.py +979 -0
- palimnex/py.typed +0 -0
- palimnex/redis_launcher.sh +404 -0
- palimnex/retention.py +705 -0
- palimnex/retrieval.py +146 -0
- palimnex/schemas/audit-graph.v1.schema.json +130 -0
- palimnex/schemas/cleanup-plan.v1.schema.json +264 -0
- palimnex/schemas/cleanup-plan.v2.schema.json +51 -0
- palimnex/schemas/deletion-contract.v1.schema.json +35 -0
- palimnex/schemas/deletion-contract.v2.schema.json +22 -0
- palimnex/schemas/erasure-tombstone.v1.schema.json +42 -0
- palimnex/schemas/event-checkpoint.v1.schema.json +71 -0
- palimnex/schemas/logical-export.v1.schema.json +233 -0
- palimnex/schemas/memory-event.v1.schema.json +156 -0
- palimnex/schemas/memory-pack-manifest.v2.schema.json +82 -0
- palimnex/schemas/retention-policy.v1.schema.json +89 -0
- palimnex/schemas/signature.v1.schema.json +42 -0
- palimnex/schemas/source-locator.v1.schema.json +81 -0
- palimnex/schemas/workflow-spec.v1.schema.json +67 -0
- palimnex/security.py +365 -0
- palimnex/semantic.py +112 -0
- palimnex/semantica.py +334 -0
- palimnex/vcs.py +39 -0
- palimnex-2.8.0.dist-info/METADATA +129 -0
- palimnex-2.8.0.dist-info/RECORD +52 -0
- palimnex-2.8.0.dist-info/WHEEL +5 -0
- palimnex-2.8.0.dist-info/entry_points.txt +3 -0
- palimnex-2.8.0.dist-info/licenses/LICENSE +21 -0
- palimnex-2.8.0.dist-info/top_level.txt +1 -0
palimnex/CHANGELOG.md
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
# Palimnex changelog
|
|
2
|
+
|
|
3
|
+
All notable portable-bundle changes are recorded here. Bundle versions describe executable and
|
|
4
|
+
operator-facing behavior; cache and graph schemas are versioned independently.
|
|
5
|
+
|
|
6
|
+
## Unreleased
|
|
7
|
+
|
|
8
|
+
## 2.8.0 - 2026-10-01
|
|
9
|
+
|
|
10
|
+
- Replicable `palimnex:audit-graph:v1` export of eligible memory and
|
|
11
|
+
non-reconstructive erasure residue, with optional signature and a sibling
|
|
12
|
+
file from `memory-export --include-audit-graph`. Pack v2 bytes are unchanged.
|
|
13
|
+
- Optional Semantica audit-graph projector with TTL disabled, local
|
|
14
|
+
`semantica:` resolvers, and derivative registration. The Semantica package
|
|
15
|
+
is not imported by core Palimnex.
|
|
16
|
+
- Fail-closed Semantica erasure adapter: mandatory store inventory, sanitized
|
|
17
|
+
receipt digests on the retention control chain, no forensic-erasure claim.
|
|
18
|
+
- Documented audit-graph, optional Semantica projection, and fail-closed
|
|
19
|
+
adapter receipts in README, SDK, design, runbook, retention, compatibility,
|
|
20
|
+
and the GitHub Pages site.
|
|
21
|
+
- Corrected 32 documentation statements that disagreed with the code, found
|
|
22
|
+
by the claim check in `artifacts/doc-claim-check/`. Among them: the durable
|
|
23
|
+
ledger default path, the exact 4,096-entry hot-stream cap, mode-dependent
|
|
24
|
+
`clear` behavior, the missing `ledger-init` quick-start step, exit code `2`
|
|
25
|
+
for a non-ready ledger, the longitudinal result field set, and that only
|
|
26
|
+
packs registered through `RetentionLedger.register_pack` block erasure
|
|
27
|
+
(`memory-export` does not register packs). No code behavior changed.
|
|
28
|
+
- Added `docs/INSTALL.md` (adopting Palimnex in another repository: pinned
|
|
29
|
+
installs with pip, pipx or uv, `.gitignore` lines, configuration, Redis,
|
|
30
|
+
first run, agent instructions, evaluation fixtures, MCP and uninstall) and
|
|
31
|
+
`docs/UPGRADING.md` (pre-flight snapshot, per-version notes, cache and
|
|
32
|
+
retention migrations, rollback limits). The package README template now
|
|
33
|
+
uses `cache_mode: "on"` and an explicit slug.
|
|
34
|
+
|
|
35
|
+
- `palimnex init` previews a starter `.palimnex.json` (new UUID, slug,
|
|
36
|
+
`cache_mode: "on"`, include patterns detected from the repository) and the
|
|
37
|
+
missing `.gitignore` lines; `--write` creates them without overwriting and
|
|
38
|
+
never creates a ledger or starts Redis.
|
|
39
|
+
- `palimnex doctor` checks configuration, Git ignore rules, corpus coverage,
|
|
40
|
+
socket path length, Redis, cache freshness (naming the version that built a
|
|
41
|
+
stale cache), a leftover plaintext v2 cache, the ledger and its snapshots.
|
|
42
|
+
It changes no configuration, cache or ledger content; exit `0` healthy,
|
|
43
|
+
`2` action needed.
|
|
44
|
+
- `palimnex redis start|stop|status|reset|guard` runs the guarded launcher,
|
|
45
|
+
now packaged as `palimnex/redis_launcher.sh` (a byte-identical copy of
|
|
46
|
+
`scripts/palimnex_redis.sh`). `start` refuses an over-long socket path or a
|
|
47
|
+
missing `redis_socket_path`.
|
|
48
|
+
- `ledger-backup` (SDK `backup_ledger`) writes a verified owner-only SQLite
|
|
49
|
+
snapshot. `retention-migrate --dry-run` describes the migration without
|
|
50
|
+
writing, and a real migration first writes a verified pre-migration
|
|
51
|
+
snapshot (`--no-snapshot` skips it; SDK `snapshot=True` opts in).
|
|
52
|
+
- Inside a Git work tree, creating a ledger at a path Git does not ignore is
|
|
53
|
+
refused before anything is written; `ledger-init --allow-unignored-ledger`
|
|
54
|
+
and SDK `initialize(allow_unignored_ledger=True)` override explicitly.
|
|
55
|
+
- Clearer errors: missing configuration points to `palimnex init`; an
|
|
56
|
+
over-long, missing or stale Unix socket is named as such; `status` adds
|
|
57
|
+
`action` and `built_by_version`, and `search` names the version that built
|
|
58
|
+
an unreadable cache.
|
|
59
|
+
|
|
60
|
+
### Upgrade notes
|
|
61
|
+
|
|
62
|
+
- Upgrading from 2.7 to 2.8 invalidates the Redis cache. Run
|
|
63
|
+
`index --incremental` to rebuild it with version 2.8.0.
|
|
64
|
+
- New ledgers inside a Git work tree require Git to ignore the ledger path;
|
|
65
|
+
existing ledgers are unaffected. `palimnex redis start` requires
|
|
66
|
+
`redis_socket_path` in `.palimnex.json`.
|
|
67
|
+
- Downgrade hazard: once an erasure adapter records an `adapter_receipt`
|
|
68
|
+
control entry, version 2.7.0 refuses the whole ledger ("durable ledger
|
|
69
|
+
failed semantic validation"). See `docs/UPGRADING.md`.
|
|
70
|
+
|
|
71
|
+
## 2.7.0 - 2026-09-16
|
|
72
|
+
|
|
73
|
+
- Installable Python distribution, console scripts, PEP 561 types and public
|
|
74
|
+
SDK v1 with explicit repository roots and write guards.
|
|
75
|
+
- Versioned derivative adapter protocol and namespaced SQLite reference
|
|
76
|
+
backend with generation checks, projection invalidation and verified receipts.
|
|
77
|
+
- Structured source locators and explicitly registered version-aware resolvers.
|
|
78
|
+
- Signed predecessor-linked Merkle checkpoints with keyed commitments and
|
|
79
|
+
external-tip verification, without a live ledger migration.
|
|
80
|
+
- Ed25519 identities, injectable signer protocol, and optional detached pack
|
|
81
|
+
signatures verified against operator-configured public keys.
|
|
82
|
+
- Optional MCP stdio tools over the SDK, read-only by default with session-bound
|
|
83
|
+
evidence recording when explicitly enabled.
|
|
84
|
+
|
|
85
|
+
Existing `project-memory:*` storage formats and frozen fixtures remain intact.
|
|
86
|
+
External derivative coordination does not clear legacy retention blockers.
|
|
87
|
+
See `docs/SDK.md` for protocol semantics and deployment limitations.
|
|
88
|
+
|
|
89
|
+
### Upgrade notes
|
|
90
|
+
|
|
91
|
+
- Ledger schema v1 and pack v2 are unchanged. The new version number
|
|
92
|
+
invalidates the Redis cache; run `index --incremental`.
|
|
93
|
+
- Events with structured `palimnex:source-locator:v1:` locators are not
|
|
94
|
+
verified by older readers.
|
|
95
|
+
- The SDK `import_pack` requires a pack signature by default; the CLI
|
|
96
|
+
`memory-import` keeps the v2 behavior.
|
|
97
|
+
|
|
98
|
+
## 2.6.0-rc.1 - 2026-09-15
|
|
99
|
+
|
|
100
|
+
Release candidate for the portable Palimnex bundle only. SQLite schema
|
|
101
|
+
v1, Redis cache v3 and encrypted pack v2 remain the compatibility baseline.
|
|
102
|
+
Retention migration, policy activation and cleanup stay explicit operator
|
|
103
|
+
writes; this release does not claim distributed or forensic erasure.
|
|
104
|
+
|
|
105
|
+
### Added
|
|
106
|
+
|
|
107
|
+
- Explicit, expiring per-event authorization for durable and imported erasure,
|
|
108
|
+
with record-class-specific reason codes and permanently protected session
|
|
109
|
+
audit anchors.
|
|
110
|
+
- Derived-fact support sets with deterministic maximum-confidence
|
|
111
|
+
recomputation; unsupported derivatives and temporal assertion components are
|
|
112
|
+
withdrawn with their forgotten source.
|
|
113
|
+
- Cleanup-plan and deletion-contract v2 plus a non-reconstructive erasure
|
|
114
|
+
tombstone schema. Receipts retain pseudonymous identifiers, keyed record
|
|
115
|
+
commitments, policy/authorization metadata, verification state, counts and
|
|
116
|
+
retention-control hash-chain continuity, never deleted payloads.
|
|
117
|
+
- MIT license for the independent Palimnex repository.
|
|
118
|
+
- GitHub Actions workflow that installs the test-only `jsonschema` dependency
|
|
119
|
+
and runs `scripts/palimnex_check.sh` on isolated temporary Redis with no
|
|
120
|
+
live-ledger write or model call.
|
|
121
|
+
- Dependency-free GitHub Pages architecture site with retrieval, durable-memory,
|
|
122
|
+
erasure, storage, prerequisite, and third-party dependency diagrams.
|
|
123
|
+
|
|
124
|
+
### Changed
|
|
125
|
+
|
|
126
|
+
- Local erasure now removes evidence, verification attempts, promotions,
|
|
127
|
+
workflows, lexical indexes and graph/relationship derivatives, and scrubs
|
|
128
|
+
session prompt/outcome payloads before secure-delete compaction.
|
|
129
|
+
- Managed packs and previously attempted hot projections fail closed until a
|
|
130
|
+
verified retirement/invalidation adapter is available. No distributed or
|
|
131
|
+
forensic-erasure claim is made.
|
|
132
|
+
- Standalone Palimnex extraction keeps the promoted retention implementation,
|
|
133
|
+
schemas, tests and operator documentation while excluding source-project
|
|
134
|
+
runtime state and domain-specific rollback history.
|
|
135
|
+
|
|
136
|
+
### Documentation
|
|
137
|
+
|
|
138
|
+
- Recorded that this repository's frozen evaluation is 20/20 with Recall@5
|
|
139
|
+
`1.0`. Baseline commit `6bb9c72` reported MRR `0.8333` from overlapping
|
|
140
|
+
relevant gold labels, not a miss or scorer regression. Historical exception
|
|
141
|
+
`PM-ACCEPT-001` is bound to the prior corpus only. The frozen fixture and
|
|
142
|
+
scorer are unchanged. Reported MRR remains diagnostic.
|
|
143
|
+
|
|
144
|
+
### Upgrade notes
|
|
145
|
+
|
|
146
|
+
- Configuration moves to `.palimnex.json`; a repository with only
|
|
147
|
+
`.project-memory.json` keeps working. `PROJECT_MEMORY_URL` is read only when
|
|
148
|
+
listed in `redis_url_envs`. New state defaults to `.palimnex/`; set
|
|
149
|
+
`durable_ledger_path` if an existing ledger lives elsewhere, before any write.
|
|
150
|
+
- Reindex after upgrading; ledger schema v1 is unchanged.
|
|
151
|
+
- `retention-migrate` is optional and permanent: it stops hot projection and
|
|
152
|
+
`memory-import` for that ledger, and readers without the retention profile
|
|
153
|
+
refuse it. See `docs/UPGRADING.md`.
|
|
154
|
+
|
|
155
|
+
## 2.5.0 - 2026-09-04
|
|
156
|
+
|
|
157
|
+
### Added
|
|
158
|
+
|
|
159
|
+
- Project-UUID-scoped compact Redis v3 generations with hashed postings,
|
|
160
|
+
quantized vectors, no source bodies/plaintext lexical-token lists, bounded
|
|
161
|
+
candidate retrieval, renewable reader leases, three-generation retention
|
|
162
|
+
and fenced garbage collection. Graph records retain sensitive plaintext
|
|
163
|
+
structural names.
|
|
164
|
+
- Full content privacy admission before indexing or persistence, with
|
|
165
|
+
rule-and-line-only diagnostics and digest-pinned exceptions.
|
|
166
|
+
- Deterministic Markdown and generic-document graph extraction.
|
|
167
|
+
- A SHA-256-pinned frozen evaluation fixture outside its indexed corpus.
|
|
168
|
+
- A typed SQLite ledger for sessions, events, evidence, bitemporal
|
|
169
|
+
supersession, additive contradiction, promotion, workflow records and an
|
|
170
|
+
idempotent Redis hot outbox.
|
|
171
|
+
- Explicit bounded hot-projection rebuild from durable metadata after loss of
|
|
172
|
+
disposable Redis state.
|
|
173
|
+
- Session retention by default, durable-only promotion, and
|
|
174
|
+
`retention-durable-closed-sessions:v1` pack selection; local non-durable audit
|
|
175
|
+
rows are not yet physically pruned.
|
|
176
|
+
- Bounded ChaCha20-Poly1305 authenticated and encrypted cross-machine packs
|
|
177
|
+
with validate-first quarantine, explicit atomic activation, backup and crash
|
|
178
|
+
recovery. Raw 32-byte keys are owner-only, path-hardened files supplied
|
|
179
|
+
separately from packs.
|
|
180
|
+
- Authenticated, bounded event term digests preserve subject-only recall across
|
|
181
|
+
export/import and are validated against deletion, addition, ordering,
|
|
182
|
+
duplication and malformed-value corruption.
|
|
183
|
+
- Machine-readable event, workflow, logical-export and pack-manifest schemas.
|
|
184
|
+
- A disabled-by-default semantic-provider interface and evidence-only promotion
|
|
185
|
+
gate; no provider, model, HNSW index or network runtime is bundled.
|
|
186
|
+
|
|
187
|
+
### Fixed
|
|
188
|
+
|
|
189
|
+
- Indexer C18: a later edit that keeps some chunk text no longer leaves those
|
|
190
|
+
content-addressed records with a stale `file_hash`. Reuse now requires the
|
|
191
|
+
stored digest to match the current file, the writer replaces a record when
|
|
192
|
+
the payload differs, and `index --repair-deep` regenerates the refreshed
|
|
193
|
+
digest. Deep validation no longer needs `clear` after an ordinary edit.
|
|
194
|
+
- Frozen `evaluate` search cases and the migration p95 samples call the
|
|
195
|
+
shipped `search()` scorer. The duplicate in-process v3 hot scorer is gone.
|
|
196
|
+
- Shadow migration `legacy_comparison` is an asserted v2-versus-v3 check, not
|
|
197
|
+
a literal `"passed"`: v3 must return every expected path, and v2 must return
|
|
198
|
+
a non-empty list of paths. v2 paths are not checked against expected paths
|
|
199
|
+
or against v3.
|
|
200
|
+
|
|
201
|
+
### Security and authority
|
|
202
|
+
|
|
203
|
+
- Local writes default to an owner-only Unix socket. Plain Redis TCP is
|
|
204
|
+
loopback-only; remote Redis requires authenticated TLS with CA and hostname
|
|
205
|
+
verification.
|
|
206
|
+
- The repository Redis launcher's guarded reset removes only its projection
|
|
207
|
+
log/RDB files and preserves the durable SQLite ledger and adjacent state.
|
|
208
|
+
- Portable-pack authentication proves symmetric-key possession and integrity,
|
|
209
|
+
not sender identity. The privacy-minimal outer manifest exposes no plaintext
|
|
210
|
+
content size or digest. Encrypted export permits `restricted` records,
|
|
211
|
+
refuses `secret` records and rescans the selected logical content; imports
|
|
212
|
+
remain quarantined/untrusted and discard current verification and promotion
|
|
213
|
+
state.
|
|
214
|
+
- Normal recall abstains from imported or claimed-untrusted events;
|
|
215
|
+
`--include-untrusted` is explicit historical inspection.
|
|
216
|
+
- Current verification is derived from source evidence, not latched forever.
|
|
217
|
+
Changed, unavailable or policy-old evidence becomes stale, removes current
|
|
218
|
+
verification/promotion and remains available only as append-only attempt and
|
|
219
|
+
observed history.
|
|
220
|
+
- Every durable or imported result is historical context and cannot authorize
|
|
221
|
+
Git, network, wallet, deployment, spending, destructive or external writes.
|
|
222
|
+
|
|
223
|
+
### Compatibility and migration
|
|
224
|
+
|
|
225
|
+
- The v2 CLI command names, common flags, search text result and exit-code
|
|
226
|
+
meanings remain available. `status` is compact by default and adds
|
|
227
|
+
`--verbose` for the complete manifest.
|
|
228
|
+
- `cache_mode=off` keeps v2 authoritative, `shadow` dual-builds while v2 stays
|
|
229
|
+
authoritative, and `on` makes v3 authoritative. Missing means `off`; this
|
|
230
|
+
repository's evidenced configuration is `on`.
|
|
231
|
+
- Redis cache schema: `project-memory:cache:v3`, in a new UUID-scoped namespace.
|
|
232
|
+
- Durable ledger schema: `project-memory:ledger:v1`.
|
|
233
|
+
- Portable pack schema: `project-memory:pack:v2`; pack operations require the
|
|
234
|
+
reviewed distribution `python3-cryptography` package.
|
|
235
|
+
- The legacy `project-memory:v2` namespace is read-only during shadow
|
|
236
|
+
comparison and is never changed by v3 migration or by `clear` in `shadow` or
|
|
237
|
+
`on` mode. With `cache_mode` `off` (the default), `clear` removes the v2 index.
|
|
238
|
+
It still contains full source chunks and plaintext lexical-token lists and
|
|
239
|
+
remains sensitive until a separate retirement or lower-level local reset.
|
|
240
|
+
- Migration acceptance requires an equal-corpus, byte-stable v2 baseline, all
|
|
241
|
+
three retained v3 generations, total v3 size at most `0.60x` v2 and v3 p95
|
|
242
|
+
at most `10.0x` v2 on the shipped `search()` path.
|
|
243
|
+
- Filesystem rollback to `88354eb` preserves/quarantines SQLite and leaves both
|
|
244
|
+
Redis namespaces untouched.
|
|
245
|
+
|
|
246
|
+
## 2.4.0 - 2026-08-17
|
|
247
|
+
|
|
248
|
+
### Added
|
|
249
|
+
|
|
250
|
+
- Read-only `path SOURCE TARGET` queries using deterministic breadth-first search over the resolved
|
|
251
|
+
dependency graph.
|
|
252
|
+
- Forward and reverse traversal, repeatable edge-kind filters, bounded depth, and explicit opt-in
|
|
253
|
+
for probable unique-short-name resolutions.
|
|
254
|
+
- Ordered symbol paths, hop counts, resolution metadata, and source pointers in path results.
|
|
255
|
+
- `palimnex.py --version` and a package-level `palimnex.__version__` value.
|
|
256
|
+
- Exact repository-relative `exclude_paths` configuration and boundary-safe strict UTF-8 probing.
|
|
257
|
+
|
|
258
|
+
### Compatibility
|
|
259
|
+
|
|
260
|
+
- Cache schema: `project-memory:v2` (unchanged).
|
|
261
|
+
- Code-graph schema: `project-memory:code-graph:v3` (unchanged).
|
|
262
|
+
- Graph-record schema: `project-memory:graph-record:v1` (unchanged).
|
|
263
|
+
- Redis namespace and mandatory privacy boundaries are unchanged.
|
|
264
|
+
- Upgrades require an incremental index to activate a 2.4.0 manifest; unchanged chunks and graph
|
|
265
|
+
records remain reusable.
|
|
266
|
+
|
|
267
|
+
## 2.3.0
|
|
268
|
+
|
|
269
|
+
- Moved per-file extraction graphs into path-owned, content-addressed Redis records.
|
|
270
|
+
- Kept compact graph references and aggregate counts in the active manifest.
|
|
271
|
+
- Added on-demand graph loading, cross-file resolution, deep graph validation, incremental record
|
|
272
|
+
reuse and repair, and migration from embedded 2.2 graphs.
|
palimnex/README.md
ADDED
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
# Portable Palimnex v2.8.0 bundle and Python SDK
|
|
2
|
+
|
|
3
|
+
Status: version 2.8.0 package implementation; see `docs/SDK.md` for public API v1
|
|
4
|
+
and publication requirements. This includes explicit local retention and
|
|
5
|
+
authorized-erasure functionality; it
|
|
6
|
+
does not activate a live retention policy, migrate or delete a live ledger, or
|
|
7
|
+
claim deletion from external copies.
|
|
8
|
+
Existing SQLite schema v1, Redis cache v3 and encrypted pack v2 formats remain
|
|
9
|
+
the compatibility baseline.
|
|
10
|
+
|
|
11
|
+
To adopt Palimnex in another repository, follow `docs/INSTALL.md`: install
|
|
12
|
+
the package from a pinned release tag, add the `.gitignore` lines for
|
|
13
|
+
`.palimnex/`, `*.pmem` and `*.key`, create `.palimnex.json`, and start Redis
|
|
14
|
+
with the guarded launcher. In 2.8.0 and later,
|
|
15
|
+
`palimnex init --write` creates the configuration and `.gitignore` lines,
|
|
16
|
+
`palimnex redis start` runs the packaged launcher, and `palimnex doctor`
|
|
17
|
+
checks the result. Upgrades are covered in `docs/UPGRADING.md`.
|
|
18
|
+
|
|
19
|
+
The older portable-bundle layout still works: copy these paths while
|
|
20
|
+
preserving their relative layout, and add `scripts/palimnex_redis.sh` if you
|
|
21
|
+
want the launcher. A copied bundle has no version or integrity check.
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
palimnex.py
|
|
25
|
+
palimnex/
|
|
26
|
+
.palimnex.json
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The copied root entrypoint discovers the repository from its script location.
|
|
30
|
+
Installed console/module entrypoints use the current directory. `PALIMNEX_ROOT`
|
|
31
|
+
can explicitly override either; SDK clients always receive an explicit root.
|
|
32
|
+
Source indexing and the ledger use Python 3.11+ standard-library modules.
|
|
33
|
+
Pack v2 additionally requires the reviewed distribution
|
|
34
|
+
`python3-cryptography` package for ChaCha20-Poly1305. SQLite is the durable
|
|
35
|
+
memory authority; Redis is an optional, rebuildable discovery and hot-projection
|
|
36
|
+
cache. The full test gate also requires the `jsonschema` distribution for
|
|
37
|
+
Draft 2020-12 schema-conformance tests.
|
|
38
|
+
|
|
39
|
+
Release and schema compatibility are recorded in [CHANGELOG.md](CHANGELOG.md).
|
|
40
|
+
This repository's full design and operator guide are
|
|
41
|
+
`docs/DESIGN.md` and `docs/RUNBOOK.md`.
|
|
42
|
+
|
|
43
|
+
## Configuration
|
|
44
|
+
|
|
45
|
+
A repository needs a committed `.palimnex.json` with a stable random UUID and
|
|
46
|
+
an explicit slug:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"project_slug": "my-repository",
|
|
51
|
+
"project_id": "REPLACE-WITH-A-NEW-UUID",
|
|
52
|
+
"cache_mode": "on",
|
|
53
|
+
"redis_socket_path": ".palimnex/redis/redis.sock",
|
|
54
|
+
"durable_ledger_path": ".palimnex/memory.sqlite3",
|
|
55
|
+
"include_patterns": ["docs/**/*.md", "src/**/*.py", "tests/**/*.py"],
|
|
56
|
+
"semantic_provider": {"mode": "disabled"}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Generate a real UUID for each project
|
|
61
|
+
(`python3 -c "import uuid; print(uuid.uuid4())"`); never reuse the example or
|
|
62
|
+
another project's identity. Preserve it across authorized clones of that
|
|
63
|
+
project, but do not point concurrent divergent checkouts at one Redis
|
|
64
|
+
endpoint. Set `project_slug` explicitly: it defaults to the directory name,
|
|
65
|
+
and the ledger refuses to open under a different slug. Redis and ledger paths
|
|
66
|
+
must be repository-relative and ignored by Git.
|
|
67
|
+
|
|
68
|
+
`include_patterns` replaces the default corpus patterns, which cover
|
|
69
|
+
`src/**`, `docs/**/*.md`, `tests/**` and root configuration files but not
|
|
70
|
+
directories such as `app/` or `scripts/`. Check `status --verbose`
|
|
71
|
+
(`manifest.files`) after the first index. `docs/INSTALL.md` lists the defaults
|
|
72
|
+
and the always-skipped paths.
|
|
73
|
+
|
|
74
|
+
Evaluation is optional. `evaluate` needs a fixture written for your own
|
|
75
|
+
corpus, excluded from the index and pinned with `evaluation_fixture` and
|
|
76
|
+
`evaluation_fixture_sha256`; the fixtures bundled under
|
|
77
|
+
`palimnex/evaluation/` describe Palimnex's own files. See `docs/INSTALL.md`
|
|
78
|
+
for the fixture format.
|
|
79
|
+
|
|
80
|
+
`redis_url_envs` is optional and defaults to `["PALIMNEX_URL"]`; list any
|
|
81
|
+
legacy repository-specific URL variables there. Configuration files must not
|
|
82
|
+
contain credentials.
|
|
83
|
+
|
|
84
|
+
`cache_mode` is the explicit cutover flag. Use `on` for a new repository.
|
|
85
|
+
`off` indexes and reads the legacy v2 cache, which stores complete source text
|
|
86
|
+
and plaintext token lists in Redis; `shadow` builds both caches while reads
|
|
87
|
+
remain v2-authoritative. Missing means `off` for backward compatibility.
|
|
88
|
+
Advance an existing v2 deployment only after `migration-shadow` passes over a
|
|
89
|
+
fresh equal-corpus v2 baseline. If you started a new repository with `off`,
|
|
90
|
+
run `clear` while still in `off` mode to delete the plaintext v2 cache, then
|
|
91
|
+
switch to `on` and run `index --incremental`.
|
|
92
|
+
|
|
93
|
+
## Redis endpoints
|
|
94
|
+
|
|
95
|
+
The default may be an owner-only `redis+unix://` socket. Plain
|
|
96
|
+
`redis://HOST:PORT/DB` is restricted to explicit loopback hosts, and cache
|
|
97
|
+
writes additionally require authentication. Remote access requires
|
|
98
|
+
`rediss://[USER:]PASSWORD@HOST:PORT/DB`; the standard TLS context validates the
|
|
99
|
+
CA and hostname. Prefer injecting the URL through a protected environment or
|
|
100
|
+
file mechanism and never print it.
|
|
101
|
+
|
|
102
|
+
## Source discovery
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
python3 palimnex.py --version
|
|
106
|
+
python3 palimnex.py status
|
|
107
|
+
python3 palimnex.py status --verbose
|
|
108
|
+
python3 palimnex.py migration-shadow --limit 5
|
|
109
|
+
python3 palimnex.py index --incremental
|
|
110
|
+
python3 palimnex.py index --incremental --repair-deep
|
|
111
|
+
python3 palimnex.py validate --deep
|
|
112
|
+
python3 palimnex.py search "authentication boundary" --limit 5
|
|
113
|
+
python3 palimnex.py symbols "qualified.name" --limit 20
|
|
114
|
+
python3 palimnex.py impact "symbol_name" --limit 20
|
|
115
|
+
python3 palimnex.py path "source.name" "target.name" --edge-kind calls
|
|
116
|
+
python3 palimnex.py evaluate --limit 5
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
`status` and `validate` are compact by default and retain
|
|
120
|
+
`manifest.chunk_count`; `--verbose` exposes the complete active manifest.
|
|
121
|
+
Exit `0` means success/fresh, `2` means missing/stale or a failed quality gate,
|
|
122
|
+
and `1` means operational or validation error.
|
|
123
|
+
|
|
124
|
+
Frozen evaluation passes only when every critical case passes, aggregate
|
|
125
|
+
Recall@limit is at least 0.95, and `forbidden_clear` is true. Reported MRR is
|
|
126
|
+
diagnostic, not a pass/fail threshold. See `docs/DESIGN.md` section 10.
|
|
127
|
+
|
|
128
|
+
The v3 namespace includes the stable project UUID. Index builds scan source
|
|
129
|
+
content before deriving anything, stage an immutable generation, activate it
|
|
130
|
+
with a fenced writer lock, and retain three complete generations. Renewable
|
|
131
|
+
reader leases and a grace interval prevent post-activation garbage collection
|
|
132
|
+
from deleting records used by an in-flight reader.
|
|
133
|
+
|
|
134
|
+
Redis v3 records contain compact digested lexical postings, paths, hashes, line
|
|
135
|
+
bounds, keyed term digests and packed quantized vectors. They contain no raw
|
|
136
|
+
source text and no plaintext lexical-token list. Graph records do retain
|
|
137
|
+
plaintext structural names for symbols, headings and links. Search scores and
|
|
138
|
+
fetches at most 512 chunk candidates and reopens digest-verified source to
|
|
139
|
+
preserve the result `text` field; snapshot and graph verification still scan
|
|
140
|
+
the admitted checkout.
|
|
141
|
+
|
|
142
|
+
Python/Rust symbols plus deterministic Markdown and generic-document structure
|
|
143
|
+
form the graph. Extractor identity `document-structure:v2` resolves a
|
|
144
|
+
root-looking reference to an exact admitted corpus path first, then uses
|
|
145
|
+
Markdown-relative resolution only if that path is absent; this avoids false
|
|
146
|
+
`docs/docs/...` targets. `path` traverses strong links by default; probable
|
|
147
|
+
heuristic links require `--include-probable`.
|
|
148
|
+
|
|
149
|
+
`migration-shadow` builds and evaluates v3 beside a required fresh v2 baseline.
|
|
150
|
+
It never writes to the legacy namespace, proves its bytes unchanged, fills all
|
|
151
|
+
three retained v3 generations, and requires an equal corpus, Recall at least
|
|
152
|
+
0.95, zero forbidden hits, total retained-v3 Redis size at most `0.60x` v2,
|
|
153
|
+
and shipped `search()` p95 at most `10.0x` v2. The retired in-process hot
|
|
154
|
+
scorer used `1.20x`; that is not the current executable gate. With `cache_mode`
|
|
155
|
+
`shadow` or `on`, `clear` deletes only this project's v3 cache and reports that
|
|
156
|
+
both the durable ledger and v2 were untouched. With `off` (the default), it
|
|
157
|
+
deletes this project's legacy v2 cache namespace instead. Neither mode touches
|
|
158
|
+
the durable ledger.
|
|
159
|
+
|
|
160
|
+
The preserved legacy v2 namespace still contains full source chunks and
|
|
161
|
+
plaintext lexical-token lists. It remains sensitive rollback state until a
|
|
162
|
+
separately authorized retirement or lower-level local Redis reset; v3 `clear`
|
|
163
|
+
does not remove it.
|
|
164
|
+
|
|
165
|
+
The repository launcher's lower-level `reset` is deliberately different: it
|
|
166
|
+
stops only its verified Redis process and removes that instance's Redis log,
|
|
167
|
+
RDB dump and temporary RDB files. It preserves the SQLite ledger and adjacent
|
|
168
|
+
WAL, lock, import, backup and pack files, but every cache namespace that lived
|
|
169
|
+
only in the removed RDB needs rebuilding.
|
|
170
|
+
|
|
171
|
+
## Durable session memory
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
python3 palimnex.py ledger-init
|
|
175
|
+
python3 palimnex.py ledger-status
|
|
176
|
+
python3 palimnex.py session-start --task "TASK"
|
|
177
|
+
python3 palimnex.py remember --session ID --kind decision \
|
|
178
|
+
--subject "SUBJECT" --payload '{"value":"small typed fact"}' \
|
|
179
|
+
--retention durable \
|
|
180
|
+
--evidence docs/file.md:1-5
|
|
181
|
+
python3 palimnex.py session-close ID --outcome "OUTCOME" \
|
|
182
|
+
--evidence docs/file.md:1-5
|
|
183
|
+
python3 palimnex.py consolidate ID
|
|
184
|
+
python3 palimnex.py recall "QUERY" --promoted-only
|
|
185
|
+
python3 palimnex.py hot-events --limit 100
|
|
186
|
+
python3 palimnex.py audit-graph
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
SQLite uses WAL, full synchronous writes, foreign keys, process locking and
|
|
190
|
+
canonical-JSON-plus-zlib payloads. The event transaction creates an outbox row
|
|
191
|
+
before Redis projection. A Redis failure leaves durable data intact; use
|
|
192
|
+
`project-hot` to retry idempotently.
|
|
193
|
+
|
|
194
|
+
`remember` defaults to `retention=session`. SQLite is crash-safe local
|
|
195
|
+
staging/audit for all classes, but only explicit durable events can promote or
|
|
196
|
+
leave the machine in a pack. The v2.6 release candidate adds explicit,
|
|
197
|
+
operator-authorized local retention migration and cleanup; nothing is
|
|
198
|
+
forgotten automatically.
|
|
199
|
+
|
|
200
|
+
## Retention and authorized erasure
|
|
201
|
+
|
|
202
|
+
Inspect ordinary state with `retention-status`. On an isolated private ledger,
|
|
203
|
+
an operator may explicitly migrate the retention schema, activate a reviewed
|
|
204
|
+
policy, place or release holds, authorize an eligible record, register derived
|
|
205
|
+
fact support, review a digest-bound cleanup plan, apply it with a separate
|
|
206
|
+
forget key, and finalize compaction. See
|
|
207
|
+
`docs/RETENTION.md` for the complete runbook and policy rules.
|
|
208
|
+
|
|
209
|
+
Cleanup is an orchestrated local transaction, not `delete_node()`: it removes
|
|
210
|
+
eligible content and local derivatives, recomputes or withdraws dependent
|
|
211
|
+
facts, verifies affected local stores, and retains only a non-reconstructive,
|
|
212
|
+
hash-chained audit tombstone. Durable and imported records require explicit,
|
|
213
|
+
expiring per-event authorization. Session audit anchors remain protected.
|
|
214
|
+
`audit-graph` exports `palimnex:audit-graph:v1` of eligible memory and
|
|
215
|
+
tombstones. Pack v2 bytes stay unchanged; `--include-audit-graph` writes a
|
|
216
|
+
sibling JSON. Optional `palimnex.semantica` projects that graph as untrusted
|
|
217
|
+
history with TTL disabled; fail-closed adapter receipts hash onto the control
|
|
218
|
+
chain and do not claim forensic erasure. See `docs/SDK.md`.
|
|
219
|
+
|
|
220
|
+
Previously attempted Redis projections and managed packs fail closed until a
|
|
221
|
+
verified invalidation or regeneration adapter exists. SQLite compaction cannot
|
|
222
|
+
prove forensic erasure from SSDs, snapshots, backups, or third-party systems.
|
|
223
|
+
Migration, policy activation, cleanup application and finalization are
|
|
224
|
+
explicit writes and must never be inferred from installing this bundle.
|
|
225
|
+
|
|
226
|
+
After complete loss of the disposable hot namespace, `project-hot --rebuild`
|
|
227
|
+
resets delivered flags and force-replays all ledger-committed metadata in
|
|
228
|
+
bounded batches. This includes local audit events of every retention class but
|
|
229
|
+
does not promote or export `volatile`/`session` records. It does not project
|
|
230
|
+
payload bodies.
|
|
231
|
+
|
|
232
|
+
Events distinguish observation and validity time and may explicitly supersede
|
|
233
|
+
or contradict one same-subject event. Supersession changes current selection;
|
|
234
|
+
contradiction is additive and leaves both records visible. Recall supports
|
|
235
|
+
`--known-at`, `--valid-at`, and `--include-history`. Normal recall abstains from
|
|
236
|
+
claimed-untrusted/imported events; `--include-untrusted` is an explicit
|
|
237
|
+
historical-inspection mode. Promotion requires a closed session,
|
|
238
|
+
`retention=durable`, and current, locally-verified source evidence. All output
|
|
239
|
+
is `historical_only` and cannot authorize actions.
|
|
240
|
+
|
|
241
|
+
For local writes the ledger stamps `observed_at`; callers may supply only
|
|
242
|
+
`valid_from`. Only quarantined imports preserve a foreign recorded time.
|
|
243
|
+
Event, evidence, verification and verification-attempt chronology is
|
|
244
|
+
validated, and an append-only attempt timestamp is the ledger-clock check
|
|
245
|
+
time, clamped so it never precedes the event's previous attempt
|
|
246
|
+
(`attempt_sequence` breaks ties).
|
|
247
|
+
|
|
248
|
+
Verification attempts are append-only. Current verification is re-derived
|
|
249
|
+
from repository bytes: changed, unavailable or older-policy evidence makes the
|
|
250
|
+
ledger stale, excludes the event from current recall/consolidation, and a stale
|
|
251
|
+
`reverify` removes its current verification/promotion without erasing history.
|
|
252
|
+
`--include-history` retains stale observed events; imported/untrusted history
|
|
253
|
+
also requires `--include-untrusted`.
|
|
254
|
+
|
|
255
|
+
The Redis hot stream is notification metadata only. `hot-events` validates the
|
|
256
|
+
entire bounded batch and each field against SQLite before filtering/limiting;
|
|
257
|
+
it never returns payloads. `latest-projected` is only an expiring
|
|
258
|
+
delivery-order pointer, never a current-fact pointer. No Redis `active` pointer
|
|
259
|
+
exists.
|
|
260
|
+
|
|
261
|
+
## Workflows and packs
|
|
262
|
+
|
|
263
|
+
`workflow-put` accepts a bounded JSON file matching
|
|
264
|
+
`schemas/workflow-spec.v1.schema.json` and requires local source evidence.
|
|
265
|
+
`workflow-dry-run` reports every step with `will_execute: false`. There is no
|
|
266
|
+
workflow execution command.
|
|
267
|
+
|
|
268
|
+
Workflow specifications and semantic metrics JSON must be bounded regular,
|
|
269
|
+
non-symlink files inside the repository; the CLI opens them with no-follow
|
|
270
|
+
semantics.
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
python3 palimnex.py memory-keygen PRIVATE_KEY_FILE.key
|
|
274
|
+
python3 palimnex.py memory-export NEW_FILE.pmem --key-file PRIVATE_KEY_FILE.key
|
|
275
|
+
python3 palimnex.py memory-import FILE.pmem --key-file PRIVATE_KEY_FILE.key
|
|
276
|
+
python3 palimnex.py memory-import FILE.pmem --key-file PRIVATE_KEY_FILE.key --activate --replace
|
|
277
|
+
python3 palimnex.py memory-recover-import
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
Pack validation is the default. Activation is explicit, crash-recoverable and
|
|
281
|
+
retains the replaced database as a uniquely named backup. Pack v2 is
|
|
282
|
+
ChaCha20-Poly1305 authenticated and encrypted, but imported records remain
|
|
283
|
+
untrusted historical context; promotion and verification state are not
|
|
284
|
+
imported. Those records are absent from normal recall until matching local
|
|
285
|
+
source evidence is reverified; use `--include-untrusted` only for explicit
|
|
286
|
+
inspection.
|
|
287
|
+
|
|
288
|
+
The manifest selection is `retention-durable-closed-sessions:v1`: only closed
|
|
289
|
+
sessions with explicit durable non-anchor events, their durable anchors and
|
|
290
|
+
selected workflows are exported. Sequences are compacted; volatile/session
|
|
291
|
+
events, orphaned relations and empty selections are excluded or refused.
|
|
292
|
+
Each event also carries authenticated, sorted, unique, bounded term digests so
|
|
293
|
+
subject-only recall remains available after import; import validates and
|
|
294
|
+
restores those exact derived terms.
|
|
295
|
+
|
|
296
|
+
Pack and raw 32-byte key inputs must be private owner-controlled, one-link
|
|
297
|
+
regular files reached without symlinks. New keys and packs are mode `0600`.
|
|
298
|
+
Encrypted export permits `restricted` events, refuses selected `secret`
|
|
299
|
+
events, and rescans selected content with the current privacy policy. The outer
|
|
300
|
+
manifest contains no plaintext-content size or digest.
|
|
301
|
+
|
|
302
|
+
Shared-key authentication proves integrity and key possession, not sender
|
|
303
|
+
identity. Transfer key and pack separately, back up the key separately, and
|
|
304
|
+
rotate by generating a new key plus a new export. Key loss makes the pack
|
|
305
|
+
unrecoverable; there is no in-place rekey command. Key bytes must never enter
|
|
306
|
+
configuration, logs, Git or memory records. `PALIMNEX_PACK_KEY_FILE` may
|
|
307
|
+
hold only an injected path.
|
|
308
|
+
|
|
309
|
+
## Semantic hold
|
|
310
|
+
|
|
311
|
+
`semantic-status` reports disabled. The bundle defines only an in-process local
|
|
312
|
+
provider protocol and a metrics promotion gate. It installs no model, makes no
|
|
313
|
+
network call, builds no HNSW index, and gives semantic scores no retrieval
|
|
314
|
+
influence.
|
|
315
|
+
|
|
316
|
+
## Privacy boundary
|
|
317
|
+
|
|
318
|
+
Mandatory path, type, symlink and size checks still apply. In addition, exact
|
|
319
|
+
UTF-8 bytes are scanned for credential/key/token/WIF/mnemonic shapes before
|
|
320
|
+
indexing or persistence. Diagnostics return only a rule and line number. A
|
|
321
|
+
content exception is permitted only by exact reviewed SHA-256.
|
|
322
|
+
|
|
323
|
+
Derived hashes and vectors remain sensitive. Never expose Redis, commit its
|
|
324
|
+
state, commit SQLite or packs, use raw keys, reuse another project's namespace,
|
|
325
|
+
or run `FLUSHDB`/`FLUSHALL`.
|
|
326
|
+
|
|
327
|
+
Repository files remain authoritative. Redis and durable recall provide
|
|
328
|
+
candidates and history, never current operational authorization.
|
palimnex/__init__.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""Portable Palimnex package."""
|
|
2
|
+
|
|
3
|
+
from .core import BUNDLE_VERSION, main
|
|
4
|
+
from .api import API_VERSION, Evidence, Event, Palimnex, RecallOptions
|
|
5
|
+
from .locators import SourceLocator, SourceRange, SourceResolver
|
|
6
|
+
|
|
7
|
+
__version__ = BUNDLE_VERSION
|
|
8
|
+
|
|
9
|
+
__all__ = ["__version__", "main", "API_VERSION", "Palimnex", "Event", "Evidence",
|
|
10
|
+
"RecallOptions", "SourceLocator", "SourceRange", "SourceResolver"]
|
palimnex/__main__.py
ADDED