Brain Docs

Reference

TypeScript SDKInstallationHTTP clientWire client
encoderecallforgetencodeVectormemoryListmemoryInspectgraphFetchlinkunlink
ErrorsRetriesPagination
Brain/Docs
✦ ASKBrain on GitHubDashboard
TypeScript SDKMemorylink

link

Assert a typed memory-to-memory edge, alongside the ones the write pipeline infers.

PURPOSE

Assert an edge between two memories yourself. The write pipeline infers edges on its own; link is for the ones you know about and it does not.

POST/v1/linksBearer API keystable
link(input: LinkInput): Promise<LinkResult>
Handshake credentialstable
link(request: LinkRequest): Promise<LinkResponse>

Parameters

ParameterTypeRequired
sourcestring (wire: 64-bit integer)required

The memory the edge leaves.

targetstring (wire: 64-bit integer)required

The memory it points at.

kindEdgeKindrequired

One of caused, followed_by, derived_from, similar_to, contradicts, supports, references, part_of. Anything else is BadEdgeKind. On the wire these are integer discriminants, not lowercase strings.

weightfloatoptional

Edge strength. Defaults server-side.

Returns

FieldTypePresence
source / target / kind / weight—always

Echoed back as stored.

createdAtUnixNanos64-bit integeralways

When the edge was written.

alreadyExistedbooleanalways

true when the edge was already there. This is what makes link idempotent — a repeat is a success, not a duplicate.

Example

await brain.link({ source: outageId, target: rollbackId, kind: "caused", weight: 0.9 });
See also
unlinkmemoryInspect

Was this page helpful?

graphFetch

A cursor-paged node and edge view of the space, for drawing — not a query.

unlink

Remove a memory-to-memory edge. Removing one that is not there is a success, not an error.

On this page

ParametersReturnsExample
Suggest an editOpen in Playground