@@ -9,14 +9,16 @@ the hub’s existing `createResolveTenant` middleware supplies principal + tenan
99` defineTool ` factories; ingestion modules call the same routes or the in-process
1010plane. That’s the product.
1111
12- Requires Bun 1.2+.
12+ ## Requirements
1313
14- ## Install
14+ ** Bun-only runtime.** This package ships TypeScript source (` src/*.ts ` , see
15+ ` package.json ` ` exports ` ) and declares ` "engines": { "bun": ">=1.2.0" } ` — run
16+ it under Bun 1.2+. There is intentionally no ` dist ` build step.
1517
16- Not published to npm yet:
18+ ## Install
1719
1820``` bash
19- bun add git+https://github.com/corbitsdev/ corbits- memory.git
21+ npm install @ corbits/ memory
2022```
2123
2224Peer stack you already have on an Interchange hub: ` @intx/authz ` , ` @intx/hub-api ` ,
@@ -46,6 +48,10 @@ That exposes:
4648| POST | ` /api/tenants/:tenantId/memory/add ` | ` ("memory", "add") ` |
4749| POST | ` /api/tenants/:tenantId/memory/search ` | ` ("memory", "search") ` |
4850| GET | ` /api/tenants/:tenantId/memory/list ` | ` ("memory", "search") ` |
51+ | GET | ` /api/tenants/:tenantId/memory/feed ` | ` ("memory", "search") ` |
52+ | POST | ` /api/tenants/:tenantId/memory/documents/:documentId/forget ` | ` ("memory", "forget") ` |
53+ | POST | ` /api/tenants/:tenantId/memory/documents/:documentId/purge ` | ` ("memory", "purge") ` |
54+ | POST | ` /api/tenants/:tenantId/memory/versions/:versionId/retention-class ` | ` ("memory", "forget") ` |
4955
5056Bodies never carry tenant/principal — routes read ` c.get("principal") ` from
5157context (set by the hub’s tenant middleware). Missing principal → ** 401** .
@@ -55,8 +61,39 @@ Missing grant → **403**.
5561POST /api/tenants/:tenantId/memory/add { "title", "text", "access_tags"?, "share"? }
5662POST /api/tenants/:tenantId/memory/search { "query", "limit"?, "kinds"?, "entity_ids"?, "sources"?, "includeEvidence"? }
5763GET /api/tenants/:tenantId/memory/list ?limit=
64+ GET /api/tenants/:tenantId/memory/feed ?after=&limit=&exclude_generator=
65+ POST /api/tenants/:tenantId/memory/documents/:documentId/forget { "reason"? }
66+ POST /api/tenants/:tenantId/memory/documents/:documentId/purge (no body)
67+ POST /api/tenants/:tenantId/memory/versions/:versionId/retention-class { "retention_class": "durable" | "standard" | "ephemeral" | "source_only" }
5868```
5969
70+ ### Feed
71+
72+ ` GET …/memory/feed ` pulls new live versions after a cursor (` after ` = last
73+ consumed ` feedSeq ` , ` limit ` 1–100, ` exclude_generator ` skips one
74+ ` generator_agent_id ` ). Grant: ` ("memory", "search") ` , same grant-tag
75+ post-filter as search. Details: [ ` docs/FEED.md ` ] ( docs/FEED.md ) ; the resident
76+ distiller consumes this feed — see ` @corbits/memory/distiller `
77+ (` createResidentDistiller ` , ` runDistillTick ` ) and
78+ [ ` docs/DISTILLER.md ` ] ( docs/DISTILLER.md ) .
79+
80+ ### Retention (` forget ` , ` purge ` , ` retention-class ` )
81+
82+ - ` POST …/documents/:documentId/forget ` — tombstone: stops appearing in
83+ search/feed, chunk text redacted, version rows stay for audit.
84+ Grant ` ("memory", "forget") ` ** plus** the caller must be the document’s
85+ creator. Plane verb: ` memory.tombstoneDocument ` .
86+ - ` POST …/documents/:documentId/purge ` — hard delete, irreversible; refused
87+ while a durable version is untombstoned. Grant ` ("memory", "purge") `
88+ ** plus** creator check. Plane verb: ` memory.hardDeleteDocument ` .
89+ - ` POST …/versions/:versionId/retention-class ` — set a version’s retention
90+ class (` setRetentionClass ` ). Grant ` ("memory", "forget") ` ** plus** the
91+ caller must be that version’s creator.
92+
93+ Details: [ ` docs/RETENTION.md ` ] ( docs/RETENTION.md ) . Engine config for these
94+ paths comes from ` @corbits/memory/config ` (` loadMemoryConfig ` ,
95+ ` MemoryConfig ` ).
96+
6097## Workflow agent tools
6198
6299This package exports Interchange ` defineTool ` factories at
@@ -123,7 +160,7 @@ always sees their own docs. Details:
123160
124161## Config
125162
126- ` loadMemoryConfig() ` reads env (see ` .env.example ` ). For the default pgvector
163+ ` loadMemoryConfig() ` (from ` @corbits/memory/config ` ) reads env (see ` .env.example ` ). For the default pgvector
127164store you need ` DATABASE_URL ` , ` EMBED_BASE_URL ` , ` EMBED_MODEL ` .
128165
129166``` ts
0 commit comments