memleaf 0.2.62__tar.gz → 0.2.63__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.
- {memleaf-0.2.62 → memleaf-0.2.63}/CHANGELOG.md +7 -0
- {memleaf-0.2.62/src/memleaf.egg-info → memleaf-0.2.63}/PKG-INFO +4 -3
- {memleaf-0.2.62 → memleaf-0.2.63}/README.en.md +3 -2
- {memleaf-0.2.62 → memleaf-0.2.63}/README.md +3 -2
- {memleaf-0.2.62 → memleaf-0.2.63}/docs/semantic-extraction-protocol.md +2 -4
- {memleaf-0.2.62 → memleaf-0.2.63}/pyproject.toml +1 -1
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/__init__.py +1 -1
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/hermes_provider/plugin.yaml +1 -1
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/semantic_maintenance.py +2 -2
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/semantic_protocol.py +7 -8
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/single_pass_plan.py +2 -2
- {memleaf-0.2.62 → memleaf-0.2.63/src/memleaf.egg-info}/PKG-INFO +4 -3
- {memleaf-0.2.62 → memleaf-0.2.63}/LICENSE +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/MANIFEST.in +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/docs/capture-budget-design.md +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/docs/config-migrations.md +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/docs/core-refactor.md +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/docs/evidence-retention.md +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/docs/extraction-latency.md +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/docs/gate-evidence-boundary.md +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/docs/general-processing.md +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/docs/hermes-mcp-runtime.md +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/docs/processing-quality-acceptance.md +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/docs/v0.2.26-processing-status.md +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/examples/README.md +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/examples/basic_usage.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/examples/mcp_stdio.ndjson +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/install.ps1 +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/install.sh +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/setup.cfg +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/__main__.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/adapters/__init__.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/adapters/antigravity.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/adapters/base.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/adapters/codex.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/adapters/hermes.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/admission.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/batch_review.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/budget.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/capture.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/cli.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/compaction.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/config.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/create_coordinator.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/credentials.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/evidence_budget.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/evidence_policy.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/evidence_structure.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/evidence_syntax.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/extraction_budget.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/extraction_capability.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/extraction_work_state.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/frontmatter.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/hermes_provider/README.md +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/hermes_provider/__init__.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/hermes_provider/_mcp_client.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/hermes_provider/_provider.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/hermes_provider/_shared.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/hermes_provider/evidence_budget.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/hermes_runtime.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/host_events.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/host_runtime.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/inbox.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/index.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/inspection.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/installer.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/llm/__init__.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/llm/base.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/llm/claude_compatible.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/llm/gemini.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/llm/openai_compatible.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/llm/router.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/llm/thinking.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/locking.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/mcp_server.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/memory_commit.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/memory_planner.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/memory_writer.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/model_capabilities.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/model_discovery.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/model_execution.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/models.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/native_index.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/native_registration.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/parallel_model.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/planning_context.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/process_common.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/process_jobs.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/process_journal.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/process_owner.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/processing.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/prompts.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/provenance.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/recording_policy.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/redaction.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/retention.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/retrieval.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/retrieval_gate.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/scope_maintenance.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/scope_state.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/service.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/single_pass_memory_planner.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/source_policy.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/state_layout.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/subprocess_flags.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/summary_batch.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/target_reconciliation.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/turn_audit.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/turn_plan.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/update_coordinator.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/update_review.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/validation.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf/vault.py +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf.egg-info/SOURCES.txt +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf.egg-info/dependency_links.txt +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/src/memleaf.egg-info/entry_points.txt +0 -0
- {memleaf-0.2.62 → memleaf-0.2.63}/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.63 — 2026-09-16
|
|
6
|
+
|
|
7
|
+
- Unify the retention decision across first-pass extraction, topic selection, candidate repair and `semantic_maintenance`. The model now judges future reuse, information gain, direct usability and forgetting cost, keeping only the smallest core with clear material value; the contract contains no mail, report, customer or project-specific exclusion rule.
|
|
8
|
+
- Keep maintenance complementary to extraction: it applies the same value judgment to incoming candidates, continues maintaining candidates that qualify, discards those without clear value and defers only unresolved meaning. The `0.2.62` date/ownership degradation and update-target grouping remain intact.
|
|
9
|
+
|
|
10
|
+
Verification covers prompt consistency and compactness assertions, Python 3.11 compilation/imports, package metadata consistency, a package wheel containing the Hermes provider resource, and `git diff --check`. Real-provider replay remains runtime acceptance after installation.
|
|
11
|
+
|
|
5
12
|
## 0.2.62 — 2026-09-16
|
|
6
13
|
|
|
7
14
|
- Record conclusions, not process. The contract now opens with one precedence rule -- 只记结论: what the user chose, agreed to, or what happened; options, plans and drafts offered by the assistant are process even when they look like reusable knowledge. It replaces a genuine conflict between two earlier sentences: `reusable`/通用经验 invited storing the assistant's own outline, while the assistant-proposal clause forbade it, so the model decided by coin flip. The contradictory sentence about assistant suggestions never being a task basis is gone with it. Measured on the reproduced turn, the assistant's four-section outline was written in one of two runs before the change and in none of four runs after it.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: memleaf
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.63
|
|
4
4
|
Summary: A local-first Markdown memory core for AI agents
|
|
5
5
|
Author: memleaf contributors
|
|
6
6
|
License-Expression: MIT
|
|
@@ -23,8 +23,9 @@ 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.
|
|
27
|
-
>
|
|
26
|
+
> **版本:0.2.63。**
|
|
27
|
+
> 自动提炼和复核共用同一条“未来记忆价值”标准:模型综合未来复用、信息增量、再次读取时的直接可用性和忘记成本,只保留对未来理解、判断或行动有实质影响的最小核心;没有明确价值的信息不提炼,不按具体业务场景硬编码排除。
|
|
28
|
+
> 提炼契约现在只有一份中文语义契约(旧版英文 B3 提示词已删除),首轮、主题选择、候选修复和 `semantic_maintenance` 使用同一套保留价值判断;同一件事只写一次。
|
|
28
29
|
> Core 不再因为归属、日期、任务依据或跨项目而丢弃整条候选:归属缺失会归一到证据里唯一被点名的项目、否则落 `global`;日期只接受能在本候选证据里找到出处、且能锚定成 ISO 的写法(`明天`、`周五`、`月底` 都会被解析),无法解析时只丢掉日期字段,记忆照常写入;未获授权的改归属沿用目标原归属。
|
|
29
30
|
> 待办 `due_date` 只表示待办动作本身明确声明的截止日;属于待办主题或预期结果的日期不会被误作截止日。项目归属由模型按语义判断,不要求项目名在证据里逐字出现。复核阶段会保留首轮已选定的更新目标,避免“状态变更”被降级成新增记忆。Markdown 仍是唯一事实源。
|
|
30
31
|
> **当前版本支持 Hermes 和 Codex。** Antigravity(反重力)不检测、不安装、不配置。
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
[中文](README.md) · [PyPI](https://pypi.org/project/memleaf/) · [GitHub](https://github.com/miffyblueboo/memleaf)
|
|
6
6
|
|
|
7
|
-
> **Version: 0.2.
|
|
8
|
-
> Automatic extraction
|
|
7
|
+
> **Version: 0.2.63.**
|
|
8
|
+
> Automatic extraction and review share one future-value standard: the model weighs likely reuse, information gain, direct usability when read again, and the cost of forgetting. It keeps only the smallest core that can materially help future understanding, decisions, or actions; information without clear value is not extracted, and no business-specific exclusion rule is hard-coded.
|
|
9
|
+
> A single Chinese semantic contract is sent for extraction, topic selection, candidate repair, and `semantic_maintenance`; the older English B3 prompt has been deleted and B3 remains only as a compatibility read format. One topic is written once.
|
|
9
10
|
> Core no longer discards a whole candidate over ownership, dates, task basis or cross-project wording. A missing owner normalizes to the single project named by that candidate's own evidence, otherwise `global`. A deadline is accepted only when it appears in the candidate's own evidence and can be anchored to ISO (`明天`, `周五`, `月底` all resolve); when it cannot, only the date field is dropped and the memory is still written. An unauthorized ownership change keeps the target's existing scope.
|
|
10
11
|
> A todo's `due_date` means only the explicit deadline of the todo action; dates describing its subject or desired outcome are not deadlines. Project ownership remains the model's semantic judgement and needs no literal name match. The review stage now keeps the update target chosen by the first pass, so a state change is no longer downgraded into a new memory. Markdown remains the sole source of truth.
|
|
11
12
|
> **The current release supports Hermes and Codex.** Antigravity is not detected, installed, or configured.
|
|
@@ -4,8 +4,9 @@
|
|
|
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.
|
|
8
|
-
>
|
|
7
|
+
> **版本:0.2.63。**
|
|
8
|
+
> 自动提炼和复核共用同一条“未来记忆价值”标准:模型综合未来复用、信息增量、再次读取时的直接可用性和忘记成本,只保留对未来理解、判断或行动有实质影响的最小核心;没有明确价值的信息不提炼,不按具体业务场景硬编码排除。
|
|
9
|
+
> 提炼契约现在只有一份中文语义契约(旧版英文 B3 提示词已删除),首轮、主题选择、候选修复和 `semantic_maintenance` 使用同一套保留价值判断;同一件事只写一次。
|
|
9
10
|
> Core 不再因为归属、日期、任务依据或跨项目而丢弃整条候选:归属缺失会归一到证据里唯一被点名的项目、否则落 `global`;日期只接受能在本候选证据里找到出处、且能锚定成 ISO 的写法(`明天`、`周五`、`月底` 都会被解析),无法解析时只丢掉日期字段,记忆照常写入;未获授权的改归属沿用目标原归属。
|
|
10
11
|
> 待办 `due_date` 只表示待办动作本身明确声明的截止日;属于待办主题或预期结果的日期不会被误作截止日。项目归属由模型按语义判断,不要求项目名在证据里逐字出现。复核阶段会保留首轮已选定的更新目标,避免“状态变更”被降级成新增记忆。Markdown 仍是唯一事实源。
|
|
11
12
|
> **当前版本支持 Hermes 和 Codex。** Antigravity(反重力)不检测、不安装、不配置。
|
|
@@ -13,11 +13,9 @@
|
|
|
13
13
|
|
|
14
14
|
## 提炼判据
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
契约引导模型先判断信息是否有长期记忆价值,而不按具体业务场景列禁止项:综合未来复用、信息增量、再次读取时的直接可用性和忘记成本。只有对未来理解、判断或行动可能产生实质影响的信息才保留;没有明确价值就列入 `no_memory`,并只写产生该价值的最小核心。同一件事只写一次。
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
- **同一件事只写一次**:同一条内容不会同时落成事实和待办。
|
|
20
|
-
- `retention` 与类型独立:`reusable` 表示今后仍需使用的业务状态、约定或可复用结论;`session` 表示仅说明本轮如何查询、执行和恢复的过程,Core 会把它转成 `no_memory`。
|
|
18
|
+
首轮提炼、主题选择、候选修复和 `semantic_maintenance` 共用这条判断标准。`retention` 与类型独立:`reusable` 表示符合上述标准,`session` 表示不符合,Core 会把 `session` 转成 `no_memory`。维护阶段将符合标准的 incoming 继续维护,不符合的丢弃,语义无法确定的延后;它负责维护已有候选,不重新发明主题。
|
|
21
19
|
|
|
22
20
|
## 降级而不是丢弃
|
|
23
21
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Local-first Markdown memory core for AI agents."""
|
|
2
2
|
|
|
3
|
-
__version__ = "0.2.
|
|
3
|
+
__version__ = "0.2.63"
|
|
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
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
import json
|
|
4
4
|
from typing import Any, Mapping
|
|
5
|
-
from .semantic_protocol import expand_fragments, _invalid
|
|
5
|
+
from .semantic_protocol import RETENTION_GUIDANCE, expand_fragments, _invalid
|
|
6
6
|
from .validation import parse_strict_json
|
|
7
7
|
|
|
8
|
-
MAINTENANCE_SYSTEM = '''
|
|
8
|
+
MAINTENANCE_SYSTEM = RETENTION_GUIDANCE + "\n" + '''维护长期记忆,而不是再次摘录对话。按上述标准复核 incoming:符合标准的继续维护,没有明确价值的放 discard,无法判断的放 deferred。groups 按项目和类型隔离,incoming 是本轮增量,existing 是可更新的 catalog ID。
|
|
9
9
|
同一事项的需求、进展、回复、附件位置和约定日期合并维护;后续状态替换旧状态,重复信息不新建。不同的独立事项保持分开。正文概括核心,不逐条转录文档或保存助手的临时建议。类型由输入确定,本阶段只维护同类型的状态。
|
|
10
10
|
返回 JSON {"memories":[{"from":[incoming ID],"target":"已有memory_id或null","title":"主题","body":"合并后的当前内容","type":"fact或todo等"}],"discard":[incoming ID],"deferred":[incoming ID]}。
|
|
11
11
|
每条仅合并同组 incoming;同一事项已有记忆时 target 必须选该组 existing 中的ID,保留其有效内容并更新变化;独立新事项 target=null。已有target保留原type;新任务没有同事项todo目标时新建todo,不借用fact ID。同一target只输出一次。无需修改的已有记忆可原样返回。todo 提供 status(active/completed/cancelled)和 due_date(原文日期,无则null);不能把任务变成一般事实而丢失动作。每个 incoming 由 from、discard 或 deferred 覆盖。无需处理原始片段ID、复制证据或生成记忆ID。'''
|
|
@@ -107,16 +107,15 @@ def source_fragments(b3_prompt: str) -> dict[str, Any]:
|
|
|
107
107
|
'scope_context': data['scope_background'], 'scope_registry': data['scope_registry']}
|
|
108
108
|
|
|
109
109
|
|
|
110
|
-
RETENTION_GUIDANCE = """
|
|
110
|
+
RETENTION_GUIDANCE = """先判断这段信息是否有长期记忆价值:综合未来复用概率、信息增量、再次读取时是否可直接使用和忘记成本。只有对未来理解、判断或行动可能产生实质影响的信息才保留;没有明确价值就放 no_memory。只保留产生该价值的最小核心。"""
|
|
111
111
|
|
|
112
112
|
|
|
113
|
-
FRAGMENT_SYSTEM = f'''
|
|
114
|
-
根据底层长期有效的业务含义提炼记忆,不继承原文的标题、紧急程度、列表分类或建议处理方式。
|
|
113
|
+
FRAGMENT_SYSTEM = f'''根据对话语义判断每段信息是否值得形成长期记忆,不继承原文的标题、紧急程度、列表分类或建议处理方式。
|
|
115
114
|
{RETENTION_GUIDANCE}
|
|
116
115
|
返回 JSON:{{"memories":[],"no_memory":[],"deferred":[]}}。
|
|
117
|
-
每条 memory:{{"retention":"reusable 或 session","title":"简短主题","body":"脱离本轮对话仍有价值的核心内容","scope":"project:主体名 或 global","evidence":[片段ID]}}。type 默认 fact,表示业务事实或状态;可选类型 preference、project、todo、event、identity、other,event 仅用于事件本身而非其携带的业务事实。一条一个独立主题与归属,同一件事只写一次。scope
|
|
116
|
+
每条 memory:{{"retention":"reusable 或 session","title":"简短主题","body":"脱离本轮对话仍有价值的核心内容","scope":"project:主体名 或 global","evidence":[片段ID]}}。type 默认 fact,表示业务事实或状态;可选类型 preference、project、todo、event、identity、other,event 仅用于事件本身而非其携带的业务事实。一条一个独立主题与归属,同一件事只写一次。scope 表示事实所属主体,按语义判断,不要求名称与证据逐字一致;项目、客户、系统、产品等主体均可作为归属,没有明确主体才写 global。同一段的独立主题分别提炼。
|
|
118
117
|
新 todo 额外提供 task_basis:[用户角色片段ID],其内容须明确建立用户自己承担的未完成动作。todo 提供 status(active/completed/cancelled)及 due_date(该任务约定日期,无则 null),completed_at 可选。日期保留原文写法,由 Core 解析相对日期。
|
|
119
|
-
no_memory
|
|
118
|
+
no_memory 填不符合上述长期记忆价值标准的片段ID;deferred 填语义尚无法确定的片段ID。每个片段须被 memory 引用或列入其中一个数组。同片段允许支持多条 memory。若为 catalog 中同一事项的补充、状态变化或重复,target 填已有真实 ID 并给出合并后的当前内容;新事项才省略 target。无需输出写入决策、生成ID或复制原文。'''
|
|
120
119
|
|
|
121
120
|
|
|
122
121
|
def expand_fragments(raw: str, fragments: list[dict[str, Any]]) -> str:
|
|
@@ -227,11 +226,11 @@ def _independent_project_subjects(text: str, scope_registry: Mapping[str, Any] |
|
|
|
227
226
|
|
|
228
227
|
|
|
229
228
|
|
|
230
|
-
TOPIC_SYSTEM = RETENTION_GUIDANCE + "\n" + '''
|
|
229
|
+
TOPIC_SYSTEM = RETENTION_GUIDANCE + "\n" + '''根据对话语义识别值得保留的独立主题,不继承原文标题、紧急程度、列表分类或建议处理方式。
|
|
231
230
|
这一阶段只选择有后续价值的主题及其证据,不写记忆正文,不分类,不处理日期,不决定数据库操作。
|
|
232
231
|
返回 JSON {"topics":[{"retention":"reusable 或 session","scope":"project:项目名 或 global","evidence":[片段ID]}],"no_memory":[片段ID],"deferred":[片段ID]}。
|
|
233
|
-
每个独立主题单独列出,scope
|
|
234
|
-
no_memory
|
|
232
|
+
每个独立主题单独列出,scope 表示主题真正所属的主体,按语义判断,不要求名称与证据逐字一致;没有明确主体才写 global。其他合法 scope:domain:名称、portfolio:名称、unscoped。
|
|
233
|
+
no_memory 表示不符合上述长期记忆价值标准;deferred 表示语义无法确定。覆盖所有片段,每个被一个或多个主题引用或列入一个数组。'''
|
|
235
234
|
|
|
236
235
|
|
|
237
236
|
def compile_topics(raw: str, fragments: list[dict[str, Any]], protocol_version: str, *, contexts=None):
|
|
@@ -1496,7 +1496,7 @@ def run_single_pass_stage(
|
|
|
1496
1496
|
if row.get("detail") == "scope_drift" else "A field contains an unsupported date or task attribution; retain supported core facts."}
|
|
1497
1497
|
for row in deferrals if row.get("candidate_id") in failed_ids]}
|
|
1498
1498
|
repair_prompt = "MEMORY_REPAIR\n" + json.dumps(payload, ensure_ascii=False, separators=(",", ":"))
|
|
1499
|
-
repair_system = FRAGMENT_SYSTEM + "\nCore
|
|
1499
|
+
repair_system = FRAGMENT_SYSTEM + "\nCore 已拒绝这些候选。请按上述长期记忆价值标准复核,保留符合标准的最小核心,纠正违规日期或归属;不要凭空增加内容。"
|
|
1500
1500
|
if inline_system:
|
|
1501
1501
|
repair_prompt, repair_system = repair_system + "\n\n" + repair_prompt, ""
|
|
1502
1502
|
repair_details, repair_targets = [], []
|
|
@@ -1691,7 +1691,7 @@ def run_single_pass_stage(
|
|
|
1691
1691
|
if any(c["unit_id"] == f["unit_id"] for c in row["evidence"])]}
|
|
1692
1692
|
for row in affected if problems[row["candidate_id"]]["detail"] not in {"semantic_review", "maintenance_uncertain"}
|
|
1693
1693
|
]
|
|
1694
|
-
review_system = FRAGMENT_SYSTEM + "\n
|
|
1694
|
+
review_system = FRAGMENT_SYSTEM + "\n请按完整证据独立复核每条信息是否符合上述长期记忆价值标准;主题清单和 no_memory_candidates 均只是待复核候选。修正 issues,只提炼符合标准的最小核心,其余放入 no_memory。"
|
|
1695
1695
|
maintenance_context = None
|
|
1696
1696
|
if "memories" in value:
|
|
1697
1697
|
from .semantic_maintenance import maintenance_input, MAINTENANCE_SYSTEM
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: memleaf
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.63
|
|
4
4
|
Summary: A local-first Markdown memory core for AI agents
|
|
5
5
|
Author: memleaf contributors
|
|
6
6
|
License-Expression: MIT
|
|
@@ -23,8 +23,9 @@ 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.
|
|
27
|
-
>
|
|
26
|
+
> **版本:0.2.63。**
|
|
27
|
+
> 自动提炼和复核共用同一条“未来记忆价值”标准:模型综合未来复用、信息增量、再次读取时的直接可用性和忘记成本,只保留对未来理解、判断或行动有实质影响的最小核心;没有明确价值的信息不提炼,不按具体业务场景硬编码排除。
|
|
28
|
+
> 提炼契约现在只有一份中文语义契约(旧版英文 B3 提示词已删除),首轮、主题选择、候选修复和 `semantic_maintenance` 使用同一套保留价值判断;同一件事只写一次。
|
|
28
29
|
> Core 不再因为归属、日期、任务依据或跨项目而丢弃整条候选:归属缺失会归一到证据里唯一被点名的项目、否则落 `global`;日期只接受能在本候选证据里找到出处、且能锚定成 ISO 的写法(`明天`、`周五`、`月底` 都会被解析),无法解析时只丢掉日期字段,记忆照常写入;未获授权的改归属沿用目标原归属。
|
|
29
30
|
> 待办 `due_date` 只表示待办动作本身明确声明的截止日;属于待办主题或预期结果的日期不会被误作截止日。项目归属由模型按语义判断,不要求项目名在证据里逐字出现。复核阶段会保留首轮已选定的更新目标,避免“状态变更”被降级成新增记忆。Markdown 仍是唯一事实源。
|
|
30
31
|
> **当前版本支持 Hermes 和 Codex。** Antigravity(反重力)不检测、不安装、不配置。
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|