feat(openclaw-plugin): add multimodal attachment support to memory_store#837
Open
zhangMINGkeq1 wants to merge 1 commit intovolcengine:mainfrom
Open
feat(openclaw-plugin): add multimodal attachment support to memory_store#837zhangMINGkeq1 wants to merge 1 commit intovolcengine:mainfrom
zhangMINGkeq1 wants to merge 1 commit intovolcengine:mainfrom
Conversation
|
Failed to generate code suggestions for PR |
Add optional `attachments` parameter to `memory_store` tool, enabling agents to associate local files (images, documents, JSON, etc.) with memories. Files are uploaded to Viking Resources via temp_upload + addResource, which triggers VLM description and multimodal embedding automatically. Key design decisions: - Content-addressed storage (SHA-256 hash in URI) for deduplication - Concurrency limited to 3 to prevent VLM avalanche on large batches - Individual file failures return null, never crash the whole batch - Each upload gets independent 60s timeout via AbortController - Memory text stays pure semantic content (no URIs embedded) - Attachments returned in details.attachments for caller consumption This is V0.5: files are uploaded and searchable via Viking Resources, but Memory↔Resource linking requires Viking schema changes (V1). Changes: - client.ts: add AttachmentItem type, storeAttachments() method, hashFile() helper, getMimeType() with common MIME mappings - index.ts: memory_store accepts optional attachments string array, uploads before session creation, reports success/failure counts
c4a67c9 to
f731c98
Compare
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
Adds optional
attachmentsparameter to thememory_storetool in the OpenClaw plugin, enabling agents to associate local files (images, documents, JSON, etc.) with memories.Type of Change
Motivation
Agents frequently produce output files (images, configs, JSON results) that are semantically linked to a task. Without this feature, there is no way to retrieve "the file from last time" — the memory exists but the artifact is lost.
OpenViking already has a powerful Resources API with VLM description and multimodal embedding (via
doubao-embedding-vision). This PR simply wires the OpenClaw plugin to use it.Usage
Changes
examples/openclaw-plugin/client.ts(+154 lines):AttachmentItemtype definitionstoreAttachments(filePaths)— uploads files via temp_upload → addResource, returns URI + mime_type + VLM abstracthashFile()— streaming SHA-256 for content-addressed dedup (no OOM on large files)getMimeType()— extension-based MIME type lookupexamples/openclaw-plugin/index.ts(+55 lines):memory_storeaccepts optionalattachments: string[]parameterdetailsDesign Decisions
viking://resources/attachments/{sha256_16}_{filename}— same file uploaded twice gets the same URIattachmentsFailedcountdetails.attachmentsScope (V0.5)
This PR is intentionally scoped:
memory_recallreturning attachments (depends on schema linking — future PR)Testing
Backward compatibility verified: existing
memory_storecalls withoutattachmentsparameter work identically.Checklist