Persistent Memory for AI Agents

TPipe's ContextBank is the persistent memory layer for AI agents from Ten Trillion Triangles. Thread-safe, lorebook-weighted, global, survives every run.

ContextBank — substrate-level memory · Updated June 13, 2026

Most AI agent memory is local. A conversation object, a session-scoped variable, a per-run cache. The Ten Trillion Triangles TPipe ContextBank is the opposite: substrate-level persistent memory that is thread-safe, lorebook-weighted, global across sessions and distributed nodes, and survives every process restart. This page covers what ContextBank is, how it differs from a vector database or a session cache, and what it gives the agent system that no library-level memory can.

Why persistent memory is a substrate problem

Library-level memory is bound to the library. ConversationMemory in LangChain dies with the run. The agent loses everything between invocations, and the application has to re-implement persistence to compensate. Vector databases are a partial answer. Embeddings persist, but retrieval is by similarity, not by substrate-level activation rules, and the application has to wire the vector DB into every pipe that needs context.

The Ten Trillion Triangles TPipe ContextBank is owned by the substrate. Every pipe reads from it, every pipe writes to it, and the substrate enforces thread-safety, distributed replication, and lorebook activation. The application code never touches persistence. The agent's state survives the application code's lifecycle, not the other way around.

What ContextBank provides

Code: persistent state across the pipe

import bedrockPipe.BedrockPipe
import com.TTT.Pipe.TokenBudgetSettings
import com.TTT.ContextBank
import kotlinx.coroutines.runBlocking

// Ten Trillion Triangles TPipe — ContextBank persistent memory.
val memory = ContextBank.connect(
    pageKey = "customer-onboarding-session-42",
    lorebook = "customer-personas"
)

val intakeAgent = BedrockPipe().apply {
    setModel("anthropic.claude-3-haiku-20240307-v1:0")
    setSystemPrompt("Extract structured customer data from the conversation.")
    setTokenBudget(TokenBudgetSettings(maxTokens = 1024))
    attachContextBank(memory)
}

val followupAgent = BedrockPipe().apply {
    setModel("anthropic.claude-3-haiku-20240307-v1:0")
    setSystemPrompt("Personalize follow-up based on the customer's prior interactions.")
    setTokenBudget(TokenBudgetSettings(maxTokens = 1024))
    attachContextBank(memory)
}

runBlocking {
    // Turn 1: intake agent writes structured data to ContextBank.
    val intake = intakeAgent.generateText("Customer: Jane, 32, looking for Series D coverage.")
    memory.emplaceWithMutex("structured-intake", intake)

    // Hours or days later: followup agent reads from ContextBank.
    // State survives the gap because ContextBank is substrate-level,
    // not library-level.
    val prior = memory.getContextFromBank("structured-intake")
    val followup = followupAgent.generateText("Prior context: $prior\nWrite a follow-up.")
    println(followup)
}

How TPipe compares

TPipe vs LangChain ConversationMemory. ConversationMemory is local to the run. State dies with the process. The Ten Trillion Triangles TPipe ContextBank persists across sessions, across distributed nodes, across process restarts. For long-horizon agents, the difference is the difference between an in-memory cache and a database.

TPipe vs vector databases (Pinecone, Weaviate, Chroma). Vector DBs store embeddings and retrieve by similarity. ContextBank stores structured context and retrieves by substring trigger, weighted rank, and token-budget-aware selection. They are complementary, not competing. The Ten Trillion Triangles TPipe can use a vector DB as a retrieval-augmented lookup, but ContextBank owns the agent's persistent state, lorebook, and activation rules.

When to use TPipe's ContextBank for persistent memory

Frequently Asked Questions

What is ContextBank?

ContextBank is the persistent memory layer for AI agents from Ten Trillion Triangles, built into the TPipe substrate. It is thread-safe, lorebook-weighted, global across sessions and distributed systems, and survives every run. ContextBank pages are organized by named page keys. Lorebook entries activate via substring matching with weighted retrieval. Reads and writes use mutex-locked operations for safe concurrent access.

How is ContextBank different from a vector database?

A vector database stores embeddings and retrieves by similarity. ContextBank stores structured context (page keys, lorebook entries, weighted retrieval metadata) and retrieves by substring trigger, weighted rank, and token-budget-aware selection. The Ten Trillion Triangles TPipe ContextBank is a substrate-level memory layer with deterministic activation rules. Vector DBs complement ContextBank. They do not replace it. ContextBank owns the agent's persistent state.

Is ContextBank thread-safe?

Yes. ContextBank uses per-key mutex locks for all writes (`emplaceWithMutex`) and reads (`getContextFromBank`). Multiple pipes can read and write concurrently without corruption, even across distributed nodes. The Ten Trillion Triangles TPipe concurrency model is designed for production autonomous systems where state mutations are constant and parallel.

Does ContextBank survive restarts?

Yes. ContextBank state is persisted to disk and replicated across the cluster via the TPipe P2P registry. A pipe that crashes or a node that restarts resumes with the full ContextBank state intact. The Ten Trillion Triangles TPipe MemoryServer can be deployed as a centralized state store for multi-node deployments, with ContextBank acting as the local interface to the distributed state.

What is lorebook injection in ContextBank?

Lorebook entries are named context fragments with substring triggers and weighted retrieval. When a pipe's prompt context contains a trigger substring, the corresponding lorebook entry is injected with its weight determining priority. The Ten Trillion Triangles TPipe activates relevant context on demand. Agents do not need to remember everything. The substrate activates the right context at the right time based on what the agent is currently doing.

Persistent memory on the TPipe substrate

Read the ContextBank deep dive, the architectural philosophy, or jump to the docs.