severian 0.3.13__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 (229) hide show
  1. severian-0.3.13/.gitignore +18 -0
  2. severian-0.3.13/CHANGELOG.md +146 -0
  3. severian-0.3.13/LICENSE +21 -0
  4. severian-0.3.13/PKG-INFO +278 -0
  5. severian-0.3.13/README.md +247 -0
  6. severian-0.3.13/docs/README.md +13 -0
  7. severian-0.3.13/docs/benchmarks/README.md +14 -0
  8. severian-0.3.13/docs/benchmarks/evidence/2026-08-05-head/README.md +38 -0
  9. severian-0.3.13/docs/benchmarks/evidence/2026-08-09-zero-debt/README.md +60 -0
  10. severian-0.3.13/docs/benchmarks/evidence/2026-08-10-zero-debt-remediation-round2/README.md +71 -0
  11. severian-0.3.13/docs/benchmarks/omnimemeval/README.md +22 -0
  12. severian-0.3.13/native/README.md +64 -0
  13. severian-0.3.13/native/pyproject.toml +24 -0
  14. severian-0.3.13/plugins/hermes/severian/README.md +36 -0
  15. severian-0.3.13/plugins/hermes/severian/pyproject.toml +13 -0
  16. severian-0.3.13/pyproject.toml +107 -0
  17. severian-0.3.13/src/severian/__init__.py +0 -0
  18. severian-0.3.13/src/severian/api/__init__.py +12 -0
  19. severian-0.3.13/src/severian/api/app.py +419 -0
  20. severian-0.3.13/src/severian/api/schemas.py +124 -0
  21. severian-0.3.13/src/severian/application/__init__.py +0 -0
  22. severian-0.3.13/src/severian/application/anticipation.py +397 -0
  23. severian-0.3.13/src/severian/application/compactcites.py +42 -0
  24. severian-0.3.13/src/severian/application/conflicts.py +204 -0
  25. severian-0.3.13/src/severian/application/context_v2.py +145 -0
  26. severian-0.3.13/src/severian/application/datestamps.py +96 -0
  27. severian-0.3.13/src/severian/application/derivation.py +326 -0
  28. severian-0.3.13/src/severian/application/dreaming.py +760 -0
  29. severian-0.3.13/src/severian/application/emptyitems.py +72 -0
  30. severian-0.3.13/src/severian/application/episodes.py +155 -0
  31. severian-0.3.13/src/severian/application/eventtime.py +333 -0
  32. severian-0.3.13/src/severian/application/extraction.py +253 -0
  33. severian-0.3.13/src/severian/application/factanchors.py +78 -0
  34. severian-0.3.13/src/severian/application/factslots.py +356 -0
  35. severian-0.3.13/src/severian/application/fillbudget.py +192 -0
  36. severian-0.3.13/src/severian/application/graph.py +218 -0
  37. severian-0.3.13/src/severian/application/ingestion.py +114 -0
  38. severian-0.3.13/src/severian/application/ports.py +430 -0
  39. severian-0.3.13/src/severian/application/projections.py +211 -0
  40. severian-0.3.13/src/severian/application/replytrim.py +82 -0
  41. severian-0.3.13/src/severian/application/rerank.py +116 -0
  42. severian-0.3.13/src/severian/application/retrieval.py +604 -0
  43. severian-0.3.13/src/severian/application/service.py +905 -0
  44. severian-0.3.13/src/severian/application/statements.py +167 -0
  45. severian-0.3.13/src/severian/application/sufficiency.py +171 -0
  46. severian-0.3.13/src/severian/application/truthresolution.py +505 -0
  47. severian-0.3.13/src/severian/application/userfacts.py +409 -0
  48. severian-0.3.13/src/severian/application/worker.py +465 -0
  49. severian-0.3.13/src/severian/auth/__init__.py +24 -0
  50. severian-0.3.13/src/severian/auth/principal_resolver.py +114 -0
  51. severian-0.3.13/src/severian/auth/store.py +226 -0
  52. severian-0.3.13/src/severian/backends.py +104 -0
  53. severian-0.3.13/src/severian/benchmarks/__init__.py +48 -0
  54. severian-0.3.13/src/severian/benchmarks/adapters/__init__.py +24 -0
  55. severian-0.3.13/src/severian/benchmarks/adapters/baseline.py +85 -0
  56. severian-0.3.13/src/severian/benchmarks/adapters/chroma.py +271 -0
  57. severian-0.3.13/src/severian/benchmarks/adapters/scope.py +18 -0
  58. severian-0.3.13/src/severian/benchmarks/adapters/severian.py +434 -0
  59. severian-0.3.13/src/severian/benchmarks/checkpoint_merge.py +151 -0
  60. severian-0.3.13/src/severian/benchmarks/cli.py +45 -0
  61. severian-0.3.13/src/severian/benchmarks/embedding_runner.py +680 -0
  62. severian-0.3.13/src/severian/benchmarks/manifest.py +292 -0
  63. severian-0.3.13/src/severian/benchmarks/quantiles.py +57 -0
  64. severian-0.3.13/src/severian/benchmarks/runner.py +398 -0
  65. severian-0.3.13/src/severian/cli/__init__.py +13 -0
  66. severian-0.3.13/src/severian/cli/__main__.py +5 -0
  67. severian-0.3.13/src/severian/cli/app.py +774 -0
  68. severian-0.3.13/src/severian/cli/path_policy.py +103 -0
  69. severian-0.3.13/src/severian/composition.py +204 -0
  70. severian-0.3.13/src/severian/domain/__init__.py +0 -0
  71. severian-0.3.13/src/severian/domain/errors.py +42 -0
  72. severian-0.3.13/src/severian/domain/hits.py +25 -0
  73. severian-0.3.13/src/severian/domain/models.py +362 -0
  74. severian-0.3.13/src/severian/domain/text.py +38 -0
  75. severian-0.3.13/src/severian/infrastructure/__init__.py +0 -0
  76. severian-0.3.13/src/severian/infrastructure/audit.py +411 -0
  77. severian-0.3.13/src/severian/infrastructure/embedding_daemon.py +305 -0
  78. severian-0.3.13/src/severian/infrastructure/embedding_metadata.py +137 -0
  79. severian-0.3.13/src/severian/infrastructure/embedding_registry.py +177 -0
  80. severian-0.3.13/src/severian/infrastructure/embedding_resolver.py +170 -0
  81. severian-0.3.13/src/severian/infrastructure/fts.py +289 -0
  82. severian-0.3.13/src/severian/infrastructure/granite_embedding.py +100 -0
  83. severian-0.3.13/src/severian/infrastructure/native_accel.py +148 -0
  84. severian-0.3.13/src/severian/infrastructure/pgvector_index.py +343 -0
  85. severian-0.3.13/src/severian/infrastructure/postgresql.py +2176 -0
  86. severian-0.3.13/src/severian/infrastructure/qwen_embedding.py +147 -0
  87. severian-0.3.13/src/severian/infrastructure/rebuild.py +469 -0
  88. severian-0.3.13/src/severian/infrastructure/remote_qwen_embedding.py +254 -0
  89. severian-0.3.13/src/severian/infrastructure/snapshot.py +237 -0
  90. severian-0.3.13/src/severian/infrastructure/sqlite.py +2036 -0
  91. severian-0.3.13/src/severian/infrastructure/stemming.py +207 -0
  92. severian-0.3.13/src/severian/infrastructure/task_notes.py +107 -0
  93. severian-0.3.13/src/severian/infrastructure/vector.py +520 -0
  94. severian-0.3.13/src/severian/integrations/__init__.py +9 -0
  95. severian-0.3.13/src/severian/integrations/hermes.py +1115 -0
  96. severian-0.3.13/src/severian/mcp/__init__.py +18 -0
  97. severian-0.3.13/src/severian/mcp/__main__.py +73 -0
  98. severian-0.3.13/src/severian/mcp/server.py +931 -0
  99. severian-0.3.13/src/severian/py.typed +0 -0
  100. severian-0.3.13/src/severian/sdk/__init__.py +17 -0
  101. severian-0.3.13/src/severian/sdk/client.py +250 -0
  102. severian-0.3.13/tests/api/test_api.py +322 -0
  103. severian-0.3.13/tests/application/test_anticipation.py +491 -0
  104. severian-0.3.13/tests/application/test_architecture_repairs.py +286 -0
  105. severian-0.3.13/tests/application/test_backlog_sweep.py +182 -0
  106. severian-0.3.13/tests/application/test_bulk_operations.py +282 -0
  107. severian-0.3.13/tests/application/test_combined_h1h2.py +89 -0
  108. severian-0.3.13/tests/application/test_context_efficiency.py +270 -0
  109. severian-0.3.13/tests/application/test_context_v2.py +377 -0
  110. severian-0.3.13/tests/application/test_contradiction_resolution.py +173 -0
  111. severian-0.3.13/tests/application/test_correction_integrity.py +169 -0
  112. severian-0.3.13/tests/application/test_date_stamps.py +198 -0
  113. severian-0.3.13/tests/application/test_derive_amplification_fix.py +125 -0
  114. severian-0.3.13/tests/application/test_derive_pending.py +101 -0
  115. severian-0.3.13/tests/application/test_drain_projection_isolation.py +170 -0
  116. severian-0.3.13/tests/application/test_dreaming.py +271 -0
  117. severian-0.3.13/tests/application/test_dreaming_lsh.py +140 -0
  118. severian-0.3.13/tests/application/test_dreaming_lsh_repair.py +174 -0
  119. severian-0.3.13/tests/application/test_episodes.py +176 -0
  120. severian-0.3.13/tests/application/test_event_time.py +248 -0
  121. severian-0.3.13/tests/application/test_extraction.py +287 -0
  122. severian-0.3.13/tests/application/test_fact_anchors.py +77 -0
  123. severian-0.3.13/tests/application/test_fill_safety.py +157 -0
  124. severian-0.3.13/tests/application/test_name_links.py +125 -0
  125. severian-0.3.13/tests/application/test_outbox_claiming.py +149 -0
  126. severian-0.3.13/tests/application/test_pending_derivation.py +107 -0
  127. severian-0.3.13/tests/application/test_projection_events.py +318 -0
  128. severian-0.3.13/tests/application/test_rerank.py +265 -0
  129. severian-0.3.13/tests/application/test_retrieval_coverage.py +72 -0
  130. severian-0.3.13/tests/application/test_round3_fixes.py +183 -0
  131. severian-0.3.13/tests/application/test_search_tuning.py +166 -0
  132. severian-0.3.13/tests/application/test_service.py +263 -0
  133. severian-0.3.13/tests/application/test_tier2_memory.py +296 -0
  134. severian-0.3.13/tests/application/test_tier3_memory.py +247 -0
  135. severian-0.3.13/tests/application/test_truth_resolver.py +457 -0
  136. severian-0.3.13/tests/application/test_truth_state.py +194 -0
  137. severian-0.3.13/tests/application/test_user_facts.py +868 -0
  138. severian-0.3.13/tests/application/test_worker.py +317 -0
  139. severian-0.3.13/tests/auth/__init__.py +0 -0
  140. severian-0.3.13/tests/auth/test_api_auth.py +282 -0
  141. severian-0.3.13/tests/auth/test_auth_store.py +180 -0
  142. severian-0.3.13/tests/auth/test_hermes_principal.py +171 -0
  143. severian-0.3.13/tests/auth/test_mcp_principal.py +206 -0
  144. severian-0.3.13/tests/auth/test_principal_resolver.py +155 -0
  145. severian-0.3.13/tests/auth/test_sdk_api_key.py +160 -0
  146. severian-0.3.13/tests/auth/test_serve_dev_guard.py +62 -0
  147. severian-0.3.13/tests/benchmarks/test_aggregate_bakeoff_reps.py +135 -0
  148. severian-0.3.13/tests/benchmarks/test_batch_compare.py +118 -0
  149. severian-0.3.13/tests/benchmarks/test_bench_provenance.py +63 -0
  150. severian-0.3.13/tests/benchmarks/test_chroma_isolation.py +284 -0
  151. severian-0.3.13/tests/benchmarks/test_corpus_provenance.py +134 -0
  152. severian-0.3.13/tests/benchmarks/test_derive_on_query.py +145 -0
  153. severian-0.3.13/tests/benchmarks/test_embedding_evidence_integrity.py +394 -0
  154. severian-0.3.13/tests/benchmarks/test_embedding_manifest_resource_caps.py +23 -0
  155. severian-0.3.13/tests/benchmarks/test_embedding_runner.py +313 -0
  156. severian-0.3.13/tests/benchmarks/test_manifest.py +440 -0
  157. severian-0.3.13/tests/benchmarks/test_metric_denominators.py +225 -0
  158. severian-0.3.13/tests/benchmarks/test_native_acceleration_runner.py +132 -0
  159. severian-0.3.13/tests/benchmarks/test_quantiles.py +53 -0
  160. severian-0.3.13/tests/benchmarks/test_qwen_lane_contract.py +252 -0
  161. severian-0.3.13/tests/benchmarks/test_ranking_determinism.py +76 -0
  162. severian-0.3.13/tests/benchmarks/test_retrieval_fixes.py +270 -0
  163. severian-0.3.13/tests/benchmarks/test_run_benchmark_qwen_selection.py +39 -0
  164. severian-0.3.13/tests/benchmarks/test_scale_provenance.py +139 -0
  165. severian-0.3.13/tests/benchmarks/test_scale_warmup.py +68 -0
  166. severian-0.3.13/tests/ci/test_ci_workflow_postgres_contract.py +24 -0
  167. severian-0.3.13/tests/cli/test_audit.py +201 -0
  168. severian-0.3.13/tests/cli/test_build_redacted_embedding_corpus.py +295 -0
  169. severian-0.3.13/tests/cli/test_build_semantic_quality_corpus.py +163 -0
  170. severian-0.3.13/tests/cli/test_cli.py +469 -0
  171. severian-0.3.13/tests/conftest.py +24 -0
  172. severian-0.3.13/tests/contract/test_backends.py +613 -0
  173. severian-0.3.13/tests/contract/test_backends_live.py +578 -0
  174. severian-0.3.13/tests/contract/test_deployability.py +166 -0
  175. severian-0.3.13/tests/contract/test_neighbour_lookups.py +98 -0
  176. severian-0.3.13/tests/contract/test_pgvector_index_live.py +196 -0
  177. severian-0.3.13/tests/contract/test_qwen_reembedding_pg.py +174 -0
  178. severian-0.3.13/tests/contract/test_repository.py +77 -0
  179. severian-0.3.13/tests/contract/test_repository_adversarial.py +441 -0
  180. severian-0.3.13/tests/contract/test_user_facts_golive.py +133 -0
  181. severian-0.3.13/tests/examples/test_quickstart.py +19 -0
  182. severian-0.3.13/tests/gates/test_native_fallback_contract.py +263 -0
  183. severian-0.3.13/tests/gates/test_release_gates.py +353 -0
  184. severian-0.3.13/tests/infrastructure/test_fts.py +98 -0
  185. severian-0.3.13/tests/infrastructure/test_private_file_permissions.py +35 -0
  186. severian-0.3.13/tests/infrastructure/test_snapshot_scope_integrity.py +72 -0
  187. severian-0.3.13/tests/infrastructure/test_stemming.py +76 -0
  188. severian-0.3.13/tests/integration/test_backup_export.py +54 -0
  189. severian-0.3.13/tests/integration/test_memory_engine.py +595 -0
  190. severian-0.3.13/tests/integration/test_native_vector_integration.py +149 -0
  191. severian-0.3.13/tests/integrations/test_hermes.py +604 -0
  192. severian-0.3.13/tests/integrations/test_hermes_catalog_review.py +135 -0
  193. severian-0.3.13/tests/integrations/test_hermes_context_chars.py +112 -0
  194. severian-0.3.13/tests/integrations/test_hermes_fleet_scope.py +300 -0
  195. severian-0.3.13/tests/integrations/test_hermes_memory_tools.py +220 -0
  196. severian-0.3.13/tests/integrations/test_hermes_plugin_loader.py +115 -0
  197. severian-0.3.13/tests/integrations/test_hermes_plugin_packaging.py +64 -0
  198. severian-0.3.13/tests/integrations/test_hermes_round3.py +79 -0
  199. severian-0.3.13/tests/integrations/test_hermes_task_progress.py +112 -0
  200. severian-0.3.13/tests/mcp/test_mcp_server.py +869 -0
  201. severian-0.3.13/tests/sdk/test_sdk.py +218 -0
  202. severian-0.3.13/tests/test_extraction_warning_regression.py +21 -0
  203. severian-0.3.13/tests/unit/test_atomic_rebuild.py +217 -0
  204. severian-0.3.13/tests/unit/test_atomic_rebuild_pg.py +195 -0
  205. severian-0.3.13/tests/unit/test_bench_charts.py +83 -0
  206. severian-0.3.13/tests/unit/test_bounded_topk.py +154 -0
  207. severian-0.3.13/tests/unit/test_compact_cites.py +63 -0
  208. severian-0.3.13/tests/unit/test_conflict_notes.py +166 -0
  209. severian-0.3.13/tests/unit/test_cross_version_score_contract.py +119 -0
  210. severian-0.3.13/tests/unit/test_embedding_guard.py +47 -0
  211. severian-0.3.13/tests/unit/test_embedding_resolver.py +175 -0
  212. severian-0.3.13/tests/unit/test_embedding_space_identity.py +265 -0
  213. severian-0.3.13/tests/unit/test_embeddings.py +116 -0
  214. severian-0.3.13/tests/unit/test_empty_items.py +93 -0
  215. severian-0.3.13/tests/unit/test_factslots.py +291 -0
  216. severian-0.3.13/tests/unit/test_fill_budget.py +181 -0
  217. severian-0.3.13/tests/unit/test_models.py +37 -0
  218. severian-0.3.13/tests/unit/test_native_vector_backend.py +224 -0
  219. severian-0.3.13/tests/unit/test_path_policy.py +94 -0
  220. severian-0.3.13/tests/unit/test_qwen_embedding.py +149 -0
  221. severian-0.3.13/tests/unit/test_qwen_reembedding.py +213 -0
  222. severian-0.3.13/tests/unit/test_remote_qwen_embedding.py +684 -0
  223. severian-0.3.13/tests/unit/test_reply_trim.py +102 -0
  224. severian-0.3.13/tests/unit/test_sufficiency.py +158 -0
  225. severian-0.3.13/tests/unit/test_suite_isolation.py +17 -0
  226. severian-0.3.13/tests/unit/test_truth_decide.py +339 -0
  227. severian-0.3.13/tests/unit/test_vector_blob_storage.py +242 -0
  228. severian-0.3.13/tests/unit/test_vector_topk.py +48 -0
  229. severian-0.3.13/uv.lock +1539 -0
@@ -0,0 +1,18 @@
1
+ .venv/
2
+ __pycache__/
3
+ .pytest_cache/
4
+ .mypy_cache/
5
+ .ruff_cache/
6
+ *.py[cod]
7
+ *.db
8
+ *.db-wal
9
+ *.db-shm
10
+ build/
11
+ dist/
12
+ # native companion build artifacts (Rust)
13
+ native/target/
14
+ native/.venv/
15
+ *.whl
16
+ .hermes/
17
+ # local stores created by the quick start
18
+ data/
@@ -0,0 +1,146 @@
1
+ # Changelog
2
+
3
+ All notable changes to Severian. Dates are release dates (YYYY-MM-DD). Behaviour switches named here are environment
4
+ variables; see the Configuration table in the [README](README.md).
5
+
6
+ ## [Unreleased]
7
+
8
+ ## [0.3.13] - 2026-10-25
9
+
10
+ Plugin-catalog review fixes (NousResearch/hermes-agent#142812). No change to memory behaviour.
11
+
12
+ ### Changed
13
+ - Severian is published on PyPI. The Hermes plugin folder pins `severian==0.3.13` from the index instead of a local
14
+ wheel path, so a catalog install (which copies only the plugin folder) resolves its dependency. The plugin folder now
15
+ holds only reviewable source. Releases publish from `.github/workflows/release.yml` with trusted publishing and a
16
+ build attestation.
17
+ - `SEVERIAN_DSN` is read through Hermes's profile-aware secret scope (`agent.secret_scope.get_secret`) and declared
18
+ under `requires_env` as an optional secret, so one Hermes process serving several profiles never picks up another
19
+ profile's database credentials. Under multiplexing with no active scope the read fails closed. A Hermes without the
20
+ secret scope falls back to the environment, as before.
21
+ - The optional Qwen and Granite embedding loaders pass `local_files_only` to the loader instead of setting
22
+ `HF_HUB_OFFLINE` / `TQDM_DISABLE` for the whole Hermes process.
23
+
24
+ ## [0.3.12] - 2026-10-25
25
+
26
+ Every new switch is off by default; with all of them off, behaviour is byte-identical to 0.3.11 (tested). Measured on
27
+ OmniMemEval with the board's models: [docs/benchmarks/omnimemeval-2026-10.md](docs/benchmarks/omnimemeval-2026-10.md).
28
+
29
+ ### Added
30
+ - `SEVERIAN_CONTEXT_CHARS` (unset = 8,000, unchanged): the Hermes provider's prefetch context cap, now settable without
31
+ code changes (the loader builds the provider with no arguments). Whole numbers >= 1,000; a bad value logs a warning
32
+ and keeps 8,000 rather than leaving memory unavailable. On stores of long messages this cap is the main
33
+ cost/quality trade-off (OmniMemEval, Hermes default: BEAM 63.9 vs 71.6 and LongMemEval 82.0 vs 90.6 uncapped).
34
+ - `SEVERIAN_FILL_BUDGET` (off; measured at the Hermes default: LoCoMo +1.23, 95% range +0.13 to +2.34, no change on
35
+ LongMemEval or BEAM): assembly spends the character window the caller's own items leave empty on the turns
36
+ either side of them, read from the same conversations and appended after those items. It runs no search, so the
37
+ ranking cannot move: the items and their order are unchanged, and with the switch off the block is byte-identical to
38
+ 0.3.11. Three seeds, two turns either side, both bounded; nothing is read at all when the items already fill the
39
+ window. The appended memories obey the same closure rule as the `now` view, so a fact that truth resolution closed
40
+ is never put back into a current context.
41
+ - `SEVERIAN_COMPACT_CITES` (off): one id per item instead of two. The block cites the source observation ids in the
42
+ bracket and drops the trailing `source:` line, saving about 45 characters per item; every cited id still resolves
43
+ through `severian_get_observation`, `severian_correct` and `severian_forget`.
44
+ - `SEVERIAN_LINK_SEEDS` / `SEVERIAN_LINK_WEIGHT` (off, seeds 0, **parked**: lowered multi-hop all-evidence 23.8% -> 16.7% at equal budget
45
+ and slowed search 1.2-1.8x; keep off): name links. A name in one of the best matches
46
+ ("my manager is Kiran") runs one keyword search of its own and pulls in the memories that name the same person
47
+ ("Kiran is allergic to sesame"), scored at `LINK_WEIGHT` times the match so real matches stay first. Targets
48
+ multi-hop questions. Off means the ranking and the number of searches are exactly as before.
49
+ - `SEVERIAN_CONTEXT_FORMAT=v2` (off; measured: no change on LoCoMo or LongMemEval, so it stays off): the
50
+ answerer-facing block. It leads with the most directly relevant note, numbers
51
+ each note with its state (current / also true together / earlier, replaced / change) and the date it was said, quotes
52
+ the user's own words for a user fact, and ends with an explicit "if none of these notes is relevant, say you don't
53
+ know". Off keeps the 0.3.11 block byte for byte. **Order with conflict notes** (on by default since 0.3.9): a note's
54
+ state label carries the conflict information on the note it belongs to, so when v2 is on the trailing conflict note
55
+ is not added after the don't-know rule — one voice, nothing repeated.
56
+
57
+ ### Parked
58
+ - `SEVERIAN_SUFFICIENCY` (off, **not shippable as designed**): the line fires on a missing *word*, not a missing
59
+ *answer*. An independent probe showed it firing on 20 of 20 answerable questions whose answer is worded without the
60
+ question's slot word ("What is my budget for the trip?" / "I can spend about £500 on the trip"). The code stays in
61
+ the tree behind its switch, off, with its budget guard tested; a future version needs a semantic answerability check
62
+ and a paraphrased negative-control set.
63
+
64
+ ## [0.3.11] - 2026-10-22
65
+
66
+ ### Added
67
+ - The MCP server now exposes the full seven-tool surface (`severian_correct`, `severian_forget`,
68
+ `severian_task_progress`, `severian_search_shared` alongside ingest/search/get), so Claude Code, Codex,
69
+ OpenCode and Claude Desktop get feature parity with the Hermes provider. All new tools carry the same
70
+ principal binding, explicit-scope rule and error mapping as the existing three.
71
+ - `docs/integrations.md`: MCP recipes per harness, with the verification status of each stated honestly
72
+ (all protocol-verified over live stdio; harness end-to-end runs marked where pending).
73
+
74
+ ## [0.3.10] - 2026-10-22
75
+
76
+ ### Added
77
+ - Repo tidied for catalog submission: pitch README with the October competitor round, docs index, CHANGELOG, CONTRIBUTING, SECURITY, issue/PR templates, a runnable example with its own test, and rule-13 disclosures in the plugin directory.
78
+
79
+ ### Changed
80
+ - Dependency floors carry upper bounds (pydantic, sqlalchemy, alembic, psycopg, pgvector).
81
+ - The GitHub repository is renamed to `Sahil-SS9/Severian` (old links redirect).
82
+
83
+ ## [0.3.9] - 2026-10-21
84
+
85
+ ### Changed
86
+ - `SEVERIAN_CONFLICT_NOTES` is **on by default**: when two returned memories disagree, the context ends with a short
87
+ note naming both ("If it matters, mention both."). `SEVERIAN_CONFLICT_NOTES=0` turns it off. Re-test: more BEAM
88
+ answers right with no size limit and at 8,000 characters, never fewer in total.
89
+
90
+ ### Removed
91
+ - `SEVERIAN_TIE_ORDER` (same-moment "1st/2nd" marks): correct after 0.3.8's fix, but it changed no answers.
92
+
93
+ ### Unchanged (off)
94
+ - `SEVERIAN_REPLY_TRIM` is parked: large gains when the context budget is very tight, losses at 8,000 characters.
95
+ - `SEVERIAN_DROP_EMPTY`: no gain in the round 3 re-run.
96
+
97
+ ## [0.3.8] - 2026-10-21 (built for benchmarking, never released to production)
98
+
99
+ ### Added
100
+ - Four round 3 switches, all off by default: `SEVERIAN_REPLY_TRIM`, `SEVERIAN_CONFLICT_NOTES`, `SEVERIAN_DROP_EMPTY`,
101
+ `SEVERIAN_TIE_ORDER`. With every switch off, output is byte-identical to 0.3.7.
102
+
103
+ ## [0.3.7] - 2026-10-16
104
+
105
+ ### Changed
106
+ - Fact extraction treats a busy or restarting model as retryable: the job goes back to pending (5 to 60 minutes, six
107
+ tries) instead of failing.
108
+ - Fact extraction skips machine prompts (cron, kanban dispatch) and profiles listed in `SEVERIAN_FACTS_SKIP_PROFILES`.
109
+
110
+ ## [0.3.6] - 2026-10-11
111
+
112
+ ### Changed
113
+ - Much faster exact vector search on large scopes on the `SEVERIAN_OPT_NUMPY=1` path: a candidate cut keeps every
114
+ tie at the boundary, so results are identical. This is the version benchmarked in the October competitor round.
115
+
116
+ ## [0.3.5] - 2026-10-11
117
+
118
+ ### Added
119
+ - Task progress notes (`severian_task_progress`: set, get, list, clear), kept as history and never returned by search.
120
+ - Embedding sidecar device switch.
121
+
122
+ ## [0.3.4] - 2026-10-10
123
+
124
+ ### Added
125
+ - `SEVERIAN_TRUTH_RESOLUTION`: memories a newer fact replaced leave the current view and appear, dated, in history.
126
+ - `SEVERIAN_RERANK`: optional cross-encoder re-ranking of the fused candidates.
127
+ - Fact-extraction failure logging.
128
+
129
+ ## [0.3.3] - 2026-10-07
130
+
131
+ ### Added
132
+ - `SEVERIAN_DATE_STAMPS`: saves the date and weekday with each memory and resolves relative times ("last Tuesday").
133
+
134
+ ### Fixed
135
+ - Plugin manifest and provider version now match the package version.
136
+
137
+ ## [0.3.2] - 2026-10-07
138
+
139
+ ### Added
140
+ - `SEVERIAN_USER_FACTS`: short facts per conversation turn, extracted in the background.
141
+
142
+ ## [0.1.0] - 2026-08-01
143
+
144
+ First release: canonical append-only store (SQLite and PostgreSQL), five-dimensional scope, hybrid BM25 + vector
145
+ retrieval, correction and rollback, worker jobs, dreaming and curation, CLI, HTTP API, MCP server, export/import and
146
+ the operator runbook.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sahil Saghir
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,278 @@
1
+ Metadata-Version: 2.5
2
+ Name: severian
3
+ Version: 0.3.13
4
+ Summary: Local-first long-term memory for AI agents: scoped, cited, correctable, with hybrid recall
5
+ Project-URL: Homepage, https://github.com/Sahil-SS9/Severian
6
+ Project-URL: Source, https://github.com/Sahil-SS9/Severian
7
+ Project-URL: Changelog, https://github.com/Sahil-SS9/Severian/blob/main/CHANGELOG.md
8
+ Project-URL: Benchmarks, https://github.com/Sahil-SS9/Severian/blob/main/docs/benchmarks/omnimemeval-2026-10.md
9
+ Author: Sahil-SS9
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: agents,hermes,llm,mcp,memory,retrieval
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: POSIX :: Linux
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Requires-Python: >=3.11
21
+ Requires-Dist: alembic<2.0,>=1.13
22
+ Requires-Dist: fastapi<1.0,>=0.115
23
+ Requires-Dist: httpx<1.0,>=0.27
24
+ Requires-Dist: pgvector<1.0,>=0.3
25
+ Requires-Dist: psycopg[binary]<4.0,>=3.2
26
+ Requires-Dist: pydantic<3.0,>=2.9
27
+ Requires-Dist: sqlalchemy<2.1,>=2.0
28
+ Requires-Dist: typer<1.0,>=0.12
29
+ Requires-Dist: uvicorn<1.0,>=0.30
30
+ Description-Content-Type: text/markdown
31
+
32
+ <div align="center">
33
+
34
+ <img src="assets/severian-hero.png" alt="Severian" width="40%">
35
+
36
+ # Severian
37
+
38
+ **Long-term memory for AI agents that runs on your own machine, remembers where every fact came from, and keeps
39
+ every user's memories apart.**
40
+
41
+ [![Python](https://img.shields.io/badge/Python-3.11+-blue.svg)](https://python.org)
42
+ [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
43
+ [![CI](https://github.com/Sahil-SS9/Severian/actions/workflows/ci.yml/badge.svg)](https://github.com/Sahil-SS9/Severian/actions/workflows/ci.yml)
44
+ [![MCP](https://img.shields.io/badge/MCP-ready-6366f1)](#use-it-from)
45
+
46
+ </div>
47
+
48
+ Severian gives an agent a memory it can trust. It saves what was said exactly as it was said, derives short searchable
49
+ memories from it, and hands the answering model a compact, cited context block for each question. It runs on SQLite
50
+ out of the box (PostgreSQL + pgvector when you need it), works fully offline, and plugs into Hermes Agent, any MCP
51
+ client, a CLI, an HTTP API or plain Python.
52
+
53
+ ## Results
54
+
55
+ Severian on the [OmniMemEval](https://github.com/MemTensor/OmniMemEval/blob/main/docs/user_memory/results.md)
56
+ long-term-memory leaderboard (October 2026). Every other row is OmniMemEval's own published record, copied verbatim;
57
+ Severian's row (†) is our run through the same public harness, answer model (`gpt-4.1-mini`), judge (`gpt-4o-mini`),
58
+ prompts and metrics, not an official board entry. 🥇 marks the best score in each column; `-` means not run.
59
+
60
+ <!-- board:summary -->
61
+ | Backend | LoCoMo | LongMemEval | BEAM 100K | BEAM 10M | PersonaMem v2 | HaluMem |
62
+ | --- | ---: | ---: | ---: | ---: | ---: | ---: |
63
+ | Mem0 | 77.68 | 56.00 | 70.41 | 43.33 | 36.76 | 73.64 |
64
+ | Zep / Graphiti | 63.83 | 79.80 | 68.70 | 56.11 | 32.34 | 81.71 |
65
+ | Supermemory | 73.53 | 66.07 | 65.98 | 52.49 | 39.64 | 52.61 |
66
+ | Viking | 69.33 | 61.07 | 70.76 | 58.14 | 30.80 | 77.39 |
67
+ | Cognee | 83.48 | 51.80 | 59.30 | 56.02 | 26.46 | 72.60 |
68
+ | Letta | 77.12 | 77.67 | 69.22 | 52.30 | 35.12 | 85.43 |
69
+ | Hindsight | 81.99 | 72.20 | 70.22 | **🥇 59.75** | 37.98 | 83.99 |
70
+ | Memori | 41.34 | 20.80 | - | - | 33.16 | 49.38 |
71
+ | EverOS | 82.75 | 80.40 | 58.64 | 47.73 | 35.94 | **🥇 88.66** |
72
+ | MemMachine | 73.90 | 63.60 | 64.80 | 51.90 | 34.14 | 47.02 |
73
+ | mem9 | 73.64 | 78.00 | 65.75 | 57.30 | 30.76 | 72.80 |
74
+ | MemoryLake | 72.49 | - | - | - | - | - |
75
+ | Backboard.io | 22.40 | - | - | - | - | - |
76
+ | MemOS | **🥇 88.83** | 89.20 | 66.87 | 56.75 | **🥇 40.58** | 80.91 |
77
+ | LCM-X | 78.83 | 87.00 | **🥇 71.84** | - | 33.96 | 81.68 |
78
+ | **Severian 0.3.11** † | 87.34 | **🥇 90.60** | 71.62 | - | - | - |
79
+ <!-- /board:summary -->
80
+
81
+ ![OmniMemEval standings](docs/benchmarks/img/board.svg)
82
+
83
+ - **1st on LongMemEval, 2nd on LoCoMo, 2nd on BEAM 100K** (0.22 behind LCM-X). The board has no error ranges, and on
84
+ 400 questions a gap that small is noise; Severian has not been run on BEAM 10M, PersonaMem v2 or HaluMem yet.
85
+ - **We checked the board before building on it.** Re-running LCM-X through the same pipeline gave its published scores
86
+ back within 0.65 points. Compared question by question, Severian is ahead of it on LoCoMo (+7.9, 95% range +6.0 to
87
+ +9.7) and LongMemEval (+4.0, +1.2 to +6.6) and level on BEAM, and a stricter second marker (Claude Opus) agrees.
88
+ - **Trade-offs, stated plainly.** Severian hands the answering model more text than most systems and makes model calls
89
+ when it saves memories. Hermes ships it with a cheap 8,000-character context cap, which costs little on LoCoMo but
90
+ about 8 points on BEAM and LongMemEval; raising it to 16,000 characters wins back about 5 points on each
91
+ ([settings](docs/benchmarks/omnimemeval-2026-10.md#severians-own-settings)).
92
+ - **We found a marking flaw in BEAM** that rewards made-up answers to "the chat never said" questions. It inflates
93
+ every system's BEAM score, ours included ([details](docs/benchmarks/omnimemeval-2026-10.md#a-marking-flaw-in-beam)).
94
+ - **Zero leaks, zero stale facts.** On Severian's own adversarial quality gate, a corrected fact never comes back in
95
+ search (0.000 stale-fact rate) and no query ever returns another scope's memory (0.000 leakage).
96
+
97
+ Per-benchmark tables for every system (LoCoMo, LongMemEval, BEAM, PersonaMem v2, HaluMem), the LCM-X validation, the
98
+ plan and its changes, and the limitations are in
99
+ [docs/benchmarks/omnimemeval-2026-10.md](docs/benchmarks/omnimemeval-2026-10.md). Our earlier internal round against
100
+ Mem0, Mnemosyne, Hindsight and Honcho (different harness and marker) is in
101
+ [docs/benchmarks/competitor-round-2026-10.md](docs/benchmarks/competitor-round-2026-10.md).
102
+
103
+ ## Why Severian
104
+
105
+ - **Nothing is lost, nothing is made up.** Raw observations are append-only and hashed. Every memory and every search
106
+ hit cites the observation it came from, and corrections create a new revision instead of overwriting history, so
107
+ any earlier version can be restored.
108
+ - **Scope is the security boundary.** Every read and write names five levels: tenant, profile, collection, agent and
109
+ session. There is no default scope, and another scope's memories are never returned or even hinted at. Agents can
110
+ opt in to reading an explicit list of teammates' scopes.
111
+ - **Built for real conversations.** Short facts per turn, real dates for relative times, newer facts that close older
112
+ ones, and a note when two memories disagree, so the agent answers with the current truth.
113
+ - **Hybrid search that holds up.** BM25 and vector search fused with reciprocal rank fusion, an optional cross-encoder
114
+ re-ranker, an entity graph for multi-hop lookups, and a context assembler that keeps the most useful items inside a
115
+ character budget.
116
+ - **Local-first.** No network call from the engine; cloud derivation needs an explicit per-collection opt-in. Qwen3
117
+ 0.6B embeddings run locally or in a shared sidecar; a deterministic hash embedding needs nothing at all.
118
+ - **Looks after itself.** Background "dreaming" merges near-duplicates and flags contradictions, curation scores
119
+ salience, and retention policies archive instead of deleting.
120
+ - **Operable.** Crash-safe leased worker jobs, dead-letter recovery, export/import, side-by-side vector rebuilds, an
121
+ integrity audit, per-profile fact rollback and an optional Rust acceleration module.
122
+ - **Harness-agnostic.** The same engine serves any agent framework through the CLI, the Python SDK, the HTTP API or
123
+ MCP, and runs unchanged on SQLite or PostgreSQL; the Hermes plugin is one adapter on top.
124
+
125
+ ## How it works
126
+
127
+ ```text
128
+ ┌──────────────────────────────────────────┐
129
+ │ SOURCE INPUT │
130
+ │ text observation · attachments (multi- │
131
+ │ modal metadata: image/audio/video/file) │
132
+ └──────────────────┬───────────────────────┘
133
+ │
134
+ ▼
135
+ ┌──────────────────────────────────────────┐
136
+ │ IngestionService │
137
+ │ normalise · hash raw · source identity │
138
+ └──────────────────┬───────────────────────┘
139
+ │
140
+ ┌─────────────────────────┼─────────────────────────┐
141
+ ▼ ▼ ▼
142
+ ┌───────────────────────┐ ┌───────────────────────┐ ┌───────────────────────┐
143
+ │ CANONICAL STORE │ │ derive job queue │ │ Entity/Relation │
144
+ │ (SQLite | PostgreSQL)│──▶│ (leased, crash-safe, │──▶│ Graph (auto-populated │
145
+ │ observations │ │ idempotent) │ │ by EntityExtraction) │
146
+ │ memories │ └───────────────────────┘ └───────────────────────┘
147
+ │ entities/relations │
148
+ │ jobs · audit events │ append-only · scoped · hashed · supersede-aware
149
+ └───────────────────────┘
150
+ │
151
+ ▼
152
+ ┌──────────────────────────────────────────────────────────────┐
153
+ │ DerivationService (worker drains derive/episode/dream jobs) │
154
+ │ · policy-gated (cloud_allowed false by default) │
155
+ │ · deterministic hash OR Qwen 0.6B semantic opt-in │
156
+ │ · skips superseded observations (P0-5) │
157
+ │ · EntityExtractionService upserts entities + typed relations│
158
+ └──────────────────────────────────────────────────────────────┘
159
+ │
160
+ ├──────────────► ProjectionCoordinator
161
+ │ ├──► FTS5 lexical projection (BM25)
162
+ │ └──► vector projection (hash default;
163
+ │ Qwen 0.6B semantic opt-in, 384-dim)
164
+ │
165
+ ▼
166
+ ┌──────────────────────────────────────────────────────────────┐
167
+ │ RetrievalService (hybrid RRF fusion) │
168
+ │ · coverage abstention gate · salience-weighted ranking │
169
+ │ · shared-scope read (search_shared, opt-in multi-agent) │
170
+ │ · temporal query orientation (active head first for present)│
171
+ └───────────────┬──────────────────────────────────────────────┘
172
+ │
173
+ ├──────────────► ContextAssembler (bounded, source-cited)
174
+ │
175
+ ▼
176
+ ┌──────────────────────────────────────────────────────────────┐
177
+ │ GraphRetrievalService │
178
+ │ · BFS neighborhood over Entity/Relation (both directions) │
179
+ │ · temporal validity filtering (expired relations excluded) │
180
+ │ · related_memories by min graph distance │
181
+ └──────────────────────────────────────────────────────────────┘
182
+
183
+ OFFLINE SELF-REGULATION (dream worker jobs, non-destructive):
184
+ ┌──────────────────────────────────────────────────────────────┐
185
+ │ ConsolidationService · Jaccard near-dup merge (>= 0.8) │
186
+ │ CurationService · salience scoring (recency+usage+ │
187
+ │ confidence), review markers only │
188
+ │ RetentionPolicyService· max_age/min_usage/kinds policy, │
189
+ │ evaluate + opt-in archive │
190
+ │ ContradictionScanService · report-only, never auto-resolves │
191
+ └──────────────────────────────────────────────────────────────┘
192
+ ```
193
+
194
+
195
+ - The **canonical store** is the only source of truth. Search indexes are projections that can be rebuilt from it at
196
+ any time.
197
+ - **Worker jobs** derive memories and facts in the background, so saving stays fast. A failed job retries and then
198
+ dead-letters; it never silently disappears.
199
+ - **Retrieval** runs inside one exact scope, fuses lexical and semantic results, and drops memories a newer fact has
200
+ closed from the current view (they stay in history).
201
+
202
+ More: [architecture](docs/architecture.md), [memory engine](docs/memory-engine.md), [threat model](docs/threat-model.md).
203
+
204
+ ## Quick start
205
+
206
+ Requires Python 3.11+ and [uv](https://docs.astral.sh/uv/).
207
+
208
+ ```bash
209
+ git clone https://github.com/Sahil-SS9/Severian.git
210
+ cd severian
211
+ uv sync
212
+
213
+ # Save an observation in a scope
214
+ uv run severian ingest \
215
+ --database data/severian.db --fts data/fts.db --vectors data/vectors.db \
216
+ --tenant acme --profile alice --collection main --agent cli --session ses-1 \
217
+ --content "Alice signed the Acme contract on Friday" \
218
+ --source '{"uri": "note://contract-1"}'
219
+
220
+ # Search it (--derive processes pending jobs first; production runs `severian work`)
221
+ uv run severian search \
222
+ --database data/severian.db --fts data/fts.db --vectors data/vectors.db \
223
+ --tenant acme --profile alice --collection main --agent cli --session ses-1 \
224
+ --query "contract" --derive
225
+ ```
226
+
227
+ Or run the Python example, which saves memories for two users, searches one and builds a cited context:
228
+
229
+ ```bash
230
+ uv run python examples/quickstart.py
231
+ ```
232
+
233
+ ## Use it from
234
+
235
+ | Surface | How |
236
+ |---|---|
237
+ | **Hermes Agent** | Drop-in memory provider: `hermes plugins install severian` (or copy `plugins/hermes/severian/` to `$HERMES_HOME/plugins/severian/`), set `memory.provider: severian`. Tools: search, ingest, correct, forget, shared search, task progress notes. |
238
+ | **MCP** | full seven-tool surface over stdio for Claude Code, Codex, OpenCode and Claude Desktop: [docs/integrations.md](docs/integrations.md). Tools: ingest, search, get, correct, forget, task progress, shared search. |
239
+ | **Python** | `severian.composition.build_bundle(...)`; see [examples/quickstart.py](examples/quickstart.py) |
240
+ | **HTTP** | `uv run severian serve` (dev server); client in `severian.sdk.client` |
241
+ | **CLI** | `severian ingest / search / work / export / import / audit / rebuild-vectors / ...` (`--help` lists all) |
242
+
243
+ ## Configuration
244
+
245
+ Behaviour switches are environment variables, so the same code serves benchmarks, tests and production.
246
+
247
+ | Setting | Default | What it does |
248
+ |---|---|---|
249
+ | `SEVERIAN_EMBEDDING` | `hash` | `qwen` (local Qwen3-Embedding-0.6B) or `remote-qwen` (shared sidecar at `SEVERIAN_EMBED_SOCKET`) |
250
+ | `SEVERIAN_USER_FACTS` | off (**recommended on**) | Short facts per conversation turn, extracted by a local model in the background |
251
+ | `SEVERIAN_DATE_STAMPS` | off (**recommended on**) | Writes real dates next to relative times when saving |
252
+ | `SEVERIAN_TRUTH_RESOLUTION` | off (**recommended on**) | Memories a newer fact replaced leave the current view and stay in history |
253
+ | `SEVERIAN_RERANK` | off (**recommended**: `cross-encoder/ms-marco-MiniLM-L6-v2`) | Re-ranks the fused candidates |
254
+ | `SEVERIAN_OPT_NUMPY` | off (**recommended on**) | Fast exact vector scoring on large scopes |
255
+ | `SEVERIAN_CONFLICT_NOTES` | **on** | Adds a short note when two returned memories disagree (`0` turns it off) |
256
+ | `SEVERIAN_FILL_BUDGET` | off | Search over-fetches a bounded pool and the context keeps adding ranked items until its character budget is full, instead of stopping at `limit` |
257
+ | `SEVERIAN_COMPACT_CITES` | off | Cites the source observation ids in one bracket and drops the trailing `source:` line: about 45 characters less per item, every citation still resolvable through `severian_get_observation` |
258
+ | `SEVERIAN_SUFFICIENCY` | off | Adds one line after the results when no returned memory holds the specific detail the question names |
259
+ | `SEVERIAN_STORAGE` / `SEVERIAN_DSN` | Hermes store / unset | SQLite directory, or a PostgreSQL DSN |
260
+
261
+ The recommended settings are the ones benchmarked above. PostgreSQL setup:
262
+ [docs/postgresql-backend.md](docs/postgresql-backend.md). Day-to-day running: [docs/operator-runbook.md](docs/operator-runbook.md).
263
+
264
+ ## Roadmap
265
+
266
+ Two moves carry the next round: per-person fact sheets to close the multi-hop gap, and a better rule for knowing when
267
+ to answer "I don't know". Then a wider field (MemMachine, Graphiti/Zep, Letta, Cognee, LangMem, Memobase), a
268
+ cloud-model check of the winning setup, and stricter marks: every in-house run re-marked by Opus, plus cost per
269
+ memory, a 10x-size stress test, and a confident-wrong vs "I don't know" measure.
270
+
271
+ ## Contributing and security
272
+
273
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for the development loop and quality gates, and [SECURITY.md](SECURITY.md) to
274
+ report a vulnerability. Release history: [CHANGELOG.md](CHANGELOG.md). All documentation: [docs/](docs/README.md).
275
+
276
+ ## License
277
+
278
+ MIT. See [LICENSE](LICENSE).