Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(skills): maintain falls back to get_brain_health without admin scope (#6748)
garrytan9963f5902842
diff --git a/skills/maintain/SKILL.md b/skills/maintain/SKILL.mdindex 14418aefe1..8527bbcb7a 100644--- a/skills/maintain/SKILL.md+++ b/skills/maintain/SKILL.md@@ -29,6 +29,7 @@ triggers:- "consolidate yesterday's conversations"tools:- get_health+ - get_brain_health- get_page- put_page- list_pages@@ -109,7 +110,7 @@ Use the per-dimension walk below (Phase 2 onward) when:### Manual path-1. **Run health check.** Check gbrain health to get the dashboard.+1. **Run health check.** Check gbrain health (`get_health`) to get the dashboard. `get_health` needs admin scope; without it, call `get_brain_health` (read scope), which returns bands only (write capacity, write failures, ghost pages, unsearchable chunks), and skip the dimensions it cannot answer: stale pages, orphan pages, dead links, embed coverage, link and timeline counts and the brain score. Name the skipped dimensions in the report and ask for an admin token, or for `gbrain doctor --json` on the brain host, to cover them.2. **Check each dimension:**### Stale pages@@ -574,7 +575,8 @@ The maintenance report follows this structure:## Tools Used-- Check gbrain health (get_health)+- Check gbrain health (get_health; admin scope)+- Check banded brain health without admin scope (get_brain_health)- List pages in gbrain with filters (list_pages)- Read a page from gbrain (get_page)- Check backlinks in gbrain (get_backlinks)diff --git a/skills/skills.lock.json b/skills/skills.lock.jsonindex 9462b04f67..90e77fd0d5 100644--- a/skills/skills.lock.json+++ b/skills/skills.lock.json@@ -94,7 +94,7 @@"idea-lineage/SKILL.md": "8cb36179dbf94abc17065613b8e773b1bb2b22670742aa77347b91ac885a05c5","idea-lineage/routing-eval.jsonl": "ee2e00704b9accb7dd58bb8f126a3bc04a2c40be499180fa505dbf6d5061cd41","ingest/SKILL.md": "1acc220ce6e9e65876fa2ccede6ce11f9c75457feb6695ef904955f8debecaae",- "maintain/SKILL.md": "cb45aba2ea4075195ed244f28571457cec8cb42f70fe209b570c29528d857b9e",+ "maintain/SKILL.md": "bb23382770ffce60aebc5475abe65bc65b1789a93fb47f7641d39efe952ea3bc","manifest.json": "357aa185d380f0a357cb15cd513317e290cbc5fcf5ca4e3860b0e829fdcbf1e4","mcp-access/SKILL.md": "1bc16338b89f476aa8c24ffec79c989fa60716793998af264d357f7886d2bc96","measure-before-you-fix/SKILL.md": "11906da29a1a31976b13d4796b686d9a9981825737846a85f32d88bf431b9b36",diff --git a/test/maintain-skill-health-fallback.test.ts b/test/maintain-skill-health-fallback.test.tsnew file mode 100644index 0000000000..9051f510eb--- /dev/null+++ b/test/maintain-skill-health-fallback.test.ts@@ -0,0 +1,30 @@+/**+ * #6748: skills/maintain declared only the admin-scoped `get_health`, so an+ * agent with a read token had no declared way to run the manual path. It now+ * declares the read-scoped `get_brain_health` as the fallback (bands only)+ * and names the dimensions that fallback cannot answer.+ */+import { describe, expect, test } from 'bun:test';+import { readFileSync } from 'node:fs';+import { join } from 'node:path';+import { operationsByName } from '../src/core/operations.ts';++const skill = readFileSync(join(import.meta.dir, '..', 'skills', 'maintain', 'SKILL.md'), 'utf8');+const frontmatterTools = (skill.match(/^tools:\n((?: - .+\n)+)/m)?.[1] ?? '').split('\n').map(l => l.replace(/^ - /, '').trim()).filter(Boolean);++describe('#6748 maintain health tools', () => {+ test('declares the admin get_health and the read-scoped get_brain_health fallback', () => {+ expect(operationsByName.get_health?.scope).toBe('admin');+ expect(operationsByName.get_brain_health?.scope).toBe('read');+ expect(frontmatterTools).toContain('get_health');+ expect(frontmatterTools).toContain('get_brain_health');+ expect(skill).toContain('(get_brain_health)');+ });++ test('the manual path says when to fall back and names the dimensions the bands skip', () => {+ const step = skill.match(/^1\. \*\*Run health check\.\*\*.*$/m)?.[0] ?? '';+ expect(step).toContain('get_health');+ expect(step).toContain('get_brain_health');+ for (const dimension of ['stale pages', 'orphan pages', 'dead links', 'embed coverage']) expect(step).toContain(dimension);+ });+});