Skip to content

th-374b27: memory_for_access seam — durable auto-recall into every turn - #330

Merged
brentrager merged 1 commit into
mainfrom
th-374b27-memory-seam
Jul 26, 2026
Merged

th-374b27: memory_for_access seam — durable auto-recall into every turn#330
brentrager merged 1 commit into
mainfrom
th-374b27-memory-seam

Conversation

@brentrager

Copy link
Copy Markdown
Contributor

Problem

The engine core already supports memory auto-recall (`AgentConfig::with_memory` → `build_context_messages` → `memory.recall(msg, 5)`), but the server never wired it. `StorageAdapter` exposed `checkpoints()`/`knowledge()` but no memory accessor, and `runner.rs` built each turn's `AgentConfig` without `.with_memory(...)`. So Big Smooth's durable memory (RememberTool/RecallTool, th-6d1692) only worked when the agent explicitly called `recall` — never auto-injected.

Fix

  • `StorageAdapter::memory_for_access(&access) -> Option<Arc>` (adapter.rs), defaulting to `None`. Mirrors `knowledge_for_access`; threads the access context so a multi-tenant backend can scope memory to org/user.
  • `runner.rs` now calls `config = config.with_memory(mem)` whenever the adapter returns `Some` — right beside the existing `with_user_images` block.
  • in-memory adapter gains a `with_memory(...)` builder + the override, so the seam is exercised end-to-end.

Default `None` ⇒ every existing backend is byte-for-byte unchanged. Hosted auto-recall across all orgs stays a deliberate opt-in (a backend overriding `memory_for_access`), not a side effect of adding the seam.

Lights up Big Smooth

Its single-tenant SQLite adapter (smooth repo) overrides `memory_for_access` to return its store → remembered preferences (e.g. "always add shows to smoo-hub") get injected into every turn without the agent calling `recall`. Follow-on in the smooth repo: bump the engine pin + add the daemon-side override.

Tests

2 new `injection_seams` tests (no memory ⇒ no recall block; attached memory ⇒ recalled content reaches the model). 8/8 pass. Clippy clean on the new code; fmt clean on touched files.

🤖 Generated with Claude Code

…y turn

The engine core already supported auto-recall (AgentConfig::with_memory →
build_context_messages → memory.recall(msg, 5)), but the server never wired
it: StorageAdapter had checkpoints()/knowledge() but no memory accessor, and
runner.rs built each AgentConfig without .with_memory().

Add StorageAdapter::memory_for_access(&access) -> Option<Arc<dyn Memory>>
(default None → every backend byte-for-byte unchanged; hosted auto-recall
stays a deliberate opt-in). runner.rs now calls .with_memory() when the adapter
returns Some. The in-memory conformance adapter gains a with_memory() builder +
override so the seam is exercised end-to-end (2 new injection_seams tests, 8/8
pass). Lights up Big Smooth: its SQLite adapter overrides memory_for_access to
return its store, injecting remembered preferences into every turn.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017QkUKdJ4Xbx7WXV2FAg555
@changeset-bot

changeset-bot Bot commented Jul 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6fe69cc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@smooai/smooth-operator Patch
@smooai/smooth-operator-web-chat-example Patch

Not sure what this means? Click here to learn what changesets are.

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

@brentrager
brentrager merged commit 379cb28 into main Jul 26, 2026
1 check 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