{"_id":"@aifcoding/opencode-memory","_rev":"9-f3fc4b61795f45c9aea0c24a9cf8341f","name":"@aifcoding/opencode-memory","dist-tags":{"latest":"2.1.0"},"versions":{"0.1.0":{"name":"@aifcoding/opencode-memory","version":"0.1.0","keywords":["opencode","plugin","memory","sqlite","jieba","rag","ai"],"license":"MIT","_id":"@aifcoding/opencode-memory@0.1.0","maintainers":[{"name":"aifcodinggaopser","email":"shaoecnu@gmail.com"}],"homepage":"https://github.com/aifcoding/opencode-memory#readme","bugs":{"url":"https://github.com/aifcoding/opencode-memory/issues"},"dist":{"shasum":"ff4df1648d5e97df83c8a1983a992733ff3eb1ff","tarball":"https://registry.npmjs.org/@aifcoding/opencode-memory/-/opencode-memory-0.1.0.tgz","fileCount":5,"integrity":"sha512-o6HTW47lFUHDERmJW4IZm8RZUIiKe0Rvtd0zbb40d1z2/ymwAQgOWOXCnuxHfh7CyBn4ZddKTfIRBd3sEzAwWg==","signatures":[{"sig":"MEUCIA7UTHM+dQLjubRwIT+X1MCIg/eGiCH2S7tUQ9O2DBuZAiEAvBnWZPa8oMddDbwD3reZlLDyG5LVOAHJ2VKTMw/1TqA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":64747},"main":"dist/plugin.js","type":"module","module":"dist/plugin.js","exports":"./dist/plugin.js","gitHead":"d87d1f99b96ed4927ccb6d3ee3e612684f2add52","scripts":{"test":"bun test","build":"bun build plugin.ts --outdir dist --target bun --external jieba-wasm --external zod --external jsonc-parser","prepublishOnly":"bun test && bun run build"},"_npmUser":{"name":"aifcodinggaopser","email":"shaoecnu@gmail.com"},"repository":{"url":"git+https://github.com/aifcoding/opencode-memory.git","type":"git"},"_npmVersion":"11.18.0","description":"opencode 本地持久记忆插件：三层记忆（长期知识/情景摘要/会话工作记忆），纯本地 SQLite + jieba 中文检索","directories":{},"_nodeVersion":"26.6.0","dependencies":{"zod":"^4.5.4","jieba-wasm":"^2.4.0","jsonc-parser":"^3.3.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/opencode-memory_0.1.0_1789026663573_0.7770212741588773","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@aifcoding/opencode-memory","version":"0.1.1","keywords":["opencode","plugin","memory","sqlite","jieba","rag","ai"],"license":"MIT","_id":"@aifcoding/opencode-memory@0.1.1","maintainers":[{"name":"aifcodinggaopser","email":"shaoecnu@gmail.com"}],"homepage":"https://github.com/aifcoding/opencode-memory#readme","bugs":{"url":"https://github.com/aifcoding/opencode-memory/issues"},"dist":{"shasum":"ca0bc216c48faaa53df119c5ca52f36f194d2ede","tarball":"https://registry.npmjs.org/@aifcoding/opencode-memory/-/opencode-memory-0.1.1.tgz","fileCount":5,"integrity":"sha512-7ob1OreYM+/H9dojKOQi9qHpQ1RbqCNXzrglTbM+C1XVVW54qZzRcNt4espiVK9/tN4b4Wv4Ox3wiq9YulrYFQ==","signatures":[{"sig":"MEYCIQCrTBcaoFMJBvjCu/dyJ6g1L9P9ndGMigPhlKq5E30dDQIhAKSeVX03eeFz8P7qhKblCrYE0vyKAEd1QH9k1LfOTkOQ","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":64674},"main":"dist/plugin.js","type":"module","module":"dist/plugin.js","exports":"./dist/plugin.js","gitHead":"98ee0e718d30ad879ae47aa0e14412ec18044283","scripts":{"test":"bun test","build":"bun build plugin.ts --outdir dist --target bun --external jieba-wasm --external zod --external jsonc-parser","prepublishOnly":"bun test && bun run build"},"_npmUser":{"name":"aifcodinggaopser","email":"shaoecnu@gmail.com"},"repository":{"url":"git+https://github.com/aifcoding/opencode-memory.git","type":"git"},"_npmVersion":"11.18.0","description":"opencode 本地持久记忆插件：三层记忆（长期知识/情景摘要/会话工作记忆），纯本地 SQLite + jieba 中文检索","directories":{},"_nodeVersion":"26.6.0","dependencies":{"zod":"^4.5.4","jieba-wasm":"^2.4.0","jsonc-parser":"^3.3.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/opencode-memory_0.1.1_1789028248119_0.9235780001935094","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@aifcoding/opencode-memory","version":"0.1.2","keywords":["opencode","plugin","memory","sqlite","jieba","rag","ai"],"license":"MIT","_id":"@aifcoding/opencode-memory@0.1.2","maintainers":[{"name":"aifcodinggaopser","email":"shaoecnu@gmail.com"}],"homepage":"https://github.com/aifcoding/opencode-memory#readme","bugs":{"url":"https://github.com/aifcoding/opencode-memory/issues"},"dist":{"shasum":"6b99e6a9900d594e09ce33adcae69f2dc0f6285f","tarball":"https://registry.npmjs.org/@aifcoding/opencode-memory/-/opencode-memory-0.1.2.tgz","fileCount":5,"integrity":"sha512-X8zShXyt+lr5Eexdxfo4JOzNLTL0YQnQS/ln6+gYvo7bxh9aNGRzQWGQI6LjCp7jA0bVp+INCRpZUhEqfO/T4w==","signatures":[{"sig":"MEUCIFzsExhqt+NKcAJKe9OqpkCIyWJuS79ZgRmeJqmV+JqxAiEAiXyUyBF1+aV2melieAT/4+IoUimWcyd7chBonl8kBy0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":65202},"main":"dist/plugin.js","type":"module","module":"dist/plugin.js","exports":"./dist/plugin.js","gitHead":"bdc50759c262cd6892e79b14996254dd1770d9c1","scripts":{"test":"bun test","build":"bun build plugin.ts --outdir dist --target bun --external jieba-wasm --external zod --external jsonc-parser","typecheck":"tsc --noEmit","prepublishOnly":"bun run typecheck && bun test && bun run build"},"_npmUser":{"name":"aifcodinggaopser","email":"shaoecnu@gmail.com"},"repository":{"url":"git+https://github.com/aifcoding/opencode-memory.git","type":"git"},"_npmVersion":"11.18.0","description":"opencode 本地持久记忆插件：三层记忆（长期知识/情景摘要/会话工作记忆），纯本地 SQLite + jieba 中文检索","directories":{},"_nodeVersion":"26.6.0","dependencies":{"zod":"4.1.8","jieba-wasm":"^2.4.0","jsonc-parser":"^3.3.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"^1.4.2","typescript":"^7.0.2","@opencode-ai/plugin":"1.18.30"},"_npmOperationalInternal":{"tmp":"tmp/opencode-memory_0.1.2_1789030825162_0.1615346058287792","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@aifcoding/opencode-memory","version":"0.1.3","license":"MIT","_id":"@aifcoding/opencode-memory@0.1.3","maintainers":[{"name":"aifcodinggaopser","email":"shaoecnu@gmail.com"}],"homepage":"https://github.com/aifcoding/opencode-memory#readme","bugs":{"url":"https://github.com/aifcoding/opencode-memory/issues"},"dist":{"shasum":"151981317f0017140304ba317a60813d3e4adb9c","tarball":"https://registry.npmjs.org/@aifcoding/opencode-memory/-/opencode-memory-0.1.3.tgz","fileCount":4,"integrity":"sha512-aiaE2cmSlHaFOKDk2M4XJOd/fjecbSu9i/8mNlq6JYgPmRdEOd5OK4k62X/uf/p6IHKF9KzvHLHLJpx1OVmhmQ==","signatures":[{"sig":"MEUCIB74/WpUwTpyEsaeL3VXzkLwRgce5vn0zfXvfgZhXXl4AiEA7riMEmdszWEi5JUT1/F0IsBKsvQUFxXsH9UUZcNMreM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQDHANHj6exJnVV95e0uwsxtYx1UozjGhr0TTw0fME+z5gIhAIvEzMMPxwI6e0VkJR8mVaRvCu/oT57MsKZAWizRewOn","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29123},"main":"dist/plugin.js","type":"module","module":"dist/plugin.js","exports":{"import":"./dist/plugin.js"},"gitHead":"95fbe47189fc2d73a301609f384214660ab6f82b","scripts":{"test":"bun test tests","build":"bun build src/plugin.ts --outdir dist --target bun --external @aifcoding/memory-core --external jieba-wasm --external zod --external jsonc-parser","typecheck":"tsc --noEmit","prepublishOnly":"bun run typecheck && bun test && bun run build"},"_npmUser":{"name":"aifcodinggaopser","email":"shaoecnu@gmail.com"},"repository":{"url":"git+https://github.com/aifcoding/opencode-memory.git","type":"git"},"_npmVersion":"11.18.0","description":"opencode 本地持久记忆插件","directories":{},"_nodeVersion":"26.6.0","dependencies":{"zod":"4.1.8","jsonc-parser":"^3.3.1","@aifcoding/memory-core":"^0.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"^1.4.2","typescript":"^7.0.2","@opencode-ai/plugin":"1.18.30"},"_npmOperationalInternal":{"tmp":"tmp/opencode-memory_0.1.3_1789119602172_0.15126596968447115","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@aifcoding/opencode-memory","version":"0.1.4","license":"MIT","_id":"@aifcoding/opencode-memory@0.1.4","maintainers":[{"name":"aifcodinggaopser","email":"shaoecnu@gmail.com"}],"homepage":"https://github.com/aifcoding/opencode-memory#readme","bugs":{"url":"https://github.com/aifcoding/opencode-memory/issues"},"dist":{"shasum":"3dd4c148dd9cfdee7252b3c128286b583fddc274","tarball":"https://registry.npmjs.org/@aifcoding/opencode-memory/-/opencode-memory-0.1.4.tgz","fileCount":4,"integrity":"sha512-Y5iYp88Iy6Wm0A2QRkOoRZYlDYjal4dqCwoRPfg0XdvixowK1VIVlXbix8Ox8NnJotrEOKWm7Jso3gwkNy0flA==","signatures":[{"sig":"MEQCIHODvUqFCByscpqcDzx8PMBEYvdIfZdNm/JRt3S1P4zqAiBP6JrffwKUCAbrL0GnMZDchVfBkSedndpAecG14mufeA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQCba2/GCE0K6l6guglCN0yiW9ld0FO/n99PWJYIViuJGQIgBrxcqGfUC/bmafC19HnAnPoTVnKmGScbG8ymH9zs3yo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31487},"main":"dist/plugin.js","type":"module","module":"dist/plugin.js","exports":{"import":"./dist/plugin.js"},"gitHead":"b51bdb340c2dc3abae54ff0d0c915e2c3dfc53df","scripts":{"test":"bun test tests","build":"bun build src/plugin.ts --outdir dist --target bun --external @aifcoding/memory-core --external jieba-wasm --external zod --external jsonc-parser","typecheck":"tsc --noEmit","prepublishOnly":"bun run typecheck && bun test && bun run build"},"_npmUser":{"name":"aifcodinggaopser","email":"shaoecnu@gmail.com"},"repository":{"url":"git+https://github.com/aifcoding/opencode-memory.git","type":"git"},"_npmVersion":"11.18.0","description":"opencode 本地持久记忆插件","directories":{},"_nodeVersion":"26.6.0","dependencies":{"zod":"4.1.8","jsonc-parser":"^3.3.1","@aifcoding/memory-core":"^0.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"^1.4.2","typescript":"^7.0.2","@opencode-ai/plugin":"1.18.30"},"_npmOperationalInternal":{"tmp":"tmp/opencode-memory_0.1.4_1789274207195_0.6104905364654702","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@aifcoding/opencode-memory","version":"2.0.0","license":"MIT","_id":"@aifcoding/opencode-memory@2.0.0","maintainers":[{"name":"aifcodinggaopser","email":"shaoecnu@gmail.com"}],"homepage":"https://github.com/aifcoding/opencode-memory#readme","bugs":{"url":"https://github.com/aifcoding/opencode-memory/issues"},"dist":{"shasum":"a48ea3e0f19008d745801dcca0cf48429004e2c6","tarball":"https://registry.npmjs.org/@aifcoding/opencode-memory/-/opencode-memory-2.0.0.tgz","fileCount":4,"integrity":"sha512-0a36to7sBPYFlflnXCgG1y/hXE22F8BoFhP78X4D8YyC07t1iwLx67rZatqGqaqRwzmjyni5hbFY9bt/F67QuQ==","signatures":[{"sig":"MEUCIBnPrC1jUPgg4ayFQOqeIhkJf1XLZfqiuhKin73o1izfAiEA3hHOZ3QegRo96+KqtJ40r4ssOZ73gHXTB24cPjPVgmM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCIGqGhcEoRl+BSNTykSHjNQYCbT+nlsuMGQNFlaQ+HYEBAiBp10yfs1/oG2HPFKGTLdWZ0StMF3loQYFEJTMHqACMHg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":46512},"main":"dist/plugin.js","type":"module","module":"dist/plugin.js","exports":{"import":"./dist/plugin.js"},"gitHead":"050533d60d446d6f1d011ae5a5c23ced54ef3da9","scripts":{"test":"bun test tests","build":"bun build src/plugin.ts --outdir dist --target bun --external @aifcoding/memory-core --external jieba-wasm --external zod --external jsonc-parser","typecheck":"tsc --noEmit","prepublishOnly":"bun run typecheck && bun test && bun run build"},"_npmUser":{"name":"aifcodinggaopser","email":"shaoecnu@gmail.com"},"deprecated":"有严重 bug（opencode 启动崩溃），请升级到 2.0.1+","repository":{"url":"git+https://github.com/aifcoding/opencode-memory.git","type":"git"},"_npmVersion":"11.18.0","description":"opencode 本地持久记忆插件","directories":{},"_nodeVersion":"26.6.0","dependencies":{"zod":"4.1.8","jsonc-parser":"^3.3.1","@aifcoding/memory-core":"^0.2.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"^1.4.2","typescript":"^7.0.2","@opencode-ai/plugin":"1.18.30"},"_npmOperationalInternal":{"tmp":"tmp/opencode-memory_2.0.0_1789367114220_0.6116423616487265","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"name":"@aifcoding/opencode-memory","version":"2.0.1","license":"MIT","_id":"@aifcoding/opencode-memory@2.0.1","maintainers":[{"name":"aifcodinggaopser","email":"shaoecnu@gmail.com"}],"homepage":"https://github.com/aifcoding/opencode-memory#readme","bugs":{"url":"https://github.com/aifcoding/opencode-memory/issues"},"dist":{"shasum":"ff85586b68dd557d2810a845e7bc69cfca05ddb1","tarball":"https://registry.npmjs.org/@aifcoding/opencode-memory/-/opencode-memory-2.0.1.tgz","fileCount":4,"integrity":"sha512-4VC8anfvCS4MigGBQ+Lu1UTMzGNjfIY/lNIUG40o8zCXgsLf95ScWfeE62OpIQGaxZz6JswPOUB/1O4LerF8Yw==","signatures":[{"sig":"MEYCIQDcT321nQV6M85IEckWx4IRjVz9WAiMXZi/bNsi/kL+MgIhAK7erc1LijAZDbgkdWG+XwVJ0wcjr7LLBUJNQ1nKZYM6","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQCwV9WTHIUxpXb+8Yi1uZVSuZepdC9tCuevJtieoPCZUQIhAMiYIK8Wahholcy2xDrFdHej/8E2wW6xZPEqr5QYm7Yo","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":46513},"main":"dist/plugin.js","type":"module","module":"dist/plugin.js","exports":{"import":"./dist/plugin.js"},"gitHead":"4830a242137ad3f049d8358b226c3723c1eb695b","scripts":{"test":"bun test tests","build":"bun build src/plugin.ts --outdir dist --target bun --external @aifcoding/memory-core --external jieba-wasm --external zod --external jsonc-parser","typecheck":"tsc --noEmit","prepublishOnly":"bun run typecheck && bun test && bun run build"},"_npmUser":{"name":"aifcodinggaopser","email":"shaoecnu@gmail.com"},"repository":{"url":"git+https://github.com/aifcoding/opencode-memory.git","type":"git"},"_npmVersion":"11.18.0","description":"opencode 本地持久记忆插件","directories":{},"_nodeVersion":"26.6.0","dependencies":{"zod":"4.1.8","jsonc-parser":"^3.3.1","@aifcoding/memory-core":"^0.2.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"^1.4.2","typescript":"^7.0.2","@opencode-ai/plugin":"1.18.30"},"_npmOperationalInternal":{"tmp":"tmp/opencode-memory_2.0.1_1789370302082_0.9783286331324492","host":"s3://npm-registry-packages-npm-production"}},"2.1.0":{"_id":"@aifcoding/opencode-memory@2.1.0","bugs":{"url":"https://github.com/aifcoding/opencode-memory/issues"},"dist":{"shasum":"17ec6c7065d86a1502c86bce5935a6ff0e3d5fdc","tarball":"https://registry.npmjs.org/@aifcoding/opencode-memory/-/opencode-memory-2.1.0.tgz","fileCount":4,"integrity":"sha512-uGZ69pKybXAtDEex3EVLzUUSBFL4JOCxF9+0q9p4r0ne4h63sbFUS03SVfOBOQMdlTXgzlZqRCzbInj9nQ1tpg==","signatures":[{"sig":"MEUCIQCn0U0jahmhhJwx0bhrucbn/8w4Q4zbgMhGXcK9chZyRAIgUHKrc1eP01Mpl0mblypjhN2O/fxKiAVeBSP8Fa/dTlI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD0iWg0A1WIa8V7e3mbKlvM3bFBa1FrMZt0N6L/uIlpBwIhAKl+kAbhxSFx+NRvI+tY3sqNcl/QGAff9qpUO/Yhqp5M"}],"unpackedSize":50495},"main":"dist/plugin.js","name":"@aifcoding/opencode-memory","type":"module","module":"dist/plugin.js","exports":{"import":"./dist/plugin.js"},"gitHead":"830e955f4b67a70dae8d19757818cd0658bfaae7","license":"MIT","scripts":{"test":"bun test tests","build":"bun build src/plugin.ts --outdir dist --target bun --external @aifcoding/memory-core --external jieba-wasm --external zod --external jsonc-parser","typecheck":"tsc --noEmit","prepublishOnly":"bun run typecheck && bun test && bun run build"},"version":"2.1.0","_npmUser":{"name":"aifcodinggaopser","email":"shaoecnu@gmail.com"},"homepage":"https://github.com/aifcoding/opencode-memory#readme","repository":{"url":"git+https://github.com/aifcoding/opencode-memory.git","type":"git"},"_npmVersion":"11.18.0","description":"opencode 本地持久记忆插件","directories":{},"maintainers":[{"name":"aifcodinggaopser","email":"shaoecnu@gmail.com"}],"_nodeVersion":"26.6.0","dependencies":{"zod":"4.1.8","jsonc-parser":"^3.3.1","@aifcoding/memory-core":"^0.3.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"^1.4.2","typescript":"^7.0.2","@opencode-ai/plugin":"1.18.30"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/opencode-memory_2.1.0_1789544711864_0.9571784655524485"}}},"time":{"created":"2026-09-10T07:51:03.047Z","modified":"2026-09-16T07:45:12.133Z","0.1.0":"2026-09-10T07:51:03.699Z","0.1.1":"2026-09-10T08:17:28.243Z","0.1.2":"2026-09-10T09:00:25.297Z","0.1.3":"2026-09-11T09:40:02.256Z","0.1.4":"2026-09-13T04:36:47.270Z","2.0.0":"2026-09-14T06:25:14.296Z","2.0.1":"2026-09-14T07:18:22.169Z","2.1.0":"2026-09-16T07:45:11.941Z"},"bugs":{"url":"https://github.com/aifcoding/opencode-memory/issues"},"license":"MIT","homepage":"https://github.com/aifcoding/opencode-memory#readme","repository":{"url":"git+https://github.com/aifcoding/opencode-memory.git","type":"git"},"description":"opencode 本地持久记忆插件","maintainers":[{"name":"aifcodinggaopser","email":"shaoecnu@gmail.com"}],"readme":"# @aifcoding/opencode-memory\n\n[简体中文](#中文) | [English](#english)\n\n## 中文\n\nOpenCode 本地持久记忆插件，基于 [`@aifcoding/memory-core`](https://github.com/aifcoding/opencode-memory/tree/main/packages/core)。\n\n前置条件：OpenCode 与 Bun。\n\n在 `opencode.json` 或 `opencode.jsonc` 中注册：\n\n```jsonc\n{ \"plugin\": [\"@aifcoding/opencode-memory\"] }\n```\n\n可通过 tuple options 配置数据库路径和 Pin 配额：\n\n```jsonc\n{ \"plugin\": [[\"@aifcoding/opencode-memory\", {\n  \"dbPath\": \"/Users/you/.local/share/opencode/memory/memory.db\",\n  \"pinQuota\": 8000\n}]] }\n```\n\n`dbPath` 必须是绝对路径；默认路径为\n`$HOME/.local/share/opencode/memory/memory.db`，默认 `pinQuota` 为 8000 字符。\n\nRecall 分层召回配置（可选，走默认值即可）：\n\n```jsonc\n{ \"plugin\": [[\"@aifcoding/opencode-memory\", {\n  \"recall\": {\n    \"maxCharacters\": 3000,\n    \"maxOverflowItems\": 10,\n    \"maxOverflowCharacters\": 1500\n  }\n}]] }\n```\n\n`memory_recall` 默认只返回标题+摘要（无摘要时回退正文前 200 字符），预算外候选以轻量 Ref 列表返回，全文用 `memory_read` 获取。\n\n更多功能、配置和工具说明见仓库根目录的 [`README.md`](https://github.com/aifcoding/opencode-memory/blob/main/README.md) 和 [`docs/CONFIGURATION.md`](https://github.com/aifcoding/opencode-memory/blob/main/docs/CONFIGURATION.md)。\n\n## OpenCode adapter overview\n\nThis package is the first adapter for `@aifcoding/memory-core` and provides:\n\n| Tier | Meaning | Storage |\n|---|---|---|\n| Long-term knowledge | Preferences, facts, decisions, solutions, conventions | `memories` |\n| Episodic summaries | Compaction summaries searchable across sessions | `session_summaries` |\n| Session working memory | Persistent per-session key-value context | `session_kv` |\n\nPinned memories are appended as ephemeral reference context on each turn. Compaction summaries are extracted from `session.compacted` and archived idempotently by message ID. The default database is local SQLite at `$HOME/.local/share/opencode/memory/memory.db`; recalled or pinned content enters the model context and may be sent to a remote provider.\n\nThe `<memory-context>` and `<mem_block>` fences are model-side prompts, not a mechanism-level defense against prompt injection.\n\nTool descriptions and results are currently in Simplified Chinese; English localization is not implemented.\n\nCapture is disabled by default. When enabled, configure `capture.enabled`, `capture.agent`, optional `capture.onCompaction` (default `true`), and `capture.maxCandidates` (default `8`). The adapter provides `memory_capture`, `memory_candidates`, `memory_candidate_read`, and `memory_candidate_review`; candidates remain low-trust until explicitly approved.\n\n`autoUpdate` defaults to `true`. At startup the adapter checks npm and refreshes only its own OpenCode cache when a newer version exists; the update is non-blocking and requires an OpenCode restart. Network/install failures are silent.\n\n## 使用示例\n\n以下请求都可以直接复制到 OpenCode 对话中。模型会根据需要调用插件工具。\n\n### 保存长期知识\n\n**你：**\n\n```text\n记住以下项目约定：Go 服务的函数签名使用 context.Context，不要把 gin.Context 传入业务层。类型设为 convention，标签使用 go、context、architecture。\n```\n\n**OpenCode：**\n\n```text\n已记住 (id=12) Go Context 使用约定\n```\n\n对应工具调用：\n\n```text\nmemory_store(\n  title=\"Go Context 使用约定\",\n  content=\"Go 服务的函数签名使用 context.Context，不要把 gin.Context 传入业务层。\",\n  type=\"convention\",\n  tags=[\"go\", \"context\", \"architecture\"]\n)\n```\n\n### 检索中文记忆\n\n**你：**\n\n```text\n检索我保存过的 Context 使用约定。\n```\n\n**OpenCode：**\n\n```text\n- [id=12] Go Context 使用约定\n    Go 服务的函数签名使用 context.Context，不要把 gin.Context 传入业务层。\n```\n\n没有匹配结果时返回：\n\n```text\n无匹配记忆。\n```\n\n插件不会用\"最近记忆\"填充无关结果。\n\n### 固定为每轮上下文\n\n摘要模式适合需要长期生效、但不希望占用过多上下文的规则。\n\n**你：**\n\n```text\n把 id=12 的记忆固定为摘要模式，摘要写成：业务层只接受 context.Context。\n```\n\n**OpenCode：**\n\n```text\n已固定 id=12 (summary)\n```\n\n此后每轮主模型调用都会收到这条参考信息。取消固定：\n\n```text\n取消固定 id=12。\n```\n\n返回：\n\n```text\n已取消固定 id=12\n```\n\n如需注入完整内容：\n\n```text\n把 id=12 的记忆用 full 模式固定。\n```\n\n### 查看和删除长期记忆\n\n```text\n列出最近 10 条长期记忆。\n```\n\n```text\n读取 id=12 的完整内容。\n```\n\n```text\n删除 id=12 的记忆。\n```\n\n`memory_forget` 执行软删除；删除后的条目默认不会出现在列表和检索结果中。\n\n### 检索历史会话摘要\n\n会话发生压缩后，插件会自动归档 OpenCode 生成的 compaction 摘要。\n\n在后续会话中可以询问：\n\n```text\n检索历史会话摘要：头像加载失败。\n```\n\n可能返回：\n\n```text\n- [msg_ab12] 排查了微信头像加载失败问题，根因是 CDN 缓存键未包含图片版本号……\n```\n\n只有已经发生压缩并成功归档的会话才会出现在情景摘要检索结果中。\n\n### 使用会话工作记忆\n\n保存会话级信息：\n\n```text\n把当前需求编号 DEV-2048 存到会话工作记忆，键名使用 ticket。\n```\n\n读取：\n\n```text\n读取会话工作记忆中的 ticket。\n```\n\n列出当前会话的全部键值：\n\n```text\n列出当前会话工作记忆。\n```\n\n删除：\n\n```text\n删除会话工作记忆中的 ticket。\n```\n\n这些键值按 `sessionID` 隔离并持久保存（当前版本不自动清理），不会作为长期知识参与检索或自动注入。\n## OpenCode 工具参考\n\n### 长期知识\n\n| 工具 | 说明 | 参数 |\n|---|---|---|\n| `memory_store` | 存储一条长期记忆，适合保存个人偏好、环境事实、决策和经验教训 | `title: string` 必填；`content: string` 必填；`type?: \"preference\" \\| \"fact\" \\| \"decision\" \\| \"solution\" \\| \"convention\"`，默认 `\"fact\"`；`tags?: string[]`，默认 `[]` |\n| `memory_recall` | 分层检索：默认返回标题+摘要（无摘要回退正文前 200 字），预算外候选返回标题导航，全文用 `memory_read` | `query: string` 必填；`maxCharacters?: number`（1–20000） |\n| `memory_ls` | 按更新时间倒序列出记忆 | `limit?: number`，默认 `20` |\n| `memory_read` | 按 ID 读取记忆完整内容 | `id: number` 必填 |\n| `memory_forget` | 软删除记忆 | `id: number` 必填 |\n| `memory_pin` | 固定或取消固定记忆；固定后每轮自动注入上下文 | `id: number` 必填；`pinned: boolean` 必填；`pinMode?: \"full\" \\| \"summary\"`，默认 `\"summary\"`；`summary?: string`，默认使用条目已有摘要 |\n| `memory_pins` | 列出当前固定的记忆 | 无 |\n\n#### `memory_store` 类型\n\n| 类型 | 用途 |\n|---|---|\n| `preference` | 个人偏好或工具选择 |\n| `fact` | 环境、项目或业务事实 |\n| `decision` | 已确认的技术或产品决策 |\n| `solution` | 问题根因、解决方案或经验教训 |\n| `convention` | 编码规范、流程约定或团队惯例 |\n\n#### `memory_pin` 模式\n\n| 模式 | 注入内容 | 适用场景 |\n|---|---|---|\n| `summary` | 一行摘要 | 长期规则、偏好和高频约定 |\n| `full` | 记忆正文 | 内容较短且需要完整上下文的知识 |\n\n`summary` 模式要求摘要非空。如果条目没有已有摘要，调用时必须提供 `summary`。固定后的总注入量受 `pinQuota` 限制；超额时插件拒绝操作，不会自动移除已有固定记忆。\n\n### 情景摘要\n\n| 工具 | 说明 | 参数 |\n|---|---|---|\n| `recall_summaries` | 检索历史会话中自动归档的压缩摘要 | `query: string` 必填 |\n\n每次收到 `session.compacted` 事件后，插件读取 compaction agent 生成的摘要，并以压缩消息 ID 幂等写入 `session_summaries`。\n\n### 会话工作记忆\n\n| 工具 | 说明 | 参数 |\n|---|---|---|\n| `kv_set` | 保存当前会话可见的键值；同名键会覆盖旧值 | `key: string` 必填；`value: string` 必填 |\n| `kv_get` | 读取当前会话的指定键值 | `key: string` 必填 |\n| `kv_list` | 列出当前会话的全部键值 | 无 |\n| `kv_del` | 删除当前会话的指定键值 | `key: string` 必填 |\n\n## Usage examples\n\nThese prompts can be pasted directly into an OpenCode conversation. The model calls the relevant tool as needed.\n\n> Note: tool descriptions and user-facing tool results are currently emitted in Simplified Chinese. English localization is not yet implemented.\n\n### Store long-term knowledge\n\n**You:**\n\n```text\nRemember this convention: Go service functions take context.Context and never pass gin.Context into the business layer. Type it as convention, tags go, context, architecture.\n```\n\n**OpenCode:**\n\n```text\n已记住 (id=12) Go Context 使用约定\n```\n\nUnderlying tool call:\n\n```text\nmemory_store(\n  title=\"Go Context 使用约定\",\n  content=\"Go 服务的函数签名使用 context.Context，不要把 gin.Context 传入业务层。\",\n  type=\"convention\",\n  tags=[\"go\", \"context\", \"architecture\"]\n)\n```\n\n### Search memories in Chinese\n\n**You:**\n\n```text\n检索我保存过的 Context 使用约定。\n```\n\n**OpenCode:**\n\n```text\n- [id=12] Go Context 使用约定\n    Go 服务的函数签名使用 context.Context，不要把 gin.Context 传入业务层。\n```\n\nWith no match, it returns:\n\n```text\n无匹配记忆。\n```\n\nThe plugin never pads results with \"recent\" unrelated memories.\n\n### Pin a memory into every turn\n\nSummary mode suits rules that should persist long-term without consuming much context.\n\n**You:**\n\n```text\n把 id=12 的记忆固定为摘要模式，摘要写成：业务层只接受 context.Context。\n```\n\n**OpenCode:**\n\n```text\n已固定 id=12 (summary)\n```\n\nFrom then on, every main-model turn receives this reference. To unpin:\n\n```text\n取消固定 id=12。\n```\n\n```text\n已取消固定 id=12\n```\n\nTo inject the full content instead:\n\n```text\n把 id=12 的记忆用 full 模式固定。\n```\n\n### List and delete long-term memories\n\n```text\n列出最近 10 条长期记忆。\n```\n\n```text\n读取 id=12 的完整内容。\n```\n\n```text\n删除 id=12 的记忆。\n```\n\n`memory_forget` soft-deletes; deleted entries no longer appear in lists or search results.\n\n### Search archived session summaries\n\nAfter a session is compacted, the plugin auto-archives the compaction summary OpenCode generated.\n\nIn a later session, ask:\n\n```text\n检索历史会话摘要：头像加载失败。\n```\n\nA possible result:\n\n```text\n- [msg_ab12] 排查了微信头像加载失败问题，根因是 CDN 缓存键未包含图片版本号……\n```\n\nOnly sessions that have been compacted and successfully archived appear in episodic search.\n\n### Use session working memory\n\nStore session-scoped info:\n\n```text\n把当前需求编号 DEV-2048 存到会话工作记忆，键名使用 ticket。\n```\n\nRead:\n\n```text\n读取会话工作记忆中的 ticket。\n```\n\nList all keys for this session:\n\n```text\n列出当前会话工作记忆。\n```\n\nDelete:\n\n```text\n删除会话工作记忆中的 ticket。\n```\n\nThese keys are scoped by `sessionID` and persist (no auto-cleanup in the current version); they do not participate in long-term search or injection.\n## English\n\n## OpenCode tool reference\n\n### Long-term knowledge\n\n| Tool | Description | Arguments |\n|---|---|---|\n| `memory_store` | Store a long-term memory (preferences, facts, decisions, lessons learned) | `title: string` required; `content: string` required; `type?: \"preference\" \\| \"fact\" \\| \"decision\" \\| \"solution\" \\| \"convention\"`, default `\"fact\"`; `tags?: string[]`, default `[]` |\n| `memory_recall` | Layered search; returns title + summary (or first 200 chars); overflow candidates as title-only refs; full content via `memory_read` | `query: string` required; `maxCharacters?: number` (1–20000) |\n| `memory_ls` | List memories, most recently updated first | `limit?: number`, default `20` |\n| `memory_read` | Read a memory's full content by ID | `id: number` required |\n| `memory_forget` | Soft-delete a memory | `id: number` required |\n| `memory_pin` | Pin or unpin a memory; pinned memories are injected every turn | `id: number` required; `pinned: boolean` required; `pinMode?: \"full\" \\| \"summary\"`, default `\"summary\"`; `summary?: string`, defaults to the entry's existing summary |\n| `memory_pins` | List currently pinned memories | none |\n\n#### `memory_store` types\n\n| Type | Purpose |\n|---|---|\n| `preference` | Personal preference or tool choice |\n| `fact` | Environment, project, or business fact |\n| `decision` | A confirmed technical or product decision |\n| `solution` | Root cause, solution, or lesson learned |\n| `convention` | Coding standard, process convention, or team practice |\n\n#### `memory_pin` modes\n\n| Mode | Injected content | Best for |\n|---|---|---|\n| `summary` | A one-line summary | Long-lived rules, preferences, high-frequency conventions |\n| `full` | The full content | Short knowledge that needs complete context |\n\n`summary` mode requires a non-empty summary. If the entry has none, you must provide `summary` in the call. Total injected size is bounded by `pinQuota`; when exceeded, the plugin rejects the operation instead of silently dropping existing pins.\n\n### Episodic summaries\n\n| Tool | Description | Arguments |\n|---|---|---|\n| `recall_summaries` | Search auto-archived compaction summaries from past sessions | `query: string` required |\n\nOn each `session.compacted` event, the plugin reads the summary produced by the compaction agent and idempotently writes it to `session_summaries`, keyed by the compaction message ID.\n\n### Session working memory\n\n| Tool | Description | Arguments |\n|---|---|---|\n| `kv_set` | Store a session-scoped key-value pair; overwrites on duplicate key | `key: string` required; `value: string` required |\n| `kv_get` | Read a session-scoped value | `key: string` required |\n| `kv_list` | List all key-value pairs for the current session | none |\n| `kv_del` | Delete a session-scoped key | `key: string` required |\n","readmeFilename":"README.md"}