Skip to main content
n8n-nodes-haki gives any n8n AI Agent workflow durable, cross-session memory on your own Postgres — no vendor lock-in, no per-call memory tax. Two nodes, placed around your existing AI Agent node: one reads memory in, one writes the turn back out.
Runs against any Haki instance you already host (docker compose up). No Haki account required — self-hosted end to end.

Install

Or from the CLI, inside your n8n data directory:

Credential — Haki API

One credential, shared by both nodes:
string
required
The Haki API URL, no trailing slash. From an n8n Docker container to a Haki API on the host machine, use http://host.docker.internal:8100 instead of localhost.
string
Haki bearer key. Optional in local development (the API runs in open mode), required as soon as HAKI_ADMIN_KEY or a project key is configured server-side.

Haki Context — place before your AI Agent

Fetches the subject’s memory as a ready-to-inject block, before the LLM call.
string
required
Haki project (memory scope). Never chosen by the model.
string
required
Stable identifier for the person (sessionId, email, webhook ID…). Empty or "default" is rejected.
string
required
The current message — used to rerank relevant facts.
number
default:"2000"
Token budget for the returned context packet.
string
Optional task type (support, onboarding…), recorded in the trace.
Outputs context_text (drop straight into your AI Agent’s system message), the raw packet, warnings, token_count and trace_id.

Haki Capture — place after your AI Agent

Records the user/assistant turn once the reply exists.
string
required
Must match the Haki Context node.
string
required
Reuse the one from the Haki Context node.
string
required
string
required
string
Optional — either anchors an idempotency key derived from the run/ thread plus a content hash, so re-running the same n8n execution never duplicates the captured turn.
boolean
default:"false"
When on, also calls /v1/consolidate so the memory is recallable immediately — useful in dev/demo, not needed in steady-state production (consolidation runs on its own cadence).
options
default:"trusted"
trusted (direct message from the subject), semi_trusted (agent/tool output), third_party (someone else in the conversation) or untrusted (ingested content). In a group where the sender is not the tracked subject, choose third_party — the fact is attributed to that third party, never silently merged into the subject’s own memory.

A minimal wiring

Haki Context runs first and hands context_text to the AI Agent’s system message; Haki Capture runs after the agent replies, so the next turn — even in a brand new execution — starts with everything the agent already learned.

Ready-made workflows

A persistent support-agent template and an end-to-end test workflow ship in the repository’s integrations/n8n/ directory — import either one directly into n8n to see the wiring above running for real.