Skip to content

Per-session engines drop memory and user-model tools #42

Closed

Description

@JAORMX

Summary

Memory tools are implemented and registered on the main/shared engine, but they appear to be missing from per-session engine catalogs. In this session the prompt included the tier-0 <memory-index> and <user-model> blocks instructing the agent to use Recall/SearchMemory/SearchUserModel, but the actual toolset exposed to the model did not include any memory tools.

Missing from the exposed toolset:

  • Remember
  • Recall
  • SearchMemory
  • RememberUser
  • RecallUser
  • SearchUserModel

Current wiring found in repo

Project memory tools exist and register correctly:

  • internal/adapter/memory/tools.go defines Remember, Recall, and SearchMemory (RememberToolName, RecallToolName, SearchMemoryToolName).
  • internal/adapter/memory/tools.go has Register(cat, store) for the project-memory family.

User-model tools exist and register correctly:

  • internal/adapter/memory/usermodeltools.go defines RememberUser, RecallUser, and SearchUserModel.
  • internal/adapter/memory/usermodeltools.go has RegisterUserModel(cat, store).

The main catalog wires them:

  • internal/app/build.go registers project memory only when cfg.MemoryDir != "".
  • internal/app/build.go builds a default-on user-model store (unless NoUserModel) and calls memory.RegisterUserModel.
  • cmd/mecatui/main.go computes a default per-project memory dir unless --no-memory, so embedded mecatui should enable project memory by default.
  • standalone mecated still requires explicit --memory-dir for project memory.

Suspected bug

sessionEngineFactory builds a fresh catalog for per-session engines but does not re-register memory/user-model tools.

The per-session path currently creates a new catalog, calls registerCoreTools, then mounts global/client MCP, Subagent/Team, etc. I did not find memory.Register or memory.RegisterUserModel in this path.

This path is used when a session needs a per-session engine, e.g.:

  • non-default provider/model selection
  • client-provided MCP servers / ACP session MCP

That means a session can still receive the prompt memory blocks (MemoryIndexAssembler / UserModelAssembler) but not receive the corresponding Recall/Search/Remember tools, creating an inconsistent contract.

Likely history suspects

  • 4baf34a feat(acp): accept client-provided streaming-HTTP MCP servers on session/new (#7) introduced sessionEngineFactory with a fresh per-session catalog.
  • fa0346a feat(provider): gRPC model selector + ListModels + per-session routing (multi-provider P0, S3) expanded per-session engines to model-selection sessions.
  • 500e524 feat(memory): enable Remember/Recall by default on embedded mecatui enabled default project memory for embedded/shared catalog, but not the per-session catalog path.
  • 48b7af5 feat(soul): user-model learning loop — agent-curated, cross-session added the user-model tools, also on the main catalog path only.

Expected behavior

If project memory/user-model is wired for the server and their turn-0 blocks are injected into the prompt, the same session catalog should expose the matching tools:

  • project memory: Remember, Recall, SearchMemory
  • user model: RememberUser, RecallUser, SearchUserModel

This should hold for both the shared engine and per-session engines.

Suggested fix direction

Thread the already-open memory stores into sessionEngineFactory (project memStore and user userModelStore) and register the same memory families into the per-session catalog when non-nil.

Also add regression coverage for a per-session engine (provider selector or client MCP) asserting that enabled memory/user-model tools are present in the resulting catalog/toolset, and that the prompt/tool contract stays consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions