TypeScript SDK
The TypeScript SDK (@senselab-ai/amfs) provides full parity with the Python SDK for Node.js and TypeScript applications — including ReadTracker, auto-causal linking, search, history, stats, scopes, transactions, integrity verification, and explainability.
Installation
Quick Start
Constructor
HttpAdapter to connect to a remote AMFS server, or implement AmfsAdapter for custom storage.
ReadTracker & Auto-Causal Linking
The TypeScript SDK includes aReadTracker that automatically logs every read() call and external context. When you call commitOutcome() without explicit causal keys, the SDK uses the read log to build the causal chain — identical to the Python SDK behavior.
Agent-Scoped Memory
The SDK distinguishes between shared memory and agent-scoped memory. Userecall, myEntries, and readFrom for explicit agent-level operations.
Scopes
AMemoryScope provides a focused view bound to a single entity path, reducing boilerplate when working with one service or module.
Search
Composite Scoring with RecallConfig
Pass arecallConfig to get scored results with breakdown information:
Version History
Watch
Subscribe to changes on an entity path:Transactions
Group multiple writes into an atomic commit:Integrity Verification
Verify content hashes and integrity chains for stored entries:Commit Log & DAG
Inspect the commit history and navigate the commit DAG:Stats
Connecting to AMFS
Using the HttpAdapter
HttpAdapter provides async methods for remote operations:
Direct REST calls
Rooms & Collaboration
The SDK includes room-based collaboration APIs for multi-agent knowledge sharing and negotiation. These require anHttpAdapter connection.
Negotiation
Rooms support structured negotiation sessions between agents:Full API Reference
AgentMemory
Constructor
read
write
list
search
history
stats
watch
verify
transaction
commitLog
commonAncestor
recordContext
explain
commitOutcome
recall
myEntries
readFrom
scope
listScopes
info
tree
clearReadLog
MemoryScope
A scoped view bound to a fixed entity path. Whenreadonly is true, writes throw an error.
TransactionContext
Exports
OutcomeType Values
Notes
The TypeScript SDK uses an in-memory adapter by default. To persist data remotely, pass an
HttpAdapter instance configured with your AMFS server URL and API key. The HttpAdapter provides both sync (stub) and async methods — use the async variants (readAsync, writeAsync, etc.) for remote operations.Room and negotiation APIs require an HTTP connection to AMFS and return Promises. They are available on the
AgentMemory instance when using an adapter that exposes a base URL.