Skip to content

runtime: add config switches for memory and embeddings#842

Open
CastleOneX wants to merge 1 commit intoRightNow-AI:mainfrom
CastleOneX:pr/runtime-memory-embedding-switches
Open

runtime: add config switches for memory and embeddings#842
CastleOneX wants to merge 1 commit intoRightNow-AI:mainfrom
CastleOneX:pr/runtime-memory-embedding-switches

Conversation

@CastleOneX
Copy link
Copy Markdown

Problem

OpenFang did not have an explicit runtime-level way to disable memory entirely or disable embedding-backed recall independently. In practice, memory behavior could still partially activate unless provider setup failed in a particular way, which led to unnecessary embedding initialization attempts, noisy fallback paths, and avoidable external calls.

What this changes

  • Adds explicit config flags in crates/openfang-types/src/config.rs:
    • memory.enabled
    • memory.embeddings_enabled
  • In crates/openfang-kernel/src/kernel.rs:
    • skips embedding driver initialization when memory is disabled
    • skips embedding driver initialization when embeddings are disabled
    • passes the effective runtime flags into agent manifest metadata
  • In crates/openfang-runtime/src/agent_loop.rs:
    • skips recall entirely when memory is disabled
    • disables embedding-backed recall when embeddings are disabled
    • skips remember / remember_with_embedding writes when memory is disabled
    • does this in both streaming and non-streaming loops

Why this is useful upstream

  • It makes runtime behavior explicit and configurable.
  • It reduces unwanted provider calls and noisy fallback behavior.
  • It gives users a supported way to choose between full memory, text-only memory, and no memory.
  • Defaults remain enabled, so existing behavior is preserved unless explicitly changed.

Validation

  • cargo check -p openfang-runtime -p openfang-kernel -p openfang-types

(cherry picked from commit 209e0075365b3a6133571aee1c2dddbc558dcf55)
@jaberjaber23
Copy link
Copy Markdown
Member

Reviewed. The feature logic is correct but CI is failing (format check and ubuntu test). Please run cargo fmt and add unit tests for MemoryConfig defaults and deserialization with missing fields.

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.

2 participants