Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
test: the cycle has 28 phases; doctor goldens and the phase-order pin take content_repair; maintain and spend docs name the lane
garrytandc5c3c0a77fb
diff --git a/docs/operations/spend-controls.md b/docs/operations/spend-controls.mdindex b908ba11f3..31712822b7 100644--- a/docs/operations/spend-controls.md+++ b/docs/operations/spend-controls.md@@ -180,7 +180,16 @@ The maintenance run's `fence_repair` phase and `gbrain repair fences --apply`send a malformed facts or takes fence that only a rewrite can realign to therepair model. Only the fence header and the rows it must realign leave themachine, never valid rows or the rest of the page. Every other fence repair-is free.+is free. The same caps and the same daily ledger govern the rest of the+content-repair lane (#6377): the tail classifier (an unclosed fence whose+trailing lines hold a pipe; the fence region and those lines leave the+machine) and the slug-conflict judgment (`content_repair` phase,+`gbrain repair slug-conflicts`; both pages' frontmatter, headings, first 60+lines and the lines mentioning the other slug leave the machine). The model+chooses among coded answers and writes no text. `models.content_repair`+overrides the slug-conflict model; unset, it follows `models.fence_repair`,+then the content-repair eval's measured list (`anthropic:claude-opus-5-5`,+`openai:gpt-6.1-sol`, `anthropic:claude-sonnet-5-5`, first with a key).- **Model.** `models.fence_repair` when set (any model, priced or not, alwaysruns). Unset, the first model the fence-repair eval measured as accuratediff --git a/skills/maintain/SKILL.md b/skills/maintain/SKILL.mdindex afb9e5d229..c6c2e515f5 100644--- a/skills/maintain/SKILL.md+++ b/skills/maintain/SKILL.md@@ -153,7 +153,11 @@ lint -> backlinks -> sync -> synthesize -> extract -> patterns -> embed -> orpha`fence_repair` runs right after `sync`, once per maintenance pass: it repairsthe facts and takes fences sync held or pages store malformed (the same plan`gbrain repair fences` previews), for at most 300 s or a third of the job's-remaining time, and resumes on the next run. Pause it with+remaining time, and resumes on the next run. `content_repair` runs right after+it (#6377): the rest of the content-repair lane, today the `slug-conflicts`+kind that removes a stray frontmatter `slug:` or records a recommended merge+for a person (`gbrain repair content` previews both kinds), for at most 120 s+or a third of the remaining time. Pause both with`gbrain config set fences.repair.enabled false`.The two new phases consolidate yesterday's conversations into long-term memory:diff --git a/test/core/cycle.serial.test.ts b/test/core/cycle.serial.test.tsindex 685e41b15c..1436a5239e 100644--- a/test/core/cycle.serial.test.ts+++ b/test/core/cycle.serial.test.ts@@ -486,8 +486,8 @@ describe('runCycle — yieldBetweenPhases hook', () => {// conversation_facts_backfill). #5876: 24 (added `chronicle` after drift).// GBRA-40 Lane D: 25 (added `facts_drain` after chronicle).// Temporal typed edges: 26 (added `edge_contradictions` after calibration_profile).- // #6188: 27 (added `fence_repair` after sync).- expect(hookCalls).toBe(27);+ // #6188: 27 (added `fence_repair` after sync). #6377: 28 (added `content_repair` after fence_repair).+ expect(hookCalls).toBe(28);});test('hook exceptions do not abort the cycle', async () => {@@ -503,8 +503,8 @@ describe('runCycle — yieldBetweenPhases hook', () => {// v0.41.11.0: 20 phases (+extract_atoms, +synthesize_concepts, +conversation_facts_backfill).// v0.41.39 (#1700) + v0.42.0.0: 22 phases (+enrich_thin, +skillopt).// #2653: 23 phases (+drift). #5876: 24 (+chronicle). GBRA-40 Lane D: 25 (+facts_drain). Temporal typed edges: 26 (+edge_contradictions).- // #6188: 27 (+fence_repair).- expect(report.phases.length).toBe(27);+ // #6188: 27 (+fence_repair). #6377: 28 (+content_repair).+ expect(report.phases.length).toBe(28);});});diff --git a/test/e2e/dream-cycle-phase-order-pglite.test.ts b/test/e2e/dream-cycle-phase-order-pglite.test.tsindex c94f873953..b16df1cb59 100644--- a/test/e2e/dream-cycle-phase-order-pglite.test.ts+++ b/test/e2e/dream-cycle-phase-order-pglite.test.ts@@ -131,6 +131,7 @@ const EXPECTED_PHASES: CyclePhase[] = ['backlinks','sync','fence_repair', // #6188 — fence repair (global maintenance lane)+ 'content_repair', // #6377 — the rest of the content-repair lane (slug conflicts)'synthesize','extract','extract_facts', // v0.32.2 — reconcile fence → DB facts indexdiff --git a/test/fixtures/goldens/doctor/content-pglite-human.json b/test/fixtures/goldens/doctor/content-pglite-human.jsonindex 224c95ccef..02adb40f24 100644--- a/test/fixtures/goldens/doctor/content-pglite-human.json+++ b/test/fixtures/goldens/doctor/content-pglite-human.json@@ -189,7 +189,7 @@" [OK] oauth_client_scope_health: Scoped-client grants consistent (no dangling federated reads, no orphaned workspace sources, no privileged self-registered clients)"," [OK] autopilot_lock_scope: Lock path: <home>/.gbrain/autopilot.lock"," [OK] stale_locks: No stale locks (no rows with ttl_expires_at < NOW())",- " [OK] cycle_phase_scope: Phase taxonomy: 12 source-scoped, 13 brain-global, 2 mixed. Source-safe: [lint, backlinks, sync, extract, extract_facts, extract_atoms, recompute_emotional_weight, consolidate, propose_takes, conversation_facts_backfill, enrich_thin, schema-suggest]. Brain-global: [fence_repair, resolve_symbol_edges, synthesize_concepts, grade_takes, calibration_profile, edge_contradictions, drift, chronicle, facts_drain, skillopt, embed, orphans, purge]. Mixed: [synthesize, patterns].",+ " [OK] cycle_phase_scope: Phase taxonomy: 12 source-scoped, 14 brain-global, 2 mixed. Source-safe: [lint, backlinks, sync, extract, extract_facts, extract_atoms, recompute_emotional_weight, consolidate, propose_takes, conversation_facts_backfill, enrich_thin, schema-suggest]. Brain-global: [fence_repair, content_repair, resolve_symbol_edges, synthesize_concepts, grade_takes, calibration_profile, edge_contradictions, drift, chronicle, facts_drain, skillopt, embed, orphans, purge]. Mixed: [synthesize, patterns]."," [INFO] embed_staleness: Not applicable: embeddings are disabled on this brain by choice, so chunks have no vectors by design (keyword search keeps working)."," [OK] entity_link_coverage: Only 2 entity pages (< 5) — coverage ratio not meaningful at this scale"," [OK] timeline_coverage: Only 2 entity pages (< 5) — coverage ratio not meaningful at this scale",diff --git a/test/fixtures/goldens/doctor/content-pglite-json.json b/test/fixtures/goldens/doctor/content-pglite-json.jsonindex c6faaad2db..528f323e43 100644--- a/test/fixtures/goldens/doctor/content-pglite-json.json+++ b/test/fixtures/goldens/doctor/content-pglite-json.json@@ -2224,7 +2224,7 @@"category": "meta","details": {"counts": {- "global": 13,+ "global": 14,"mixed": 2,"source": 12},@@ -2233,6 +2233,7 @@"calibration_profile": "global","chronicle": "global","consolidate": "source",+ "content_repair": "global","conversation_facts_backfill": "source","drift": "global","edge_contradictions": "global",@@ -2258,7 +2259,7 @@"synthesize_concepts": "global"}},- "message": "Phase taxonomy: 12 source-scoped, 13 brain-global, 2 mixed. Source-safe: [lint, backlinks, sync, extract, extract_facts, extract_atoms, recompute_emotional_weight, consolidate, propose_takes, conversation_facts_backfill, enrich_thin, schema-suggest]. Brain-global: [fence_repair, resolve_symbol_edges, synthesize_concepts, grade_takes, calibration_profile, edge_contradictions, drift, chronicle, facts_drain, skillopt, embed, orphans, purge]. Mixed: [synthesize, patterns].",+ "message": "Phase taxonomy: 12 source-scoped, 14 brain-global, 2 mixed. Source-safe: [lint, backlinks, sync, extract, extract_facts, extract_atoms, recompute_emotional_weight, consolidate, propose_takes, conversation_facts_backfill, enrich_thin, schema-suggest]. Brain-global: [fence_repair, content_repair, resolve_symbol_edges, synthesize_concepts, grade_takes, calibration_profile, edge_contradictions, drift, chronicle, facts_drain, skillopt, embed, orphans, purge]. Mixed: [synthesize, patterns].","name": "cycle_phase_scope","status": "ok"},diff --git a/test/fixtures/goldens/doctor/json-pglite-degraded.json b/test/fixtures/goldens/doctor/json-pglite-degraded.jsonindex 4d175d161e..9781918205 100644--- a/test/fixtures/goldens/doctor/json-pglite-degraded.json+++ b/test/fixtures/goldens/doctor/json-pglite-degraded.json@@ -1990,7 +1990,7 @@"category": "meta","details": {"counts": {- "global": 13,+ "global": 14,"mixed": 2,"source": 12},@@ -1999,6 +1999,7 @@"calibration_profile": "global","chronicle": "global","consolidate": "source",+ "content_repair": "global","conversation_facts_backfill": "source","drift": "global","edge_contradictions": "global",@@ -2024,7 +2025,7 @@"synthesize_concepts": "global"}},- "message": "Phase taxonomy: 12 source-scoped, 13 brain-global, 2 mixed. Source-safe: [lint, backlinks, sync, extract, extract_facts, extract_atoms, recompute_emotional_weight, consolidate, propose_takes, conversation_facts_backfill, enrich_thin, schema-suggest]. Brain-global: [fence_repair, resolve_symbol_edges, synthesize_concepts, grade_takes, calibration_profile, edge_contradictions, drift, chronicle, facts_drain, skillopt, embed, orphans, purge]. Mixed: [synthesize, patterns].",+ "message": "Phase taxonomy: 12 source-scoped, 14 brain-global, 2 mixed. Source-safe: [lint, backlinks, sync, extract, extract_facts, extract_atoms, recompute_emotional_weight, consolidate, propose_takes, conversation_facts_backfill, enrich_thin, schema-suggest]. Brain-global: [fence_repair, content_repair, resolve_symbol_edges, synthesize_concepts, grade_takes, calibration_profile, edge_contradictions, drift, chronicle, facts_drain, skillopt, embed, orphans, purge]. Mixed: [synthesize, patterns].","name": "cycle_phase_scope","status": "ok"},diff --git a/test/fixtures/goldens/doctor/json-pglite-fresh.json b/test/fixtures/goldens/doctor/json-pglite-fresh.jsonindex 61300c5796..faf3a2e037 100644--- a/test/fixtures/goldens/doctor/json-pglite-fresh.json+++ b/test/fixtures/goldens/doctor/json-pglite-fresh.json@@ -2061,7 +2061,7 @@"category": "meta","details": {"counts": {- "global": 13,+ "global": 14,"mixed": 2,"source": 12},@@ -2070,6 +2070,7 @@"calibration_profile": "global","chronicle": "global","consolidate": "source",+ "content_repair": "global","conversation_facts_backfill": "source","drift": "global","edge_contradictions": "global",@@ -2095,7 +2096,7 @@"synthesize_concepts": "global"}},- "message": "Phase taxonomy: 12 source-scoped, 13 brain-global, 2 mixed. Source-safe: [lint, backlinks, sync, extract, extract_facts, extract_atoms, recompute_emotional_weight, consolidate, propose_takes, conversation_facts_backfill, enrich_thin, schema-suggest]. Brain-global: [fence_repair, resolve_symbol_edges, synthesize_concepts, grade_takes, calibration_profile, edge_contradictions, drift, chronicle, facts_drain, skillopt, embed, orphans, purge]. Mixed: [synthesize, patterns].",+ "message": "Phase taxonomy: 12 source-scoped, 14 brain-global, 2 mixed. Source-safe: [lint, backlinks, sync, extract, extract_facts, extract_atoms, recompute_emotional_weight, consolidate, propose_takes, conversation_facts_backfill, enrich_thin, schema-suggest]. Brain-global: [fence_repair, content_repair, resolve_symbol_edges, synthesize_concepts, grade_takes, calibration_profile, edge_contradictions, drift, chronicle, facts_drain, skillopt, embed, orphans, purge]. Mixed: [synthesize, patterns].","name": "cycle_phase_scope","status": "ok"},diff --git a/test/fixtures/goldens/doctor/json-postgres-fresh.json b/test/fixtures/goldens/doctor/json-postgres-fresh.jsonindex 46d2c97e55..26343ecc0a 100644--- a/test/fixtures/goldens/doctor/json-postgres-fresh.json+++ b/test/fixtures/goldens/doctor/json-postgres-fresh.json@@ -2052,7 +2052,7 @@"category": "meta","details": {"counts": {- "global": 13,+ "global": 14,"mixed": 2,"source": 12},@@ -2061,6 +2061,7 @@"calibration_profile": "global","chronicle": "global","consolidate": "source",+ "content_repair": "global","conversation_facts_backfill": "source","drift": "global","edge_contradictions": "global",@@ -2086,7 +2087,7 @@"synthesize_concepts": "global"}},- "message": "Phase taxonomy: 12 source-scoped, 13 brain-global, 2 mixed. Source-safe: [lint, backlinks, sync, extract, extract_facts, extract_atoms, recompute_emotional_weight, consolidate, propose_takes, conversation_facts_backfill, enrich_thin, schema-suggest]. Brain-global: [fence_repair, resolve_symbol_edges, synthesize_concepts, grade_takes, calibration_profile, edge_contradictions, drift, chronicle, facts_drain, skillopt, embed, orphans, purge]. Mixed: [synthesize, patterns].",+ "message": "Phase taxonomy: 12 source-scoped, 14 brain-global, 2 mixed. Source-safe: [lint, backlinks, sync, extract, extract_facts, extract_atoms, recompute_emotional_weight, consolidate, propose_takes, conversation_facts_backfill, enrich_thin, schema-suggest]. Brain-global: [fence_repair, content_repair, resolve_symbol_edges, synthesize_concepts, grade_takes, calibration_profile, edge_contradictions, drift, chronicle, facts_drain, skillopt, embed, orphans, purge]. Mixed: [synthesize, patterns].","name": "cycle_phase_scope","status": "ok"},