Opinionated guides for building with Threadline.
Building your first memory-aware chatbot
system + messages and returns a reply. Prove out tone and behaviour before wiring in Threadline.Introduce tl.inject() at the system layer.
Replace your static system prompt with:
const injected = await tl.inject(userId, basePrompt)Use injected as the system message you send to your model.
await tl.update({ userId, userMessage, agentResponse })This keeps the user's context fresh and lets Threadline learn their style, tasks, and preferences over time.
/account so they can see, edit, and delete their context. This is a critical trust signal.Threadline is designed for multi-agent ecosystems: multiple assistants, tools, and products sharing a single user context.
agent_id). This keeps audit logs and rate limits clean.Scope grants narrowly. When sharing context between agents, use specific scopes:
await tl.grant({
userId,
agentId: supportAgentId,
scopes: ["communication_style", "ongoing_tasks"],
})Your support agent doesn't need access to emotional state or unrelated preferences.
preferences or emotional_state when it materially improves the experience.Migrating from Zep to Threadline
If you're already using Zep or another memory API, migration typically looks like this:
communication_style, domain_expertise, preferences.ongoing_tasks.Backfill via a one-time script. Write a script that:
POST /api/context/update or uses the admin SDK to seed context objects.Flip your runtime integration. Replace Zep's read/write calls with:
const prompt = await tl.inject(userId, basePrompt)
await tl.update({ userId, userMessage, agentResponse })Turn off writes to Zep, keep reads temporarily.
For a short window, you may want to read from both systems while only writing to Threadline, then fully cut over once you're confident in the migration.
More guides coming soon.