feat(memory-ingest): EXP-08 — scheduled consolidation every N turns#10
Draft
moralespanitz wants to merge 1 commit intoexperiment/phase2-combined-stackfrom
Draft
Conversation
Triggers consolidation-service automatically after every scheduledConsolidationTurnInterval ingested turns per user_id. Default off; default interval 50 turns. Targets BEAM SUM ability which is 0/2 to 1/2 across all 15 sprint-2 iters and has no other planned fix. Failure mode: if consolidation throws, the ingest continues and the error is logged. No silent retry, no cascade. New config keys (defaults-off): - scheduledConsolidationEnabled: false - scheduledConsolidationTurnInterval: 50 Behind feature flag. Defaults preserve current behavior.
4 tasks
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.
Summary
Auto-triggers
consolidation-service.executeConsolidationafter everyscheduledConsolidationTurnInterval(default 50) ingested turns per user_id. Targets BEAM SUM ability — currently 0/2 to 1/2 across all 15 sprint-2 iters with no other planned fix.Implementation
src/services/scheduled-consolidation.ts(81 LOC) — process-local Map<user_id, turn_count>, fires when count % interval === 0memory-ingest.ts(performIngest,performQuickIngest,performWorkspaceIngest) each awaitrecordIngestTurn(...)after the actual ingest completesscheduledConsolidationEnabled(bool, default false),scheduledConsolidationTurnInterval(number, default 50)Tests
6 new cases in
__tests__/scheduled-consolidation.test.ts, all pass:Typecheck clean.
executeConsolidationcallssoftDeleteMemoryon cluster members — it does archive originals despite the EXP-18-lite spec note "Don't archive originals." There's no alternative entry point that just synthesizes without archiving. If "no archive" is a hard requirement we'd need a newexecuteConsolidationNoArchivevariant.For now this PR uses the existing API as-is. Audit logs will show both synth and archive events.
Caveat
In-memory turn counter does not survive process restarts. Acceptable for tuning heuristics, fine for the BEAM-experiment use case where the runtime is short-lived. Documented in file header.
Test plan
Stacked on
experiment/phase2-combined-stack.