Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

feat(trust): optional content_origin on remember, put_page and capture (#5575 CEO-26, DX-8)

garrytanc96a94d96edc
diff --git a/src/core/ops/pages.ts b/src/core/ops/pages.ts
index a87937c361..40c30abb1c 100644
--- a/src/core/ops/pages.ts
+++ b/src/core/ops/pages.ts
@@ -1,6 +1,6 @@
import { pageMutationSource, submitPageMutation, validateMutationSlug } from '../persistence/page-mutations.ts';
import { suffixedSlugDryRun } from '../persistence/suffixed-slug.ts';
-import { PAGE_MUTATION_PARAMS, CAPTURE_EVENT_PARAMS, WRITE_WAIT_PARAM } from '../persistence/params.ts';
+import { AGENT_CONTENT_PARAMS, PAGE_MUTATION_PARAMS, CAPTURE_EVENT_PARAMS, WRITE_WAIT_PARAM } from '../persistence/params.ts';
import { assertPurgeParams } from '../persistence/purge-params.ts';
/**
* Page CRUD operation cluster — pure move from operations.ts (v0.46.x
@@ -293,7 +293,7 @@ const put_page: Operation = {
outputRedaction: 'no_stored_text',
description: 'Complete content REPLACES the whole page: read get_page include_content:true; send its revision as expected_revision. Keep a request_id UUID; retry with identical arguments. Remote callers: existing-page [[links]] become mentions; typed links are skipped (stdio `gbrain serve` sweeps them later, `gbrain serve --http` does not self-sweep). Edits: edit_page; >3 pages: put_pages.',
params: {
- ...PAGE_MUTATION_PARAMS,
+ ...AGENT_CONTENT_PARAMS,
slug: { type: 'string', description: 'Page slug.', required: true },
content: { type: 'string', required: true, description: 'Complete markdown (get_page include_content:true).' },
allow_empty: { type: 'boolean', required: false, description: 'Allow emptying the page.' },
@@ -637,7 +637,7 @@ const capture: Operation = {
outputRedaction: 'no_stored_text',
description: CAPTURE_DESCRIPTION,
params: {
- ...PAGE_MUTATION_PARAMS,
+ ...AGENT_CONTENT_PARAMS,
...CAPTURE_EVENT_PARAMS,
content: { type: 'string', required: true, description: 'Markdown or text (not a file path).' },
local_file: { type: 'string', description: 'Local CLI only.', required: false },
diff --git a/src/core/persistence/params.ts b/src/core/persistence/params.ts
index 2ad96f7ae8..4127259cbd 100644
--- a/src/core/persistence/params.ts
+++ b/src/core/persistence/params.ts
@@ -42,6 +42,20 @@ export const PAGE_MUTATION_PARAMS: Record<string, ParamDef> = {
request_id: WRITE_REQUEST_PARAM,
};
+/**
+ * #5575 CEO-26/DX-8: where the content of an agent write came from. Optional
+ * and additive (MEMORY_VERBS-compatible); `tool_output` stores the write as
+ * external, untrusted. Safety never depends on it (the channel tier holds
+ * without it). Validated at admission (trust/tier.ts contentOriginTier).
+ */
+export const CONTENT_ORIGIN_PARAM: ParamDef = {
+ type: 'string',
+ enum: ['user_said', 'tool_output', 'inferred'],
+ description: 'Where the content came from: user_said, tool_output (web page, email, file or other tool text: stored as untrusted), inferred. Set it.',
+};
+/** Page mutation params plus `content_origin`, for verbs whose caller supplies the content (put_page, put_pages, capture, edit_page, remember). */
+export const AGENT_CONTENT_PARAMS: Record<string, ParamDef> = { ...PAGE_MUTATION_PARAMS, content_origin: CONTENT_ORIGIN_PARAM };
+
/** Additive response schema shared by frozen memory-verb success and error envelopes. */
export const WRITE_RECEIPT_SCHEMA = {
type: 'object',
diff --git a/src/core/verbs.ts b/src/core/verbs.ts
index a00681a417..42a2d26e35 100644
--- a/src/core/verbs.ts
+++ b/src/core/verbs.ts
@@ -24,7 +24,7 @@
*/
import type { Operation } from './operations.ts';
-import { WRITE_RECEIPT_SCHEMA, WRITE_REQUEST_PARAM, PAGE_MUTATION_PARAMS } from './persistence/params.ts';
+import { WRITE_RECEIPT_SCHEMA, WRITE_REQUEST_PARAM, AGENT_CONTENT_PARAMS } from './persistence/params.ts';
import { WRITE_ERROR_CODES } from './persistence/types.ts';
/** Frozen protocol version for the MEMORY_VERBS v1 verb set. Single source of truth. */
@@ -64,7 +64,7 @@ const remember: Operation = {
outputRedaction: 'no_stored_text',
description: 'MEMORY VERB (v1): save facts with provenance. Set `entity` to the subject or entity recall misses it. Branch on `status` (inserted|duplicate|superseded); write_pending: poll get_write_request.',
params: {
- ...PAGE_MUTATION_PARAMS,
+ ...AGENT_CONTENT_PARAMS,
fact: { type: 'string', description: 'One claim.' },
items: {
type: 'array',