[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-96152":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":8,"htmlUrl":8,"language":9,"languages":8,"totalLinesOfCode":8,"stars":10,"forks":11,"watchers":12,"openIssues":11,"contributorsCount":11,"subscribersCount":11,"size":11,"stars1d":11,"stars7d":11,"stars30d":13,"stars90d":11,"forks30d":11,"starsTrendScore":11,"compositeScore":14,"rankGlobal":8,"rankLanguage":8,"license":15,"archived":16,"fork":16,"defaultBranch":17,"hasWiki":18,"hasPages":16,"topics":19,"createdAt":8,"pushedAt":8,"updatedAt":20,"readmeContent":21,"aiSummary":22,"trendingCount":11,"starSnapshotCount":11,"syncStatus":23,"lastSyncTime":24,"discoverSource":25},96152,"Paw-memory","david66l\u002FPaw-memory","david66l",null,"TypeScript",120,0,103,7,37.7,"MIT License",false,"main",true,[],"2026-09-20 04:01:32","\u003Cp align=\"center\">\n  \u003Cimg src=\"docs\u002Fassets\u002Freadme-banner.svg\" alt=\"Paw Memory — evidence-first memory for agents\" width=\"100%\">\n\u003C\u002Fp>\n\n\u003Ch1 align=\"center\">Paw Memory\u003C\u002Fh1>\n\u003Cp align=\"center\">\u003Cstrong>Memory that keeps its sources.\u003C\u002Fstrong>\u003C\u002Fp>\n\u003Cp align=\"center\">Evidence-first memory for agents · TypeScript core · Persistent PostgreSQL SDK\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"LICENSE\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-2563eb\" alt=\"License: MIT\">\u003C\u002Fa>\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flanguage-TypeScript-3178c6\" alt=\"Language: TypeScript\">\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fruntime-Bun%201.3.14-14151a\" alt=\"Runtime: Bun 1.3.14\">\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fstorage-PostgreSQL-0f766e\" alt=\"Storage: PostgreSQL\">\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\u003Cstrong>English\u003C\u002Fstrong> · \u003Ca href=\"README.zh-CN.md\">简体中文\u003C\u002Fa>\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"#quick-start\">Quick start\u003C\u002Fa> ·\n  \u003Ca href=\"#benchmarks\">Benchmarks\u003C\u002Fa> ·\n  \u003Ca href=\"#how-it-works\">Architecture\u003C\u002Fa> ·\n  \u003Ca href=\"docs\u002FSDK.md\">SDK guide\u003C\u002Fa> ·\n  \u003Ca href=\"adapters\u002Fpi\u002FREADME.md\">Pi adapter\u003C\u002Fa>\n\u003C\u002Fp>\n\n---\n\nPaw Memory stores original conversation turns, retrieves relevant evidence, and preserves who said what when memory reaches an agent. Derived cards help locate information; the original source remains the evidence.\n\n| Keep the source | Recall with context | Plug into your agent |\n| :--- | :--- | :--- |\n| Original turns retain their roles, timestamps and source identities. | Scoped retrieval returns evidence the host can inspect and render. | Two calls — `retain` and `recall` — with a local PostgreSQL database. |\n\n## Why Paw Memory\n\n| Capability | What it does |\n| --- | --- |\n| **Traceable evidence** | Keeps immutable source turns and binds derived memory cards to them. |\n| **Role-aware context** | Preserves user, assistant and tool authority without treating assistant output as a user fact. |\n| **Scoped retrieval** | Separates tenant, user, workspace and repository data; bounds reasoning to selected sources. |\n| **Durable writes** | Saves evidence and navigation cards transactionally, with idempotent write receipts. |\n| **Host-owned models** | Works without a model by default; supports optional model extraction and host-supplied answer generation. |\n\n## Quick start\n\nFrom the repository root, with **Bun 1.3.14** and Docker Compose (or an existing **PostgreSQL 16+** server):\n\n```sh\nbun install --frozen-lockfile\ncp .env.example .env\ndocker compose up -d --wait\nbun run db:migrate\nbun run example\n```\n\nThe example writes a conversation, closes its connection pool, reconnects, and recalls the original evidence. **No model API key or Python environment is needed; PostgreSQL must be running.**\n\nUsing an existing database? Set `DATABASE_URL` in `.env`, skip the Docker command, and run the migration. The Compose credentials are for local development. See [PostgreSQL setup](docs\u002FPOSTGRESQL.md) for schema permissions, tests and upgrading from the SQLite snapshot.\n\n### Add memory to an agent\n\n```ts\nimport { createMemory, renderMemoryContext } from \"@paw\u002Fmemory\";\n\nconst memory = createMemory({\n  connectionString: process.env.DATABASE_URL!,\n  scope: {\n    tenantId: \"local\",\n    userId: \"alice\",\n    workspaceId: \"personal\",\n    repositoryId: \"travel\",\n  },\n});\n\nawait memory.retain({\n  conversationId: \"trip-1\",\n  turns: [{\n    sequence: 1,\n    role: \"user\",\n    content: \"I stayed in Kyoto for seven days.\",\n    createdAt: \"2026-08-01T00:00:00.000Z\",\n  }],\n});\n\nconst result = await memory.recall(\"How long was my Kyoto trip?\");\nconsole.log(renderMemoryContext(result));\nawait memory.close();\n```\n\n`@paw\u002Fmemory` resolves through this repository's workspace. It is not yet an npm-published package. For optional model extraction, see the [runnable example](examples\u002Fmodel-extraction.ts) and [SDK guide](docs\u002FSDK.md).\n\n\u003Ca id=\"how-it-works\">\u003C\u002Fa>\n\n## How it works\n\n```mermaid\nflowchart TB\n    A[Conversation turns] --> B[Validate and retain]\n    B --> C[(L0 · Original evidence)]\n    B --> D[L1 · Navigation cards]\n    D -. Source references .-> C\n    Q[Agent question] --> R[Scoped retrieval and source lock]\n    C --> R\n    D --> R\n    R --> E[Evidence packet · Roles, sources and coverage]\n    E --> H[Host answer model]\n    classDef source fill:#e7f7f1,stroke:#169b77,color:#123c32\n    classDef engine fill:#edf3ff,stroke:#6283c6,color:#243c64\n    class C,D source\n    class B,R,E engine\n```\n\n**Write once, keep the source.** Original turns are L0 evidence; extracted cards are L1 navigation. Corrections are new turns instead of silent source overwrites. During retrieval, source locks and authority checks constrain the evidence passed to the host. The host owns the final answer model.\n\n\u003Ca id=\"benchmarks\">\u003C\u002Fa>\n\n## Benchmarks\n\n### LongMemEval-S · 90.80%\n\nThe **original full Paw v77 system** reported **454 \u002F 500 correct (90.80%)** on a LongMemEval-S development regression using the AMB evaluation integration.\n\n> This is a historical full-system result, not a measurement of this minimal repository or its PostgreSQL SDK. Public questions were used during development; it is not an official leaderboard submission.\n\n| Answer accuracy | Correct answers | Evaluation scope |\n| :---: | :---: | :---: |\n| **90.80%** | **454 \u002F 500** | **Full Paw v77 system** |\n\n| Category | Correct \u002F Total | Accuracy |\n| --- | ---: | ---: |\n| User fact recall | 67 \u002F 70 | 95.71% |\n| Assistant history recall | 56 \u002F 56 | 100.00% |\n| Cross-session reasoning | 114 \u002F 133 | 85.71% |\n| Temporal reasoning | 121 \u002F 133 | 90.98% |\n| Knowledge updates | 69 \u002F 78 | 88.46% |\n| User preferences | 27 \u002F 30 | 90.00% |\n| **Overall** | **454 \u002F 500** | **90.80%** |\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>Evaluation setup and result provenance\u003C\u002Fstrong>\u003C\u002Fsummary>\n\n\n| Item | Configuration |\n| --- | --- |\n| Evaluated source | Paw v77 · `0331a110359cb0601d41899a3ff98bc4b45a6cad` |\n| Dataset | LongMemEval-S · 500 questions |\n| Storage in the evaluated system | PostgreSQL |\n| Index writer | Prebuilt DeepSeek-v4-Flash index |\n| Read-side, answer and judge model | GLM-5.3-Flash |\n| Embeddings | MiniLM |\n| Source budget | 16 |\n| Cache policy | Compatible model-response replay allowed; not every response was a fresh call |\n\nThe counts and configuration were cross-checked against the Paw development repositories: `paw-memory\u002Fbenchmarks\u002Famb\u002Fresults\u002Fv77-development.json` and `paw-ts-memory-v78\u002Fpackages\u002Fmemory-core\u002FBENCHMARKS.md`. The v78 report attributes this score to the frozen v77 commit above; it does not claim a new 500-question run for v78.\n\nThe full evaluation host and Python reader are maintained separately. This repository includes a [machine-readable result summary](docs\u002Fbenchmark-results.json), not the evaluation runner, dataset or raw model logs. These counts document the reported result; they are not a self-contained reproduction package. See [source provenance and validation](docs\u002FPROVENANCE.md).\n\n\u003C\u002Fdetails>\n\n## Integrations and project layout\n\n| Path | Responsibility |\n| --- | --- |\n| [`packages\u002Fmemory-core`](packages\u002Fmemory-core) | Storage-independent evidence retrieval and context assembly |\n| [`packages\u002Fmemory-sdk`](packages\u002Fmemory-sdk) | `retain`, `recall`, PostgreSQL persistence and optional model extraction |\n| [`examples`](examples) | Persistent memory and model extraction examples |\n| [`adapters\u002Fpi`](adapters\u002Fpi) | Optional Pi lifecycle extension |\n| [`docs`](docs) | SDK limits, architecture, provenance and result summary |\n\nAn agent calls `recall` before answering and `retain` after an exchange. The [Pi adapter](adapters\u002Fpi\u002FREADME.md) demonstrates that lifecycle through a Bun subprocess. Read the [architecture guide](docs\u002FARCHITECTURE.md) to replace storage or integrate another host.\n\n## Development\n\n```sh\nbun run check\n```\n\nSet `TEST_DATABASE_URL` to a development\u002Ftest database (`.env.example` includes the local Compose URL). The validation suite has **404 tests**: 384 core tests and 20 SDK\u002FPi tests, plus lint and type checks. PostgreSQL tests exercise real connections, competing writes, rollback, scope isolation and Pi subprocess persistence. Tests do not call paid models.\n\n[CI](.github\u002Fworkflows\u002Fci.yml) checks the core on Windows\u002FLinux, runs PostgreSQL integration tests on Linux, and checks the standalone core separately. Local PostgreSQL integration was verified on Windows. A live-model Pi conversation has not been tested. `bun run check:core` needs no database.\n\n## Current scope\n\n- The SDK is validated with Bun and exports TypeScript source. PostgreSQL 16+ is required.\n- PostgreSQL retrieval is lexical and append-only. Embeddings, robust paraphrase matching and automatic update\u002Fmerge policies are not included.\n- Conversation text is stored as supplied. The host owns authentication, privacy controls and backups.\n\nSee [SDK usage and limits](docs\u002FSDK.md) before choosing a production retrieval adapter.\n\n## License\n\n[MIT](LICENSE) © 2026 Paw Memory contributors. Packages have `private: true` to prevent accidental npm publication; this does not restrict use under the MIT license.\n","Paw Memory 是一个面向 AI 代理（agents）的证据优先型持久化记忆系统，核心目标是完整保留原始对话片段的来源、角色、时间戳和上下文归属。它基于 TypeScript 实现，内置 PostgreSQL 存储支持，提供 `retain`（存入带溯源信息的原始交互）与 `recall`（按作用域检索可验证证据）两个简洁接口。系统强调不可变证据链、角色感知上下文隔离、多租户\u002F工作区数据分片及事务安全写入，不依赖大模型 API 或 Python 运行时。适用于需审计性、可追溯性与强上下文控制的生产级 AI 代理场景，如合规客服、知识协作助手与企业级 RAG 构建。",2,"2026-09-11 02:30:06","CREATED_QUERY"]