Auto-Sync

Auto-Sync is a documentation synchronization skill (label control) for keeping docs in sync with code. It detects outdated markdown files through INDEX, delegates updates to parallel agents, and produces a change report.

How it works

Auto-Sync tracks documents through an INDEX — a JSONL file containing a record for each synchronized file: path, type, last sync date, and protocol.

Documents are marked for tracking via frontmatter tags in the file header. The skill periodically checks which files are stale and updates their content based on the current state of the code.

/brewdoc:auto-sync

Modes

ModeInvocationScope
STATUS/brewdoc:auto-sync statusINDEX status report
INIT/brewdoc:auto-sync init <path>Mark a file for tracking
PROJECT/brewdoc:auto-syncAll .md in .claude/**
GLOBAL/brewdoc:auto-sync globalAll .md in ~/.claude/**
FILE/brewdoc:auto-sync path/to/file.mdSingle file
FOLDER/brewdoc:auto-sync path/to/folderAll .md in the folder

Sync workflow

  • DiscoveryPhase 1

    The discover.sh script finds all markdown files in the scope and determines their type: skill, agent, rule, config, or doc. Files without frontmatter tags are added automatically.

  • QueuePhase 2

    The index-ops.sh stale script identifies stale entries based on the configured interval (INTERVAL_DAYS from config). New and stale files enter the processing queue.

  • ProcessingPhase 3

    For each file in the queue, a bd-auto-sync-processor agent (sonnet model) is launched. Agents run in parallel (up to PARALLEL_AGENTS concurrently). Each agent analyzes the code, compares it with the current document content, and applies changes.

  • ReportPhase 4

    Updated files receive a new date in the INDEX. Failed files remain stale for a retry. A summary report is generated: discovered, queued, updated, unchanged, errors.

INDEX format

INDEX is stored in JSONL format. Project: .claude/auto-sync/INDEX.jsonl. Global: ~/.claude/auto-sync/INDEX.jsonl.

{"p":"skills/auth/SKILL.md","t":"skill","u":"2026-02-05","pr":"default"}
FieldDescription
pRelative path from the scope root
tType: skill / agent / rule / config / doc
uLast sync date (YYYY-MM-DD)
prProtocol: default or override

Frontmatter tags

To include a file in synchronization, add 3 required fields to the frontmatter:

---
auto-sync: enabled
auto-sync-date: 2026-02-05
auto-sync-type: skill
---

Override protocol

For fine-tuning synchronization of a specific file, use the optional auto-sync-override block:

---
auto-sync: enabled
auto-sync-date: 2026-02-05
auto-sync-type: doc
auto-sync-override: |
  sources: src/**/*.ts, .claude/agents/*.md
  focus: API endpoints, error handling
  preserve: ## User Notes, ## Custom Config
---
ParameterPurpose
sourcesGlob patterns for code files to analyze
focusWhat to pay attention to during analysis
preserveDocument sections to leave untouched during updates

When auto-sync-override is present, the INDEX entry gets pr: "override".

Managed directories

By default, rules/, agents/, and skills/ are excluded from automatic scanning. To sync them, specify the path explicitly:

/brewdoc:auto-sync .claude/rules
/brewdoc:auto-sync .claude/agents
/brewdoc:auto-sync .claude/skills

Tips

  • Start with /brewdoc:auto-sync status to see the current INDEX state and find untracked files.
  • Use /brewdoc:auto-sync init <path> to add individual files — the skill will automatically determine the type and add frontmatter.
  • For documents with non-standard structure, use auto-sync-override with the preserve parameter to protect custom sections from being overwritten.

Error handling

ErrorAction
INDEX corruptedRebuild via discover
File not foundSkip, add to errors
Agent timeoutOne retry attempt
No marked filesReport “0 found”