Repository navigation
feat(memory): L3 field cognition, retry failed L3 batches (MEMMY-852), feed scanned sessions into L3 - #739
Open
Anson-Se wants to merge 9 commits into
Open
feat(memory): L3 field cognition, retry failed L3 batches (MEMMY-852), feed scanned sessions into L3#739Anson-Se wants to merge 9 commits into
Anson-Se wants to merge 9 commits into
Conversation
Add the storage base for itemized machine/project L3, behind algorithm.l3FieldCognition (off by default, local SQLite only): - four new tables (l3_units, l3_items, l3_unit_batches, l3_user_projects) created alongside the existing ones without bumping SCHEMA_VERSION; old L3 tables and rows are untouched - L3FieldRepository for units, items, snapshot memories, unit deletion, inactive-item purge and the user project list - register the tables for bundle export/import and clear-all; reject imports whose units already exist and drop unfinished unit batches from redacted exports - countL3Units for the per-item length limit Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decide which project a path belongs to for the new L3, by reading files only (no git process): - the nearer of a user-selected folder and a git repository wins; a shared root counts once with the git identity - git identity is the normalized origin (ssh, scp-like and https forms map to host/path), else the common git dir, so a clone's worktrees and subdirectories share one project - a session folder outside any repository is a plain-folder project; a tool path only joins the session project it lands in - temp dirs, Codex dated dirs, Claude scratch workspaces, ~/.codex/memories*, Memmy task folders and the home/Desktop/ Documents/Downloads folders themselves are never projects Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The desktop app now tells Memory which folders the user picked as projects, so L3 can treat them as project roots: - POST /api/v1/l3/user-projects replaces the user's whole list and the Memmy task-folder roots; relative paths are rejected; the list is stored regardless of the L3 field cognition flag - memmy-agent's long-running gateway reads the project registry every minute and pushes only when the list changed or the last push failed; a corrupt registry is never pushed - the contract is added identically to the Memory and App copies, with a test that keeps them in sync Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cut a raw turn into evidence fragments for the new L3 so each fact can be attributed by the paths its own evidence touched: - one fragment for the user's words, one per tool call with its paired result (reusing the existing strict call/result pairing), and one per result that matches no call - paths come from file/dir arguments, cd and git -C targets and absolute command arguments; Codex code-mode snippets are read for their cmd/workdir literals; relative paths resolve against the call's workdir, else the session folder; URLs are ignored - each fragment gets the project units its paths resolve to, falling back to the session folder; long outputs keep head, tail and the error lines in between Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- machine profile: probe OS (macOS product version, not the Darwin kernel), arch, shell and node/python3/git/npm/brew versions with 2-second timeouts, and render it in a fixed format by code only - project profile for the new L3: reuse the existing scan and the shared summarizeProjectProfile model call, but feed it only what the project declares (runtime versions probed on this machine belong to the machine profile); write it into the project unit and refresh its snapshot; skip the model when the scan is unchanged and drop the result when the unit was deleted meanwhile - at most one pending profile job per unit; each request carries its own scan id because the immutable dedupe index never frees a key - the old project-profile pipeline is unchanged apart from calling the extracted summarizeProjectProfile Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Temporary model failures of L3 jobs wait 1, 5, 15, 30 and 60 minutes before retrying (runAfter); the sixth failure goes to dead letter and later batches continue. Configuration problems (bad key, quota 40309) wait 30 minutes without using an attempt, and L3 jobs are not leased at all while no evolution model is configured. Adds POST /api/v1/l3/failed-batches/retry, which resets the user's dead-letter l3_unit_update jobs and batches in place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conversations first opened by an agent-source scan now use the L3 v2 session protocol with Work Memory disabled, so their turns register as L3 input like Hook sessions. When a scan pass finishes a source, the sessions it touched are frozen through the existing freezeBatches entry (trigger scan_pass; the old pipeline records it as session_close) and the worker is woken. Hosted imports (backend importManaged) do the same when an import ends, through POST /api/v1/l3/scan-sessions/freeze, which only freezes the caller's own sessions. Freezing only writes rows, so neither scans nor imports wait on L3. Existing sessions and detached legacy history keep their protocol. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Anson-Se
requested review from
Wang-Daoji,
ZongYue99 and
hijzy
as code owners
October 25, 2026 10:38
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Contributor
Author
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
做了什么
这个 PR 包含三件互相依赖的事,按提交顺序:
1. L3 场域认知改造(前 7 个提交)
algorithm.l3FieldCognition.enabled(环境变量MEMMY_L3_FIELD_COGNITION=1),默认关闭。关闭时走原来的 L3,行为不变。SCHEMA_VERSION(仍为 9),只新增 4 张表,旧数据不转写,旧版 Memmy 仍能打开这个库。2. MEMMY-852 失败批次补跑(第 8 个提交)
POST /api/v1/l3/failed-batches/retry,在原任务上复位后重跑。evolution_jobs队列上(用runAfter、attempts/max_attempts、failJob这些现有字段和方法),没有新建队列、定时器或重试表。3. #590 扫描会话进 L3(第 9 个提交)
ingestion-service)也走同样的处理。Closes #590
改动范围
共 46 个文件,约 3400 行,其中包含测试。
怎么验证的
npm run memory:test1754 个通过。有 9 个失败,都在已知的“满负载超时”名单里(扫描响应、checkpoint 恢复等),单独运行全部通过。已知限制
🤖 Generated with Claude Code