Skip to content

Commit eb45eef

Browse files
Address pre-publish review findings for corbits-memory (#37)
1 parent a83765a commit eb45eef

3 files changed

Lines changed: 48 additions & 8 deletions

File tree

‎README.md‎

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@ bundle and call the run-scoped routes under `/api/workflow-memory/*`;
1010
ingestion modules call the tenant routes or the in-process plane. That’s the
1111
product.
1212

13-
Requires Bun 1.2+. `engines.node` is `>=24` as a floor for Node-side tooling
14-
(typecheck, pack); native Node does not load this package's extensionless
15-
TypeScript source.
13+
## Requirements
14+
15+
**Bun-only runtime.** This package ships TypeScript source (`src/*.ts`, see
16+
`package.json` `exports`) and declares `"engines": { "bun": ">=1.2.0" }` — run
17+
it under Bun 1.2+. There is intentionally no `dist` build step. `engines.node`
18+
is `>=24` as a floor for Node-side tooling (typecheck, pack); native Node does
19+
not load this package's extensionless TypeScript source.
20+
1621

1722
## Install
1823

@@ -49,6 +54,10 @@ That exposes:
4954
| POST | `/api/tenants/:tenantId/memory/add` | `("memory", "add")` |
5055
| POST | `/api/tenants/:tenantId/memory/search` | `("memory", "search")` |
5156
| GET | `/api/tenants/:tenantId/memory/list` | `("memory", "search")` |
57+
| GET | `/api/tenants/:tenantId/memory/feed` | `("memory", "search")` |
58+
| POST | `/api/tenants/:tenantId/memory/documents/:documentId/forget` | `("memory", "forget")` |
59+
| POST | `/api/tenants/:tenantId/memory/documents/:documentId/purge` | `("memory", "purge")` |
60+
| POST | `/api/tenants/:tenantId/memory/versions/:versionId/retention-class` | `("memory", "forget")` |
5261

5362
Bodies never carry tenant/principal — routes read `c.get("principal")` from
5463
context (set by the hub’s tenant middleware). Missing principal → **401**.
@@ -58,8 +67,39 @@ Missing grant → **403**.
5867
POST /api/tenants/:tenantId/memory/add { "title", "text", "access_tags"?, "share"? }
5968
POST /api/tenants/:tenantId/memory/search { "query", "limit"?, "kinds"?, "entity_ids"?, "sources"?, "includeEvidence"? }
6069
GET /api/tenants/:tenantId/memory/list ?limit=
70+
GET /api/tenants/:tenantId/memory/feed ?after=&limit=&exclude_generator=
71+
POST /api/tenants/:tenantId/memory/documents/:documentId/forget { "reason"? }
72+
POST /api/tenants/:tenantId/memory/documents/:documentId/purge (no body)
73+
POST /api/tenants/:tenantId/memory/versions/:versionId/retention-class { "retention_class": "durable" | "standard" | "ephemeral" | "source_only" }
6174
```
6275

76+
### Feed
77+
78+
`GET …/memory/feed` pulls new live versions after a cursor (`after` = last
79+
consumed `feedSeq`, `limit` 1–100, `exclude_generator` skips one
80+
`generator_agent_id`). Grant: `("memory", "search")`, same grant-tag
81+
post-filter as search. Details: [`docs/FEED.md`](docs/FEED.md); the resident
82+
distiller consumes this feed — see `@corbits/memory/distiller`
83+
(`createResidentDistiller`, `runDistillTick`) and
84+
[`docs/DISTILLER.md`](docs/DISTILLER.md).
85+
86+
### Retention (`forget`, `purge`, `retention-class`)
87+
88+
- `POST …/documents/:documentId/forget` — tombstone: stops appearing in
89+
search/feed, chunk text redacted, version rows stay for audit.
90+
Grant `("memory", "forget")` **plus** the caller must be the document’s
91+
creator. Plane verb: `memory.tombstoneDocument`.
92+
- `POST …/documents/:documentId/purge` — hard delete, irreversible; refused
93+
while a durable version is untombstoned. Grant `("memory", "purge")`
94+
**plus** creator check. Plane verb: `memory.hardDeleteDocument`.
95+
- `POST …/versions/:versionId/retention-class` — set a version’s retention
96+
class (`setRetentionClass`). Grant `("memory", "forget")` **plus** the
97+
caller must be that version’s creator.
98+
99+
Details: [`docs/RETENTION.md`](docs/RETENTION.md). Engine config for these
100+
paths comes from `@corbits/memory/config` (`loadMemoryConfig`,
101+
`MemoryConfig`).
102+
63103
## Agent tools (sidecar bundle)
64104

65105
A deployed agent carries the memory tools through one factory at
@@ -127,7 +167,7 @@ always sees their own docs. Details:
127167

128168
## Config
129169

130-
`loadMemoryConfig()` reads env (see `.env.example`). For the default pgvector
170+
`loadMemoryConfig()` (from `@corbits/memory/config`) reads env (see `.env.example`). For the default pgvector
131171
store you need `DATABASE_URL`, `EMBED_BASE_URL`, `EMBED_MODEL`.
132172

133173
```ts

‎bun.lock‎

Lines changed: 3 additions & 3 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
@@ -64,7 +64,7 @@
6464
"postgres": "^3.4.7"
6565
},
6666
"devDependencies": {
67-
"@types/bun": "latest",
67+
"@types/bun": "1.4.2",
6868
"typescript": "^5.9.0"
6969
},
7070
"author": "Sawyer Cutler <sawyer@dirtroad.dev>",

0 commit comments

Comments
 (0)