feat(session): persist metadata + inject into memory extraction prompt (#2414)#2667
Open
yeyitech wants to merge 1 commit into
Open
feat(session): persist metadata + inject into memory extraction prompt (#2414)#2667yeyitech wants to merge 1 commit into
yeyitech wants to merge 1 commit into
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
volcengine#2414) Sessions can now carry an arbitrary metadata dict (project name, tech-stack preferences, architectural style, etc.) that survives through commit and is included in the system context the memory extractor sees. Today the only way to express project-level personalization was to allocate a separate agent_id per project; with this change, a single agent can keep distinct memory layers across projects via session metadata. - Session model + storage gain a metadata field (dict, JSON-serializable, size-capped at 16 KB, key-count-capped at 64). - API: POST /api/v1/sessions accepts metadata; PATCH /api/v1/sessions/{id}/metadata merges by default, replace=true overrides. - Memory extractor: when metadata is present, a [Session metadata] block is added to the prompt's system context. - CLI: ov session set-metadata --key K --value V. Closes volcengine#2414 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
7245e05 to
c00a0c7
Compare
1 task
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.
Summary
Closes #2414. Today the only way to express project-level personalization (architectural style, tech-stack preferences) is to allocate a different
agent_idper project. This PR ships the foundational piece — arbitrary session-levelmetadatathat persists end-to-end and is injected into the memory extractor's prompt context — so a single agent can keep distinct memory layers across projects.Surface
Session.metadata: dict | None, JSON-serializable, capped at 16 KB / 64 keys (module constants, no config field).POST /api/v1/sessions— accepts optionalmetadataon create.GET /api/v1/sessions/{id}— includesmetadatain the response.PATCH /api/v1/sessions/{id}/metadata— merges by default;?replace=trueoverwrites.[Session metadata]block is added to the system prompt the LLM sees during memory extraction.ov session set-metadata <id> --key K --value V(repeatable).Per-schema multi-layer memory (the issue's longer-term ask) is intentionally out of scope and lands as a follow-up — this PR just makes the foundation available.
Test plan
pytest tests/server/test_session_metadata.py -x -qpasses (7 cases).curl -X PATCH /api/v1/sessions/{id}/metadata -d '{\"project\":\"alpha\"}'thenGETreturns it; commit a session and verify the LLM extractor saw the metadata block.Closes #2414