[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-80580":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":13,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":14,"stars7d":15,"stars30d":16,"stars90d":14,"forks30d":14,"starsTrendScore":14,"compositeScore":17,"rankGlobal":9,"rankLanguage":9,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":9,"pushedAt":9,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":14,"starSnapshotCount":14,"syncStatus":26,"lastSyncTime":27,"discoverSource":28},80580,"memory-sdk-ts","XTraceAI\u002Fmemory-sdk-ts","XTraceAI","TypeScript SDK for the xtrace memory API",null,"TypeScript",295,33,1,0,95,153,74.59,"MIT License",false,"main",true,[],"2026-06-12 04:01:29","\u003Cdiv align=\"center\">\n\n\u003Cimg src=\"assets\u002Fxtrace_orbital.gif\" width=\"600\" alt=\"xtrace memory\">\n\n\u003Cp>\u003Cstrong> Long-term memory for AI agents.\u003Cbr>Send conversation messages, get back structured facts you can search. \u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Cp>\n  \u003Ca href=\"https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@xtraceai\u002Fmemory\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F@xtraceai\u002Fmemory?color=blue&label=npm&cacheSeconds=0\" alt=\"npm\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FXTraceAI\u002Fmemory-sdk-ts\u002Fblob\u002Fmain\u002FLICENSE\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-ffffff?labelColor=d4eaf7&color=2e6cc4\" alt=\"License\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fnodejs.org\u002F\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FNode-18+-339933?logo=node.js&logoColor=white\" alt=\"Node 18+\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fdocs.mem.xtrace.ai\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDocs-docs.mem.xtrace.ai-blue\" alt=\"Docs\">\u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003Ch4>\n  \u003Ca href=\"https:\u002F\u002Fdocs.mem.xtrace.ai\">Documentation\u003C\u002Fa> |\n  \u003Ca href=\"https:\u002F\u002Fx.com\u002FXTrace_ai\">X\u003C\u002Fa> |\n  \u003Ca href=\"https:\u002F\u002Fwww.linkedin.com\u002Fcompany\u002Fxtrace-ai\u002F\">LinkedIn\u003C\u002Fa>\n\u003C\u002Fh4>\n\u003Csub>Encrypted vector search &rarr; \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FXTraceAI\u002Fxtrace-sdk\">xtrace-sdk\u003C\u002Fa>\u003C\u002Fsub>\n\u003C\u002Fdiv>\n\n---\n\n# What is xtrace memory?\n\n`@xtraceai\u002Fmemory` is the TypeScript SDK for the [xtrace memory API](https:\u002F\u002Fapi.production.xtrace.ai) — a hosted memory service for AI agents. Send raw conversation messages and the service extracts structured **facts**, **artifacts**, and **episodes** in the background. Search them later with vector + filter queries to give your agent durable, long-term memory.\n\n- **Ingest** — drop in conversation messages; extraction runs async (or sync for short turns).\n- **Search** — semantic vector search with metadata filters (`user_id`, `conv_id`, …).\n- **Manage** — list, get, update, and soft-delete memories.\n- **Vercel AI SDK** — a drop-in `@xtraceai\u002Fmemory\u002Fai-sdk` subpath for auto-context and tool-based recall.\n\nWorks in Node 18+ (native `fetch`) and in the browser.\n\n# Quick Start\n\n> [!TIP]\n> 🚀 **Create a free account at [app.xtrace.ai](https:\u002F\u002Fapp.xtrace.ai)** to get your API key and org ID. The free tier is rate-limited but fully functional.\n\n## Install\n\n```bash\nnpm install @xtraceai\u002Fmemory\n```\n\nRequires Node 18+ (uses native `fetch`). Works in the browser too.\n\n## Get credentials\n\nSign in at [app.xtrace.ai](https:\u002F\u002Fapp.xtrace.ai) and grab two values from **Settings → API Keys**:\n\n- **API key** — `xtk_…`\n- **Org id** — your organization identifier\n\nBoth are required on every request. See the [full docs](https:\u002F\u002Fdocs.mem.xtrace.ai\u002Fguides\u002Fauthentication) for storage best practices.\n\n## TypeScript SDK\n\n```ts\nimport { MemoryClient } from \"@xtraceai\u002Fmemory\";\n\nconst client = new MemoryClient({\n  apiKey: process.env.XTRACE_API_KEY!, \u002F\u002F xtk_...\n  orgId: process.env.XTRACE_ORG_ID!,   \u002F\u002F org_...\n});\n\n\u002F\u002F Ingest — async by default. `conv_id` is currently required.\nconst job = await client.memories.ingest({\n  messages: [{ role: \"user\", content: \"I keep a daily log of every dog I see.\" }],\n  user_id: \"alice\",\n  conv_id: \"conv_2026_05_15\",\n});\n\n\u002F\u002F Wait for extraction to finish\nconst done = await client.memories.jobs.pollUntilDone(job.id);\nconsole.log(done.result?.memories_created);\n\n\u002F\u002F Or ingest synchronously (server waits up to 30s; falls back to async otherwise)\nconst sync = await client.memories.ingest(\n  {\n    messages: [{ role: \"user\", content: \"I love Thai food.\" }],\n    user_id: \"alice\",\n    conv_id: \"conv_2026_05_15\",\n  },\n  { wait: true },\n);\nif (sync.status === \"succeeded\") {\n  console.log(sync.result?.memories_created);\n}\n\n\u002F\u002F Search\nconst results = await client.memories.search({\n  query: \"what does the user like to eat?\",\n  filters: { user_id: \"alice\" },\n});\n\n\u002F\u002F List with auto-pagination\nfor await (const memory of client.memories.list({ user_id: \"alice\" })) {\n  console.log(memory.text);\n}\n\n\u002F\u002F Get one\nconst memory = await client.memories.get(results.data[0]!.id);\n\n\u002F\u002F Update\nawait client.memories.update(memory.id, { text: \"Updated content\" });\n\n\u002F\u002F Delete (soft — sets details.status to \"retracted\"; hidden from list\u002Fsearch)\nawait client.memories.delete(memory.id);\n```\n\n## Vercel AI SDK integration\n\nA separate subpath, `@xtraceai\u002Fmemory\u002Fai-sdk`, ships two ways to use the SDK with the [Vercel AI SDK](https:\u002F\u002Fai-sdk.dev). Peer dependencies (`ai`, `zod`) are optional — they're only required if you import from this subpath.\n\n### Memory-aware model wrapper (auto-context + auto-ingest)\n\nWraps any `LanguageModel` so it searches your memory before each call and ingests the turn after. Set it and forget it:\n\n```ts\nimport { streamText } from \"ai\";\nimport { openai } from \"@ai-sdk\u002Fopenai\";\nimport { createXtraceMemory } from \"@xtraceai\u002Fmemory\u002Fai-sdk\";\n\nconst xtrace = createXtraceMemory({\n  apiKey: process.env.XTRACE_API_KEY!,\n  orgId:  process.env.XTRACE_ORG_ID!,\n  user_id: \"alice\",\n  conv_id: \"conv_42\",\n});\n\nconst result = streamText({\n  model: xtrace(openai(\"gpt-4o-mini\")),  \u002F\u002F memory-aware wrapper\n  messages,\n});\n```\n\n### Memory as tools (LLM decides when to recall \u002F save)\n\nFor agent loops where you want the model in control of memory access:\n\n```ts\nimport { streamText } from \"ai\";\nimport { openai } from \"@ai-sdk\u002Fopenai\";\nimport { MemoryClient } from \"@xtraceai\u002Fmemory\";\nimport { memoryTools } from \"@xtraceai\u002Fmemory\u002Fai-sdk\";\n\nconst client = new MemoryClient({ apiKey, orgId });\n\nconst result = streamText({\n  model: openai(\"gpt-4o-mini\"),\n  tools: memoryTools(client, { user_id: \"alice\", conv_id: \"conv_42\" }),\n  messages,\n});\n```\n\nThe model gets two tools: `search_memory(query, limit?)` and `save_memory(fact)`. Use `{ includeSave: false }` for read-only.\n\n## Error handling\n\nAll errors extend `MemoryError`. Match on `error.code` for stable machine-readable handling:\n\n```ts\nimport { MemoryNotFound, RateLimited } from \"@xtraceai\u002Fmemory\";\n\ntry {\n  await client.memories.get(\"fact_does_not_exist\");\n} catch (err) {\n  if (err instanceof MemoryNotFound) {\n    \u002F\u002F ...\n  } else if (err instanceof RateLimited) {\n    \u002F\u002F err.retryAfter is the seconds to wait\n  }\n}\n```\n\n## Documentation\n\nFull documentation at [docs.mem.xtrace.ai](https:\u002F\u002Fdocs.mem.xtrace.ai).\n\n# License\n\nMIT — see [LICENSE](LICENSE).\n","XTraceAI\u002Fmemory-sdk-ts 是一个用于 xtrace 记忆 API 的 TypeScript SDK，旨在为 AI 代理提供长期记忆功能。通过发送原始对话消息，该服务能够在后台提取结构化的事实、工件和事件，并支持使用向量加过滤器查询进行搜索，从而赋予 AI 代理持久的记忆能力。其核心功能包括异步或同步的消息摄入、基于语义的向量搜索以及对记忆数据的管理（如列表展示、获取、更新和软删除）。此外，它还提供了与 Vercel AI SDK 的集成，便于实现自动上下文理解和工具驱动的回忆。适用于需要增强 AI 代理学习能力和交互体验的各种应用场景，特别是在需要维护用户历史对话记录的服务中表现尤为出色。项目采用 MIT 许可证发布，支持 Node.js 18 及以上版本及浏览器环境。",2,"2026-06-11 04:01:17","CREATED_QUERY"]