frontmatter-guard
하는 일
이 스킬은 각 브레인 페이지의 숨겨진 머리말 부분에 실수가 있는지 확인합니다. 미리 보기를 승인하면 흔한 오류는 자동으로 고칠 수 있습니다.
사용하는 경우
- ✓브레인 페이지가 동기화되지 않거나 검색 결과가 깨져 보일 때.
- ✓큰 가져오기 전에 모든 페이지의 머리말 오류를 확인하고 싶을 때.
- ✓페이지에 닫는 줄이 없거나, 따옴표가 중첩되었거나, 제목이 파일 이름과 맞지 않을 때.
스킬 링크
https://github.com/garrytan/gbrain/blob/master/plugin/skills/frontmatter-guard/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“내 브레인 페이지에서 깨진 머리말 정보를 모두 확인하고, 적용하기 전에 고침 사항을 미리 보여 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 각 페이지를 표준 점검 항목과 비교합니다. 각 문제를 설명한 뒤, 백업을 만들고 내가 미리 보기를 승인한 경우에만 수정을 적용합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 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
자주 묻는 질문
묻지 않고 페이지를 바꾸나요?
아닙니다. 수정 사항은 먼저 미리 보기로 보여 주며, 백업도 보관합니다.
어떤 종류의 오류를 잡아내나요?
닫는 줄 누락, 중첩된 따옴표, 이름 불일치, 빈 머리말, 손상된 문자를 잡아냅니다.
동기화가 일부 파일을 건너뛰는 이유는 무엇인가요?
스킬은 기록에 따라 각 보류 사유를 설명하고, 승인된 수정으로만 고칩니다.
상세 정보
작성자의 원본 설명
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
인기도
- GitHub 스타
- 31k
- 순위
- #9302
- 라이선스
- MIT
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
gbrain
31k에이전트가 공유 회사 지식 브레인에서 사람, 프로젝트, 결정에 관한 사실을 검색하고, 지속적인 메모를 저장하도록 돕습니다.
brain-ingest-gate
31k새 콘텐츠를 지식 브레인에 추가하기 전에 기존 내용과 비교해 중복을 막고, 고유 명칭을 먼저 확인합니다.
brain-link-discipline
31k에이전트가 브레인 페이지를 보고할 때 같은 메시지에 각 페이지의 작동하는 링크를 포함해, 바로 열어 볼 수 있게 합니다.
brain-ops
31k지식 브레인의 기본 루틴을 제공합니다. 먼저 기존 맥락을 확인하고, 메모는 출처와 함께 저장하며, 관련 페이지를 연결합니다.
비슷한 스킬
technical-documentation
394k에이전트가 명확한 기술 문서와 에이전트 지침 파일을 작성하고 검토하도록 도와, 사람과 AI 도구가 쉽게 따를 수 있게 합니다.
architecture-decision-records
280k에이전트가 프로젝트 구조에 관한 중요한 결정을 기록하도록 합니다. 선택의 이유를 이해하고 변경 이력을 명확히 유지하는 데 도움이 됩니다.
code-tour
280k에이전트가 정확한 파일과 줄 번호를 참조하는 단계별 코드 안내를 만들도록 합니다. 소개, 설명, 리뷰에 유용합니다.