Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(skills): bundled skills pass the publication parser; guard it in verify (#5476, A-NEW-3)

time-attack7f7a1fe5edf8
diff --git a/package.json b/package.json
index b964debe7c..88d5d0ff32 100644
--- a/package.json
+++ b/package.json
@@ -78,6 +78,7 @@
"check:doc-history": "bash scripts/check-key-files-current-state.sh",
"check:resolver": "bun src/cli.ts check-resolvable --strict --skills-dir skills/",
"check:skill-brain-first": "bash scripts/check-skill-brain-first.sh",
+ "check:skill-publication": "bun scripts/check-skill-publication.ts",
"check:plugin-tree": "bash scripts/check-plugin-tree.sh",
"check:wasm": "bash scripts/check-wasm-embedded.sh",
"check:pglite-embedded": "bash scripts/check-pglite-embedded.sh",
diff --git a/scripts/check-skill-publication.ts b/scripts/check-skill-publication.ts
new file mode 100644
index 0000000000..cb287e1a1a
--- /dev/null
+++ b/scripts/check-skill-publication.ts
@@ -0,0 +1,44 @@
+#!/usr/bin/env bun
+/**
+ * A-NEW-3 (#5476): every bundled SKILL.md (skills/, plugin/skills/ and each
+ * plugin-variants/<v>/skills/) must pass the shared-skill publication parser
+ * (`normalizeSkillFiles` + `skillMetadata`), the same check `put_skill` and
+ * the 0.53 adoption run. A bundled skill that fails it (the capture skill's
+ * list-valued `writes_pages:` did) blocks every brain that adopts the pack.
+ *
+ * GBRAIN_GUARD_ROOT points the scan at a fixture tree (guard self-test).
+ * Exit 0 clean, 1 on any violation.
+ */
+import { existsSync, readdirSync, readFileSync } from 'node:fs';
+import { join, relative, resolve } from 'node:path';
+import { normalizeSkillFiles, skillMetadata } from '../src/core/shared-skills/manifest.ts';
+
+const ROOT = process.env.GBRAIN_GUARD_ROOT ? resolve(process.env.GBRAIN_GUARD_ROOT) : resolve(import.meta.dir, '..');
+const variants = existsSync(join(ROOT, 'plugin-variants')) ? readdirSync(join(ROOT, 'plugin-variants')).map(v => join('plugin-variants', v, 'skills')) : [];
+const lanes = ['skills', join('plugin', 'skills'), ...variants].map(dir => join(ROOT, dir)).filter(dir => existsSync(dir));
+
+const failures: string[] = [];
+let checked = 0;
+for (const lane of lanes) {
+ for (const entry of readdirSync(lane, { withFileTypes: true })) {
+ const path = join(lane, entry.name, 'SKILL.md');
+ if (!entry.isDirectory() || !existsSync(path)) continue;
+ checked++;
+ try {
+ const files = normalizeSkillFiles(entry.name, [{ path: `skills/${entry.name}/SKILL.md`, content: readFileSync(path, 'utf8'), file_class: 'prose' }]);
+ skillMetadata(entry.name, files, {});
+ } catch (error) {
+ const code = (error as { code?: string }).code ?? 'error';
+ failures.push(`${relative(ROOT, path)}: ${code}: ${(error as Error).message} ${(error as { suggestion?: string }).suggestion ?? ''}`.trim());
+ }
+ }
+}
+
+if (failures.length) {
+ console.error(`FAIL: ${failures.length} bundled SKILL.md file(s) fail the shared-skill publication parser:`);
+ for (const failure of failures) console.error(` ${failure}`);
+ console.error('Why: put_skill and the 0.53 shared-skills adoption refuse these files, so a brain adopting the bundled pack is blocked.');
+ console.error('Fix: correct the frontmatter (markers like writes_pages take true/false; list directories under writes_to), then regenerate plugin trees.');
+ process.exit(1);
+}
+console.log(`OK: ${checked} bundled SKILL.md file(s) pass the shared-skill publication parser.`);
diff --git a/scripts/guards-manifest.tsv b/scripts/guards-manifest.tsv
index 067c4b0366..c0a94d90b6 100644
--- a/scripts/guards-manifest.tsv
+++ b/scripts/guards-manifest.tsv
@@ -30,6 +30,7 @@ check-progress-to-stdout.sh scanner todo
check-proposal-pii.sh scanner todo
check-search-path.sh scanner yes GBRAIN_GUARD_ROOT seam; schema base files incl. the generated PGLite template (pglite-schema.generated.ts, refactor wave 1)
check-skill-brain-first.sh scanner yes runs this checkout's doctor skill_brain_first over <root>/skills; GBRAIN_GUARD_ROOT seam
+check-skill-publication.ts scanner yes A-NEW-3: bundled SKILL.md files (skills/, plugin/, plugin-variants/) through normalizeSkillFiles + skillMetadata; GBRAIN_GUARD_ROOT seam
check-skill-refs.mjs scanner todo
check-source-config-leak.sh scanner yes GBRAIN_GUARD_ROOT seam; bad-<dir> fixtures cover serve-http-*.ts, engine-sql/, sync/, doctor/checks/
check-source-id-projection.sh scanner yes GBRAIN_GUARD_ROOT seam; portable word boundaries (mawk has no \b, so the guard matched nothing on Ubuntu before); scans engine façades, module dirs and engine-sql/
diff --git a/scripts/run-verify-parallel.sh b/scripts/run-verify-parallel.sh
index 100a88bdbd..28d420d49a 100755
--- a/scripts/run-verify-parallel.sh
+++ b/scripts/run-verify-parallel.sh
@@ -96,6 +96,8 @@ CHECKS=(
# `bun run test` keeps it.
"check:bootstrap-templates"
"check:skill-brain-first"
+ # A-NEW-3: bundled SKILL.md files pass the shared-skill publication parser.
+ "check:skill-publication"
"check:conversation-parser"
"check:resolver"
"check:privacy"
diff --git a/skills/_brain-filing-rules.json b/skills/_brain-filing-rules.json
index f266d421c7..18deab3be8 100644
--- a/skills/_brain-filing-rules.json
+++ b/skills/_brain-filing-rules.json
@@ -135,6 +135,12 @@
"examples": ["media/x/{handle}/", "media/audio/", "media/video/"],
"description": "Format-prefixed parent for media-by-source-format ingest. Subdirectories like media/x/{handle}/ hold X/Twitter archives, media/audio/ holds podcast/voice captures. The format-prefix lives only when the content is sui generis to the source format AND lacks a clean primary-subject directory. Prefer subject-by-subject filing; fall through to media/ only when the source format IS the unifying frame."
},
+ {
+ "kind": "inbox",
+ "directory": "inbox/",
+ "examples": ["captured thoughts", "pasted snippets awaiting filing"],
+ "description": "Raw captured content awaiting filing; `gbrain capture` writes here. Move a page to its primary-subject directory once it is understood."
+ },
{
"kind": "conversation",
"directory": "conversations/",
diff --git a/skills/capture/SKILL.md b/skills/capture/SKILL.md
index 3745c0588a..c9b4c1f7a5 100644
--- a/skills/capture/SKILL.md
+++ b/skills/capture/SKILL.md
@@ -8,8 +8,9 @@ triggers:
- "ingest this into my brain"
- "drop this in the inbox"
- "save to brain"
-writes_pages:
- - "inbox/*"
+writes_pages: true
+writes_to:
+ - inbox/
---
# capture — the single ingestion entrypoint
diff --git a/skills/schema-author/SKILL.md b/skills/schema-author/SKILL.md
index 9e96c88040..d819d6f566 100644
--- a/skills/schema-author/SKILL.md
+++ b/skills/schema-author/SKILL.md
@@ -52,7 +52,7 @@ triggers:
- "schema sync"
- "schema author"
brain_first: exempt
-writes_pages: []
+writes_pages: false
---
# schema-author — evolve your schema pack
diff --git a/test/fixtures/guards/check-skill-publication.ts/bad/skills/capture/SKILL.md b/test/fixtures/guards/check-skill-publication.ts/bad/skills/capture/SKILL.md
new file mode 100644
index 0000000000..0990f87712
--- /dev/null
+++ b/test/fixtures/guards/check-skill-publication.ts/bad/skills/capture/SKILL.md
@@ -0,0 +1,8 @@
+---
+name: capture
+description: Synthetic fixture with a list-valued marker.
+writes_pages:
+ - "inbox/*"
+---
+
+Body.
diff --git a/test/fixtures/guards/check-skill-publication.ts/good/skills/capture/SKILL.md b/test/fixtures/guards/check-skill-publication.ts/good/skills/capture/SKILL.md
new file mode 100644
index 0000000000..041b73ecf9
--- /dev/null
+++ b/test/fixtures/guards/check-skill-publication.ts/good/skills/capture/SKILL.md
@@ -0,0 +1,9 @@
+---
+name: capture
+description: Synthetic fixture with a boolean marker.
+writes_pages: true
+writes_to:
+ - "inbox/*"
+---
+
+Body.