Skip to content

docs(rfc): propose local file-first project memory, 4-scenario privacy assembler, and inbox triage - #9333

Open
maxliux5 wants to merge 1 commit into
mainfrom
codex/local-file-memory-rfc
Open

maxliux5 wants to merge 1 commit into
mainfrom
codex/local-file-memory-rfc

Conversation

@maxliux5

Copy link
Copy Markdown
Collaborator

Summary

Proposes a default-off, zero-external-dependency local file-first project & topic memory provider (local_file_memory_v0), a four-scenario privacy assembler (MemoryAssembler), field-level ownership write locks, a rebuildable CJK/ASCII 2/3-gram exclusion index (.search/), and a fail-open pre-admission external inbox funnel built over LoopX's existing reward_memory, semantic_preference_provider_v0, material_lifecycle, and app-conversation-and-async-inbox-v0 contracts.

Delivery Brief

  • Goal / source: Let single-machine LoopX / Workbench / CLI sessions accumulate verified repository lessons and cross-project topic knowledge in plain inspectable files—without requiring an external OpenViking or vector-DB server—while enforcing deterministic privacy boundaries across prompts, handoffs, group chats, public PRs, and work laptops, and filtering external message noise before waking Steward.
  • Current gap on main (49881d5a3):
    1. reward_memory and semantic_preference_provider_v0 provide clean provider seams, but practical peer storage requires an external OpenViking (>=0.4.19) server and lacks a zero-ceremony local file provider with agent_reported / accepted / owner verification tiers.
    2. Memory sources lack a unified scenario-graded privacy assembler (standing / recall / handoff / external) and machine.trust = "work" host block, creating prompt bloat or group/PR leak risks if extensions write directly into AGENTS.md / CLAUDE.md.
    3. Plain-file summaries lack owner > extension > pipeline digest write locks and incremental add / update / drop diff distillation, while multi-hundred-thousand-file CJK/substring scans lack a 0-WAL file-exclusion index.
    4. High-volume external feeds lack rule-based capture selection and fail-open action / fyi / noise pre-triage prior to Steward intake.
  • Observable result (normative design & M1–M4 plan):
    1. M1 — local_file_memory_v0 provider, verification tiers & ownership locks: Ignored local-private projects/<slug>/memory.jsonl (outcome | decision | pitfall | lesson + agent_reported | accepted | owner) and topics/<slug>/points.json + summary.md, enforcing owner > extension > pipeline digest locks (409 on overwrite attempts) and .intent.json-backed add | update | drop diffs under semantic_preference_provider_v0 and reward_memory seams (recall != application != helpful preserved).
    2. M2 — Four-scenario MemoryAssembler & machine.trust = "work" boundary: Code-enforced gates across standing (≤ 1,536 B non-sensitive accepted/owner project items), recall (trusted_owner private only), handoff (sensitive tags require explicit user plan-card Start confirmation + immutable audit receipt), and external (hard block on all sensitive tags + personal view/inference entries), plus fail-closed 403 personal-memory block on trust: "work" hosts and forbidden AGENTS.md/CLAUDE.md extension writes.
    3. M3 — Rebuildable .search/ 2/3-gram exclusion index: NFC-lowercased CJK 2-gram / ASCII 3-gram / cross-script 2-gram segment index verified by stat(path, mtime_ns, size) (0 WAL writes, < 200 ms p95 target, 100% recall parity with raw scan across stale/deleted index states).
    4. M4 — Pre-admission external inbox funnel: Capture selection (selection_rules.json + retention.json + STOP-interruptible quiet backfill) + rules-first / fail-open action | fyi | noise pre-triage feeding app-conversation-and-async-inbox-v0 (0 Steward wakes on noise, 0 lost action items on classifier failure).
  • Owning boundary: Documentation-only Architecture RFC (docs/architecture/rfcs/local-file-project-memory-v0.md + .zh-CN.md, README.md, STATUS.md, STATUS.zh-CN.md). Default-off (Delivery maturity: Proposal); zero runtime or UI changes in this PR.

Validation

  • uv run --extra test python scripts/generate_rfc_status_index.py --check — passed
  • uv run --extra test python scripts/check_rfc_bilingual.py --base origin/main --head HEAD — passed
  • uv run --extra test python examples/docs-governance-smoke.py — passed
  • uv run --extra test loopx canary premerge --from-git-diff --git-diff-base origin/main — passed

Signed-off-by: maxliux5 <5958865+maxliux5@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

  • [P2] 排除文件前确认索引对应同一内容版本。 在临时文件中把 old memo 改成等长的 new memo 并保留原修改时间,两次的路径、长度和纳秒 mtime 相同。按 §5.4 旧倒排可以直接跳过该文件,原文搜索却能找到 new。单个宽字符文件也没有 2-gram 可供前缀扫描。仅在索引覆盖已确认的同一内容快照且查询有完整候选覆盖时允许排除。无法确认代数或不支持的查询回退原文。将同元数据换内容和单宽字符文件纳入 A4。 §5.4 · A4
  • [P2] 让被合法标签误分的实际请求可找回。 一条已采集的私信「能在中午前帮忙确认吗?」可以得到合法的 noise 和理由。§5.5 此时只做短期归档,超时和错误回退均不触发,A5 仍可能通过。明确哪些有权发起请求的事件进入原收件箱,以及其余模型降级结果如何留待人工确认或重放。若承诺仅限分类器错误,缩小零漏单主张,并用带真值的误判样例度量。 §5.5 · A5

动机 / Motivation

单机用户可以在现有 provider 下保留有来源的项目教训。两条主张直接影响需要找回原项目文档的用户,以及收到待办私信的管家用户。先建立索引并更换保存时间不变的原文,再发出一条需要确认的私信。新设计允许两处结果静默不可见。当前提交提供中英文规范和验收计划,运行时尚待实现。本次不执行安装、真实归档、外部连接器、模型调用或性能达标验证。

改动思路 / Approach

保留 Core 的验证和效用归因、semantic_preference_provider_v0 的绑定以及原收件箱的 send_id 和 in_doubt。提议让文本文件持有原内容,缓存减少打开文件的次数,分流器决定事件进入原收件箱还是归档。搜索回退和原请求可找回性应成为两个各自可验收的条件。 既有异步收件箱契约

具体改动 / Changes

在提交 be981d601456f54315c5566979f2f45ab926f779 对照 49881d5a3ac25adf8c105b2dbfdb109716cefbcb 走读全部五个文件,+592/−2。两种语言都需要补齐 A4-recall-parity 和 A5-action-retained。现有 A4 只覆盖 mtime 变化等情形,A5 则注入超时和 500。 中文规范

对主干的风险 / Risks

状态索引、精确基线的中英文成对检查、文档治理 smoke 及 git diff --check 通过。两个反例执行的是规范路径推演。 远端 CI 未核验。

我的整体评价 / Verdict

请同步修订两种语言的排除条件、误分后的找回路径和验收项,再复审设计。

English verdict: REQUEST_CHANGES at be981d6. Require content-version proof before excluding files and a recovery path or narrower guarantee for valid but incorrect inbox classifications.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

  • [P2] 文件的时间戳与长度不变时,索引会漏掉新命中。 §5.4 按 (mtime_ns, size) 相等就排除不在旧倒排表里的文件。我用临时文件把 cold 改成同长度的 warm,还原原时间戳后两项均相等。原文扫描命中 warm,按提案的旧 gram 排除规则则跳过文件。单字规则还有独立反例:只有「猫」的文件没有 bigram,「黑猫」的唯一 bigram 也不以「猫」开头。请把「无法证明索引仍覆盖当前内容」和「查询无法生成必要 gram」明确设为直扫条件。A4 应覆盖保留时间戳的等长改写、双字词末字和单字文件。 §5.4
  • [P2] 给 M1 写明隐私生效前的调用边界。 M1 的出门条件只有 A1、A3、A6,但它已通过偏好与奖励记忆接口提供可召回的文件数据。强制场景过滤、工作机禁入库和 A2 独立验收都在 M2。请明确 M1 仅供隔离验证,或在 M1 同步启用并验收它已经开放的入口所需的隐私约束。回滚装配器时也应说明如何证明召回为空。 §5.3 与 M1–M2 交付计划

动机 / Motivation

本地维护者在下次处理同一仓库时,需要找回已确认的踩坑记录,并决定它是否能进入另一条会话。没有方便的本地来源时,维护者往往重复查证;有了可检查的本地记录后,可以只取已经验明适用范围的条目。提案希望验证无需外部服务也能检索、区分可信度并控制分享范围。本提交仅确定双语设计及其验收方式,尚未交付记忆、索引或消息分流运行时。

改动思路 / Approach

已有的偏好、奖励记忆和收件箱契约继续处理来源、效果和投递,提案增加本地文件实现以及调用场景过滤。文件是搜索真源,索引是可弃缓存。用结构化条目保护人工修订、复用现有投递身份,都比另建一套工作状态合适。更小的独立切片是先在隔离环境验收文件适配器及写锁,等所开放入口的隐私约束具备后再接普通调用。搜索优化和消息分类可以各用现有真源的反例验收。

具体改动 / Changes

关键内容讲解

规范对应 docs/architecture/rfcs/local-file-project-memory-v0.md(be981d601456f54315c5566979f2f45ab926f779)及中文镜像。两篇各 288 行,目录增加导航,双语 STATUS 补相同登记。A1 本地 provider 和分级、A3 人工写锁与崩溃恢复、A5 收件箱分流、A6 开关关闭的行为等价均为后续实现及其验收。A2 的保护范围已列出,M1 暂缺边界,因此当前交付计划未满足。A4 写明召回目标,当前排除算法的反例仍需修正。度量目标需在各自实现上取证。

对主干的风险 / Risks

两种漏检会给操作者错误的「没有历史记录」结果,尤其是从备份恢复内容后。索引命中最终复核只保护候选文件,无法找回先被跳过的文件。另一风险发生在分阶段启用或关闭过滤器时。验证应从实际 caller 发出召回,核对允许和拒绝结果,再检查公开投递及工作机存储尾部。索引、双语差异和文档治理检查通过。首轮本地 premerge 因独立工作树缺 TypeScript 依赖失败,按原锁文件补齐后原命令重跑通过,4 项直接检查和 18 项选中检查均通过。它们没有执行拟议 provider 或验证隐私行为。

我的整体评价 / Verdict

复用现有契约、保留可检查的文件真源,方向合理。长期续作仍可能因漏检重复调查,且阶段计划还未明确何时可在普通会话启用召回。请先修正规范和独立反例,再决定是否实施 M3 与开放 M1。此 diff 只涉及文档和索引导航,没有应用页面的渲染改动。

English verdict: REQUEST_CHANGES at be981d6. Make index exclusion recall-safe and fence M1 until its exposed memory paths enforce privacy.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants