Skip to content

fix(memory): isolate project access and automate memory cleanup - #166

Merged
ScriptedAlchemy merged 4 commits into
mainfrom
fix/project-memory-isolation-curation
Nov 19, 2026
Merged

ScriptedAlchemy merged 4 commits into
mainfrom
fix/project-memory-isolation-curation

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Problem

Thread-bound MCP knowledge tools accepted a caller-supplied project ID without comparing it with the authenticated thread. This let a thread read or change another project's memory. Automatically collected memories also needed ongoing cleanup of temporary notes, duplicates, and explicitly replaced decisions.

The requested behavior is fully automatic: obsolete memories are removed without a review queue, confirmation dialog, or human approval step.

Changes

  • Bind all seven knowledge MCP tools to the calling thread's project and environment, before any linked-environment forwarding. Outside clients can still explicitly select a project.
  • Run a background curator, enabled by default with per-project overrides. Review at most 16 candidates and 8 related facts with bounded, verified excerpts. Persist the cursor, cooldown and outcome; space batches by 15 minutes and completed sweeps by 24 hours.
  • Apply retirement immediately using the existing permanent-forget lifecycle. Both transient/code-note retirement and supported supersession clear the retired fact's content, sources, entities and tags, plus historical content and stored delivery copies. Keep the source conversations and validated replacement.
  • Scrub history after the complete batch so a later rationale cannot preserve a fact removed earlier in the batch. Retain only removal metadata.
  • Discard new automatic task/code proposals before any database writes. They create no saved record, tombstone or review queue.
  • Clean up eligible older automatic set-aside records and proven curator supersessions in bounded background batches, even when the current provider cannot run a curation model. Respect project settings, project availability and owner protections.
  • Remove the Set aside browsing filter from web/desktop and mobile. Show automatic removal in history. Manual supersession controls remain available; automatically forgotten memories cannot be restored.
  • Require exact reviewed IDs and revisions, verified current source evidence, and confidence of at least 0.85 for changes. Age alone and unresolved conflicts do not justify removal. Owner-written, edited or explicitly restored memories remain protected.
  • Use isolated, tool-free generation. Recheck the whole review packet, evidence, current project and latest settings transactionally before applying any result.
  • Preserve existing history through migration 121 and retain compatible wire events for older clients.

Deeper inspection and validation

Failing regressions reproduced a curator classification surviving a human correction, retirement leaving saved content behind, non-standing proposals being stored, and old retired rows never being cleaned. All pass after the changes.

  • 103 memory tests passed across ProjectKnowledge, MemoryCuration and AssistedLearning.
  • 51 focused tests passed for mobile, shared client behavior, provider generation, the curation grader and context measurement.
  • 8 React compiler checks passed for the changed client files and required mobile controls.
  • 21/21 real-model samples passed with GPT-6 Luna, covering seven authored cases three times each: temporary work, duplicates, explicit replacements, durable old rules, protected facts, unresolved conflicts and embedded instructions. These are small policy regression samples, not an accuracy estimate for arbitrary projects.
  • Focused Effect/TypeScript checks passed for the changed server, web and mobile code and test import graphs.
  • Formatting, lint, both unused-code checks, GraphQL validation and the native addon build passed.
  • The project boundary audit covered authenticated tool identity, automatic recall, saved delivery replay, source moves, project deletion/recreation, imports, worktrees and environment-scoped client caches; no additional cross-project saved-memory leak was found.

Check status and limits

The required vp run check:changed HEAD --concurrency 1 --skip-tests command was run. Its cached typecheck step is blocked by the workspace's nested seccomp supervisor; the direct focused checks above passed. Behavioral suites were run separately. Local Chromium cannot create its required socket, so the updated browser interaction regression is left to hosted CI. Full hosted CI passed on the preceding head and is being rerun for this change.

An extra localization audit reports the existing Inference accounts catalog key missing on main; this follow-up did not introduce that key.

The advertised MCP tool list measures 74,746 bytes, 398 bytes above main's 74,348. The context-budget workflow passed for this head with the required agent-context-increase label already present. This repository merge check is unchanged; the runtime curator has no human approval step.

This changes the code and PR branch; it does not rewrite a live user's database. Forgetting removes T3's stored memory copies and future recall, not information a provider already consumed in its existing native context.

Model and harness: GPT-6 Astra Pro in the ChatGPT shared workspace, with delegated implementation and review agents; GPT-6 Luna for the real-model evaluations.

Bind thread knowledge tools to their project and environment. Add bounded,
reversible background memory curation with source and revision validation,
project settings, review history, and user-only restoration across clients.
@changeset-bot

changeset-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 5fd93da

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Fix the migration ledger, hidden-memory listing, and restore refresh fixtures. Correct Cursor and OpenCode curation test types and record the measured MCP context size.

The agent-context-increase maintainer gate remains required.
Apply curator retirement as automatic forgetting, erase stored history and delivery copies, discard non-standing learning proposals, and clean prior automatic retirements in bounded background batches. Remove set-aside browsing from web and mobile while retaining owner protections and manual supersession controls.
@ScriptedAlchemy ScriptedAlchemy changed the title fix(memory): isolate project access and add reversible curation fix(memory): isolate project access and automate memory cleanup Nov 19, 2026
AssistedLearning now discards task and code verdicts before saving, so
saveAutomatic no longer takes a verdict or returns "discarded". This also
removes the unreachable "unsupported assertion" note, and the test
fixtures no longer set a standing-check capability that no client reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ScriptedAlchemy
ScriptedAlchemy merged commit a602b11 into main Nov 19, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant