Skip to content

feat(openclaw): expose Hindsight docs as memory bridge artifacts#967

Open
frvade wants to merge 6 commits intovectorize-io:mainfrom
frvade:feat/openclaw-public-artifacts
Open

feat(openclaw): expose Hindsight docs as memory bridge artifacts#967
frvade wants to merge 6 commits intovectorize-io:mainfrom
frvade:feat/openclaw-public-artifacts

Conversation

@frvade
Copy link
Copy Markdown

@frvade frvade commented Apr 10, 2026

Closes #963.

Summary

  • register OpenClaw publicArtifacts support in the Hindsight OpenClaw plugin
  • fetch Hindsight banks/documents over the existing external HTTP API and materialize them as markdown under memory/hindsight-bridge/
  • add one focused test that covers the document export path

Verification

  • cd hindsight-integrations/openclaw && npm run build
  • cd hindsight-integrations/openclaw && npm test

@frvade frvade force-pushed the feat/openclaw-public-artifacts branch 2 times, most recently from 7340612 to 9421a71 Compare April 11, 2026 08:06
@frvade frvade force-pushed the feat/openclaw-public-artifacts branch from 9421a71 to 3e0937a Compare April 11, 2026 11:29
Copy link
Copy Markdown
Collaborator

@nicoloboschi nicoloboschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 than limit items.
  • 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): MemoryPluginPublicArtifact and MemoryPluginCapability are 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 / writeFileSync block the event loop while materializing many artifacts. Prefer fs/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.list with 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 compatible is noise, please drop.

Notes

  • listArtifacts sounds 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_text is 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.

OpenClaw Agent and others added 3 commits April 13, 2026 10:06
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>
@frvade
Copy link
Copy Markdown
Author

frvade commented Apr 13, 2026

Addressed all review items from #pullrequestreview-4097275838 across three commits (d3f03e7, 2b307b5, 50631cb):

Must fix — both resolved in d3f03e7:

  • Pagination: loop until items.length < pageSize, no more 100-doc cap
  • Error isolation: failed per-document fetches are logged and skipped

Should fix — resolved in 2b307b5 + 50631cb:

  • N+1 sequential I/O → batched with Promise.allSettled, concurrency 8
  • kind: 'daily-note' → added inline comment explaining it's the closest OpenClaw bridge kind
  • Locally redeclared SDK types → added comment + TODO to replace once OpenClaw ships a types package
  • Sync FS → switched to fs/promises (mkdir/writeFile)
  • Test coverage → added: pagination boundary, fetch failure + continue, empty bank list, multi-workspace materialization (5 tests total)
  • Unrelated comment churn → reverted (em-dash restored)

Notes — resolved in 50631cb:

  • Added JSDoc on listHindsightPublicArtifacts clarifying it materializes files despite the "list" name
  • Added note that original_text is written with no size cap (acceptable for v1)

Also reverted an accidental package-lock.json drift (local→npm dep resolution) that was unrelated to this feature (2b307b5).

@frvade
Copy link
Copy Markdown
Author

frvade commented Apr 14, 2026

@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!

@frvade
Copy link
Copy Markdown
Author

frvade commented Apr 19, 2026

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenClaw memory-wiki bridge imports 0 artifacts with hindsight-openclaw

2 participants