Skill: vidursharma202-del/threadline (version 1.0.3)

--- name: Threadline — Persistent Memory and Context Layer for AI Agents slug: threadline version: 1.0.3 description: > Your AI agents start from zero. Every session. Users repeat themselves — their stack, their preferences, their ongoing projects. Threadline fixes this in 2 lines. inject() before your LLM call, update() after. Your agent now remembers every user, forever. Structured extraction across 7 scopes, OAuth-style grant system so agents only see permitted context, user-owned data with deletion dashboard, and relevance-scored injection — 200 tokens of signal, not 2,000 tokens of noise. Works with OpenAI, Anthropic, Vercel AI SDK, and LangChain. < 50ms retrieval. GDPR-ready by design. Free tier: 2,500 calls/month. homepage: https://threadline.to emoji: 🧵 env: - name: THREADLINE_API_KEY description: Your Threadline API key — get one at threadline.to/dashboard required: true --- # Threadline — Persistent Memory and Context Layer for AI Agents Threadline fixes agent amnesia. Two lines of code give your AI agent persistent memory across every user session — with full developer control over what's stored, who sees it, and how it's used. ## When to use this skill Use Threadline whenever the user: - Is building an AI agent, chatbot, or assistant - Mentions agents forgetting context between sessions - Wants to personalise agent responses per user - Is using OpenAI, Anthropic, Vercel AI SDK, or LangChain - Mentions "context rot", "session reset", "agent memory", or "persistent context" ## What Threadline does Threadline gives your agent a persistent context layer — preferences, tasks, communication style, domain expertise, and key relationships — that travels across every conversation. Agents stop starting from zero. Relevance-scored injection means your agent gets 200 tokens of signal, not 2,000 tokens of noise. No prompt bloat at scale. ## Integration (2 lines) ```typescript import { ThreadlineClient } from 'threadline-sdk'; const tl = new ThreadlineClient({ [REDACTED_SECRET] }); // Before your LLM call — inject user context into system prompt const systemPrompt = await tl.inject(userId, "You are a helpful assistant."); // After your LLM response — extract and store new facts await tl.update({ userId, userMessage, agentResponse }); ``` ## OpenAI example ```typescript import OpenAI from 'openai'; import { ThreadlineClient } from 'threadline-sdk'; const openai = new OpenAI(); const tl = new ThreadlineClient({ [REDACTED_SECRET] }); const systemPrompt = await tl.inject(userId, "You are a helpful assistant."); const response = await openai.chat.completions.create({ model: "gpt-4o", messages: [ { role: "system", content: systemPrompt }, { role: "user", content: userMessage } ] }); await tl.update({ userId, userMessage, agentResponse: response.choices[0].message.content }); ``` ## Anthropic example ```typescript import Anthropic from '@anthropic-ai/sdk'; import { ThreadlineClient } from 'threadline-sdk'; const anthropic = new Anthropic(); const tl = new ThreadlineClient({ [REDACTED_SECRET] }); const systemPrompt = await tl.inject(userId, "You are a helpful assistant."); const response = await anthropic.messages.create({ model: "claude-opus-4-6", max_tokens: 1024, system: systemPrompt, messages: [{ role: "user", content: userMessage }] }); await tl.update({ userId, userMessage, agentResponse: response.content[0].text }); ``` ## Vercel AI SDK example ```typescript import { streamText } from 'ai'; import { openai } from '@ai-sdk/openai'; import { ThreadlineClient } from 'threadline-sdk'; const tl = new ThreadlineClient({ [REDACTED_SECRET] }); const systemPrompt = await tl.inject(userId, "You are a helpful assistant."); const result = await streamText({ model: openai('gpt-4o'), system: systemPrompt, messages, onFinish: async ({ text }) => { await tl.update({ userId, userMessage, agentResponse: text }); } }); ``` ## LangChain example ```typescript import { ChatOpenAI } from '@langchain/openai'; import { SystemMessage, HumanMessage } from '@langchain/core/messages'; import { ThreadlineClient } from 'threadline-sdk'; const tl = new ThreadlineClient({ [REDACTED_SECRET] }); const llm = new ChatOpenAI({ model: "gpt-4o" }); const systemPrompt = await tl.inject(userId, "You are a helpful assistant."); const response = await llm.invoke([ new SystemMessage(systemPrompt), new HumanMessage(userMessage) ]); await tl.update({ userId, userMessage, agentResponse: response.content }); ``` ## 7 context scopes Threadline extracts and stores context across 7 scopes: | Scope | What it captures | |---|---| | `communication_style` | Tone, verbosity, format preferences | | `ongoing_tasks` | Active projects, deadlines, blockers | | `key_relationships` | Team members, clients, collaborators | | `domain_expertise` | Tech stack, industry knowledge, skills | | `preferences` | Tools, workflows, working style | | `emotional_state` | Stress signals, motivation, sentiment | | `general` | Everything else worth remembering | ## Grant system Agents only see the scopes they're explicitly granted. A coding assistant sees `domain_expertise` and `ongoing_tasks`. A writing assistant sees `communication_style` and `preferences`. No agent sees everything by default. ```typescript await tl.grant({ agentId: "coding-assistant", userId: userId, scopes: ["domain_expertise", "ongoing_tasks"] }); ``` ## Rules - Always call `inject()` before the LLM call, never after - Always call `update()` after receiving the agent response - Use a stable, consistent `userId` — this is how context is scoped per user - Do not log or expose the enriched system prompt — it contains user context - Context is user-owned — users can view and delete via threadline.to/dashboard ## REST API (any language) ```bash # Inject POST https://api.threadline.to/api/inject [REDACTED_SECRET] { "userId": "user_123", "basePrompt": "You are a helpful assistant." } # Update POST https://api.threadline.to/api/update [REDACTED_SECRET] { "userId": "user_123", "userMessage": "...", "agentResponse": "..." } ``` ## Troubleshooting | Issue | Fix | |---|---| | `inject()` returns base prompt unchanged | Check API key is set correctly | | Context not persisting | Confirm `update()` is being called after every response | | Slow injection | Redis-cached — first call ~200ms, subsequent calls <50ms | | Wrong user context | Ensure userId is stable and unique per user | ## Links - Homepage: https://threadline.to - Docs: https://threadline.to/docs - API reference: https://api.threadline.to/docs - npm: https://www.npmjs.com/package/threadline-sdk - Support: [REDACTED_SECRET]


Security scan verdicts — ClawScan: suspicious | static analysis: suspicious | VirusTotal: clean | SkillSpector: suspicious (MEDIUM)