feat(openclaw): expose Hindsight docs as memory bridge artifacts#967
feat(openclaw): expose Hindsight docs as memory bridge artifacts#967frvade wants to merge 6 commits intovectorize-io:mainfrom
Conversation
7340612 to
9421a71
Compare
9421a71 to
3e0937a
Compare
nicoloboschi
left a comment
There was a problem hiding this comment.
Code review notes:
Must fix
- Missing pagination in
listHindsightPublicArtifacts(src/index.ts): documents query is hardcoded to?limit=100&offset=0. Banks with >100 documents will silently drop artifacts. Loop until the API returns fewer thanlimititems. - No error isolation in the fetch loop: if a single document GET fails, the whole call throws — and we may already have written a partial set of files to the user's workspace. Wrap per-document fetches in try/catch, log, and continue so one bad doc doesn't nuke the export.
Should fix
- N+1 / sequential I/O: for each bank we list, then for each doc we fetch individually, fully sequentially. Parallelize with a bounded concurrency (e.g. p-limit) per bank — this will be painfully slow on real workspaces.
kind: 'daily-note'is misleading: these aren't daily notes, they're Hindsight documents. If OpenClaw's bridge requires this literal string, add a comment explaining why; otherwise use a more accurate kind.- Locally redeclared SDK contract (
src/types.ts):MemoryPluginPublicArtifactandMemoryPluginCapabilityare hand-rolled here instead of imported from the OpenClaw SDK. If OpenClaw changes the shape this plugin drifts silently. Import the real type or add a comment acknowledging the duplication. - Sync FS inside async function:
mkdirSync/writeFileSyncblock the event loop while materializing many artifacts. Preferfs/promises. - Test coverage is thin: one happy-path test (1 bank, 1 doc, default workspace). Missing: pagination boundary, fetch failure, empty bank list, runtime without
registerMemoryCapability, multi-workspace (agents.listwith multiple entries). For code that writes to the user's filesystem this is under-covered. - Unrelated comment churn:
// Default: true (on) — backward compatible→// Default: true (on), backward compatibleis noise, please drop.
Notes
listArtifactssounds read-only but materializes markdown files on disk. Mirrors the OpenClaw contract, but worth a one-line comment on the exported function so future readers aren't surprised.original_textis written verbatim with no size cap — fine for v1, but flag-worthy for very large documents.
Overall direction looks right and scoped to #963. The two must-fix items (silent 100-doc cap + all-or-nothing error handling during a filesystem-mutating call) will bite real users before tests will — I'd block on those; the rest is polish.
Adds public artifact bridging so that Hindsight documentation pages are surfaced as OpenClaw bridge artifacts, with tests covering the new behaviour. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ion test Remove accidental lock file drift (local→npm dep resolution) that was unrelated to the public-artifacts feature. Add a test that exercises the pagination path (full 100-item page triggers a second request). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Batch document fetches (concurrency 8) instead of sequential N+1 - Revert unrelated comment churn (em-dash → comma) - Add JSDoc on listHindsightPublicArtifacts noting it materializes files - Comment why kind is 'daily-note' (OpenClaw bridge contract) - Comment on original_text having no size cap (acceptable for v1) - Comment on locally redeclared SDK types with TODO to replace - Add tests: empty bank list, multi-workspace materialization Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Addressed all review items from #pullrequestreview-4097275838 across three commits ( Must fix — both resolved in
Should fix — resolved in
Notes — resolved in
Also reverted an accidental |
|
@nicoloboschi — merged the latest main into this branch, conflicts are resolved, and targeted tests pass. Could you take another look when you get a chance? Thanks! |
|
Merged latest main into this branch, resolved the OpenClaw integration conflict, and pushed the updated branch. @nicoloboschi could you please take another look when you have a moment? |
Closes #963.
Summary
publicArtifactssupport in the Hindsight OpenClaw pluginmemory/hindsight-bridge/Verification
cd hindsight-integrations/openclaw && npm run buildcd hindsight-integrations/openclaw && npm test