Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

Proposal receipts carry their timestamps, and contract v4 states retention and the person-read arm rule

garrytande46970e64e1
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 05b7de119a..4bf755ef99 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,13 +18,15 @@ identifiers and attribution are available in the pre-removal Git revision
| Area | Before | Now |
|---|---|---|
-| `memory_recall` fact rows | `id`, `text`, `date`, `kind`, `arm` | also `own_page`: `true` when the fact is on the person's own member page in the connection's source, the same check `forget_fact` makes, so `forget_fact` accepts it; `false` when `forget_fact` answers `fact_not_found`. `arm` is unchanged |
-| QM contract | v3: no proposal, no scope marking, no `own_page` | v4 adds `memory_propose` (arguments, caps, the held answer, the proposal receipt and its states, `cancel_write_request` as the proposer's cancel, and "a state not listed means unknown, not published"), `scope_read: true`/`false` on each personal tool, and `own_page`; v1-v3 unchanged |
+| `memory_recall` fact rows | `id`, `text`, `date`, `kind`, `arm` | also `own_page`: `true` when the fact is on the person's own member page in the connection's source, the same check `forget_fact` makes, so `forget_fact` accepts it on ownership; `false` when `forget_fact` for that attested person answers `fact_not_found`. `arm` is unchanged |
+| `get_write_request` / `cancel_write_request` on a proposal | `request_id`, `state`, `retry_after_ms`, `operation`, `source_id`, `slug`, `proposal`, and `decision` / `write_error` when closed | also `created_at` and `updated_at`, as a write's receipt carries them |
+| QM contract | v3: no proposal, no scope marking, no `own_page` | v4 adds `memory_propose` (arguments, caps, the held answer, the proposal receipt and its states, `cancel_write_request` as the proposer's cancel, how long a closed proposal is kept, and "a state not listed means unknown, not published"), `scope_read: true`/`false` on each personal tool, and `own_page`; v1-v3 unchanged |
### Itemized changes
- `src/core/access/member-facts.ts`: `ownMemberFactIds` returns the facts on the caller's own member page. `forget` and `forget_fact` decide ownership with it, and `memory_recall` sets `own_page` from it, so the two cannot disagree.
- `src/core/ops/qm-memory.ts`: each recalled row carries `own_page`.
+- `src/core/persistence/memory-proposals.ts`: the proposal receipt carries `created_at` and `updated_at`.
- `scripts/build-qm-memory-contract.ts`, `docs/contracts/qm-memory-provider/v4.json` (new): contract v4, generated from the live registry; the `actor_required` fix row names `memory_propose` from v4 on.
- Docs: `docs/contracts/qm-memory-provider/README.md`, `docs/guides/qm.md`, `docs/architecture/key-files/access.md`.
- Tests: `test/qm-memory-tools.test.ts` checks on PGLite and Postgres that every `own_page: true` row is one `forget_fact` withdraws and every `false` row is refused `fact_not_found`, whichever arm found it; `test/qm-memory-contract.test.ts` pins the v1-v3 bytes and checks v4 against the registry; `test/qm-memory-propose.test.ts` checks the held answer, the receipt and the cancel against v4.
diff --git a/docs/contracts/qm-memory-provider/README.md b/docs/contracts/qm-memory-provider/README.md
index 602ddd1e02..0cb2ff09f1 100644
--- a/docs/contracts/qm-memory-provider/README.md
+++ b/docs/contracts/qm-memory-provider/README.md
@@ -28,7 +28,8 @@ answers, the proposal states (a state not listed means unknown, not published) a
`cancel_write_request` as the proposer's cancel. Each personal tool carries
`scope_read: true` or `false`: a marked tool reads named sources as their audience,
never as the person. Each `memory_recall` fact carries `own_page`, true when the fact
-sits on the person's own member page, which is exactly when `forget_fact` accepts it.
+sits on the person's own member page, which is exactly when `forget_fact` accepts it on
+ownership (it can still ask the owner for a fact more trusted than the person's own writes).
They are generated from the live operation registry by
`bun scripts/build-qm-memory-contract.ts` (part of `bun run regen:all`), and
diff --git a/docs/contracts/qm-memory-provider/v4.json b/docs/contracts/qm-memory-provider/v4.json
index a334711e37..6e4f25180f 100644
--- a/docs/contracts/qm-memory-provider/v4.json
+++ b/docs/contracts/qm-memory-provider/v4.json
@@ -918,7 +918,8 @@
"unknown": "a state not listed here means unknown, not published: never report the write as saved; poll again or report it as unknown",
"poll": "until a terminal state, after retry_after_ms when it is set"
}
- }
+ },
+ "proposal_receipt": "the fields and states in result are a write's receipt; a request_id from memory_propose that no write holds yet answers memory_propose.receipt instead, with its own fields and states (awaiting_owner, denied, expired, cancelled, failed, conflict)"
},
{
"name": "query",
@@ -1303,7 +1304,7 @@
"query_truncated": "boolean, only when the call sent query_keep",
"code": "actor_unlinked (only on unlinked_recall)"
},
- "arm": "own: the person's own fact from the last 24 hours; ranked: matched by query (a fact found both ways is own); a call that names sources answers ranked rows only",
+ "arm": "own: the person's own fact from the last 24 hours; ranked: matched by query (a fact found both ways is own); a call that names sources answers ranked rows only, unless the credential reads named sources as the person (--attest-read person)",
"own_page": "true: the fact sits on the person's own member page in the connection's source, the same test forget_fact applies, so forget_fact accepts it on ownership; false: forget_fact for this person answers fact_not_found. Independent of arm (an own-page fact older than 24 hours is ranked); false on every row of a scope read (a call that names sources, unless the credential reads them as the person)",
"scope_read": {
"arguments": [
@@ -1467,6 +1468,7 @@
"held": "nothing is written until the brain owner approves; while it waits the proposed text is never in search, recall, git or an export, and no receipt carries it",
"request_id": "derived from the credential, the person and idempotency_key: one request id from proposal to publication",
"replay": "the same idempotency_key with the same fields, from the same person and credential, returns that proposal's current state in status; with other fields it is idempotency_conflict; from another person or credential it is a separate proposal",
+ "retention": "a closed proposal (denied, expired, cancelled, failed, conflict or approved) is deleted proposals.retention_days days after it closed (default 30); after that its request_id answers not_found while no write holds it, an approved write's receipt no longer carries proposal, and the same idempotency_key starts a new proposal under the same request_id, so never resend an old key to learn how a proposal ended",
"awaiting": {
"content": "the result as JSON",
"structuredContent": {
@@ -1487,6 +1489,8 @@
"operation": "\"add_timeline_entry\" | \"add_link\"",
"source_id": "string",
"slug": "string",
+ "created_at": "string",
+ "updated_at": "string",
"proposal": {
"kind": "\"timeline\" | \"link\"",
"target": "string",
@@ -1516,7 +1520,7 @@
"failed",
"conflict"
],
- "approved": "get_write_request answers the write's own receipt (personal_tools get_write_request, published when committed) plus proposal {kind, target, to?, decided_at}",
+ "approved": "get_write_request answers the write's own receipt (personal_tools get_write_request, published when committed) plus proposal {kind, target, to?, decided_at} until the proposal row is deleted (retention)",
"unknown": "a state not listed here means unknown, not published: never report the proposal as written; poll again or report it as unknown",
"poll": "while awaiting_owner, after retry_after_ms (300000, or the time to expiry when sooner)"
},
diff --git a/docs/guides/qm.md b/docs/guides/qm.md
index fbd2962ee1..54ce27c713 100644
--- a/docs/guides/qm.md
+++ b/docs/guides/qm.md
@@ -211,8 +211,8 @@ On success the result is in `structuredContent`, and `content` holds only the te
for the model. Each fact in `structuredContent.facts` carries `arm`: `own` (the
person's own recent fact) or `ranked` (matched by `query`); a recall that names
sources has only `ranked` rows. Each fact also carries `own_page`: `true` when it sits on
-the person's own member page, the same test `forget_fact` uses, so `forget_fact` accepts it;
-`false` means `forget_fact` for that person answers `fact_not_found`. An older own fact can be `ranked` with
+the person's own member page, the same test `forget_fact` uses, so `forget_fact` accepts it on
+ownership; `false` means `forget_fact` for that person answers `fact_not_found`. An older own fact can be `ranked` with
`own_page: true`. A query over 2,000 characters is ranked on its start;
send `query_keep: "tail"` when QM puts its preamble ahead of the turn, and read
`query_truncated` to tell a cut query from a short one. An attested call to a v3 personal tool also gets its
diff --git a/scripts/build-qm-memory-contract.ts b/scripts/build-qm-memory-contract.ts
index b98c97fdb0..df9d8ef394 100644
--- a/scripts/build-qm-memory-contract.ts
+++ b/scripts/build-qm-memory-contract.ts
@@ -212,7 +212,8 @@ export function buildQmMemoryContract(version: QmContractVersion): Record<string
as_person: 'a credential the brain operator binds with --attest-read person reads named sources as the person instead, narrowed to those sources',
without_sources: 'the person read (read_as above)',
} } : {}),
- tools: [...QM_PERSONAL_OPS].sort().map(name => ({ ...toolEntry(name, version), personal_only: true, ...(v4 ? { scope_read: SCOPE_READ_OPS.has(name) } : {}), result: PERSONAL_RESULTS[name] })),
+ tools: [...QM_PERSONAL_OPS].sort().map(name => ({ ...toolEntry(name, version), personal_only: true, ...(v4 ? { scope_read: SCOPE_READ_OPS.has(name) } : {}), result: PERSONAL_RESULTS[name],
+ ...(v4 && name === 'get_write_request' ? { proposal_receipt: 'the fields and states in result are a write\'s receipt; a request_id from memory_propose that no write holds yet answers memory_propose.receipt instead, with its own fields and states (awaiting_owner, denied, expired, cancelled, failed, conflict)' } : {}) })),
} } : {}),
memory_recall: {
limits: { max_chars: { ...MEMORY_RECALL_MAX_CHARS, whole_number: true, unit: 'UTF-16 code units (JavaScript string length)' }, query_chars_ranked: MEMORY_RECALL_QUERY_CHARS, own_recent_window_hours: OWN_RECENT_WINDOW_HOURS },
@@ -225,7 +226,7 @@ export function buildQmMemoryContract(version: QmContractVersion): Record<string
order: ['own facts from the last ' + OWN_RECENT_WINDOW_HOURS + ' hours, newest first', 'facts the person may read, ranked by query'],
ranking: 'keyword-only unless an embedding provider is configured (no embedding call on a keyless brain)',
structured_content: { facts: [{ id: 'string', text: 'string', date: 'YYYY-MM-DD', kind: 'string', ...(v3 ? { arm: '"own" | "ranked"' } : {}), ...(v4 ? { own_page: 'boolean' } : {}) }], truncated: 'boolean', ...(v3 ? { query_truncated: 'boolean, only when the call sent query_keep' } : {}), code: 'actor_unlinked (only on unlinked_recall)' },
- ...(v3 ? { arm: 'own: the person\'s own fact from the last ' + OWN_RECENT_WINDOW_HOURS + ' hours; ranked: matched by query (a fact found both ways is own); a call that names sources answers ranked rows only' } : {}),
+ ...(v3 ? { arm: 'own: the person\'s own fact from the last ' + OWN_RECENT_WINDOW_HOURS + ' hours; ranked: matched by query (a fact found both ways is own); a call that names sources answers ranked rows only' + (v4 ? ', unless the credential reads named sources as the person (--attest-read person)' : '') } : {}),
...(v4 ? { own_page: 'true: the fact sits on the person\'s own member page in the connection\'s source, the same test forget_fact applies, so forget_fact accepts it on ownership; false: forget_fact for this person answers fact_not_found. Independent of arm (an own-page fact older than ' + OWN_RECENT_WINDOW_HOURS + ' hours is ranked); false on every row of a scope read (a call that names sources, unless the credential reads them as the person)' } : {}),
...(v2 ? { scope_read: {
arguments: ['source_id', 'source_ids'],
@@ -276,14 +277,15 @@ export function buildQmMemoryContract(version: QmContractVersion): Record<string
held: 'nothing is written until the brain owner approves; while it waits the proposed text is never in search, recall, git or an export, and no receipt carries it',
request_id: 'derived from the credential, the person and idempotency_key: one request id from proposal to publication',
replay: 'the same idempotency_key with the same fields, from the same person and credential, returns that proposal\'s current state in status; with other fields it is idempotency_conflict; from another person or credential it is a separate proposal',
+ retention: `a closed proposal (denied, expired, cancelled, failed, conflict or approved) is deleted ${PROPOSAL_LIMIT_KEYS.retentionDays.key} days after it closed (default ${PROPOSAL_LIMIT_KEYS.retentionDays.default}); after that its request_id answers not_found while no write holds it, an approved write\'s receipt no longer carries proposal, and the same idempotency_key starts a new proposal under the same request_id, so never resend an old key to learn how a proposal ended`,
awaiting: { content: 'the result as JSON', structuredContent: { status: 'awaiting_owner', request_id: 'uuid', kind: '"timeline" | "link"', target: 'string', expires_at: 'string (ISO 8601)', text: 'string' } },
receipt: {
read: 'get_write_request {request_id}',
- structured_content: { request_id: 'string', state: PROPOSAL_STATES.filter(s => s !== 'approved').map(s => '"' + s + '"').join(' | '), retry_after_ms: 'number | null', operation: '"add_timeline_entry" | "add_link"', source_id: 'string', slug: 'string', proposal: { kind: '"timeline" | "link"', target: 'string', expires_at: 'string' } },
+ structured_content: { request_id: 'string', state: PROPOSAL_STATES.filter(s => s !== 'approved').map(s => '"' + s + '"').join(' | '), retry_after_ms: 'number | null', operation: '"add_timeline_entry" | "add_link"', source_id: 'string', slug: 'string', created_at: 'string', updated_at: 'string', proposal: { kind: '"timeline" | "link"', target: 'string', expires_at: 'string' } },
optional: { 'proposal.to': 'string: a link\'s to page', decision: 'object {reason, decided_at} once the proposal is closed: denied carries the owner\'s reason', write_error: 'string: why approval closed it (failed: actor_unlinked, actor_not_attested, permission_denied, page_not_found or source_changed; conflict: revision_changed or link_target_changed)' },
states: {
known: [...PROPOSAL_STATES], held: 'awaiting_owner', closed: PROPOSAL_STATES.filter(s => s !== 'awaiting_owner' && s !== 'approved'),
- approved: 'get_write_request answers the write\'s own receipt (personal_tools get_write_request, published when committed) plus proposal {kind, target, to?, decided_at}',
+ approved: 'get_write_request answers the write\'s own receipt (personal_tools get_write_request, published when committed) plus proposal {kind, target, to?, decided_at} until the proposal row is deleted (retention)',
unknown: 'a state not listed here means unknown, not published: never report the proposal as written; poll again or report it as unknown',
poll: `while awaiting_owner, after retry_after_ms (${PROPOSAL_RETRY_AFTER_MS}, or the time to expiry when sooner)`,
},
diff --git a/src/core/behavior-change-notice.ts b/src/core/behavior-change-notice.ts
index e8451af9c4..e665d91a9e 100644
--- a/src/core/behavior-change-notice.ts
+++ b/src/core/behavior-change-notice.ts
@@ -1517,9 +1517,9 @@ export const BEHAVIOR_CHANGES: ReadonlyArray<{ since: string; text: ChangeText;
{ since: '0.60.655.0', id: 'member_email_link_gst1158', text: 'A member can carry an operator-declared email: `gbrain access member add <id> --email <addr>` or `gbrain access member set <id> --email <addr>|none`, shown by `member list`, stored lower-case and unique per brain, and cleared when the member is removed. `gbrain access member link --email <addr> --qm <id>` (and `gbrain mcp admin link --email`, `member-add --email`, `member-set` over the owner session) links the one member that declares it, exactly as linking by member id does; an unknown email is `not_found` and creates nothing. No OAuth token, attested call or MCP tool can set an email or make a link.' },
{ since: '0.60.655.0', id: 'qm_admin_http_gst1094', text: 'The brain owner can now manage the attest right, members and canonical-id links over the running server: `gbrain mcp admin attest <client> --attest-actor qm|none [--attest-ops <list>]`, `member-add`, `member-disable`, `member-enable`, `members`, `link <member> --qm <id>`, `unlink --qm <id>` and `links`, backed by `/admin/api/access/attest`, `/admin/api/access/members` and `/admin/api/access/member-links`. These routes take the owner session only (never an OAuth token or an MCP tool), refuse what the local `gbrain auth rescope` and `gbrain access member` commands refuse, preview with `--dry-run` where those do, and log each applied change as `access_admin`. Removing a member stays a brain-host command.' },
{ since: '0.60.662.0', id: 'memory_proposals_owner_http_gst2407', text: 'The brain owner can review QM\'s memory proposals over the running server, not only on the brain host: owner-session routes `GET /admin/api/memory-proposals` (`?source=`, `?cursor=`; oldest first, 50 a page), `GET /admin/api/memory-proposals/<request_id>` and `POST /admin/api/memory-proposals/<request_id>` with `{action: "approve"|"deny", reason?, dryRun?}`, mirrored by `gbrain mcp admin memory-proposals list|show|approve|deny`. They run the same approval as `gbrain memory-proposals` and record `decided_by: admin-api`; each applied decision writes one `access_admin` audit row (never the proposed text), and a change that fails partway answers `outcome: unknown`. `gbrain memory-proposals approve` now exits 1 when the approved write itself ends without committing (it used to exit 0), and the HTTP approve reports `outcome: failed` with the write\'s receipt.' },
+ { since: '0.60.662.0', id: 'qm_recall_own_page_contract_v4_gst2407', text: 'Each `memory_recall` fact in `structuredContent.facts` gains `own_page`: `true` when the fact sits on the person\'s own member page in the connection\'s source, the same ownership check `forget_fact` makes before it withdraws a fact, and `false` when `forget_fact` for that attested person would answer `fact_not_found`. `arm` is unchanged, so an own-page fact older than 24 hours is `ranked` with `own_page: true`, and a scope read answers `own_page: false`. `get_write_request` and `cancel_write_request` on a held proposal now also answer `created_at` and `updated_at`. QM contract `docs/contracts/qm-memory-provider/v4.json` adds `memory_propose` with its proposal receipt, states and retention, a `scope_read` marking on each personal tool and `own_page`; v1, v2 and v3 are byte-identical.' },
{ since: '0.60.661.0', id: 'recreated_takes_section_keeps_stored_takes_gst2228', text: 'A takes section that gbrain re-creates on a page whose section a rewrite dropped now starts with the takes still stored for that page. `think --take --anchor <slug>` and `gbrain takes extract --from-pages` (also with `--include-covered` on a managed brain) render the stored takes, resolutions included, into the section they create and number their own takes after them, instead of numbering from 1 over a stored take. A take the user removed, or an explicit empty section retired, stays removed. A page whose stored take has a resolution without a quality, or a cell that would not read back unchanged from the section (such as the literal text `<br>`), is refused (`invalid_input`) instead of changing it, and `takes extract --from-pages` skips a page whose takes markers are malformed (`fence_unparsed`) and goes on to the next page.' },
{ since: '0.60.661.0', id: 'links_rows_keep_own_dates_gst2228', text: 'Each row of a page\'s `## Links` section (target, type, source) now keeps its own `valid_from` and `valid_until`. On a page whose links section a rewrite dropped, `add_link` writes the section back with every kept row and its own dates instead of a section holding only the new link; `remove_link` with a `link_source` deletes that row\'s dates for any source, not only `manual`, and leaves other rows\' dates alone. Dates stored before rows kept their source have none: with several rows for one target and type and the section gone, `add_link` and `remove_link` refuse `link_dates_unattributed` and ask for the section back through `edit_page`, one row per source with its own dates. `append_page` text holding a links fence marker is refused with `append_links_fence`; write each link with `add_link`.' },
- { since: '0.60.662.0', id: 'qm_recall_own_page_contract_v4_gst2407', text: 'Each `memory_recall` fact in `structuredContent.facts` gains `own_page`: `true` when the fact sits on the person\'s own member page in the connection\'s source, the same check `forget_fact` makes before it withdraws a fact, and `false` when `forget_fact` would answer `fact_not_found`. `arm` is unchanged, so an own-page fact older than 24 hours is `ranked` with `own_page: true`, and a recall that names sources answers `own_page: false`. QM contract `docs/contracts/qm-memory-provider/v4.json` adds `memory_propose` with its proposal receipt and states, a `scope_read` marking on each personal tool and `own_page`; v1, v2 and v3 are byte-identical.' },
];
/** The newest disclosed change's release: the notice id moves only when a release adds rows. */
diff --git a/src/core/persistence/memory-proposals.ts b/src/core/persistence/memory-proposals.ts
index 8463e68291..2cfad7d411 100644
--- a/src/core/persistence/memory-proposals.ts
+++ b/src/core/persistence/memory-proposals.ts
@@ -222,7 +222,7 @@ export function proposalReceipt(row: MemoryProposal, now = Date.now()): Record<s
const untilExpiry = Math.max(0, new Date(row.expires_at).getTime() - now);
return {
request_id: row.request_id, state: row.state, retry_after_ms: waiting ? Math.min(PROPOSAL_RETRY_AFTER_MS, untilExpiry) : null,
- operation: row.operation, source_id: row.source_id, slug: row.slug,
+ operation: row.operation, source_id: row.source_id, slug: row.slug, created_at: row.created_at, updated_at: row.updated_at,
proposal: { kind: row.kind, target: row.slug, ...(row.to_slug ? { to: row.to_slug } : {}), expires_at: row.expires_at },
...(waiting ? {} : { decision: { reason: row.reason, decided_at: row.decided_at } }),
...(row.error_code ? { write_error: row.error_code } : {}),
diff --git a/test/qm-memory-contract.test.ts b/test/qm-memory-contract.test.ts
index d657ec3310..8a9293c7e7 100644
--- a/test/qm-memory-contract.test.ts
+++ b/test/qm-memory-contract.test.ts
@@ -270,8 +270,8 @@ describe('QM memory-provider contract v4 (GST-2407: memory_propose, E1 scope_rea
expect(fixture[key]).toEqual(v3[key]);
}
expect(fixture.tools.filter((t: { name: string }) => t.name !== 'memory_propose')).toEqual(v3.tools);
- const { structured_content: shape, own_page: _own, ...recallRest } = fixture.memory_recall;
- const { structured_content: v3Shape, ...v3Rest } = v3.memory_recall;
+ const { structured_content: shape, own_page: _own, arm: _arm, ...recallRest } = fixture.memory_recall;
+ const { structured_content: v3Shape, arm: _v3Arm, ...v3Rest } = v3.memory_recall;
expect(recallRest).toEqual(v3Rest);
const { own_page: ownPage, ...row } = shape.facts[0];
expect({ ...shape, facts: [row] }).toEqual(v3Shape);
@@ -279,7 +279,8 @@ describe('QM memory-provider contract v4 (GST-2407: memory_propose, E1 scope_rea
const { read_as: readAs, scope_read: _marks, tools: personalTools, ...personalRest } = fixture.personal_tools;
const { read_as: v3ReadAs, tools: v3Tools, ...v3PersonalRest } = v3.personal_tools;
expect(personalRest).toEqual(v3PersonalRest);
- expect(personalTools.map(({ scope_read: _s, ...t }: { scope_read: boolean }) => t)).toEqual(v3Tools);
+ expect(personalTools.map(({ scope_read: _s, proposal_receipt: _p, ...t }: { scope_read: boolean; proposal_receipt?: string }) => t)).toEqual(v3Tools);
+ expect(personalTools.filter((t: { proposal_receipt?: string }) => t.proposal_receipt).map((t: { name: string }) => t.name)).toEqual(['get_write_request']);
expect(v3ReadAs).toContain('no tool here is marked as a shared-scope read yet');
expect(readAs).not.toContain('not marked');
expect(fixture.errors.shape).toEqual(v3.errors.shape);
@@ -309,7 +310,8 @@ describe('QM memory-provider contract v4 (GST-2407: memory_propose, E1 scope_rea
test('memory_recall rows carry own_page beside an unchanged arm', () => {
expect(fixture.memory_recall.structured_content.facts[0]).toEqual({ id: 'string', text: 'string', date: 'YYYY-MM-DD', kind: 'string', arm: '"own" | "ranked"', own_page: 'boolean' });
- expect(fixture.memory_recall.arm).toBe(v3.memory_recall.arm);
+ expect(fixture.memory_recall.arm.startsWith(v3.memory_recall.arm)).toBe(true);
+ expect(fixture.memory_recall.arm).toContain('--attest-read person');
expect(fixture.memory_recall.own_page).toContain('forget_fact');
expect(fixture.memory_recall.own_page).toContain('fact_not_found');
});
@@ -331,6 +333,8 @@ describe('QM memory-provider contract v4 (GST-2407: memory_propose, E1 scope_rea
expect(propose.receipt.states.closed).toEqual(['denied', 'expired', 'cancelled', 'failed', 'conflict']);
expect(propose.receipt.states.unknown).toContain('unknown, not published');
expect(propose.cancel).toContain('cancel_write_request');
+ expect(propose.retention).toContain(PROPOSAL_LIMIT_KEYS.retentionDays.key);
+ expect(fixture.personal_tools.tools.find((t: { name: string }) => t.name === 'get_write_request').proposal_receipt).toContain('memory_propose.receipt');
expect(propose.awaiting.structuredContent.status).toBe('awaiting_owner');
const notes = Object.fromEntries(fixture.errors.codes.map((c: { code: string; note?: string }) => [c.code, c.note]));
for (const reason of ['proposal_kind_field', 'proposal_too_large', 'proposal_revision_changed']) expect(notes.invalid_params).toContain(reason);
diff --git a/test/qm-memory-propose.test.ts b/test/qm-memory-propose.test.ts
index b166a7562a..9bd1cc155d 100644
--- a/test/qm-memory-propose.test.ts
+++ b/test/qm-memory-propose.test.ts
@@ -346,6 +346,7 @@ for (const kind of testBackends()) {
const id = held.structured!.request_id as string;
const waiting = await receipt(alice, id);
for (const key of Object.keys(contract.receipt.structured_content)) expect(waiting.structured).toHaveProperty(key);
+ expect(Object.keys(waiting.structured!).filter(k => !(k in contract.receipt.structured_content) && !(k in contract.receipt.optional))).toEqual([]);
expect(Object.keys(waiting.structured!.proposal).sort()).toEqual(Object.keys(contract.receipt.structured_content.proposal).sort());
expect(contract.receipt.states.known).toContain(waiting.structured!.state);
expect(waiting.structured!.retry_after_ms).toBeLessThanOrEqual(PROPOSAL_RETRY_AFTER_MS);
diff --git a/test/qm-memory-tools.test.ts b/test/qm-memory-tools.test.ts
index c8386882f7..098adae6c0 100644
--- a/test/qm-memory-tools.test.ts
+++ b/test/qm-memory-tools.test.ts
@@ -654,8 +654,7 @@ for (const kind of testBackends()) {
await engine.insertFact({ fact: 'Acme harbor buoy inspection canaryownpageworld', kind: 'fact', entity_slug: ACME, source: 'test', visibility: 'world' }, { source_id: SRC });
await engine.insertFact({ fact: 'Harbor buoy note on her page path canaryownpagepath', kind: 'fact', entity_slug: null, source: 'test', visibility: 'world' }, { source_id: SRC });
await engine.executeRaw("UPDATE facts SET source_markdown_slug = 'memory/members/alice-example' WHERE source_id = $1 AND fact LIKE '%canaryownpagepath%'", [SRC]);
- await engine.insertFact({ fact: 'Bob logs the harbor buoy canaryownpagebob', kind: 'fact', entity_slug: null, source: 'test', visibility: 'private' }, { source_id: SRC });
- await engine.executeRaw("UPDATE facts SET source_markdown_slug = 'memory/members/bob-example' WHERE source_id = $1 AND fact LIKE '%canaryownpagebob%'", [SRC]);
+ expect((await write(bob, [{ fact: 'Bob logs the harbor buoy canaryownpagebob', provenance: 'turn 61' }])).structured?.status).toBe('committed');
__resetPrivateVisibilityCacheForTests();
for (const [as, mine, others] of [[alice, ['canaryownpagerecent', 'canaryownpageold'], ['canaryownpageworld', 'canaryownpagepath']], [{ token: 'bob' }, ['canaryownpagebob'], ['canaryownpageworld']]] as const) {
const out = await recall(as, 'harbor buoy', { max_chars: 12_000 });