Skip to content

Claude/work mem time point on main - #545

Merged
Wang-Daoji merged 3 commits into
MemTensor:v1.1.9from
Wang-Daoji:claude/work_mem_time_point-on-main
Sep 24, 2026
Merged

Wang-Daoji merged 3 commits into
MemTensor:v1.1.9from
Wang-Daoji:claude/work_mem_time_point-on-main

Conversation

@Wang-Daoji

Copy link
Copy Markdown
Collaborator

No description provided.

Wang-Daoji and others added 3 commits September 23, 2026 17:29
Work Memory previously only ran on a token-compaction boundary, so short
Sessions that never compacted, the tail after the last compaction, and
Sessions that simply went quiet produced no L1 Work Memory at all.

Introduce a dedicated `work_memory_session_cursors` table plus a single
`extractUnextracted(sessionId, throughTraceSeq)` entry point that three
triggers now share: the compaction boundary callback, a new
`work_memory_idle_flush` job armed two hours after the last completed turn,
and session close (including the v2 rollover path). Each trigger schedules
only the traces past the cursor, so windows are never extracted twice.

Windowing reuses `splitL3TracesByRawTurn` at 20 Raw turns and never splits a
turn; a further cap of 20 Q&A pairs per window truncates on a turn boundary
and leaves the remainder to the next trigger. The cursor advances with the
enqueue inside the caller's transaction, so a failed enqueue cannot mark a
window as extracted.

The generic job merge keeps the earlier `runAfter`, so the idle flush arms
through a dedicated upsert that revives terminal rows and clears retry
bookkeeping. L3 scheduling, episode lifecycle, hooks, and retrieval are
untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ime_point-on-main

# Conflicts:
#	App/backend/local-api-contracts/src/memory-runtime.ts
#	Memory/src/contracts/memory-runtime.ts
#	Memory/src/service/worker/job-handlers.ts
#	Memory/src/types.ts
@Wang-Daoji
Wang-Daoji merged commit c78bcfe into MemTensor:v1.1.9 Sep 24, 2026
2 checks passed
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.

1 participant