Skip to content

refactor: remove dead remove_prompt_example branch in StrategyStructMemReader #1792

@nuthalapativarun

Description

@nuthalapativarun

Problem

In src/memos/mem_reader/strategy_struct.py line 58, there is a dead code branch:

if self.config.remove_prompt_example:  # TODO unused
    prompt = prompt.replace(examples, "")

examples is set to SIMPLE_STRUCT_MEM_READER_EXAMPLE (or the ZH variant), but the strategy prompt template (STRATEGY_STRUCT_MEM_READER_PROMPT / STRATEGY_STRUCT_MEM_READER_PROMPT_ZH) does not contain that example text. As a result, prompt.replace(examples, "") is always a no-op regardless of the config flag value.

The remove_prompt_example config field itself is still used correctly in simple_struct.py and multi_modal_struct.py — only the branch in strategy_struct.py is dead.

Proposed Fix

Remove the dead branch from _get_llm_response in StrategyStructMemReader:

# Remove these two lines:
if self.config.remove_prompt_example:  # TODO unused
    prompt = prompt.replace(examples, "")

# Also remove the unused `examples` variable assignment above it

The remove_prompt_example field in StrategyStructMemReaderConfig should remain as it is inherited from BaseMemReaderConfig and used by other readers.

Files

  • src/memos/mem_reader/strategy_struct.py lines 48, 58–59

Metadata

Metadata

Assignees

No one assigned

    Labels

    memosCore MemOS logic (memory, MCP, scheduler, API, database)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions