memleaf 0.2.25__tar.gz → 0.2.27__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.25 → memleaf-0.2.27}/CHANGELOG.md +21 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/MANIFEST.in +2 -0
- {memleaf-0.2.25/src/memleaf.egg-info → memleaf-0.2.27}/PKG-INFO +70 -5
- {memleaf-0.2.25 → memleaf-0.2.27}/README.en.md +71 -4
- {memleaf-0.2.25 → memleaf-0.2.27}/README.md +69 -4
- memleaf-0.2.27/docs/core-refactor.md +129 -0
- memleaf-0.2.27/docs/evidence-retention.md +58 -0
- memleaf-0.2.27/docs/general-processing.md +161 -0
- memleaf-0.2.27/docs/hermes-mcp-runtime.md +208 -0
- memleaf-0.2.27/docs/v0.2.26-processing-status.md +22 -0
- memleaf-0.2.27/examples/live_processing_acceptance.py +126 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/pyproject.toml +1 -1
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/__init__.py +1 -1
- memleaf-0.2.27/src/memleaf/admission.py +417 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/capture.py +16 -32
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/cli.py +25 -1
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/compaction.py +95 -68
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/config.py +25 -1
- memleaf-0.2.27/src/memleaf/evidence_policy.py +80 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/hermes_provider/__init__.py +131 -84
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/hermes_provider/plugin.yaml +1 -1
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/host_events.py +11 -3
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/host_runtime.py +121 -3
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/inbox.py +2 -21
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/index.py +6 -0
- memleaf-0.2.27/src/memleaf/inspection.py +174 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/locking.py +42 -13
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/mcp_server.py +7 -2
- memleaf-0.2.27/src/memleaf/memory_commit.py +452 -0
- memleaf-0.2.27/src/memleaf/memory_planner.py +988 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/memory_writer.py +44 -17
- memleaf-0.2.27/src/memleaf/model_execution.py +305 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/models.py +1 -0
- memleaf-0.2.27/src/memleaf/planning_context.py +811 -0
- memleaf-0.2.27/src/memleaf/process_common.py +677 -0
- memleaf-0.2.27/src/memleaf/process_journal.py +621 -0
- memleaf-0.2.27/src/memleaf/process_owner.py +41 -0
- memleaf-0.2.27/src/memleaf/processing.py +246 -0
- memleaf-0.2.27/src/memleaf/prompts.py +368 -0
- memleaf-0.2.27/src/memleaf/provenance.py +264 -0
- memleaf-0.2.27/src/memleaf/recording_policy.py +63 -0
- memleaf-0.2.27/src/memleaf/retention.py +192 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/service.py +57 -41
- memleaf-0.2.27/src/memleaf/source_policy.py +125 -0
- memleaf-0.2.27/src/memleaf/turn_audit.py +128 -0
- memleaf-0.2.27/src/memleaf/turn_plan.py +267 -0
- memleaf-0.2.27/src/memleaf/update_coordinator.py +200 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/validation.py +28 -462
- {memleaf-0.2.25 → memleaf-0.2.27/src/memleaf.egg-info}/PKG-INFO +70 -5
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf.egg-info/SOURCES.txt +33 -0
- memleaf-0.2.27/tests/semantic_fixtures.py +77 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_admission_noise.py +40 -47
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_cross_turn_dedupe_regressions.py +8 -9
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_email_actionable_coverage.py +42 -6
- memleaf-0.2.27/tests/test_evidence_retention_policy.py +201 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_extraction_quality_regressions.py +37 -106
- memleaf-0.2.27/tests/test_general_evidence_admission.py +229 -0
- memleaf-0.2.27/tests/test_general_tool_provenance.py +59 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_global_todo_acceptance.py +3 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_global_todo_query_no_write.py +7 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_hermes_provider.py +4 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_host_events.py +3 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_install.py +1 -0
- memleaf-0.2.27/tests/test_long_run_hygiene.py +179 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_maintenance_v2.py +12 -7
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_model_discovery.py +4 -2
- memleaf-0.2.27/tests/test_model_owned_fields.py +255 -0
- memleaf-0.2.27/tests/test_phase2_model_decisions.py +331 -0
- memleaf-0.2.27/tests/test_process_owner_locking.py +96 -0
- memleaf-0.2.27/tests/test_processing_contract_v026.py +323 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_session_lineage.py +3 -0
- memleaf-0.2.27/tests/test_shared_memory_refactor.py +255 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_stage_b1.py +75 -110
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_stage_b2a.py +147 -177
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_stage_b2b.py +14 -7
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_stage_b3a_commit.py +1 -1
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_stage_b3b_native_context.py +2 -1
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_stage_b3b_scope.py +11 -2
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_stage_b3c_retrieval.py +3 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_stage_b3d_scope_maintenance.py +18 -16
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_stage_c2_init.py +27 -3
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_todo_state_recovery.py +32 -11
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_update_target_recovery.py +50 -77
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_v023_scope_correction.py +29 -16
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_v2_host_flow.py +4 -0
- memleaf-0.2.25/src/memleaf/processing.py +0 -4931
- memleaf-0.2.25/src/memleaf/prompts.py +0 -621
- {memleaf-0.2.25 → memleaf-0.2.27}/IMPLEMENTATION_PLAN.md +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/LICENSE +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/RELEASE_CHECKLIST.md +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/examples/README.md +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/examples/basic_usage.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/examples/mcp_stdio.ndjson +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/install.ps1 +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/install.sh +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/setup.cfg +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/__main__.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/adapters/__init__.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/adapters/antigravity.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/adapters/base.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/adapters/codex.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/adapters/hermes.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/budget.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/credentials.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/frontmatter.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/hermes_provider/README.md +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/hermes_runtime.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/installer.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/llm/__init__.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/llm/base.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/llm/claude_compatible.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/llm/gemini.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/llm/openai_compatible.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/llm/router.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/model_discovery.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/native_index.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/native_registration.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/redaction.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/retrieval.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/retrieval_gate.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/scope_maintenance.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/scope_state.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf/vault.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf.egg-info/dependency_links.txt +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf.egg-info/entry_points.txt +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/src/memleaf.egg-info/top_level.txt +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/__init__.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_codex_install.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_codex_native_cli.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_context_budget.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_credential_safety.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_cross_host_acceptance.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_global_todo_retrieval.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_hermes_native_registration.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_hermes_runtime_install.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_hermes_stdio_transport.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_host_runtime_contract.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_pypi_install.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_retrieval_gate.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_retrieval_v2.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_stage_a.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_stage_b3a_contract.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_stage_b3b_native_index.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_stage_c1_mcp.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_stage_c3_packaging.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_upgrade_preserves_vault.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_v2_gate_limits.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_v2_mcp_flow.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_v2_nomatch_semantics.py +0 -0
- {memleaf-0.2.25 → memleaf-0.2.27}/tests/test_v2_search_gate_acceptance.py +0 -0
|
@@ -2,6 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to memleaf are documented here.
|
|
4
4
|
|
|
5
|
+
## 0.2.27 — 2026-09-05
|
|
6
|
+
|
|
7
|
+
- Remove application-, document-, tool- and business-specific semantic classifiers from the Core admission/target path. The model owns future-use and atomicity judgments; Core retains source-neutral evidence, Scope, type, target, date, revision and conflict validation.
|
|
8
|
+
- Bound per-memory provenance to 16 retained source rows while preserving cumulative source count/digest metadata, preventing repeated UPDATEs and copied history versions from growing `sources` without limit.
|
|
9
|
+
- Retire completed/cancelled todos from active `knowledge/` after a configurable grace period (30 days by default) while keeping them queryable through historical todo enumeration.
|
|
10
|
+
- Add bounded history retention (`3650` days and `32` complete versions per stable identity by default) with an explicit `keep_all` opt-out for audit-oriented Vaults.
|
|
11
|
+
- Preserve an existing canonical memory identity during compaction instead of generating `mem-compact-*` IDs; rollback remains journaled and crash-safe.
|
|
12
|
+
- Keep Markdown as the source of truth, retain zero runtime dependencies and no daemon, and preserve Hermes/Codex shared-Vault retrieval and write contracts.
|
|
13
|
+
|
|
14
|
+
## 0.2.26 — 2026-09-05
|
|
15
|
+
|
|
16
|
+
- Refactor automatic processing into explicit model execution, planning, update coordination, commit, journal and audit owners while preserving Markdown Vaults, memory IDs, Hermes MemoryProvider and cross-Agent retrieval contracts. No runtime dependency or independent service is added.
|
|
17
|
+
- Remove post-Gate completion/rework generation, forced status/type/Scope rewrites, local last-retry candidate splitting, wrong-target UPDATE-to-CREATE conversion and automatic old/new body concatenation. Invalid proposals receive bounded model correction, then explicit candidate-local deferral; valid siblings proceed.
|
|
18
|
+
- Add source-neutral exact evidence bindings and one bounded coverage correction. Assistant synthesis, recalled memory and truncated observations do not independently authorize new facts; evidence and candidate outcomes are accounted separately.
|
|
19
|
+
- Reconcile compatible same-target updates into one model-owned write/history operation with all contributing receipts. Preserve actual outcomes on replay and reject stale target revisions under the shared Vault lock.
|
|
20
|
+
- Freeze complete change payloads; explicit forget cancels matching pending operations before deletion. Explicit remember enforces selected Scope and target revisions. Automatic/explicit writes, forget, raw-library writes and compaction share the lock/recovery entry boundary without conflating their authorization.
|
|
21
|
+
- Honor leading recording controls and record=False before persistence, consume only safely captured tool caches, and retry unresolved coverage at most once through natural lifecycle triggers. Keep unresolved source evidence after exhaustion.
|
|
22
|
+
- Unify bounded/metadata/off tool-evidence retention across direct capture, Hermes, Codex and planning. Preserve legacy disabled settings and document-source exclusions; configuration changes do not fabricate missing source content.
|
|
23
|
+
- Add read-only audit, isolated dry-run, Windows native process-liveness and cross-process file-lock safeguards. Run complete regression suites on Linux, Windows and macOS plus wheel/sdist installation checks.
|
|
24
|
+
- Deterministic contract tests do not establish real-model semantic quality. The maintainer selected local live-model acceptance rather than repository model credentials; no real-model result is claimed by this release.
|
|
25
|
+
|
|
5
26
|
## 0.2.25 — 2026-09-04
|
|
6
27
|
|
|
7
28
|
- Keep global todo questions and cross-session recaps strictly read-only,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: memleaf
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.27
|
|
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,8 @@ 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
|
-
>
|
|
27
|
-
> 核心库、Vault、stdio MCP Server、初始化 CLI
|
|
26
|
+
> **版本:0.2.27。**
|
|
27
|
+
> 核心库、Vault、stdio MCP Server、初始化 CLI、模型路由、提炼流程、受控检索协议和宿主适配器已经实现。本版收口长期运行治理:Core 语义判断保持 source-neutral,并为来源、关闭待办、历史版本和压缩身份增加有界生命周期。真实模型语义效果仍需结合本地模型和代表性样本验收。
|
|
28
28
|
> **当前版本支持 Hermes 和 Codex。** Antigravity(反重力)不检测、不安装、不配置。
|
|
29
29
|
|
|
30
30
|
## 项目定位
|
|
@@ -417,11 +417,33 @@ $HOME/.memleaf/
|
|
|
417
417
|
|
|
418
418
|
`knowledge/` 和 `history/` 是可读数据;`_index/` 主要是派生索引或运行状态。删除或直接修改 `_index/` 可能丢失处理水位、Hook 游标或当前检索账本;需要重建时优先使用 `rebuild_index()`。
|
|
419
419
|
|
|
420
|
+
### 长期运行与保留策略
|
|
421
|
+
|
|
422
|
+
默认配置对长期增长做三层治理,而不引入后台服务:
|
|
423
|
+
|
|
424
|
+
```yaml
|
|
425
|
+
process:
|
|
426
|
+
memory_compact_threshold_tokens: 100000
|
|
427
|
+
memory_compact_candidate_ratio: 0.30
|
|
428
|
+
inbox_cleanup_hours: 24
|
|
429
|
+
closed_todo_retention_days: 30
|
|
430
|
+
history:
|
|
431
|
+
policy: bounded
|
|
432
|
+
retention_days: 3650
|
|
433
|
+
max_versions_per_memory: 32
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
- active Markdown 每条最多保留 16 个来源明细,同时记录累计 `source_count`、`source_digest` 和省略数量,避免 UPDATE 让 `sources` 无限膨胀;
|
|
437
|
+
- 已完成/已取消 todo 默认在 30 天后退出 `knowledge/` 并进入 `history/`;`list_todos(status=completed|cancelled|all)` 仍可枚举这些历史待办;
|
|
438
|
+
- `history.policy: bounded` 默认每个稳定记忆身份最多保留 32 个完整历史版本,且超过 3650 天的版本可被维护流程淘汰;需要永久审计时可显式设置 `history.policy: keep_all`;
|
|
439
|
+
- compaction 会保留一个既有 canonical `memory_id`,不会再为整理结果创建新的 `mem-compact-*` 身份;单条精简保持原 ID,多条合并选择一个稳定 survivor。
|
|
440
|
+
- 这些维护动作在正常 `process()` / `remember()` / `compact()` 生命周期中执行,不需要 daemon;普通只读检索本身不触发维护写入。
|
|
441
|
+
|
|
420
442
|
默认目录尽量使用 `0700`,文件默认明文保存。memleaf 没有内置加密层,请自行保护 Vault、备份和模型调用凭证。
|
|
421
443
|
|
|
422
444
|
## 隐私与安全边界
|
|
423
445
|
|
|
424
|
-
-
|
|
446
|
+
- 对话捕获只接收 user/assistant 可见文本,不捕获 system/developer 指令或隐藏推理。匹配到当前轮工具调用的证据另由 `capture.tool_evidence_mode` 控制;新建 Vault 默认 `bounded`(脱敏、有界正文),文件/附件正文默认不留存。旧配置显式关闭工具输出时不自动升级为保留正文;
|
|
425
447
|
- 捕获落盘前尽力脱敏常见 API key、Bearer token、Cookie、JWT 和私钥,但脱敏不是加密,也不能保证识别所有敏感信息;
|
|
426
448
|
- 路径校验、符号链接检查、Vault 锁、同目录临时文件、fsync 和原子替换用于保护本地写入;
|
|
427
449
|
- memleaf 不主动上传整个 Vault,也没有托管后台、遥测或账号系统;
|
|
@@ -457,7 +479,7 @@ python -m build --wheel --sdist
|
|
|
457
479
|
- 没有模型路由时只能捕获和检索,不能完成自动提炼、显式记忆或压缩;
|
|
458
480
|
- 真实宿主长期运行效果仍取决于本机 Agent 版本、配置、重启和模型可用性;
|
|
459
481
|
- 不提供 Obsidian 插件、Web 管理界面、云同步或透明加密层;
|
|
460
|
-
-
|
|
482
|
+
- 普通只读检索不会触发保留策略写入;历史淘汰和关闭待办退休只在正常处理/维护生命周期中执行。
|
|
461
483
|
|
|
462
484
|
|
|
463
485
|
## License
|
|
@@ -466,3 +488,46 @@ MIT,见 [LICENSE](LICENSE)。
|
|
|
466
488
|
|
|
467
489
|
**memleaf**
|
|
468
490
|
*Your memories, in files you own.*
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
## 通用处理与只读验收(0.2.27)
|
|
494
|
+
|
|
495
|
+
邮件、日历、工单、文件、浏览器与普通对话共用证据准入、覆盖检查和写入路径。
|
|
496
|
+
自动摘要只能使用获准引用的原文;助手复述和旧记忆回读不能单独授权新增写入。
|
|
497
|
+
模型负责语义判断,代码验证来源和原文引用。通过引用校验并不保证模型的语义判断一定正确。
|
|
498
|
+
|
|
499
|
+
```bash
|
|
500
|
+
memleaf audit --vault /path/to/existing/vault --json
|
|
501
|
+
memleaf process --vault /path/to/existing/vault --source hermes --session-id SESSION --dry-run --json
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
`audit` 完全本地、只读,不调用模型,不推断旧记忆由哪个版本创建,也不自动清理。
|
|
505
|
+
`--dry-run` 在私有临时副本运行正常处理,可能调用配置的独立 Model Route;不会改写原 Vault。
|
|
506
|
+
检测到原 Vault 并发变化时会拒绝输出可用预览。没有一键应用预览的功能。
|
|
507
|
+
|
|
508
|
+
工具执行状态与证据完整性分别记录;超限、丢失或不完整内容不会被模型的 NO_CHANGE 升级为完整。
|
|
509
|
+
执行成功但尚有未解决项时,结果显示 `coverage_status=partial`,并保留来源以供有界重试或补充证据。
|
|
510
|
+
行为、限制、测试协议变更见 [通用处理说明](docs/general-processing.md)。
|
|
511
|
+
|
|
512
|
+
### 工具证据留存配置
|
|
513
|
+
|
|
514
|
+
```yaml
|
|
515
|
+
capture:
|
|
516
|
+
tool_evidence_mode: bounded # bounded | metadata | off
|
|
517
|
+
include_attachments: false
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
`bounded` 允许当前轮真实工具观察保留有界、脱敏的正文;小结果可能完整保留,
|
|
521
|
+
不是承诺只保存模型总结。`metadata` 仅留工具调用标识等元数据(仍可能包含标题),
|
|
522
|
+
不保留证据正文,也不把主动排除误报成提炼漏项。`off` 不保存工具证据记录。
|
|
523
|
+
三种模式均不允许把助手复述或旧记忆回读变成独立的新事实。
|
|
524
|
+
|
|
525
|
+
现有配置未提供新字段时,旧 `include_tool_output: false` 或未设置该开关均按
|
|
526
|
+
`metadata` 处理,旧 `true` 按 `bounded` 处理。显式新字段优先;新建 Vault 只写
|
|
527
|
+
新字段,不再同时写含义冲突的旧开关。`include_attachments: true` 仍受上述总模式限制。
|
|
528
|
+
宿主通过结构化文件路径、文件/附件标识识别文档;不承诺识别任意 Shell 命令或不透明工具
|
|
529
|
+
隐藏读取的文件。用户粘贴的可见文档和显式 `remember` 内容不属于自动附件抓取。
|
|
530
|
+
|
|
531
|
+
策略在待捕获缓存、inbox 写入和新模型提炼输入处共同执行。配置收紧不会自动删除已提交
|
|
532
|
+
记忆或改写已捕获 inbox;失败前已经冻结的提交计划也不作为新的模型调用重新提炼。
|
|
533
|
+
已捕获工具原文的清理仍遵守原有安全期,明确忘记使用 `forget_memory/forget_about`。
|
|
@@ -4,8 +4,8 @@
|
|
|
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
|
-
> The core library, Vault, stdio MCP server, initialization CLI, model routing, memory extraction, controlled retrieval protocol, and host adapters are implemented.
|
|
7
|
+
> **Version: 0.2.27.**
|
|
8
|
+
> The core library, Vault, stdio MCP server, initialization CLI, model routing, memory extraction, controlled retrieval protocol, and host adapters are implemented. This release closes long-run lifecycle gaps: Core semantic decisions remain source-neutral, while provenance, closed todos, history versions, and compaction identity are bounded. Real-model semantics still require local acceptance with the selected model and representative inputs.
|
|
9
9
|
> **The current release supports Hermes and Codex.** Antigravity is not detected, installed, or configured.
|
|
10
10
|
|
|
11
11
|
## Project scope
|
|
@@ -400,11 +400,33 @@ $HOME/.memleaf/
|
|
|
400
400
|
|
|
401
401
|
`knowledge/` and `history/` are human-readable data. `_index/` contains derived indexes and runtime state. Deleting or editing it directly can lose processing watermarks, host cursors, or the current retrieval ledger; use `rebuild_index()` when a rebuild is needed.
|
|
402
402
|
|
|
403
|
+
### Long-run retention
|
|
404
|
+
|
|
405
|
+
The default configuration bounds long-run growth without adding a background service:
|
|
406
|
+
|
|
407
|
+
```yaml
|
|
408
|
+
process:
|
|
409
|
+
memory_compact_threshold_tokens: 100000
|
|
410
|
+
memory_compact_candidate_ratio: 0.30
|
|
411
|
+
inbox_cleanup_hours: 24
|
|
412
|
+
closed_todo_retention_days: 30
|
|
413
|
+
history:
|
|
414
|
+
policy: bounded
|
|
415
|
+
retention_days: 3650
|
|
416
|
+
max_versions_per_memory: 32
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
- Each active Markdown memory retains at most 16 detailed provenance rows while tracking cumulative `source_count`, `source_digest`, and omitted rows, so repeated UPDATEs cannot grow `sources` without bound.
|
|
420
|
+
- Completed/cancelled todos leave `knowledge/` after 30 days by default and move to `history/`; `list_todos(status=completed|cancelled|all)` can still enumerate retired todos.
|
|
421
|
+
- With `history.policy: bounded`, each stable memory identity keeps at most 32 full historical versions, and versions older than 3650 days are eligible for pruning. Set `history.policy: keep_all` explicitly when permanent audit retention is required.
|
|
422
|
+
- Compaction preserves an existing canonical `memory_id` instead of creating a new `mem-compact-*` identity; a single-memory rewrite keeps its ID and a multi-memory merge chooses one stable survivor.
|
|
423
|
+
- Maintenance runs through normal `process()` / `remember()` / `compact()` lifecycle calls and requires no daemon. Ordinary read-only retrieval does not trigger maintenance writes.
|
|
424
|
+
|
|
403
425
|
Directories are normally created with mode `0700`, and files are stored as plaintext by default. memleaf has no built-in encryption layer; protect the Vault, backups, and model credentials yourself.
|
|
404
426
|
|
|
405
427
|
## Privacy and security boundaries
|
|
406
428
|
|
|
407
|
-
-
|
|
429
|
+
- Conversation capture accepts visible user/assistant text, never system/developer instructions or hidden reasoning. Matched current-turn tool evidence is controlled separately by `capture.tool_evidence_mode`: new Vaults use bounded/redacted observations; document/attachment bodies are excluded by default. Legacy configurations disabling tool output are not silently opted into body retention.
|
|
408
430
|
- Common API keys, Bearer tokens, cookies, JWTs, and private keys are redacted on a best-effort basis before capture is written. Redaction is not encryption and cannot detect every secret.
|
|
409
431
|
- Path validation, symlink checks, Vault locks, same-directory temporary files, fsync, and atomic replacement protect local writes.
|
|
410
432
|
- memleaf does not upload the entire Vault and has no hosted backend, telemetry, or account system.
|
|
@@ -440,7 +462,7 @@ The following should not be interpreted as delivered capabilities:
|
|
|
440
462
|
- Without a model route, memleaf can capture and retrieve but cannot perform automatic extraction, explicit model-backed memory, or compaction.
|
|
441
463
|
- Long-running real-host behavior still depends on the local Agent version, configuration, restart, and model availability.
|
|
442
464
|
- There is no Obsidian plugin, web management UI, cloud sync, or transparent encryption layer.
|
|
443
|
-
- Routine retrieval never performs
|
|
465
|
+
- Routine read-only retrieval never performs retention writes; history pruning and closed-todo retirement run only during normal processing/maintenance lifecycle calls.
|
|
444
466
|
|
|
445
467
|
|
|
446
468
|
## License
|
|
@@ -450,3 +472,48 @@ MIT; see [LICENSE](LICENSE).
|
|
|
450
472
|
**memleaf**
|
|
451
473
|
|
|
452
474
|
*Your memories, in files you own.*
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
## General processing and read-only inspection (0.2.27)
|
|
478
|
+
|
|
479
|
+
Dialogue, calendars, tickets, files, web results and other tools share the evidence, coverage and write path.
|
|
480
|
+
Models interpret semantics; Core validates physical provenance and exact original quotations.
|
|
481
|
+
A valid quotation establishes provenance, not the truth or entailment of a generated claim.
|
|
482
|
+
|
|
483
|
+
```bash
|
|
484
|
+
memleaf audit --vault /path/to/existing/vault --json
|
|
485
|
+
memleaf process --vault /path/to/existing/vault --source hermes --session-id SESSION --dry-run --json
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
Audit is local/read-only, never calls a model, never infers producing versions and never repairs automatically.
|
|
489
|
+
Dry-run executes the normal processor on a private temporary copy and may call the configured Model Route.
|
|
490
|
+
It does not modify the source Vault; concurrent source changes invalidate the preview. There is no apply-preview mode.
|
|
491
|
+
Execution success is separate from evidence completeness: `coverage_status=partial` reports unresolved work.
|
|
492
|
+
See [general processing](docs/general-processing.md) for the protocol, limits and verification boundaries.
|
|
493
|
+
|
|
494
|
+
### Tool-evidence retention
|
|
495
|
+
|
|
496
|
+
```yaml
|
|
497
|
+
capture:
|
|
498
|
+
tool_evidence_mode: bounded # bounded | metadata | off
|
|
499
|
+
include_attachments: false
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
`bounded` keeps bounded, redacted current-turn observations; small tool results may be
|
|
503
|
+
retained in full, not just as model summaries. `metadata` keeps identifiers and permitted
|
|
504
|
+
metadata (which may include titles), not bodies; intentional exclusions are not reported
|
|
505
|
+
as unresolved extraction. `off` retains no tool-evidence records. None of these modes makes
|
|
506
|
+
assistant synthesis or retrieved old memory independent evidence of new facts.
|
|
507
|
+
|
|
508
|
+
For an existing file without the new mode, legacy `include_tool_output: false` or an
|
|
509
|
+
absent boolean means `metadata`; true means `bounded`. An explicit new mode takes
|
|
510
|
+
precedence. New Vaults write only the new mode. Attachment opt-in remains subject to the
|
|
511
|
+
mode. Adapters classify structural file paths, file IDs and attachment handles, not
|
|
512
|
+
arbitrary opaque shell commands. Pasted visible documents and explicit remember text
|
|
513
|
+
are not automatic attachment capture.
|
|
514
|
+
|
|
515
|
+
The policy applies to pending cache, inbox writes, and new model-planning inputs.
|
|
516
|
+
Tightening it is not a retroactive rewrite of committed memories or captured inbox files.
|
|
517
|
+
Previously frozen operations are recovered as existing plans, not new model calls.
|
|
518
|
+
Captured evidence retains its existing cleanup grace period; use explicit forget for
|
|
519
|
+
memory deletion. See `docs/evidence-retention.md` for limits and scope.
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
[English](README.en.md) · [PyPI](https://pypi.org/project/memleaf/) · [GitHub](https://github.com/miffyblueboo/memleaf)
|
|
6
6
|
|
|
7
|
-
>
|
|
8
|
-
> 核心库、Vault、stdio MCP Server、初始化 CLI
|
|
7
|
+
> **版本:0.2.27。**
|
|
8
|
+
> 核心库、Vault、stdio MCP Server、初始化 CLI、模型路由、提炼流程、受控检索协议和宿主适配器已经实现。本版收口长期运行治理:Core 语义判断保持 source-neutral,并为来源、关闭待办、历史版本和压缩身份增加有界生命周期。真实模型语义效果仍需结合本地模型和代表性样本验收。
|
|
9
9
|
> **当前版本支持 Hermes 和 Codex。** Antigravity(反重力)不检测、不安装、不配置。
|
|
10
10
|
|
|
11
11
|
## 项目定位
|
|
@@ -398,11 +398,33 @@ $HOME/.memleaf/
|
|
|
398
398
|
|
|
399
399
|
`knowledge/` 和 `history/` 是可读数据;`_index/` 主要是派生索引或运行状态。删除或直接修改 `_index/` 可能丢失处理水位、Hook 游标或当前检索账本;需要重建时优先使用 `rebuild_index()`。
|
|
400
400
|
|
|
401
|
+
### 长期运行与保留策略
|
|
402
|
+
|
|
403
|
+
默认配置对长期增长做三层治理,而不引入后台服务:
|
|
404
|
+
|
|
405
|
+
```yaml
|
|
406
|
+
process:
|
|
407
|
+
memory_compact_threshold_tokens: 100000
|
|
408
|
+
memory_compact_candidate_ratio: 0.30
|
|
409
|
+
inbox_cleanup_hours: 24
|
|
410
|
+
closed_todo_retention_days: 30
|
|
411
|
+
history:
|
|
412
|
+
policy: bounded
|
|
413
|
+
retention_days: 3650
|
|
414
|
+
max_versions_per_memory: 32
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
- active Markdown 每条最多保留 16 个来源明细,同时记录累计 `source_count`、`source_digest` 和省略数量,避免 UPDATE 让 `sources` 无限膨胀;
|
|
418
|
+
- 已完成/已取消 todo 默认在 30 天后退出 `knowledge/` 并进入 `history/`;`list_todos(status=completed|cancelled|all)` 仍可枚举这些历史待办;
|
|
419
|
+
- `history.policy: bounded` 默认每个稳定记忆身份最多保留 32 个完整历史版本,且超过 3650 天的版本可被维护流程淘汰;需要永久审计时可显式设置 `history.policy: keep_all`;
|
|
420
|
+
- compaction 会保留一个既有 canonical `memory_id`,不会再为整理结果创建新的 `mem-compact-*` 身份;单条精简保持原 ID,多条合并选择一个稳定 survivor。
|
|
421
|
+
- 这些维护动作在正常 `process()` / `remember()` / `compact()` 生命周期中执行,不需要 daemon;普通只读检索本身不触发维护写入。
|
|
422
|
+
|
|
401
423
|
默认目录尽量使用 `0700`,文件默认明文保存。memleaf 没有内置加密层,请自行保护 Vault、备份和模型调用凭证。
|
|
402
424
|
|
|
403
425
|
## 隐私与安全边界
|
|
404
426
|
|
|
405
|
-
-
|
|
427
|
+
- 对话捕获只接收 user/assistant 可见文本,不捕获 system/developer 指令或隐藏推理。匹配到当前轮工具调用的证据另由 `capture.tool_evidence_mode` 控制;新建 Vault 默认 `bounded`(脱敏、有界正文),文件/附件正文默认不留存。旧配置显式关闭工具输出时不自动升级为保留正文;
|
|
406
428
|
- 捕获落盘前尽力脱敏常见 API key、Bearer token、Cookie、JWT 和私钥,但脱敏不是加密,也不能保证识别所有敏感信息;
|
|
407
429
|
- 路径校验、符号链接检查、Vault 锁、同目录临时文件、fsync 和原子替换用于保护本地写入;
|
|
408
430
|
- memleaf 不主动上传整个 Vault,也没有托管后台、遥测或账号系统;
|
|
@@ -438,7 +460,7 @@ python -m build --wheel --sdist
|
|
|
438
460
|
- 没有模型路由时只能捕获和检索,不能完成自动提炼、显式记忆或压缩;
|
|
439
461
|
- 真实宿主长期运行效果仍取决于本机 Agent 版本、配置、重启和模型可用性;
|
|
440
462
|
- 不提供 Obsidian 插件、Web 管理界面、云同步或透明加密层;
|
|
441
|
-
-
|
|
463
|
+
- 普通只读检索不会触发保留策略写入;历史淘汰和关闭待办退休只在正常处理/维护生命周期中执行。
|
|
442
464
|
|
|
443
465
|
|
|
444
466
|
## License
|
|
@@ -447,3 +469,46 @@ MIT,见 [LICENSE](LICENSE)。
|
|
|
447
469
|
|
|
448
470
|
**memleaf**
|
|
449
471
|
*Your memories, in files you own.*
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
## 通用处理与只读验收(0.2.27)
|
|
475
|
+
|
|
476
|
+
邮件、日历、工单、文件、浏览器与普通对话共用证据准入、覆盖检查和写入路径。
|
|
477
|
+
自动摘要只能使用获准引用的原文;助手复述和旧记忆回读不能单独授权新增写入。
|
|
478
|
+
模型负责语义判断,代码验证来源和原文引用。通过引用校验并不保证模型的语义判断一定正确。
|
|
479
|
+
|
|
480
|
+
```bash
|
|
481
|
+
memleaf audit --vault /path/to/existing/vault --json
|
|
482
|
+
memleaf process --vault /path/to/existing/vault --source hermes --session-id SESSION --dry-run --json
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
`audit` 完全本地、只读,不调用模型,不推断旧记忆由哪个版本创建,也不自动清理。
|
|
486
|
+
`--dry-run` 在私有临时副本运行正常处理,可能调用配置的独立 Model Route;不会改写原 Vault。
|
|
487
|
+
检测到原 Vault 并发变化时会拒绝输出可用预览。没有一键应用预览的功能。
|
|
488
|
+
|
|
489
|
+
工具执行状态与证据完整性分别记录;超限、丢失或不完整内容不会被模型的 NO_CHANGE 升级为完整。
|
|
490
|
+
执行成功但尚有未解决项时,结果显示 `coverage_status=partial`,并保留来源以供有界重试或补充证据。
|
|
491
|
+
行为、限制、测试协议变更见 [通用处理说明](docs/general-processing.md)。
|
|
492
|
+
|
|
493
|
+
### 工具证据留存配置
|
|
494
|
+
|
|
495
|
+
```yaml
|
|
496
|
+
capture:
|
|
497
|
+
tool_evidence_mode: bounded # bounded | metadata | off
|
|
498
|
+
include_attachments: false
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
`bounded` 允许当前轮真实工具观察保留有界、脱敏的正文;小结果可能完整保留,
|
|
502
|
+
不是承诺只保存模型总结。`metadata` 仅留工具调用标识等元数据(仍可能包含标题),
|
|
503
|
+
不保留证据正文,也不把主动排除误报成提炼漏项。`off` 不保存工具证据记录。
|
|
504
|
+
三种模式均不允许把助手复述或旧记忆回读变成独立的新事实。
|
|
505
|
+
|
|
506
|
+
现有配置未提供新字段时,旧 `include_tool_output: false` 或未设置该开关均按
|
|
507
|
+
`metadata` 处理,旧 `true` 按 `bounded` 处理。显式新字段优先;新建 Vault 只写
|
|
508
|
+
新字段,不再同时写含义冲突的旧开关。`include_attachments: true` 仍受上述总模式限制。
|
|
509
|
+
宿主通过结构化文件路径、文件/附件标识识别文档;不承诺识别任意 Shell 命令或不透明工具
|
|
510
|
+
隐藏读取的文件。用户粘贴的可见文档和显式 `remember` 内容不属于自动附件抓取。
|
|
511
|
+
|
|
512
|
+
策略在待捕获缓存、inbox 写入和新模型提炼输入处共同执行。配置收紧不会自动删除已提交
|
|
513
|
+
记忆或改写已捕获 inbox;失败前已经冻结的提交计划也不作为新的模型调用重新提炼。
|
|
514
|
+
已捕获工具原文的清理仍遵守原有安全期,明确忘记使用 `forget_memory/forget_about`。
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Shared memory core — controlled refactor
|
|
2
|
+
|
|
3
|
+
Baseline: `bc7622e0f4c5c7b6658336c4deb71fce6a370f11` (the unreleased 0.2.26
|
|
4
|
+
candidate). This document describes the completed four-increment design, not
|
|
5
|
+
an assertion that arbitrary model outputs are correct. The maintainer chose to
|
|
6
|
+
perform live-model acceptance locally; scripted fixtures are contract tests.
|
|
7
|
+
|
|
8
|
+
## Product boundaries
|
|
9
|
+
|
|
10
|
+
Markdown in `knowledge/` and `history/` remains the permanent source of truth.
|
|
11
|
+
Existing Vaults, paths, frontmatter, memory IDs and public tools remain compatible.
|
|
12
|
+
No database, vector engine, model weights, queue service, daemon, telemetry or
|
|
13
|
+
third-party runtime dependency is introduced. The existing host-managed stdio
|
|
14
|
+
MCP subprocess remains supported; no separate service needs deployment.
|
|
15
|
+
|
|
16
|
+
Hermes still registers `MemleafMemoryProvider` with the official plugin API.
|
|
17
|
+
Native MEMORY.md / USER.md stay read-only cooperating sources. Hermes and Codex
|
|
18
|
+
use the same Core and selected Vault. Source/session identifiers describe
|
|
19
|
+
provenance and lifecycle, never permanent-memory visibility. Scope Map -> search
|
|
20
|
+
-> selected read, retrieval enforcement levels, budget, global todo paging,
|
|
21
|
+
installation and the independent Model Route remain intact.
|
|
22
|
+
|
|
23
|
+
## Ownership
|
|
24
|
+
|
|
25
|
+
| Component | Responsibility |
|
|
26
|
+
| --- | --- |
|
|
27
|
+
| Processor | Orchestrate process/remember, compose components explicitly |
|
|
28
|
+
| ModelExecutor | Existing Model Route, bounded correction, diagnostics |
|
|
29
|
+
| PlanningContext | Read related memories, Scope evidence and target context |
|
|
30
|
+
| MemoryPlanner | Validate model proposals and construct change requests |
|
|
31
|
+
| UpdateCoordinator | One bounded reconciliation for an exceptional same-target group |
|
|
32
|
+
| MemoryCommitter | Validate revisions, freeze/execute writes, coordinate forget cancellation |
|
|
33
|
+
| ProcessJournal | Claims, progress, temporary evidence cleanup and retained retry state |
|
|
34
|
+
| TurnAudit | Per-candidate/evidence outcomes and uncommitted lookup overlay |
|
|
35
|
+
| recording_policy | Pre-capture permission controls, no business extraction |
|
|
36
|
+
| evidence_policy | One retention rule for capture, host caches and new planning |
|
|
37
|
+
|
|
38
|
+
There is one automatic pipeline, not parallel old/new writers, mixin inheritance
|
|
39
|
+
or a dynamic attribute proxy. `Memleaf._mutation_boundary()` is the common Vault
|
|
40
|
+
lock plus interrupted-compaction recovery boundary for automatic/explicit
|
|
41
|
+
commits, raw-library writes, forget and compaction snapshot/commit. Each operation
|
|
42
|
+
retains its own authorization, revision checks and journal. Models execute outside
|
|
43
|
+
this critical section. Pending automatic writes are NOT replayed by entering the
|
|
44
|
+
boundary: forget must be able to cancel them first.
|
|
45
|
+
|
|
46
|
+
## Semantic ownership
|
|
47
|
+
|
|
48
|
+
The model selects type, Scope, target and content. Deterministic code validates
|
|
49
|
+
identity, allowed source spans, schema, explicit constraints and local conflicts.
|
|
50
|
+
It can reject a proposal, but must not silently change its business meaning.
|
|
51
|
+
|
|
52
|
+
Removed paths include completion/rework post-Gate candidate factories, forced
|
|
53
|
+
summary status/timestamp insertion, keyword-based fact/project/todo conversion,
|
|
54
|
+
last-retry Scope reassignment, local splitting of rejected candidates, formal-plan
|
|
55
|
+
preference that changes type, and old/new body concatenation. A persistent wrong
|
|
56
|
+
UPDATE target is DEFERRED, not converted into CREATE. Valid sibling candidates
|
|
57
|
+
continue. The model may correct its proposal during bounded retries.
|
|
58
|
+
|
|
59
|
+
`NO_CHANGE` remains a valid no-write decision. Missing required todo-update state
|
|
60
|
+
is returned for model correction, not guessed locally. A model-declared ambiguous
|
|
61
|
+
target can be represented as coverage DEFERRED / target_ambiguous. An exact title
|
|
62
|
+
lookup with more than one target cannot select one. Source-local rejection and
|
|
63
|
+
retrieval heuristics remain conservative checks, not a guarantee of semantic
|
|
64
|
+
entailment. Only exact full-statement matching is used for legacy unbound outputs.
|
|
65
|
+
|
|
66
|
+
For an UPDATE, the model must return the complete intended current state, retaining
|
|
67
|
+
still-valid facts and omitting retired facts. Code no longer appends old paragraphs
|
|
68
|
+
to an incomplete summary. The prior complete version is preserved in history.
|
|
69
|
+
Real-model quality still needs local evaluation, including preservation of old
|
|
70
|
+
facts and recognition of new assertions mixed with questions.
|
|
71
|
+
|
|
72
|
+
Multiple admitted updates to one target are reconciled using the existing Model
|
|
73
|
+
Route and original target revision. One compatible summary produces one write and
|
|
74
|
+
one history record with all contributing receipts. True conflicts defer the group;
|
|
75
|
+
unrelated targets proceed. Single updates incur no group call. Oversized groups
|
|
76
|
+
are retained, not split into competing writes. Scope-retirement/native-shadowing
|
|
77
|
+
authorizations are not silently combined.
|
|
78
|
+
|
|
79
|
+
## Lifecycle and privacy
|
|
80
|
+
|
|
81
|
+
Capture preserves process-owned root journal fields. Frozen requests keep complete
|
|
82
|
+
payloads and checksums; recovery uses the saved payload without another model call.
|
|
83
|
+
Revision checks under lock refuse stale overwrites. Replay preserves the actual
|
|
84
|
+
CREATE/UPDATE outcome for each contributing candidate. This is forward recovery,
|
|
85
|
+
not a database-style atomic transaction across every file in a Vault.
|
|
86
|
+
|
|
87
|
+
Explicit forget cancels matching frozen operations before deleting files. Unrelated
|
|
88
|
+
siblings survive, stale cancelled owners cannot commit, and a new explicitly
|
|
89
|
+
authorized remember event can store the fact again. No permanent topic blacklist
|
|
90
|
+
is added. Explicit remember skips value classification, not its supplied Scope or
|
|
91
|
+
target-revision constraints.
|
|
92
|
+
|
|
93
|
+
Successfully captured tool cache records are consumed only after their presence in
|
|
94
|
+
inbox is confirmed. Failed capture retains evidence; historical loss cannot taint
|
|
95
|
+
unrelated future turns. Retention modes and old-config compatibility are specified
|
|
96
|
+
in `evidence-retention.md`. Historical abandoned cache entries are not globally
|
|
97
|
+
purged as part of upgrade; no destructive migration is performed.
|
|
98
|
+
|
|
99
|
+
Leading recording controls and `record=False` suppress user/assistant/tool content
|
|
100
|
+
before persistence. Session off/resume state survives rebuild/restart, and late
|
|
101
|
+
callbacks for private turns remain private. Examples and quoted controls cannot
|
|
102
|
+
change permission. The command vocabulary is intentionally bounded (for example
|
|
103
|
+
`这段不要记录`, `接下来不要记录`, `恢复记录`, `Don't record this`, `stop recording this session`);
|
|
104
|
+
this is not arbitrary-language privacy inference. Integrations may use record=False.
|
|
105
|
+
Permission state stores only booleans and hashed identifiers, never private text.
|
|
106
|
+
|
|
107
|
+
Coverage-unresolved evidence receives at most one subsequent natural retry, capped
|
|
108
|
+
to four old turns per process call alongside new complete work. Missing-source,
|
|
109
|
+
Scope/target and ownership ambiguities wait for relevant new information or explicit
|
|
110
|
+
retry instead of spending model budget forever. Exhaustion retains unresolved input.
|
|
111
|
+
|
|
112
|
+
## Validation and test-contract migration
|
|
113
|
+
|
|
114
|
+
The existing suite is retained. Renamed tests distinguish a MODEL correcting its
|
|
115
|
+
Scope/type/target from the removed local repair. Public outcomes remain checked:
|
|
116
|
+
stable ID, complete new content, one prior history version, no wrong-Scope write,
|
|
117
|
+
retained inbox and independent sibling progress. Prior tests that expected invalid
|
|
118
|
+
proposals to be rewritten now assert bounded model correction or explicit DEFERRED.
|
|
119
|
+
|
|
120
|
+
A test that required creation of a fact absent from its input and attached to an
|
|
121
|
+
unrelated target now requires zero writes; the valid duplicate sibling remains
|
|
122
|
+
unchanged. Ambiguity fixtures explicitly return evidence-level DEFERRED and assert
|
|
123
|
+
retention, rather than relying on plan-title keywords. Dedicated raw-response tests
|
|
124
|
+
cover malformed evidence and illegal targets without the fixture binding adapter.
|
|
125
|
+
|
|
126
|
+
Final-source testing must include the full Linux, Windows and macOS matrix, wheel
|
|
127
|
+
entry points and the matching sdist suite. Native CLI registration is not live
|
|
128
|
+
semantic acceptance. Test results are tied to exact commits/artifacts, not to a
|
|
129
|
+
mutable local worktree or a percentage-complete estimate.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Shared tool-evidence retention — refactor phase 3
|
|
2
|
+
|
|
3
|
+
One deterministic policy governs direct capture, HostRuntime hooks and the copied
|
|
4
|
+
Hermes MemoryProvider. It grants no semantic write permission and adds no service,
|
|
5
|
+
runtime dependency, storage engine or model call.
|
|
6
|
+
|
|
7
|
+
## Modes and compatibility
|
|
8
|
+
|
|
9
|
+
| Effective setting | Bodies | Observation metadata |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| bounded | Redacted, bounded | Retained |
|
|
12
|
+
| metadata | Excluded | Retained |
|
|
13
|
+
| off | Excluded | Excluded |
|
|
14
|
+
|
|
15
|
+
New Vaults explicitly choose bounded; existing files without a mode preserve the
|
|
16
|
+
legacy boolean (false/absent -> metadata, true -> bounded). An explicit new mode
|
|
17
|
+
wins over the legacy boolean. Invalid strings and non-boolean flags fail closed.
|
|
18
|
+
Loading config does not rewrite it. Normal saves make the effective mode explicit.
|
|
19
|
+
|
|
20
|
+
The inherited limits remain eight records, 2,000 characters per body, and 320 per
|
|
21
|
+
metadata field. Oversized eligible evidence remains incomplete; its prefix is
|
|
22
|
+
never promoted into a complete fact. Policy-excluded observations are marked
|
|
23
|
+
retention=metadata, have no content, and are not retried as missing evidence.
|
|
24
|
+
No later relaxation recreates discarded original content.
|
|
25
|
+
|
|
26
|
+
Document/attachment bodies require include_attachments=true and bounded mode.
|
|
27
|
+
HostRuntime and the standalone Hermes adapter classify structural file arguments
|
|
28
|
+
using the same tested contract (path/file_path/file_id/attachment_id/file URI,
|
|
29
|
+
including bounded nesting). This is not a claim to identify every file hidden
|
|
30
|
+
behind arbitrary terminal commands or undocumented remote tools. Direct callers
|
|
31
|
+
must truthfully identify document evidence with source_type=document.
|
|
32
|
+
|
|
33
|
+
## Lifecycle
|
|
34
|
+
|
|
35
|
+
- Pre-capture recording permission takes precedence over every retention mode.
|
|
36
|
+
- New host observations and pending-cache reads obey the effective mode.
|
|
37
|
+
- Core capture validates and reapplies it before inbox persistence.
|
|
38
|
+
- New planning calls filter evidence from already captured inbox events too,
|
|
39
|
+
without mutating the original event identity or frozen-plan input checksum.
|
|
40
|
+
- Successful capture consumes only evidence verified in inbox under the same
|
|
41
|
+
policy; failed capture does not discard eligible observations.
|
|
42
|
+
- No retrospective deletion of knowledge/history/inbox is implied. Frozen plans
|
|
43
|
+
already prepared before a policy change recover via their existing contract.
|
|
44
|
+
Explicit forget coordinates cancellation; a retention toggle is not forget.
|
|
45
|
+
- Old abandoned host sessions are not scanned by a daemon or globally purged.
|
|
46
|
+
Current sessions consume their caches through the normal lifecycle.
|
|
47
|
+
|
|
48
|
+
Metadata is not anonymization: identifiers/titles may remain sensitive. Redaction
|
|
49
|
+
is best effort and local plaintext backups remain the user's responsibility.
|
|
50
|
+
|
|
51
|
+
## Verification
|
|
52
|
+
|
|
53
|
+
Contract tests cover legacy/no-capture config compatibility, round trips, explicit
|
|
54
|
+
precedence, denied documents, shared Hermes/core classification, bounded redaction,
|
|
55
|
+
cache-policy changes, direct and MCP fields, no model input after tightening,
|
|
56
|
+
no false coverage/retry from deliberate exclusion, and no reconstruction on opt-in.
|
|
57
|
+
Existing general evidence, native memory, lifecycle, retrieval and packaging tests
|
|
58
|
+
remain part of the full suite; no live model credentials are required here.
|