{"_id":"@ai-yantra/memory","_rev":"2-1da7e35fad516c98ec65aee9c0ddbdf7","name":"@ai-yantra/memory","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@ai-yantra/memory","version":"0.1.0","keywords":["memory","ai-sdk","agents","tools","sqlite","typescript"],"author":"","license":"MIT","_id":"@ai-yantra/memory@0.1.0","maintainers":[{"name":"dumbmachine","email":"ratin.kumar.2k@gmail.com"}],"dist":{"shasum":"21c16b39ddf1ed79e7f17625fc85ae616b54ad29","tarball":"https://registry.npmjs.org/@ai-yantra/memory/-/memory-0.1.0.tgz","fileCount":29,"integrity":"sha512-xdngatmqHwnUx7bzmRxKik8DfTQjlUVoBHmriYCRacAjXzdaS7UppZnkNOH+ssw85pNqnT3F96BfRCFwZesytw==","signatures":[{"sig":"MEUCIQC9n/ayjLxWVM5PNth8Ut5vgiD2IKjjpClL6wPuBRnIqgIgE8TpqIR4AKKVaObeIVSOSRh0DcJ+HixzeGiJF4R8Kq8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":42428},"main":"./dist/index.js","type":"module","_from":"file:ai-yantra-memory-0.1.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"lint":"tsc --noEmit","test":"vitest run","build":"tsc","test:watch":"vitest"},"_npmUser":{"name":"dumbmachine","email":"ratin.kumar.2k@gmail.com"},"_resolved":"/private/var/folders/f1/s_bzsp654zg4vh8jbtcw6wxm0000gn/T/d3f090c1f5ea85b10951e38e3ce4d59e/ai-yantra-memory-0.1.0.tgz","_integrity":"sha512-xdngatmqHwnUx7bzmRxKik8DfTQjlUVoBHmriYCRacAjXzdaS7UppZnkNOH+ssw85pNqnT3F96BfRCFwZesytw==","_npmVersion":"11.4.2","description":"AI SDK Memory Tools backed by SQLite via pg-fs","directories":{},"_nodeVersion":"24.3.0","dependencies":{"ai":"^6.0.42","zod":"^3.23.0","@ai-yantra/pg-fs":"0.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^1.6.0","typescript":"^5.5.4","@types/node":"^20.0.0","better-sqlite3":"^11.0.0","@types/better-sqlite3":"^7.6.0"},"peerDependencies":{"better-sqlite3":">=9.0.0"},"peerDependenciesMeta":{"better-sqlite3":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/memory_0.1.0_1771403026643_0.5451111893773435","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@ai-yantra/memory","version":"0.1.1","description":"AI SDK Memory Tools backed by SQLite via pg-fs","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"dependencies":{"ai":"^6.0.42","zod":"^3.23.0","@ai-yantra/pg-fs":"0.1.1"},"peerDependencies":{"better-sqlite3":">=9.0.0"},"peerDependenciesMeta":{"better-sqlite3":{"optional":true}},"devDependencies":{"better-sqlite3":"^11.0.0","@types/better-sqlite3":"^7.6.0","@types/node":"^20.0.0","typescript":"^5.5.4","vitest":"^1.6.0"},"keywords":["memory","ai-sdk","agents","tools","sqlite","typescript"],"author":"","license":"MIT","engines":{"node":">=18.0.0"},"publishConfig":{"access":"public"},"scripts":{"build":"tsc","test":"vitest run","test:watch":"vitest","lint":"tsc --noEmit"},"_id":"@ai-yantra/memory@0.1.1","_integrity":"sha512-1hEZCPDpGyxau+ywlMcjnOg8rUUAOzB4BC4YJzjPE4AyHb++H8AfTFyfoLSiCQVdKqBHSrNvTze3wjlbSHHwGw==","_resolved":"/private/var/folders/f1/s_bzsp654zg4vh8jbtcw6wxm0000gn/T/25217eb00808c77292fe1dc57196b29b/ai-yantra-memory-0.1.1.tgz","_from":"file:ai-yantra-memory-0.1.1.tgz","_nodeVersion":"24.3.0","_npmVersion":"11.4.2","dist":{"integrity":"sha512-1hEZCPDpGyxau+ywlMcjnOg8rUUAOzB4BC4YJzjPE4AyHb++H8AfTFyfoLSiCQVdKqBHSrNvTze3wjlbSHHwGw==","shasum":"2ff0c18a4522fd10534cba225c18bacba969f564","tarball":"https://registry.npmjs.org/@ai-yantra/memory/-/memory-0.1.1.tgz","fileCount":30,"unpackedSize":44950,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGSGqVLcRmonrGblmvZU/UXFR40HE8RMIytRalLZOVjqAiEAlzY+hdlOSjVpT8g0M3aYwC3+YPxU8xuH/5t9NPFNbcA="}]},"_npmUser":{"name":"dumbmachine","email":"ratin.kumar.2k@gmail.com"},"directories":{},"maintainers":[{"name":"dumbmachine","email":"ratin.kumar.2k@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/memory_0.1.1_1771403699266_0.1490279777678869"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-18T08:23:46.549Z","modified":"2026-02-18T08:34:59.545Z","0.1.0":"2026-02-18T08:23:46.787Z","0.1.1":"2026-02-18T08:34:59.407Z"},"license":"MIT","keywords":["memory","ai-sdk","agents","tools","sqlite","typescript"],"description":"AI SDK Memory Tools backed by SQLite via pg-fs","maintainers":[{"name":"dumbmachine","email":"ratin.kumar.2k@gmail.com"}],"readme":"# @ai-yantra/memory\n\nPersistent memory for AI agents. Give your agent a `/memories` directory it can read, write, and update across conversations — so it remembers context, tracks progress, and picks up where it left off.\n\nInspired by the [Anthropic memory tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/memory-tool), which lets Claude store and retrieve information across conversations through a client-side memory directory. This package implements the same idea as a self-contained library: a SQLite-backed filesystem (via `@ai-yantra/pg-fs`) scoped to `/memories`, with pre-built AI SDK tools and a system prompt that teaches agents to use it. All memory operations are path-validated to stay within the `/memories` boundary.\n\n## Install\n\n```bash\nnpm install @ai-yantra/memory better-sqlite3\n```\n\n## Quick Start\n\n```typescript\nimport { createMemory } from '@ai-yantra/memory';\nimport { openai } from '@ai-sdk/openai';\n\nconst { tools, systemPrompt } = await createMemory({\n  filename: './agent-memory.sqlite', // omit for in-memory\n});\n\nconst agent = new ToolLoopAgent({\n  model: openai('gpt-4'),\n  instructions: systemPrompt,\n  tools,\n});\n\nawait agent.generate({\n  prompt: 'Summarize our last conversation and save your notes',\n});\n```\n\n## Tools\n\nThe agent gets these tools automatically:\n\n| Tool | Description |\n|---|---|\n| `memory_view` | View `/memories` directory listing or read a file with line numbers |\n| `memory_create` | Create a new memory file |\n| `memory_str_replace` | Replace an exact string in a memory file (must be unique) |\n| `memory_insert` | Insert text at a specific line number |\n| `memory_delete` | Delete a file or directory (recursive) |\n| `memory_rename` | Rename or move a file within `/memories` |\n\n## API\n\n```typescript\nimport { createMemory, Memory } from '@ai-yantra/memory';\n\n// High-level: returns tools + system prompt, ready to plug into an agent\nconst { memory, tools, systemPrompt, dbFs } = await createMemory({\n  filename: './memory.sqlite',\n});\n\n// Low-level: use the Memory class directly\nconst { memory } = await Memory.create({ filename: './memory.sqlite' });\n\nawait memory.createFile('/memories/notes.md', '# Session 1\\nStarted refactor.');\nawait memory.view('/memories');\nawait memory.strReplace('/memories/notes.md', 'Started refactor.', 'Refactor complete.');\nawait memory.insert('/memories/notes.md', 2, 'Added tests.\\n');\nawait memory.rename('/memories/notes.md', '/memories/archive/session-1.md');\nawait memory.delete('/memories/archive');\n```\n","readmeFilename":"README.md"}