Skip to content

Fix #35: memos get/list 与 add 作用域不一致:add 按 conversation_id 写入而 get 仅按 user_id 读取,导致新加记忆在列 - #37

Open
Memtensor-AI wants to merge 1 commit into
MemTensor:mainfrom
Memtensor-AI:bugfix/autodev-35-20260825084416859
Open

Fix #35: memos get/list 与 add 作用域不一致:add 按 conversation_id 写入而 get 仅按 user_id 读取,导致新加记忆在列#37
Memtensor-AI wants to merge 1 commit into
MemTensor:mainfrom
Memtensor-AI:bugfix/autodev-35-20260825084416859

Conversation

@Memtensor-AI

Copy link
Copy Markdown
Collaborator

Description

Fixed the read/write scope asymmetry behind issue #35. memos add writes memories keyed by conversation_id (resolved via CLI arg -> config.defaults.conversation_id -> DEFAULT_CONVERSATION_ID), but memos get/list only sent user_id to POST /get/memory, so records added to the default conversation were invisible to the listing view. The read path now resolves and forwards conversation_id through the exact same fallback chain as cmd_add, includes it in the /get/memory request body, and surfaces it in the agent output scope. To complete the fix, the display layer now parses the text_mem bucket envelope returned by /get/memory via the shared extract_memory_list normalizer (previously it silently rendered 0 records), and the documented memos list command is now registered as a thin alias of get with the same flags.

Changes span the CLI entrypoints, backend, and output formatting: memory.py (get/list options incl. --conversation-id), memory_cmd.py (cmd_get resolves and forwards the conversation scope), memory_api.py (get_memories includes conversation_id in the payload), main.py (registers list), and output.py (text_mem parsing). Supporting docs were updated in README.md, README-zh.md, and the memos-memory skill (SKILL.md and memos-get.md) so the new flag and the list alias are documented. No API shape was removed or renamed; single-conversation users see unchanged behavior since the default conversation is applied automatically, and passing a matching conversation_id makes reads symmetric with writes.

Test results: python -m unittest discover -s tests -p "test_*.py" passes all 47 tests (including new tests in tests/test_memory_get_scope.py and an extended backend test for /get/memory conversation forwarding). CLI smoke test verified: memos --version, memos --help, and memos list --help all exit 0. Ruff reports 14 findings, all pre-existing on the base branch (12x E402 in main.py, 1x F401 unused import, 1x F541 f-string); none introduced by this change and the CI workflow does not run a linter. Opsp artifacts (.ai-tasks task file and the openspec/changes set: proposal, spec, design, and verification-report) were created and also archived to the memos-autodev-specs repository.

Related Issue (Required): Fixes #35

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (does not change functionality, e.g. code style improvements, linting)
  • Documentation update

How Has This Been Tested?

Not run; documentation-only change.

  • Unit Test
  • Test Script Or Test Steps (please provide)
  • Pipeline Automated API Test (please provide)

Checklist

  • I have performed a self-review of my own code
  • I have commented my code in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • I have created related documentation issue/PR in MemOS-Docs (if applicable)
  • I have linked the issue to this PR (if applicable)
  • I have mentioned the person who will review this PR

@lijicode please review this PR.

Reviewer Checklist

`memos add` stores memories keyed by conversation_id, but `memos get`
listed only by user_id, so freshly added memories were invisible to the
list view. Forward conversation_id through the same fallback chain as
cmd_add (CLI arg -> config.defaults.conversation_id ->
DEFAULT_CONVERSATION_ID) into the POST /get/memory body.

Also register the documented `memos list` command as an alias of `get`,
add --conversation-id to both entrypoints, and teach the display layer to
parse the text_mem bucket envelope so scoped results render instead of
showing 0 records. Update README (en/zh) and memos-memory skill docs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Memtensor-AI Memtensor-AI added ai:generated Generated or modified by AI | 由 AI 生成或修改 area:docs 文档、示例 status:in-progress Someone or AI is working on it | 人工或 AI 正在处理 labels Aug 25, 2026
@Memtensor-AI
Memtensor-AI requested a review from lijicode August 25, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai:generated Generated or modified by AI | 由 AI 生成或修改 area:docs 文档、示例 status:in-progress Someone or AI is working on it | 人工或 AI 正在处理

Projects

None yet

Development

Successfully merging this pull request may close these issues.

memos get/list 与 add 作用域不一致:add 按 conversation_id 写入而 get 仅按 user_id 读取,导致新加记忆在列表查不到

1 participant