Skip to content

Commit 58cffaf

Browse files
committed
Address pre-publish review findings for corbits-memory
1 parent 7fcbd00 commit 58cffaf

3 files changed

Lines changed: 45 additions & 8 deletions

File tree

‎README.md‎

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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
1010
plane. 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

2224
Peer 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

5056
Bodies never carry tenant/principal — routes read `c.get("principal")` from
5157
context (set by the hub’s tenant middleware). Missing principal → **401**.
@@ -55,8 +61,39 @@ Missing grant → **403**.
5561
POST /api/tenants/:tenantId/memory/add { "title", "text", "access_tags"?, "share"? }
5662
POST /api/tenants/:tenantId/memory/search { "query", "limit"?, "kinds"?, "entity_ids"?, "sources"?, "includeEvidence"? }
5763
GET /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

6299
This 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
127164
store you need `DATABASE_URL`, `EMBED_BASE_URL`, `EMBED_MODEL`.
128165

129166
```ts

‎bun.lock‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"postgres": "^3.4.7"
6464
},
6565
"devDependencies": {
66-
"@types/bun": "latest",
66+
"@types/bun": "1.4.2",
6767
"typescript": "^5.9.0"
6868
},
6969
"author": "Sawyer Cutler <sawyer@dirtroad.dev>",

0 commit comments

Comments
 (0)