frontmatter-guard
Qué hace
Esta skill revisa la sección de cabecera oculta de cada página del cerebro en busca de errores. Puede reparar errores comunes de forma automática después de que apruebes una vista previa.
Cuándo usarla
- ✓Cuando una página del cerebro no se sincroniza o muestra resultados de búsqueda ilegibles.
- ✓Cuando quieres revisar todas tus páginas en busca de errores de cabecera antes de una importación grande.
- ✓Cuando una página tiene una línea de cierre que falta, comillas anidadas o un título que no coincide con el nombre de su archivo.
Link de la skill
https://github.com/garrytan/gbrain/blob/master/plugin/skills/frontmatter-guard/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“Revisa todas mis páginas del cerebro en busca de datos de cabecera rotos y muéstrame una vista previa de los arreglos antes de aplicarlos.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
El agente analiza cada página con un conjunto de comprobaciones estándar. Explica cada problema y, después, crea una copia de seguridad y aplica un arreglo solo cuando apruebes la vista previa.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de GitHub.
Frontmatter Guard Skill
Convention: see
skills/conventions/quality.mdfor citation rules; this skill is structural validation, not citation auditing.
Contract
This skill guarantees:
- Every brain page is scanned against the eight canonical frontmatter validation classes
- Mechanical errors (nested quotes, missing closing
---, null bytes, slug mismatch) are auto-repairable on demand with.bakbackups - Validation logic is shared with
gbrain doctor'sfrontmatter_integritysubcheck — single source of truth - Reports per source (gbrain is multi-source since v0.18.0); never silently audits the wrong root
- Files sync holds are explained from their hold record (code, reason, key, line, fix) and fixed only through a previewed, hash-bound repair the user approved
Why This Exists
Brain pages pile up over months. Agents write them with malformed frontmatter:
- Missing closing
---(entity detector bugs) - Unstructured YAML in meeting pages (ingestion bugs)
- Slug mismatches (path renames not propagated)
- Null bytes (binary corruption from copy-paste accidents)
- Nested double quotes in titles (
title: "Alice "Ace" Example")
Without a guard, these accumulate silently until gbrain sync chokes or search returns garbage. The guard makes the failure visible at audit time and trivially fixable.
Write brain files safely (do this first)
Write pages through
put_page/capture(MCP orgbrain put). gbrain serializes frontmatter itself, so the file on disk is always valid YAML.A script or agent that writes Markdown files directly must build frontmatter with a YAML serializer (
yaml.dump, js-yamldump), never by string interpolation.title: ${title}breaks as soon as a title contains:,#, quotes or a newline.Check generated content before writing it, without touching disk:
printf '%s' "$content" | gbrain frontmatter validate --stdin --path notes/2026-10-04-digest.mdExit 1 means fix it first. The default is the strict producer rule: YAML gbrain could still import by quoting a value fails too, because other tools reject it.
--importableanswers the narrower question "would sync hold it?".Never write a key gbrain reads for access or identity (
visibility,derived_from,slug,type,id,source_id) from untrusted text.
Held files: read them, then fix them
A file sync cannot import without guessing is held: the rest of the source still syncs, a new file has no page yet, and an existing page keeps its last good revision and refuses put_page until the file is repaired (do not retry the write). Where holds show up: sync output (Held <path>: <code> … Next: <command>), gbrain sources status <id> (--json: git_holds.items[]), doctor git_held_files, get_page file_held, and search hits marked stale.
Each hold record carries code, reason, key, line, message (location only, never the value), fix (exact argv) and docs. Act on reason:
| Hold | What to do |
|---|---|
invalid_frontmatter / yaml_parse |
Preview gbrain repair frontmatter --source <id>; usually needs_review with the exact line to fix by hand. |
invalid_frontmatter / needs_interpretation |
Preview with --include-ambiguous, show the user each per-file diff, apply only what they approve. |
invalid_frontmatter / ambiguous_identity_key or ambiguous_protected_key; visibility_noncanonical |
Never guess. Show the user the line; they decide the one value (visibility decides who can read the page; page privacy reads only visibility: private, lowercase on its own line). |
frontmatter_slug_conflict |
Remove the slug: line or move the file; the repair proposes removing it under --include-ambiguous. |
file_too_large |
The file is over the fixed page limit (24 MiB for Markdown, 5 MB for code); every page under it is searchable, so never split one that fits. Ask the user to add it to sync.exclude, or to split it into files under the limit. A smaller page an MCP transport refused goes by file instead (docs/guides/memory-boundaries.md#large-page-limits). |
content_rejected |
The user chose content_sanity.junk_disposition=reject; ask before changing it. |
The fix flow (walkthrough with real output: docs/guides/repair.md#held-files):
gbrain sources status <id> # what is held and why
gbrain repair frontmatter --source <id> # pass 1: safe quotin
Preguntas frecuentes
¿Cambiará mis páginas sin preguntar?
No. Las reparaciones se muestran primero como vista previa y se guarda una copia de seguridad.
¿Qué tipos de errores detecta?
Líneas de cierre que faltan, comillas anidadas, nombres que no coinciden, cabeceras vacías y caracteres dañados.
¿Por qué la sincronización omite algunos archivos?
La skill explica cada bloqueo según su registro y solo lo corrige mediante una reparación aprobada.
Detalles
Descripción original del autor
Validate and auto-repair YAML frontmatter on brain pages. Catches malformed pages before they enter the brain (missing closing ---, nested quotes, slug mismatches, null bytes, empty frontmatter, YAML parse failures), explains files sync holds instead of importing, and drives the previewed `gbrain repair frontmatter` fix. Wraps the `gbrain frontmatter` CLI for agent-driven workflows.
repo: garrytan/gbrain
Popularidad
- Estrellas en GitHub
- 31 mil
- Posición en el ranking
- #9302
- Licencia
- MIT
- Actualizada
- 2/11/2026
Comentarios
- …
Más skills de este repositorio
gbrain
31 milPermite que tu agente busque en un cerebro compartido de conocimiento de la empresa datos sobre personas, proyectos y decisiones, y guarde notas duraderas en él.
brain-ingest-gate
31 milComprueba el contenido nuevo frente a un cerebro de conocimiento existente antes de añadirlo, para evitar duplicados y resolver primero las entidades nombradas.
brain-link-discipline
31 milHace que tu agente incluya un enlace que funcione a cada página del cerebro que menciona, en el mismo mensaje, para que puedas abrirla enseguida.
brain-ops
31 milOfrece a tu agente la rutina básica de un cerebro de conocimiento: consultar primero el contexto, guardar las notas explícitas con su fuente y enlazar páginas relacionadas.
Skills parecidas
technical-documentation
394 milAyuda a tu agente a escribir y revisar documentación técnica clara y archivos de instrucciones para agentes, para que personas y herramientas de IA puedan seguirlos fácilmente.
architecture-decision-records
280 milHace que tu agente registre las decisiones importantes sobre la estructura del proyecto. Así se entiende el motivo de cada elección y se mantiene un historial claro.
code-tour
280 milPermite que tu agente cree recorridos paso a paso por el código, con referencias exactas a archivos y líneas. Útil para introducciones, explicaciones y revisiones.