aletheia-memory 1.3.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.
Files changed (134) hide show
  1. aletheia_memory-1.3.0/.gitignore +14 -0
  2. aletheia_memory-1.3.0/CHANGELOG.md +19 -0
  3. aletheia_memory-1.3.0/CONTRIBUTING.md +44 -0
  4. aletheia_memory-1.3.0/LICENSE +21 -0
  5. aletheia_memory-1.3.0/PKG-INFO +522 -0
  6. aletheia_memory-1.3.0/README.md +489 -0
  7. aletheia_memory-1.3.0/SECURITY.md +39 -0
  8. aletheia_memory-1.3.0/aletheia/__init__.py +41 -0
  9. aletheia_memory-1.3.0/aletheia/adapters.py +106 -0
  10. aletheia_memory-1.3.0/aletheia/cli/__init__.py +2 -0
  11. aletheia_memory-1.3.0/aletheia/cli/main.py +4471 -0
  12. aletheia_memory-1.3.0/aletheia/client.py +587 -0
  13. aletheia_memory-1.3.0/aletheia/core/__init__.py +6 -0
  14. aletheia_memory-1.3.0/aletheia/core/crypto.py +172 -0
  15. aletheia_memory-1.3.0/aletheia/core/errors.py +14 -0
  16. aletheia_memory-1.3.0/aletheia/core/federation.py +2389 -0
  17. aletheia_memory-1.3.0/aletheia/core/hardening.py +2491 -0
  18. aletheia_memory-1.3.0/aletheia/core/ids.py +36 -0
  19. aletheia_memory-1.3.0/aletheia/core/memory.py +13221 -0
  20. aletheia_memory-1.3.0/aletheia/core/platform.py +1548 -0
  21. aletheia_memory-1.3.0/aletheia/core/time.py +24 -0
  22. aletheia_memory-1.3.0/aletheia/extraction.py +630 -0
  23. aletheia_memory-1.3.0/aletheia/help.py +144 -0
  24. aletheia_memory-1.3.0/aletheia/llm.py +451 -0
  25. aletheia_memory-1.3.0/aletheia/models/__init__.py +323 -0
  26. aletheia_memory-1.3.0/aletheia/models/adaptive.py +581 -0
  27. aletheia_memory-1.3.0/aletheia/models/claim.py +51 -0
  28. aletheia_memory-1.3.0/aletheia/models/confidence.py +96 -0
  29. aletheia_memory-1.3.0/aletheia/models/conflict.py +35 -0
  30. aletheia_memory-1.3.0/aletheia/models/context.py +163 -0
  31. aletheia_memory-1.3.0/aletheia/models/entity.py +102 -0
  32. aletheia_memory-1.3.0/aletheia/models/evidence.py +39 -0
  33. aletheia_memory-1.3.0/aletheia/models/federation.py +696 -0
  34. aletheia_memory-1.3.0/aletheia/models/hardening.py +588 -0
  35. aletheia_memory-1.3.0/aletheia/models/ingestion.py +288 -0
  36. aletheia_memory-1.3.0/aletheia/models/integrity.py +176 -0
  37. aletheia_memory-1.3.0/aletheia/models/operations.py +356 -0
  38. aletheia_memory-1.3.0/aletheia/models/platform.py +545 -0
  39. aletheia_memory-1.3.0/aletheia/models/project.py +31 -0
  40. aletheia_memory-1.3.0/aletheia/models/reasoning.py +412 -0
  41. aletheia_memory-1.3.0/aletheia/models/retrieval.py +29 -0
  42. aletheia_memory-1.3.0/aletheia/models/semantic.py +26 -0
  43. aletheia_memory-1.3.0/aletheia/models/service.py +310 -0
  44. aletheia_memory-1.3.0/aletheia/models/session.py +31 -0
  45. aletheia_memory-1.3.0/aletheia/ontology.py +13 -0
  46. aletheia_memory-1.3.0/aletheia/plugins.py +87 -0
  47. aletheia_memory-1.3.0/aletheia/retrieval/__init__.py +6 -0
  48. aletheia_memory-1.3.0/aletheia/retrieval/lexical.py +396 -0
  49. aletheia_memory-1.3.0/aletheia/review.py +80 -0
  50. aletheia_memory-1.3.0/aletheia/semantic.py +593 -0
  51. aletheia_memory-1.3.0/aletheia/service/__init__.py +7 -0
  52. aletheia_memory-1.3.0/aletheia/service/auth.py +384 -0
  53. aletheia_memory-1.3.0/aletheia/service/errors.py +47 -0
  54. aletheia_memory-1.3.0/aletheia/service/http.py +3381 -0
  55. aletheia_memory-1.3.0/aletheia/service/mcp.py +328 -0
  56. aletheia_memory-1.3.0/aletheia/storage/__init__.py +6 -0
  57. aletheia_memory-1.3.0/aletheia/storage/migrations/__init__.py +2 -0
  58. aletheia_memory-1.3.0/aletheia/storage/migrations/schema.sql +2712 -0
  59. aletheia_memory-1.3.0/aletheia/storage/sqlite.py +1473 -0
  60. aletheia_memory-1.3.0/aletheia_client.py +25 -0
  61. aletheia_memory-1.3.0/docs/Concept.md +1282 -0
  62. aletheia_memory-1.3.0/docs/M11_Embedding_Integration_contract.md +282 -0
  63. aletheia_memory-1.3.0/docs/M11_M12_preface.md +186 -0
  64. aletheia_memory-1.3.0/docs/M12_LLM_Integration_contract.md +271 -0
  65. aletheia_memory-1.3.0/docs/Plan.md +703 -0
  66. aletheia_memory-1.3.0/docs/adapter_developer_guide.md +18 -0
  67. aletheia_memory-1.3.0/docs/aletheia_phased_plan.md +1896 -0
  68. aletheia_memory-1.3.0/docs/architecture.md +240 -0
  69. aletheia_memory-1.3.0/docs/backup_restore_guide.md +36 -0
  70. aletheia_memory-1.3.0/docs/cli_reference.md +196 -0
  71. aletheia_memory-1.3.0/docs/core_concepts.md +266 -0
  72. aletheia_memory-1.3.0/docs/encryption_layer.md +228 -0
  73. aletheia_memory-1.3.0/docs/examples.md +28 -0
  74. aletheia_memory-1.3.0/docs/http_api_reference.md +35 -0
  75. aletheia_memory-1.3.0/docs/index.md +138 -0
  76. aletheia_memory-1.3.0/docs/installation.md +178 -0
  77. aletheia_memory-1.3.0/docs/integration_guide.md +327 -0
  78. aletheia_memory-1.3.0/docs/interfaces.md +465 -0
  79. aletheia_memory-1.3.0/docs/introduction.md +85 -0
  80. aletheia_memory-1.3.0/docs/m0_MVP_contract.md +529 -0
  81. aletheia_memory-1.3.0/docs/m10_federated_memory_contract.md +3044 -0
  82. aletheia_memory-1.3.0/docs/m1_reliable_recall_contract.md +626 -0
  83. aletheia_memory-1.3.0/docs/m2_memory_integrity_contract.md +2077 -0
  84. aletheia_memory-1.3.0/docs/m3_Intelligent_Ingestion_Semantic_Recall_contract.md +2566 -0
  85. aletheia_memory-1.3.0/docs/m4_reasoned_memory_contract.md +2611 -0
  86. aletheia_memory-1.3.0/docs/m5_adaptive_memory_contract.md +3182 -0
  87. aletheia_memory-1.3.0/docs/m6_memory_service_contract.md +2882 -0
  88. aletheia_memory-1.3.0/docs/m7_observability_contract.md +2948 -0
  89. aletheia_memory-1.3.0/docs/m8_production_hardening_contract.md +3198 -0
  90. aletheia_memory-1.3.0/docs/m9_stable_platform_contract.md +3236 -0
  91. aletheia_memory-1.3.0/docs/mcp_reference.md +17 -0
  92. aletheia_memory-1.3.0/docs/memory_lifecycle.md +327 -0
  93. aletheia_memory-1.3.0/docs/migration_guide.md +48 -0
  94. aletheia_memory-1.3.0/docs/near_future_changes.md +127 -0
  95. aletheia_memory-1.3.0/docs/operations_guide.md +316 -0
  96. aletheia_memory-1.3.0/docs/plugin_developer_guide.md +35 -0
  97. aletheia_memory-1.3.0/docs/security_privacy_guide.md +36 -0
  98. aletheia_memory-1.3.0/docs/troubleshooting.md +271 -0
  99. aletheia_memory-1.3.0/docs/v1_3_0_baseline_remediation_plan.md +242 -0
  100. aletheia_memory-1.3.0/docs/v1_3_0_postmortem_and_followups.md +202 -0
  101. aletheia_memory-1.3.0/docs/v1_3_0_review_closure_checklist.md +182 -0
  102. aletheia_memory-1.3.0/docs/v1_public_contracts.md +17 -0
  103. aletheia_memory-1.3.0/pyproject.toml +83 -0
  104. aletheia_memory-1.3.0/scripts/live_m10_federated_memory_scorecard.py +414 -0
  105. aletheia_memory-1.3.0/scripts/live_m11_production_semantic_retrieval_scorecard.py +328 -0
  106. aletheia_memory-1.3.0/scripts/live_m12_governed_llm_memory_scorecard.py +378 -0
  107. aletheia_memory-1.3.0/scripts/live_m1_reliable_recall_scorecard.py +765 -0
  108. aletheia_memory-1.3.0/scripts/live_m2_memory_integrity_scorecard.py +947 -0
  109. aletheia_memory-1.3.0/scripts/live_m3_intelligent_ingestion_scorecard.py +653 -0
  110. aletheia_memory-1.3.0/scripts/live_m4_reasoned_memory_scorecard.py +713 -0
  111. aletheia_memory-1.3.0/scripts/live_m5_adaptive_memory_scorecard.py +851 -0
  112. aletheia_memory-1.3.0/scripts/live_m6_agent_interoperability_scorecard.py +928 -0
  113. aletheia_memory-1.3.0/scripts/live_m7_observability_console_scorecard.py +576 -0
  114. aletheia_memory-1.3.0/scripts/live_m8_production_hardening_scorecard.py +367 -0
  115. aletheia_memory-1.3.0/scripts/live_m9_stable_platform_scorecard.py +407 -0
  116. aletheia_memory-1.3.0/scripts/live_mvp_scorecard.py +588 -0
  117. aletheia_memory-1.3.0/scripts/live_v0_1_polish_scorecard.py +422 -0
  118. aletheia_memory-1.3.0/scripts/release_gate.py +86 -0
  119. aletheia_memory-1.3.0/tests/test_cli.py +507 -0
  120. aletheia_memory-1.3.0/tests/test_crypto.py +41 -0
  121. aletheia_memory-1.3.0/tests/test_m10_federated_memory.py +543 -0
  122. aletheia_memory-1.3.0/tests/test_m11_production_semantic_retrieval.py +240 -0
  123. aletheia_memory-1.3.0/tests/test_m12_governed_llm_memory.py +516 -0
  124. aletheia_memory-1.3.0/tests/test_m1_reliable_recall.py +704 -0
  125. aletheia_memory-1.3.0/tests/test_m2_memory_integrity.py +567 -0
  126. aletheia_memory-1.3.0/tests/test_m3_intelligent_ingestion.py +463 -0
  127. aletheia_memory-1.3.0/tests/test_m4_reasoned_memory.py +463 -0
  128. aletheia_memory-1.3.0/tests/test_m5_adaptive_memory.py +811 -0
  129. aletheia_memory-1.3.0/tests/test_m6_memory_service.py +674 -0
  130. aletheia_memory-1.3.0/tests/test_m7_observability_console.py +322 -0
  131. aletheia_memory-1.3.0/tests/test_m8_production_hardening.py +948 -0
  132. aletheia_memory-1.3.0/tests/test_m9_stable_platform.py +315 -0
  133. aletheia_memory-1.3.0/tests/test_memory.py +226 -0
  134. aletheia_memory-1.3.0/tests/test_release_gate.py +24 -0
@@ -0,0 +1,14 @@
1
+ .venv/
2
+ dist/
3
+ build/
4
+ *.egg-info/
5
+ __pycache__/
6
+ *.py[cod]
7
+ .pytest_cache/
8
+ .coverage
9
+ .mypy_cache/
10
+ .DS_Store
11
+ *.db
12
+ *.sqlite
13
+ *.sqlite3
14
+ marketing/
@@ -0,0 +1,19 @@
1
+ # Changelog
2
+
3
+ All notable public changes to Aletheia are tracked here.
4
+
5
+ ## 1.3.0
6
+
7
+ Initial public release of `aletheia-memory`.
8
+
9
+ - Ships the local SQLite memory kernel, CLI, HTTP service, Python SDK clients,
10
+ MCP tools, and generic adapter surfaces.
11
+ - Includes evidence-backed memory lifecycle support: evidence, candidate
12
+ memories, review and promotion, claims, retrieval, context packs, feedback,
13
+ conflicts, confidence, and audit records.
14
+ - Adds local production controls for protected mode, scoped tokens, encrypted
15
+ backups, restore verification, redaction, forget tombstones, retention,
16
+ diagnostics, readiness checks, release gates, and compatibility reports.
17
+ - Includes federation-beta support, governed semantic retrieval, and
18
+ review-first LLM memory formation.
19
+ - Packages the public documentation set with the wheel.
@@ -0,0 +1,44 @@
1
+ # Contributing To Aletheia
2
+
3
+ Thanks for helping improve Aletheia. The project is local-first by design, so
4
+ changes should preserve provenance, reviewability, scoped access, privacy
5
+ ceilings, and auditable memory lifecycles.
6
+
7
+ ## Development Setup
8
+
9
+ ```bash
10
+ git clone https://github.com/khaledgabal2/aletheia-memory.git
11
+ cd aletheia-memory
12
+ python -m pip install -e ".[dev]"
13
+ pytest
14
+ ```
15
+
16
+ If you use `uv`, the equivalent verification command is:
17
+
18
+ ```bash
19
+ uv run --extra dev pytest
20
+ ```
21
+
22
+ ## Before Opening A Pull Request
23
+
24
+ - Run `pytest` or `uv run --extra dev pytest`.
25
+ - Run `python scripts/release_gate.py --branch main` before changes targeting
26
+ the generic public baseline.
27
+ - Update docs when changing CLI commands, HTTP routes, MCP tools, public Python
28
+ APIs, security behavior, storage schema, or release policy.
29
+ - Add or update tests for behavior changes.
30
+ - Keep generated databases, support bundles, private logs, credentials, tokens,
31
+ and environment files out of commits.
32
+
33
+ ## Design Boundaries
34
+
35
+ Open an issue or discussion before introducing:
36
+
37
+ - New persistent schema or migration behavior.
38
+ - New network behavior or external provider defaults.
39
+ - New active-write paths for agents.
40
+ - Changes to token, protected-mode, backup, retention, redaction, federation, or
41
+ plugin permission semantics.
42
+
43
+ Agent integrations should prefer candidate-first writes unless they have an
44
+ explicitly trusted active-write policy.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Aletheia Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,522 @@
1
+ Metadata-Version: 2.5
2
+ Name: aletheia-memory
3
+ Version: 1.3.0
4
+ Summary: Local, auditable memory for AI agents.
5
+ Project-URL: Homepage, https://github.com/khaledgabal2/aletheia-memory
6
+ Project-URL: Repository, https://github.com/khaledgabal2/aletheia-memory
7
+ Project-URL: Documentation, https://github.com/khaledgabal2/aletheia-memory/tree/main/docs
8
+ Project-URL: Issues, https://github.com/khaledgabal2/aletheia-memory/issues
9
+ Project-URL: Changelog, https://github.com/khaledgabal2/aletheia-memory/blob/main/CHANGELOG.md
10
+ Author: Aletheia Contributors
11
+ License-Expression: MIT
12
+ License-File: LICENSE
13
+ Keywords: agents,ai,context,local-first,memory,retrieval
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Database
23
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Requires-Python: >=3.11
26
+ Requires-Dist: cryptography>=49.0.0
27
+ Provides-Extra: cli
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest; extra == 'dev'
30
+ Provides-Extra: mcp
31
+ Provides-Extra: server
32
+ Description-Content-Type: text/markdown
33
+
34
+ # Aletheia
35
+
36
+ [![Release Gates](https://github.com/khaledgabal2/aletheia-memory/actions/workflows/release-gates.yml/badge.svg)](https://github.com/khaledgabal2/aletheia-memory/actions/workflows/release-gates.yml)
37
+
38
+ Local, auditable memory for AI agents.
39
+
40
+ Aletheia is a Python package, CLI, and local service for giving agents durable
41
+ memory without giving up provenance, review, privacy, or operator control. It
42
+ stores memory in SQLite and treats memory as an evidence-backed lifecycle:
43
+
44
+ ```text
45
+ evidence -> candidate memory -> review/promotion -> claim -> retrieval/context -> feedback/audit
46
+ ```
47
+
48
+ That lifecycle is the point. Raw notes, transcripts, tool observations, and LLM
49
+ outputs can be captured as evidence or candidate memories, but they do not need
50
+ to become trusted facts until a review or explicit active-write policy promotes
51
+ them.
52
+
53
+ Aletheia is useful for local agents, agent frameworks, developer tools,
54
+ research assistants, and any application that needs cross-session recall with a
55
+ clear audit trail.
56
+
57
+ ## Status
58
+
59
+ - Package name: `aletheia-memory`
60
+ - CLI command: `aletheia`
61
+ - Current version: `1.3.0`
62
+ - Runtime: Python 3.11+
63
+ - Storage: local SQLite
64
+ - License: [MIT](LICENSE)
65
+ - Distribution: GitHub/source install and wheel builds are supported today;
66
+ `pip install aletheia-memory` becomes the primary path after PyPI publication.
67
+
68
+ ## What Aletheia Provides
69
+
70
+ - **Local-first memory kernel**: structured evidence, candidates, claims,
71
+ confidence, conflicts, projects, sessions, audit trails, and context packs.
72
+ - **Reliable retrieval**: deterministic SQLite FTS search, optional governed
73
+ semantic indexing, hybrid retrieval, retrieval traces, and agent-ready
74
+ context budgets.
75
+ - **Review-first ingestion**: ingest notes, logs, and transcripts; extract
76
+ candidate memories; then promote, reject, scope, or merge after review.
77
+ - **Governed LLM memory tasks**: optional LLM extraction, query expansion,
78
+ entity/category suggestions, duplicate-merge suggestions, reflection drafts,
79
+ and conflict explanations with provenance and review state.
80
+ - **Reasoned memory**: inference candidates, reflections, semantic relations,
81
+ derivation traces, lossless abstractions, and invalidation when source
82
+ material changes.
83
+ - **Memory integrity controls**: confidence recomputation, contradiction
84
+ detection, decay policies, curation decisions, feedback, claim scoping, and
85
+ audit/explanation commands.
86
+ - **Agent interfaces**: in-process Python API, CLI, local HTTP API, sync/async
87
+ Python SDK clients, MCP tools, and generic agent adapters.
88
+ - **Operational hardening**: protected mode, scoped API tokens, namespace
89
+ grants, privacy ceilings, encrypted backups, restore verification, redaction,
90
+ forget tombstones, retention, integrity checks, support bundles, diagnostics,
91
+ release gates, and compatibility reports.
92
+ - **Extension platform**: plugin manifests, permissions, compatibility checks,
93
+ conformance suites, adapters, public contracts, and generated docs/examples.
94
+
95
+ ## Installation
96
+
97
+ Install directly from the public GitHub repository:
98
+
99
+ ```bash
100
+ python -m pip install "git+https://github.com/khaledgabal2/aletheia-memory.git"
101
+ ```
102
+
103
+ After the PyPI package is published, install from the package index:
104
+
105
+ ```bash
106
+ python -m pip install aletheia-memory
107
+ ```
108
+
109
+ Or install a release wheel:
110
+
111
+ ```bash
112
+ python -m pip install ./dist/aletheia_memory-1.3.0-py3-none-any.whl
113
+ ```
114
+
115
+ Verify the CLI and bundled docs:
116
+
117
+ ```bash
118
+ aletheia --help
119
+ aletheia docs list
120
+ aletheia docs show introduction
121
+ ```
122
+
123
+ Install from source:
124
+
125
+ ```bash
126
+ git clone https://github.com/khaledgabal2/aletheia-memory.git
127
+ cd aletheia-memory
128
+ python -m pip install -e ".[dev]"
129
+ ```
130
+
131
+ For local development with `uv`:
132
+
133
+ ```bash
134
+ uv run --extra dev aletheia --help
135
+ uv run --extra dev pytest
136
+ ```
137
+
138
+ ## Quick Start
139
+
140
+ Create a local SQLite database:
141
+
142
+ ```bash
143
+ aletheia init --db ./aletheia.db
144
+ ```
145
+
146
+ Store a reviewed explicit memory:
147
+
148
+ ```bash
149
+ aletheia remember \
150
+ --db ./aletheia.db \
151
+ --namespace user/default \
152
+ --type preference \
153
+ --subject user \
154
+ --predicate prefers_response_style \
155
+ --object "practical and direct"
156
+ ```
157
+
158
+ Search memory:
159
+
160
+ ```bash
161
+ aletheia search \
162
+ --db ./aletheia.db \
163
+ --namespace user/default \
164
+ "response style"
165
+ ```
166
+
167
+ Build an agent-ready context pack:
168
+
169
+ ```bash
170
+ aletheia context-pack \
171
+ --db ./aletheia.db \
172
+ --namespace user/default \
173
+ --mode lexical \
174
+ --token-budget 1200 \
175
+ "How should the assistant respond?"
176
+ ```
177
+
178
+ During repository development, prefix the same commands with
179
+ `uv run --extra dev`:
180
+
181
+ ```bash
182
+ uv run --extra dev aletheia init --db ./aletheia.db
183
+ ```
184
+
185
+ ## Candidate-First Ingestion
186
+
187
+ Use candidate-first ingestion when you want to capture source material without
188
+ trusting every extracted statement automatically.
189
+
190
+ Ingest a note:
191
+
192
+ ```bash
193
+ aletheia ingest text \
194
+ --db ./aletheia.db \
195
+ --namespace user/default \
196
+ --project demo \
197
+ --title "Agent operating notes" \
198
+ "For architecture questions, include concrete implementation details and cite the relevant files."
199
+ ```
200
+
201
+ Extract candidate memories:
202
+
203
+ ```bash
204
+ aletheia extract run \
205
+ --db ./aletheia.db \
206
+ --namespace user/default \
207
+ --batch ing_... \
208
+ --extractor rule_based
209
+ ```
210
+
211
+ Review candidates:
212
+
213
+ ```bash
214
+ aletheia candidates list \
215
+ --db ./aletheia.db \
216
+ --namespace user/default
217
+ ```
218
+
219
+ Promote only what was reviewed:
220
+
221
+ ```bash
222
+ aletheia candidates promote cand_... \
223
+ --db ./aletheia.db \
224
+ --reason "Reviewed against the original note."
225
+ ```
226
+
227
+ ## Semantic And Hybrid Retrieval
228
+
229
+ Aletheia works with deterministic lexical search out of the box. You can also
230
+ index promoted claims with a local semantic provider and run hybrid retrieval:
231
+
232
+ ```bash
233
+ aletheia index semantic \
234
+ --db ./aletheia.db \
235
+ --namespace user/default \
236
+ --target claims \
237
+ --provider local_hash \
238
+ --dimension 64
239
+
240
+ aletheia search \
241
+ --db ./aletheia.db \
242
+ --namespace user/default \
243
+ --mode hybrid \
244
+ --semantic-provider local_hash \
245
+ "What response style does the user prefer?"
246
+ ```
247
+
248
+ ## Python API
249
+
250
+ Use the in-process kernel when your Python application can safely share the
251
+ local SQLite database.
252
+
253
+ ```python
254
+ from aletheia import Memory
255
+
256
+ memory = Memory.open("./aletheia.db", namespace="user/default")
257
+
258
+ try:
259
+ claim = memory.remember(
260
+ namespace="user/default",
261
+ memory_type="preference",
262
+ subject="user",
263
+ predicate="prefers_response_style",
264
+ object="practical and direct",
265
+ )
266
+
267
+ results = memory.retrieve(
268
+ namespace="user/default",
269
+ query="response style",
270
+ mode="lexical",
271
+ limit=5,
272
+ )
273
+
274
+ pack = memory.context_pack(
275
+ namespace="user/default",
276
+ query="How should the assistant respond?",
277
+ retrieval_mode="lexical",
278
+ token_budget=1200,
279
+ )
280
+
281
+ print(claim.id)
282
+ print([result.claim_id for result in results])
283
+ print(pack.to_markdown())
284
+ finally:
285
+ memory.close()
286
+ ```
287
+
288
+ ## Local HTTP Service
289
+
290
+ Use the HTTP service when another process, runtime, or language needs access to
291
+ memory.
292
+
293
+ Create an API client and scoped token:
294
+
295
+ ```bash
296
+ aletheia clients create \
297
+ --db ./aletheia.db \
298
+ --name local-agent \
299
+ --type agent
300
+
301
+ aletheia auth create-token \
302
+ --db ./aletheia.db \
303
+ --client local-agent \
304
+ --namespace user/default \
305
+ --capabilities memory:read,memory:context,memory:write_candidate,memory:feedback,memory:audit
306
+ ```
307
+
308
+ Start the local daemon:
309
+
310
+ ```bash
311
+ aletheia serve \
312
+ --db ./aletheia.db \
313
+ --host 127.0.0.1 \
314
+ --port 8765
315
+ ```
316
+
317
+ Health and API discovery:
318
+
319
+ ```bash
320
+ curl -s http://127.0.0.1:8765/v1/health
321
+ curl -s http://127.0.0.1:8765/v1/openapi.json
322
+ ```
323
+
324
+ Fetch a context pack:
325
+
326
+ ```bash
327
+ curl -s http://127.0.0.1:8765/v1/context-pack \
328
+ -H "Content-Type: application/json" \
329
+ -H "Authorization: Bearer atl_..." \
330
+ -d '{
331
+ "namespace": "user/default",
332
+ "query": "How should the assistant respond?",
333
+ "retrieval_mode": "lexical",
334
+ "token_budget": 1200,
335
+ "record_usage": true
336
+ }'
337
+ ```
338
+
339
+ Store an agent observation as a reviewable candidate:
340
+
341
+ ```bash
342
+ curl -s http://127.0.0.1:8765/v1/remember \
343
+ -H "Content-Type: application/json" \
344
+ -H "Authorization: Bearer atl_..." \
345
+ -H "Idempotency-Key: task-001-memory-001" \
346
+ -d '{
347
+ "namespace": "user/default",
348
+ "write_mode": "candidate",
349
+ "memory_type": "preference",
350
+ "subject": "user",
351
+ "predicate": "prefers_response_style",
352
+ "object": "practical and direct",
353
+ "evidence_text": "The user asked for practical and direct answers."
354
+ }'
355
+ ```
356
+
357
+ ## MCP
358
+
359
+ Use MCP when an agent host can run local stdio tools.
360
+
361
+ ```bash
362
+ aletheia mcp \
363
+ --db ./aletheia.db \
364
+ --namespace user/default \
365
+ --mode read_write_candidate
366
+ ```
367
+
368
+ Recommended modes:
369
+
370
+ - `read_only` for context-only consumers.
371
+ - `read_write_candidate` for normal local agents.
372
+ - `read_write_active` for trusted tools that may write active claims.
373
+ - `admin` for operational tooling.
374
+
375
+ ## Common Workflows
376
+
377
+ Inspect claim provenance:
378
+
379
+ ```bash
380
+ aletheia audit clm_... --db ./aletheia.db
381
+ ```
382
+
383
+ Record feedback:
384
+
385
+ ```bash
386
+ aletheia feedback clm_... \
387
+ --db ./aletheia.db \
388
+ --namespace user/default \
389
+ --signal confirmed \
390
+ --note "Confirmed during review."
391
+ ```
392
+
393
+ Detect and resolve conflicts:
394
+
395
+ ```bash
396
+ aletheia conflicts list \
397
+ --db ./aletheia.db \
398
+ --namespace user/default
399
+
400
+ aletheia conflicts resolve conf_... \
401
+ --db ./aletheia.db \
402
+ --strategy context_scope \
403
+ --note "Both claims are valid in different contexts."
404
+ ```
405
+
406
+ Run operational checks:
407
+
408
+ ```bash
409
+ aletheia doctor --db ./aletheia.db
410
+ aletheia compatibility report --db ./aletheia.db
411
+ aletheia readiness check --db ./aletheia.db --namespace user/default
412
+ ```
413
+
414
+ Create and verify an encrypted backup:
415
+
416
+ ```bash
417
+ aletheia backup create \
418
+ --db ./aletheia.db \
419
+ --namespace user/default \
420
+ --output ./aletheia.alet \
421
+ --encrypt \
422
+ --passphrase "change-me"
423
+
424
+ aletheia backup verify ./aletheia.alet \
425
+ --db ./aletheia.db \
426
+ --passphrase "change-me"
427
+ ```
428
+
429
+ Generate local docs:
430
+
431
+ ```bash
432
+ aletheia docs build --db ./aletheia.db --output ./site
433
+ aletheia examples list --db ./aletheia.db
434
+ ```
435
+
436
+ ## Documentation
437
+
438
+ Aletheia ships its docs with the installed package:
439
+
440
+ ```bash
441
+ aletheia docs list
442
+ aletheia docs path
443
+ aletheia docs show index
444
+ ```
445
+
446
+ Recommended starting points:
447
+
448
+ - [Installation](docs/installation.md)
449
+ - [Introduction](docs/introduction.md)
450
+ - [Core Concepts](docs/core_concepts.md)
451
+ - [Memory Lifecycle](docs/memory_lifecycle.md)
452
+ - [Architecture](docs/architecture.md)
453
+ - [Interfaces](docs/interfaces.md)
454
+ - [CLI Reference](docs/cli_reference.md)
455
+ - [Integration Guide](docs/integration_guide.md)
456
+ - [HTTP API Reference](docs/http_api_reference.md)
457
+ - [MCP Reference](docs/mcp_reference.md)
458
+ - [Security And Privacy Guide](docs/security_privacy_guide.md)
459
+ - [Operations Guide](docs/operations_guide.md)
460
+ - [Troubleshooting](docs/troubleshooting.md)
461
+ - [Near-Future Changes](docs/near_future_changes.md)
462
+
463
+ ## Trust And Privacy Model
464
+
465
+ Aletheia is local-first by default. Evidence, claims, review state, service logs,
466
+ metrics, traces, and operational records live in the configured SQLite database
467
+ unless explicitly exported.
468
+
469
+ Important boundaries:
470
+
471
+ - Raw ingested content is evidence, not truth.
472
+ - Candidate writes are the default safer write path for agents.
473
+ - Active writes require explicit authority.
474
+ - API tokens can be scoped by capability, namespace grant, and privacy ceiling.
475
+ - Protected mode encrypts sensitive stored content when configured with local
476
+ key material.
477
+ - External LLM providers are optional and governed by policy.
478
+ - Forget and redaction workflows preserve tombstones and auditability.
479
+
480
+ ## Development
481
+
482
+ Run tests:
483
+
484
+ ```bash
485
+ uv run --extra dev pytest
486
+ ```
487
+
488
+ Run the release gate for the public baseline:
489
+
490
+ ```bash
491
+ python scripts/release_gate.py --branch main
492
+ ```
493
+
494
+ Build the package:
495
+
496
+ ```bash
497
+ uv build
498
+ ```
499
+
500
+ ## Release Verification
501
+
502
+ Before cutting a release, run:
503
+
504
+ ```bash
505
+ uv run --extra dev pytest
506
+ python scripts/release_gate.py --branch main
507
+ uv build
508
+ ```
509
+
510
+ ## Community And Security
511
+
512
+ - Contributions: [CONTRIBUTING.md](CONTRIBUTING.md)
513
+ - Security reports: [SECURITY.md](SECURITY.md)
514
+ - Release notes: [CHANGELOG.md](CHANGELOG.md)
515
+
516
+ ## Contributing
517
+
518
+ Contributions should preserve Aletheia's core boundaries: local-first
519
+ operation, evidence-backed memory, candidate-first agent writes, explicit
520
+ review for trust, scoped access, and auditability. Open an issue or discussion
521
+ before introducing new persistent schema, new network behavior, or new
522
+ active-write paths.