Cortex is a human-emulating agent-orchestration framework. The fabriqbrain adapter (github.com/xraph/cortex/integrations/fabriq, lives in the cortex repo) wires fabriq into cortex as a living brain. With one call your agents gain fabriq-backed:
Recall — fabriq's multi-channel agent toolkit recall (vector + full-text + graph, RRF-fused, distillation-aware) exposed as cortex's
knowledge_searchtool and injected into prompts.Rich tools — fabriq's
graph_traverse, guardedremember, and the distillation toolsmap/digest/resolve, registered as native cortex tools.Learning loop — a cortex
plugin.Extensionwrites each agent run back into the fabric, where the embed + distillation workers turn it into future recall material.
Fabriq stays standalone — the adapter lives in cortex and depends on fabriq, never the reverse.
One-line wiring01
EngineOptions auto-discovers the started *fabriq.Fabriq facade from the DI container and returns the full brain (knowledge provider + tools + learning-loop plugin). It is a no-op when no facade is present, so it is always safe to include.
import (
"github.com/xraph/cortex/engine"
fabriqbrain "github.com/xraph/cortex/integrations/fabriq"
"github.com/xraph/fabriq/core/agent"
"github.com/xraph/fabriq/core/command"
)
eng, err := engine.New(append(
[]engine.Option{engine.WithStore(store), engine.WithLLM(client)},
fabriqbrain.EngineOptions(container,
fabriqbrain.WithEmbedder(emb), // same embedder fabriq indexed with
fabriqbrain.WithEntities("doc", "note", "agent_memory"),
fabriqbrain.WithWritePolicy(fabriqbrain.MemoryWritePolicy("agent_memory")),
)...,
)...)Use EngineOption (singular) to wire only the knowledge provider, mirroring cortex's knowledge/weave adapter.
Recall02
When the knowledge provider is wired, the cortex engine exposes a knowledge_search tool and injects matching context into agent prompts. Each call runs fabriq's Toolkit.Recall — vector + search + graph fused by Reciprocal Rank Fusion, hydrated from the relational source of truth, and packed to a token budget. See Recall.
Learning loop03
The plugin persists every run to a fabriq memory entity (default agent_memory) as a {content, meta} row; fabriq's embed worker vectorizes content and distillation rolls it up, so the next recall surfaces it. To enable it the host:
Registers the memory entity (a dynamic entity with a vector-indexed
contentcolumn) —fabriqbrainshipsMemorySpec(name)for this:
reg.MustRegister(fabriqbrain.MemorySpec("agent_memory"))Provisions its table (a migration, or
postgres.Adapter.EnsureDynamicin setup —fabriq.Opendoes not auto-create dynamic tables).Allows writes via
fabriqbrain.MemoryWritePolicy("agent_memory")(deny-by-default; onlycreateon the memory entity).
Options04
| Option | Purpose |
WithEmbedder(agent.Embedder) | Embedding model for recall's vector channel. Must match the embedder fabriq indexed with. |
WithEntities(...string) | Entity types recall searches and ListCollections reports. |
WithWritePolicy(agent.WritePolicy) | Allowlist for the remember tool and learning-loop writes (deny-by-default). |
WithMemoryEntity(string) | Entity the learning loop writes to (default agent_memory). |
WithBudget(int) | Token budget per recall (default 4096). |
WithRenderer(func(agent.ContextItem) string) | Override how a recalled row becomes chunk text. |
WithTenantMapper(func(ctx) ctx) / WithLogger(...) | Translate request context to fabriq scope; surface swallowed memory-write failures. |