fleet-memory/hindsight-all-npm
Nicolò Boschi 576016f5dc
feat: add @vectorize-io/hindsight-all daemon lifecycle package (#949)
* feat: add @vectorize-io/hindsight-embed daemon lifecycle package

Create a new top-level `hindsight-embed-npm/` package that owns the daemon
lifecycle for the Python `hindsight-embed` CLI: spawning via `uvx`, writing
the profile, waiting for `/health`, and shutting down. Nothing more.

Deliberately does not ship an HTTP client — `@vectorize-io/hindsight-client`
already covers retain / recall / reflect / createBank against the Hindsight
API, and the two packages compose: once `manager.start()` returns, consumers
talk to the daemon via `new HindsightClient({ baseUrl: manager.getBaseUrl() })`.

`HindsightEmbedManagerOptions.env` forwards an arbitrary `Record<string,
string>` to both the daemon process and the profile config via `--env K=V`,
and `extraProfileCreateArgs` / `extraDaemonStartArgs` escape hatches cover
any new CLI flag without waiting for a wrapper release.

Refactor `hindsight-integrations/openclaw` to consume both packages:
`HindsightEmbedManager` for daemon lifecycle in local mode, `HindsightClient`
for all HTTP memory operations. Drop the bespoke subprocess/HTTP client that
used to live in openclaw. The retain queue stays local to openclaw (it's a
client-side reliability workaround with a single consumer today — will move
to the client package or server-side when a second consumer needs it).

Wire the new package into the main release pipeline (versioned alongside
the other core packages, published from `v*` tags) and add a CI build job.

* docs: add Embedded Node.js SDK page for @vectorize-io/hindsight-embed

* refactor: rename hindsight-embed-npm to hindsight-all, restructure docs sidebar

The Node package previously named @vectorize-io/hindsight-embed was
semantically misnamed: hindsight-embed (Python) is a CLI tool, while what
this Node package actually provides is the Node equivalent of hindsight-all
— a programmatic lifecycle manager for a local Hindsight daemon. Rename to
match.

Package rename
  - hindsight-embed-npm/ → hindsight-all-npm/ (git mv, history preserved)
  - @vectorize-io/hindsight-embed → @vectorize-io/hindsight-all
  - class HindsightEmbedManager → HindsightServer (matches Python hindsight-all)
  - HindsightEmbedManagerOptions → HindsightServerOptions
  - src/manager.ts → src/server.ts, src/manager.test.ts → src/server.test.ts
  - openclaw (index.ts, backfill.ts, tests) and the claude-code Python port
    updated to reference the new names

Docs restructure
  - Split sdks/python.md: now client-only content. New sdks/hindsight-all.md
    covers the programmatic hindsight-all Python package (HindsightServer and
    HindsightEmbedded).
  - Rename sdks/embed-npm.md → sdks/hindsight-all-npm.md with HindsightServer
    examples.
  - New "Installation" sidebar section, placed after Hosting, containing
    Docker / Kubernetes / Bare Metal (anchor links into developer/installation)
    plus Programmatic API (Python), Programmatic API (Node.js), and Daemon CLI.
  - Add si-docker, si-kubernetes, si-nodedotjs, lu-hard-drive to the sidebar
    ICON_MAP.

Docs dev-server fix
  - docusaurus.config.ts: drop the flaky NODE_ENV sniff for including the
    "Next" version. Use INCLUDE_CURRENT_VERSION exclusively. NODE_ENV was
    unreliable across hot-reload paths and caused the Next version to
    disappear intermittently when editing files.
  - scripts/dev/start-docs.sh: export INCLUDE_CURRENT_VERSION=true so local
    dev always shows Next; production builds leave it unset.

Lockfile cleanup
  - package-lock.json and hindsight-integrations/openclaw/package-lock.json
    had extraneous hindsight-embed-npm blocks left over from the rename.
    Removed manually and verified with npm install.

* ci: fix openclaw jobs by pre-building workspace deps; regenerate docs-skill

The build-openclaw-integration and test-openclaw-integration jobs failed
with "Failed to resolve entry for package @vectorize-io/hindsight-all"
because openclaw depends on two monorepo workspaces via `file:` deps
(@vectorize-io/hindsight-client and @vectorize-io/hindsight-all) whose
`dist/` directories are gitignored and never built before openclaw's npm ci.
Both jobs now install the root workspace and build the two deps first,
mirroring the release-control-plane pattern.

Also regenerate skills/hindsight-docs/references/* via
./scripts/generate-docs-skill.sh:
  - new skill pages for sdks/hindsight-all{.md,-npm.md}
  - updated skill pages for sdks/embed.md and sdks/python.md to match
    the new H1s and split content
  - incidental refreshes to changelog/index.md, developer/models.md,
    openapi.json, and uv.lock that verify-generated-files picked up

* ci: build openclaw before running tests so symlink test can realpath dist
2026-04-10 15:51:44 +02:00
..
src feat: add @vectorize-io/hindsight-all daemon lifecycle package (#949) 2026-04-10 15:51:44 +02:00
.gitignore feat: add @vectorize-io/hindsight-all daemon lifecycle package (#949) 2026-04-10 15:51:44 +02:00
package.json feat: add @vectorize-io/hindsight-all daemon lifecycle package (#949) 2026-04-10 15:51:44 +02:00
README.md feat: add @vectorize-io/hindsight-all daemon lifecycle package (#949) 2026-04-10 15:51:44 +02:00
tsconfig.json feat: add @vectorize-io/hindsight-all daemon lifecycle package (#949) 2026-04-10 15:51:44 +02:00
tsup.config.ts feat: add @vectorize-io/hindsight-all daemon lifecycle package (#949) 2026-04-10 15:51:44 +02:00
vitest.config.ts feat: add @vectorize-io/hindsight-all daemon lifecycle package (#949) 2026-04-10 15:51:44 +02:00

@vectorize-io/hindsight-all

Node.js equivalent of the Python hindsight-all package — programmatic lifecycle manager for a local Hindsight daemon. Use this when you want to embed Hindsight in a Node application without hand-rolling subprocess management.

This package deliberately does not ship an HTTP client. Once the daemon is running, talk to it with @vectorize-io/hindsight-client against server.getBaseUrl(). The two packages compose — one owns the daemon process, the other owns the HTTP API surface.

Requirements

  • Node.js >= 22 — uses global fetch and AbortSignal.timeout.
  • uv / uvx on PATH — used to download and run the underlying hindsight-embed daemon on first use. Install via https://docs.astral.sh/uv/.

Install

npm install @vectorize-io/hindsight-all @vectorize-io/hindsight-client

Example

import { HindsightServer, consoleLogger } from '@vectorize-io/hindsight-all';
import { HindsightClient } from '@vectorize-io/hindsight-client';

const server = new HindsightServer({
  profile: 'my-app',
  port: 9077,
  env: {
    HINDSIGHT_API_LLM_PROVIDER: 'anthropic',
    HINDSIGHT_API_LLM_API_KEY: process.env.ANTHROPIC_API_KEY,
    HINDSIGHT_API_LLM_MODEL: 'claude-sonnet-4-20250514',
    HINDSIGHT_EMBED_DAEMON_IDLE_TIMEOUT: '0',
  },
  logger: consoleLogger,
});

await server.start();

const client = new HindsightClient({ baseUrl: server.getBaseUrl() });

await client.retain('user-123', 'User prefers dark mode and concise answers.', {
  documentId: 'pref-2026-04-01',
});

const recall = await client.recall('user-123', 'what are the user preferences?');
console.log(recall.results);

await server.stop();

For a remote Hindsight API, skip HindsightServer entirely and just point HindsightClient at the remote URL.

Open config — forward-compatible with new daemon flags

HindsightServerOptions is designed so every new environment variable or CLI flag in the underlying Hindsight daemon can be used without waiting for a wrapper release:

  • env accepts an arbitrary Record<string, string>. Every entry is exported into the daemon process and written into the profile config via --env KEY=VALUE.
  • extraProfileCreateArgs / extraDaemonStartArgs append raw args to the respective commands.

Development against a local checkout

If you're hacking on the Python hindsight-embed package in the same monorepo, point the server at the local path — it'll use uv run --directory <path> instead of uvx:

new HindsightServer({
  embedPackagePath: '/path/to/hindsight-embed',
  // ...
});

API surface

  • HindsightServer — daemon lifecycle (start, stop, checkHealth, getBaseUrl, getProfile).
  • Logger interface plus silentLogger (default) and consoleLogger helpers.
  • getEmbedCommand(opts) — low-level helper that returns the [cmd, ...args] tuple used to invoke the underlying Python CLI.

For memory operations (retain, recall, reflect, bank management, stats) use @vectorize-io/hindsight-client.

License

MIT