memleaf 0.2.51__tar.gz → 0.2.52__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 (114) hide show
  1. {memleaf-0.2.51 → memleaf-0.2.52}/CHANGELOG.md +7 -0
  2. {memleaf-0.2.51/src/memleaf.egg-info → memleaf-0.2.52}/PKG-INFO +2 -2
  3. {memleaf-0.2.51 → memleaf-0.2.52}/README.en.md +1 -1
  4. {memleaf-0.2.51 → memleaf-0.2.52}/README.md +1 -1
  5. {memleaf-0.2.51 → memleaf-0.2.52}/pyproject.toml +1 -1
  6. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/__init__.py +1 -1
  7. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/hermes_provider/plugin.yaml +1 -1
  8. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/planning_context.py +22 -2
  9. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/single_pass_plan.py +1 -0
  10. {memleaf-0.2.51 → memleaf-0.2.52/src/memleaf.egg-info}/PKG-INFO +2 -2
  11. {memleaf-0.2.51 → memleaf-0.2.52}/LICENSE +0 -0
  12. {memleaf-0.2.51 → memleaf-0.2.52}/MANIFEST.in +0 -0
  13. {memleaf-0.2.51 → memleaf-0.2.52}/docs/capture-budget-design.md +0 -0
  14. {memleaf-0.2.51 → memleaf-0.2.52}/docs/config-migrations.md +0 -0
  15. {memleaf-0.2.51 → memleaf-0.2.52}/docs/core-refactor.md +0 -0
  16. {memleaf-0.2.51 → memleaf-0.2.52}/docs/evidence-retention.md +0 -0
  17. {memleaf-0.2.51 → memleaf-0.2.52}/docs/extraction-latency.md +0 -0
  18. {memleaf-0.2.51 → memleaf-0.2.52}/docs/gate-evidence-boundary.md +0 -0
  19. {memleaf-0.2.51 → memleaf-0.2.52}/docs/general-processing.md +0 -0
  20. {memleaf-0.2.51 → memleaf-0.2.52}/docs/hermes-mcp-runtime.md +0 -0
  21. {memleaf-0.2.51 → memleaf-0.2.52}/docs/processing-quality-acceptance.md +0 -0
  22. {memleaf-0.2.51 → memleaf-0.2.52}/docs/v0.2.26-processing-status.md +0 -0
  23. {memleaf-0.2.51 → memleaf-0.2.52}/examples/README.md +0 -0
  24. {memleaf-0.2.51 → memleaf-0.2.52}/examples/basic_usage.py +0 -0
  25. {memleaf-0.2.51 → memleaf-0.2.52}/examples/mcp_stdio.ndjson +0 -0
  26. {memleaf-0.2.51 → memleaf-0.2.52}/install.ps1 +0 -0
  27. {memleaf-0.2.51 → memleaf-0.2.52}/install.sh +0 -0
  28. {memleaf-0.2.51 → memleaf-0.2.52}/setup.cfg +0 -0
  29. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/__main__.py +0 -0
  30. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/adapters/__init__.py +0 -0
  31. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/adapters/antigravity.py +0 -0
  32. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/adapters/base.py +0 -0
  33. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/adapters/codex.py +0 -0
  34. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/adapters/hermes.py +0 -0
  35. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/admission.py +0 -0
  36. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/batch_review.py +0 -0
  37. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/budget.py +0 -0
  38. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/capture.py +0 -0
  39. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/cli.py +0 -0
  40. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/compaction.py +0 -0
  41. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/config.py +0 -0
  42. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/create_coordinator.py +0 -0
  43. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/credentials.py +0 -0
  44. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/evidence_budget.py +0 -0
  45. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/evidence_policy.py +0 -0
  46. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/evidence_structure.py +0 -0
  47. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/evidence_syntax.py +0 -0
  48. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/extraction_budget.py +0 -0
  49. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/extraction_capability.py +0 -0
  50. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/extraction_work_state.py +0 -0
  51. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/frontmatter.py +0 -0
  52. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/hermes_provider/README.md +0 -0
  53. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/hermes_provider/__init__.py +0 -0
  54. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/hermes_provider/_mcp_client.py +0 -0
  55. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/hermes_provider/_provider.py +0 -0
  56. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/hermes_provider/_shared.py +0 -0
  57. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/hermes_provider/evidence_budget.py +0 -0
  58. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/hermes_runtime.py +0 -0
  59. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/host_events.py +0 -0
  60. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/host_runtime.py +0 -0
  61. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/inbox.py +0 -0
  62. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/index.py +0 -0
  63. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/inspection.py +0 -0
  64. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/installer.py +0 -0
  65. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/llm/__init__.py +0 -0
  66. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/llm/base.py +0 -0
  67. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/llm/claude_compatible.py +0 -0
  68. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/llm/gemini.py +0 -0
  69. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/llm/openai_compatible.py +0 -0
  70. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/llm/router.py +0 -0
  71. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/llm/thinking.py +0 -0
  72. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/locking.py +0 -0
  73. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/mcp_server.py +0 -0
  74. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/memory_commit.py +0 -0
  75. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/memory_planner.py +0 -0
  76. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/memory_writer.py +0 -0
  77. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/model_capabilities.py +0 -0
  78. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/model_discovery.py +0 -0
  79. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/model_execution.py +0 -0
  80. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/models.py +0 -0
  81. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/native_index.py +0 -0
  82. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/native_registration.py +0 -0
  83. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/parallel_model.py +0 -0
  84. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/process_common.py +0 -0
  85. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/process_jobs.py +0 -0
  86. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/process_journal.py +0 -0
  87. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/process_owner.py +0 -0
  88. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/processing.py +0 -0
  89. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/prompts.py +0 -0
  90. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/provenance.py +0 -0
  91. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/recording_policy.py +0 -0
  92. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/redaction.py +0 -0
  93. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/retention.py +0 -0
  94. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/retrieval.py +0 -0
  95. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/retrieval_gate.py +0 -0
  96. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/scope_maintenance.py +0 -0
  97. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/scope_state.py +0 -0
  98. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/service.py +0 -0
  99. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/single_pass_memory_planner.py +0 -0
  100. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/source_policy.py +0 -0
  101. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/state_layout.py +0 -0
  102. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/subprocess_flags.py +0 -0
  103. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/summary_batch.py +0 -0
  104. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/target_reconciliation.py +0 -0
  105. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/turn_audit.py +0 -0
  106. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/turn_plan.py +0 -0
  107. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/update_coordinator.py +0 -0
  108. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/update_review.py +0 -0
  109. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/validation.py +0 -0
  110. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf/vault.py +0 -0
  111. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf.egg-info/SOURCES.txt +0 -0
  112. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf.egg-info/dependency_links.txt +0 -0
  113. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf.egg-info/entry_points.txt +0 -0
  114. {memleaf-0.2.51 → memleaf-0.2.52}/src/memleaf.egg-info/top_level.txt +0 -0
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to memleaf are documented here.
4
4
 
5
+ ## 0.2.52 — 2026-09-13
6
+
7
+ - Stop an assistant message from originating a durable claim. A three-sentence acceptance run recorded a project requirement the user never asked for: the user wrote only "我写日志习惯用中文,英文的扫两眼就跳过去了", the assistant replied with its own elaboration ("记账工具的日志……都写成中文;异常堆栈上头再包一层人话"), and the planner stored that elaboration as a project fact. The design allows an assistant reply as a source for *organising what the user already said*, so the rule is now explicit about what that excludes: an assistant message may organise, restate or report what the user's own evidence establishes, may never be the only support for a durable claim, and contributes nothing where it states a decision, requirement, rule, plan, recommendation or added detail of its own -- however definite it sounds. Consequences the assistant derived from a user preference are the assistant's, not the user's, and are not recorded as requirements or project state.
8
+ - Fix a regression the scope vocabulary introduced, before it could reach a project-scoped Vault. The scoped fallback runs when a turn matches no existing memory and the session scope is specific, and it declared itself ambiguous when the scope held more than one record -- ``len(records) > 1``. A populated scope therefore always reported ambiguity, which cleared ``lookup_complete`` and deferred every CREATE in that turn. It stayed dormant while sessions were ``global``-only, because ``_has_specific_scope`` is false for ``global`` and the fallback never ran; the first session that carried ``project:记账`` activated it, and turn three of the acceptance run deferred with ``lookup_incomplete`` and wrote nothing with zero rows withheld from the catalog. Ambiguity now means what it should: this turn names more than one specific scope, so the fallback cannot tell which one owns it.
9
+
10
+ Verification for this release used the real model and a real Vault. 110 tests pass with no model call, covering the assistant-source rule and the allowance it must preserve, and the scope fallback across a populated scope, two named projects, global-only and an empty scope. Against the live route, the assistant-source rule was checked on three cases: the reproduced defect (the user's preference is now recorded alone, the assistant's elaboration is marked ``assistant_restatement`` and nothing is written from it), an assistant reply that organises user-stated progress, and a requirement the user explicitly accepts -- the two controls still work. The ambiguity fix was checked against the deferred production turn, which now reports ``lookup_complete: true`` with all 21 in-scope records projected. The assistant-source rule is published in the prompt and enforced by the planner's judgement, not by a Core-side structural check, so a model that ignores it can still record such a claim; no measurement of that rate was made.
11
+
5
12
  ## 0.2.51 — 2026-09-13
6
13
 
7
14
  - Publish the scope vocabulary in the B3 single-pass contract. The compact contract described `scopes` only as `nonempty string[]` and never named `project:<name>`, so a planner handed an empty `scope_registry` had exactly one value it could be sure was legal. A first message that plainly establishes a project -- "最近在弄个记账的小玩意儿,就扔家里那台 N100 上跑" -- was filed under `global`, producing the internally inconsistent `type=project` beside `scopes=["global"]`. The legacy summarize contract always carried this paragraph; B3 lost it, the same way it had lost the todo-field and date rules repaired in 0.2.48 and 0.2.50.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: memleaf
3
- Version: 0.2.51
3
+ Version: 0.2.52
4
4
  Summary: A local-first Markdown memory core for AI agents
5
5
  Author: memleaf contributors
6
6
  License-Expression: MIT
@@ -23,7 +23,7 @@ Dynamic: license-file
23
23
 
24
24
  [English](README.en.md) · [PyPI](https://pypi.org/project/memleaf/) · [GitHub](https://github.com/miffyblueboo/memleaf)
25
25
 
26
- > **版本:0.2.51。**
26
+ > **版本:0.2.52。**
27
27
  > 记忆只从用户与 Agent 的可见对话提炼。Agent 已在回复中整理的事实、项目进展和明确待办可作为来源;邮件、附件、网页和终端等工具原文不进入记忆提炼。模型负责保留原话中的不确定性,现有记忆仅用于比较、去重和更新。Markdown 仍是唯一事实源。
28
28
  > **当前版本支持 Hermes 和 Codex。** Antigravity(反重力)不检测、不安装、不配置。
29
29
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  [中文](README.md) · [PyPI](https://pypi.org/project/memleaf/) · [GitHub](https://github.com/miffyblueboo/memleaf)
6
6
 
7
- > **Version: 0.2.51.**
7
+ > **Version: 0.2.52.**
8
8
  > Automatic extraction now uses only the current turn's visible user input and final assistant reply. Raw tool output, attachments, web/file/terminal payloads and legacy tool-evidence bodies are not new source evidence; existing or retrieved memory remains comparison context rather than source authority. Background processing is persisted as a local job and can be checked through the read-only `process_status` MCP tool; failed work remains retryable and fail closed. The release also tightens source/date grounding, target reconciliation, duplicate/no-op handling and semantic review before writes. Markdown remains the sole source of truth with no SQLite runtime dependency. Acceptance covers deterministic regression suites and synthetic inputs; it does not claim real-mail or customer-business acceptance.
9
9
  > **The current release supports Hermes and Codex.** Antigravity is not detected, installed, or configured.
10
10
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  [English](README.en.md) · [PyPI](https://pypi.org/project/memleaf/) · [GitHub](https://github.com/miffyblueboo/memleaf)
6
6
 
7
- > **版本:0.2.51。**
7
+ > **版本:0.2.52。**
8
8
  > 记忆只从用户与 Agent 的可见对话提炼。Agent 已在回复中整理的事实、项目进展和明确待办可作为来源;邮件、附件、网页和终端等工具原文不进入记忆提炼。模型负责保留原话中的不确定性,现有记忆仅用于比较、去重和更新。Markdown 仍是唯一事实源。
9
9
  > **当前版本支持 Hermes 和 Codex。** Antigravity(反重力)不检测、不安装、不配置。
10
10
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "memleaf"
7
- version = "0.2.51"
7
+ version = "0.2.52"
8
8
  description = "A local-first Markdown memory core for AI agents"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -1,6 +1,6 @@
1
1
  """Local-first Markdown memory core for AI agents."""
2
2
 
3
- __version__ = "0.2.51"
3
+ __version__ = "0.2.52"
4
4
 
5
5
  from .config import DEFAULT_CONFIG, default_config, load_config, save_config
6
6
  from .frontmatter import FrontmatterError, dump_frontmatter, dump_yaml, load_yaml, parse_frontmatter
@@ -1,5 +1,5 @@
1
1
  name: memleaf
2
- version: 0.2.51
2
+ version: 0.2.52
3
3
  description: "Hermes-native external MemoryProvider for local-first Markdown memory shared with the memleaf MCP server."
4
4
  hooks:
5
5
  - prefetch
@@ -393,7 +393,21 @@ class PlanningContext:
393
393
 
394
394
 
395
395
  def _scope_records_unlocked(self, scope: Any) -> tuple[list[Any], bool]:
396
- """Read and rank active records once for a scoped fallback."""
396
+ """Read and rank active records once for a scoped fallback.
397
+
398
+ ``ambiguous`` answers a question about *scope identity*: does this turn
399
+ name more than one specific scope, so that the fallback cannot tell
400
+ which one owns it? It deliberately does not count how many memories the
401
+ scope holds. A scope carrying many memories is ordinary, and a session
402
+ naming one project owns its turns unambiguously.
403
+
404
+ Counting records instead made the fallback declare itself ambiguous
405
+ whenever a scope was populated, which marked the lookup unprovable and
406
+ deferred every CREATE in a project-scoped session -- while a
407
+ ``global``-only session, where the fallback never runs, was unaffected.
408
+ The catalog ceiling is what bounds how much context is safe to supply;
409
+ ambiguity is not.
410
+ """
397
411
 
398
412
  active_records = self.service._read_memories_unlocked("knowledge")
399
413
  scoped = filter_by_scope(
@@ -415,7 +429,13 @@ class PlanningContext:
415
429
  ),
416
430
  reverse=True,
417
431
  )
418
- return records, len(records) > 1
432
+ requested = [scope] if isinstance(scope, str) else list(scope or [])
433
+ specific = {
434
+ value
435
+ for value in requested
436
+ if isinstance(value, str) and value not in {"", "global", "unscoped"}
437
+ }
438
+ return records, len(specific) > 1
419
439
 
420
440
 
421
441
  @classmethod
@@ -121,6 +121,7 @@ SINGLE_PASS_SYSTEM = f"""You are memleaf's single-pass memory planner.
121
121
 
122
122
  SOURCE
123
123
  Only current_evidence may establish new facts or changes. local_memory_catalog and native_memory_catalog are comparison context; native memory is never an UPDATE/NO_CHANGE target. Never invent source facts, ownership, dates, status, obligations, numbers, relationships or IDs.
124
+ An assistant message is evidence of what you reported, never of what the user wants. It may organise, restate or report what the user's own evidence establishes, but it may never be the only support for a durable claim. When it states something the user's message does not establish -- your own decision, requirement, rule, plan, recommendation or added detail -- record nothing from that statement, however definite it sounds. Consequences you derived from a user preference are yours, not the user's: never record them as a requirement or as project state. Only something the user stated or accepted becomes memory.
124
125
 
125
126
  TASK
126
127
  Extract every independently useful long-term memory. Keep independently retrievable/updateable topics separate and preserve entity, condition, polarity, uncertainty, ownership, state and meaning-critical numbers/codes. CREATE only when no supplied local memory represents the durable information; UPDATE only when current evidence proves a change to one supplied local memory; NO_CHANGE only when it adds no semantic change; DEFERRED for a durable candidate that cannot safely reach a terminal decision. Project ownership and platform/system names are separate judgments. Do not turn every negation into no_memory and do not use NO_CHANGE to hide ambiguity.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: memleaf
3
- Version: 0.2.51
3
+ Version: 0.2.52
4
4
  Summary: A local-first Markdown memory core for AI agents
5
5
  Author: memleaf contributors
6
6
  License-Expression: MIT
@@ -23,7 +23,7 @@ Dynamic: license-file
23
23
 
24
24
  [English](README.en.md) · [PyPI](https://pypi.org/project/memleaf/) · [GitHub](https://github.com/miffyblueboo/memleaf)
25
25
 
26
- > **版本:0.2.51。**
26
+ > **版本:0.2.52。**
27
27
  > 记忆只从用户与 Agent 的可见对话提炼。Agent 已在回复中整理的事实、项目进展和明确待办可作为来源;邮件、附件、网页和终端等工具原文不进入记忆提炼。模型负责保留原话中的不确定性,现有记忆仅用于比较、去重和更新。Markdown 仍是唯一事实源。
28
28
  > **当前版本支持 Hermes 和 Codex。** Antigravity(反重力)不检测、不安装、不配置。
29
29
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes