Fix #35: memos get/list 与 add 作用域不一致:add 按 conversation_id 写入而 get 仅按 user_id 读取,导致新加记忆在列 - #37
Open
Memtensor-AI wants to merge 1 commit into
Open
Conversation
`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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixed the read/write scope asymmetry behind issue #35.
memos addwrites memories keyed by conversation_id (resolved via CLI arg -> config.defaults.conversation_id -> DEFAULT_CONVERSATION_ID), butmemos get/listonly 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 documentedmemos listcommand is now registered as a thin alias ofgetwith 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, andmemos list --helpall 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.
How Has This Been Tested?
Not run; documentation-only change.
Checklist
@lijicode please review this PR.
Reviewer Checklist