Skip to content

fix(auto-memory): preserve temporal grounding in notes#313

Open
RerankerGuo wants to merge 2 commits into
agentscope-ai:mainfrom
RerankerGuo:fix/auto-memory-temporal-grounding
Open

fix(auto-memory): preserve temporal grounding in notes#313
RerankerGuo wants to merge 2 commits into
agentscope-ai:mainfrom
RerankerGuo:fix/auto-memory-temporal-grounding

Conversation

@RerankerGuo

Copy link
Copy Markdown
Contributor

Summary

  • add explicit temporal grounding rules to the auto-memory prompt
  • require created notes to store conversation_date metadata
  • document how conversation date, event date, and relative time should be preserved for historical imports

Refs #302

Verification

  • ....... [100%]
    7 passed in 0.91s
  • check python ast.........................................................Passed
    check yaml...............................................................Passed
    check xml............................................(no files to check)Skipped
    check toml...........................................(no files to check)Skipped
    check json...........................................(no files to check)Skipped
    detect private key.......................................................Passed
    trim trailing whitespace.................................................Passed
    Add trailing commas......................................................Passed
    black....................................................................Passed
    flake8...................................................................Passed
    pylint...................................................................Passed
    Check package with Pyroma................................................Passed

@jinliyl

jinliyl commented Jul 3, 2026

Copy link
Copy Markdown
Member

Thanks for the PR. I checked the change against the current auto-memory flow and the temporal-reasoning issue discussed in #302.

I agree with the general direction: for historical conversations, the memory-writing step should not silently reinterpret relative phrases such as "today", "yesterday", or "recently" against the system runtime date. Keeping the source conversation time available to the generated note is useful, and conversation_date metadata can also make later retrieval/evaluation more controllable.

That said, I am a little concerned that the current prompt wording may be too benchmark-oriented for the default auto_memory behavior. Requiring the note body to explicitly use labels like conversation date, event date, and relative time is helpful for LoCoMo/LongMemEval-style evaluation, but it may make everyday generated memories more rigid than necessary.

Could we consider one of these adjustments before merging?

  1. Keep the general temporal-grounding instruction in the default prompt, but make the exact labels optional, e.g. "preserve temporal facts clearly when relevant" rather than requiring labeled fields in every note.
  2. Move the stronger benchmark-style prompt into an evaluation/custom config, where users can override auto_memory_step.prompt_dict for LongMemEval/LoCoMo runs. The code already supports this: class YAML prompts are loaded first, and step-level prompt_dict overrides the same prompt keys.
  3. If we keep conversation_date metadata in the default prompt, please make sure the behavior is documented as a general note provenance field, not only as an evaluation aid.

So I think the core idea is valid, but I would prefer to avoid making the default memory format too test-set-specific. A lighter default prompt plus a stronger evaluation prompt would probably give us the best tradeoff.

@RerankerGuo

Copy link
Copy Markdown
Contributor Author

Thanks for the detailed review. I updated the PR to keep the default auto-memory behavior less benchmark-specific:

  • relaxed the default prompt from requiring labeled fields in every note to preserving temporal facts clearly when relevant;
  • kept explicit labels such as conversation date and event date as optional guidance for ambiguous historical imports;
  • documented conversation_date as source-conversation provenance, not necessarily the event date;
  • updated the regression test to assert the lighter default behavior.

Verification:

  • PYTHONPATH=$PWD UV_CACHE_DIR=/tmp/uv-cache UV_PYTHON_INSTALL_DIR=/tmp/uv-python uv run --python 3.11 --with '.[dev,core]' pytest tests/unit/test_evolve_utils.py -q
  • PRE_COMMIT_HOME=/tmp/pre-commit-pr313 PYLINT_HOME=/tmp/pylint-cache UV_CACHE_DIR=/tmp/uv-cache UV_PYTHON_INSTALL_DIR=/tmp/uv-python uv run --with pre-commit pre-commit run --files reme/steps/evolve/auto_memory.yaml tests/unit/test_evolve_utils.py docs/zh/auto_memory.md

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