Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(trust): the trust_tier marker is hash-ephemeral so purge tombstones and identical-content writes ignore it (the tier trigger still counts it); inventory count

garrytan05b494c1fe21
diff --git a/docs/architecture/system-of-record.md b/docs/architecture/system-of-record.md
index bf1df4d791..3180d1c16a 100644
--- a/docs/architecture/system-of-record.md
+++ b/docs/architecture/system-of-record.md
@@ -288,7 +288,7 @@ or a physical projection that leaves attribution untouched):
- `src/core/timeline-write-through.ts` (2): the timeline write-through's page row splice and entry insert run in one `maintenanceTransaction`.
- `src/core/trust/fence-guard.ts` (2): the guarded fence re-projection detaches or moves higher-tier fact rows inside the page's coordinated publication.
- `src/core/trust/owner-actions.ts` (1): an owner release inserts the held fact in a coordinated (managed) or attributed (unmanaged) transaction at user_confirmed.
-- `src/core/trust/supersede-handlers.ts` (2): owner accept/undo of a trust proposal re-tiers the new fact inside the checked supersede's transaction.
+- `src/core/trust/supersede-handlers.ts` (3): owner accept/undo of a trust proposal re-tiers the new fact (or take) inside the checked supersede's (or takes publication's) transaction.
<!-- write-attribution-covered:end -->
Unattributed (on unmanaged brains these write with `NULL` attribution). These
diff --git a/src/core/trust/schema.ts b/src/core/trust/schema.ts
index e37d4da232..57f4c94ce8 100644
--- a/src/core/trust/schema.ts
+++ b/src/core/trust/schema.ts
@@ -49,7 +49,7 @@ export const TRUST_TABLES: readonly TrustTable[] = ['facts', 'takes', 'timeline_
* `trust_tier` marker is content on purpose: deleting it by hand is the
* owner act that lets the next owner sync restamp the page (CEO-21).
*/
-export const TRUST_EPHEMERAL_FRONTMATTER_KEYS: readonly string[] = [...HASH_EPHEMERAL_FRONTMATTER_KEYS, 'quarantine_override'];
+export const TRUST_EPHEMERAL_FRONTMATTER_KEYS: readonly string[] = [...HASH_EPHEMERAL_FRONTMATTER_KEYS.filter(key => key !== 'trust_tier'), 'quarantine_override'];
/**
* ENG-2: the columns whose change is a content rewrite. Lifecycle and
diff --git a/src/core/utils.ts b/src/core/utils.ts
index 40c47cbdf8..2e960b9ccd 100644
--- a/src/core/utils.ts
+++ b/src/core/utils.ts
@@ -91,6 +91,11 @@ export const HASH_EPHEMERAL_FRONTMATTER_KEYS: readonly string[] = [
// (paraphrases defeat content_hash_duplicates). The marker is re-derived
// deterministically from the body, so dropping it from the hash is safe.
ATOMS_SCAN_HASH_KEY,
+ // #5575 CEO-21: the lower-only `trust_tier` marker a below-owner write-through stamps. It labels the
+ // content, it is not content: page purge tombstones match (source_id, content_hash) with or without it,
+ // and an agent stamping it onto identical content is no content change. (The tier trigger still treats
+ // it as content: trust/schema.ts TRUST_EPHEMERAL_FRONTMATTER_KEYS excludes it.)
+ 'trust_tier',
];
/**
diff --git a/test/trust-tier-schema.test.ts b/test/trust-tier-schema.test.ts
index 7900137c0c..fc881df6df 100644
--- a/test/trust-tier-schema.test.ts
+++ b/test/trust-tier-schema.test.ts
@@ -59,7 +59,8 @@ describe('TRUST_CONTENT_COLUMNS (ENG-2)', () => {
const columns = [...tuple.matchAll(/NEW\.([a-z_]+)/g)].map(m => m[1]);
expect(columns.length).toBeGreaterThan(5);
expect([...TRUST_CONTENT_COLUMNS.pages]).toEqual(columns);
- expect([...TRUST_EPHEMERAL_FRONTMATTER_KEYS].sort()).toEqual([...HASH_EPHEMERAL_FRONTMATTER_KEYS, QUARANTINE_OVERRIDE_KEY].sort());
+ expect([...TRUST_EPHEMERAL_FRONTMATTER_KEYS].sort()).toEqual([...HASH_EPHEMERAL_FRONTMATTER_KEYS.filter(key => key !== 'trust_tier'), QUARANTINE_OVERRIDE_KEY].sort());
+ expect(HASH_EPHEMERAL_FRONTMATTER_KEYS).toContain('trust_tier');
expect(TRUST_EPHEMERAL_FRONTMATTER_KEYS).not.toContain('trust_tier');
});
});