PLUGIN brewdoc / Skills

docsync-setup sonnet setup

Docs go stale the moment code moves on. Docsync installs three project-local hooks (track, watch, gate) that log which .md files a session edits. At the end of a turn, an edited doc whose last_updated is missing or behind the file blocks the turn, and Claude sets the date or syncs the doc. Frontmatter is the source of truth; there is no ledger. One of 11 setup skills; its config carries the artifact metadata provenance keys.

Quick reference

FieldValue
Command/brewdoc:docsync-setup [prompt] [mode] [--unattended]
Canonical modesstatus · install · upgrade · enable · disable · uninstall · purge
Extrassync [--all] · reread · frontmatter · free text (RU/EN)
No argumentstatus when installed, install when not
Invocationuser-invoked only (disable-model-invocation: true)
Modelsonnet
ToolsRead, Write, Edit, Bash, Glob, Grep, AskUserQuestion

When to use

Fits repos with hand-maintained prose docs (README, SKILL.md, design notes). Skip generated docs that regenerate on build.

ScenarioCommand
Set up tracking/brewdoc:docsync-setup install
See what is stale, no changes/brewdoc:docsync-setup status
Pause or resume tracking/brewdoc:docsync-setup disable / enable
Sync stale docs (asks which)/brewdoc:docsync-setup sync
Remove the tracker/brewdoc:docsync-setup uninstall (purge also deletes .claude/docsync/)

Example

/brewdoc:docsync-setup install

status prints an age table per tracked doc:

## Status
| Doc | doc_type | last_updated | age | state |
|-----|----------|--------------|-----|-------|
| README.md | user | 2026-07-01 | 18d | stale |
| SKILL.md | llm | 2026-07-17 | 2d | fresh |
| NOTES.md | user | — | — | no-date |

Flow

  1. Track silently

    Edits and reads of .md files are logged. No output, no interruption.

  2. Block on stale

    At Stop, the gate blocks once for edited docs whose last_updated is missing, unusable or behind the file.

  3. Sync

    sync lists stale docs, asks which to sync, follows each sync_procedure and bumps last_updated.

Technical details #

Modes

ModeDoes
installAsks a threshold (default 7 days) and excludes, validates inputs and hook syntax, copies 3 hooks, writes .claude/docsync/config.json, merges settings.json under settings.json.lock (no .bak). Never adds frontmatter
upgradeRe-copies hooks, rewrites registrations, refreshes the provenance keys; enabled, threshold_days, exclude and logs stay
enable / disableFlip enabled in config.json. Hooks stay wired and no-op from the next call, no restart
uninstallRemoves docsync hook entries and files, keeps .claude/docsync/; foreign entries untouched
purgeuninstall plus deletes .claude/docsync/
sync [--all]Per-doc sync_procedure, then last_updated = today; depth follows doc_type (llm deep, user light)
reread / frontmatterRe-read tracked docs / opt-in retro-add of frontmatter

Under --unattended, upgrade skips with nothing written when docsync is not installed or wrapped by a launcher; see how the flag works.

Removed aliases: init, on, off, setup, remove, reset, create, update, cleanup.

Enable/disable polarity. The flag is "enabled" in config.json, and an absent key means ENABLED (enabled: c.enabled !== false). The opposite of brewtools:agent-deadline-setup, where an absent key is inert.

Frontmatter schema and scope #
---
doc_type: llm                  # optional, UNQUOTED; llm | user | skip (absent = user)
last_updated: "2026-07-19"     # sole staleness input (YYYY-MM-DD, LOCAL time)
sync_procedure: "what to check / where to look when syncing"   # optional, prose
---
  • Unusable last_updated: not a real YYYY-MM-DD date (soon, 2026-13-45) or later than today. The gate reports it separately from stale and asks Claude to set today’s date.
  • Staleness is date only: no hashing, no depends_on. The gate compares last_updated with the file’s modification day (> threshold_days = stale); status and sync age against today.
  • Quote last_updated and sync_procedure, leave doc_type bare: a YAML consumer types an unquoted date as a Date, and other tooling matches ^doc_type: llm$.
  • sync_procedure is a model-only hint; no hook parses it.
  • Scope: all *.md minus exclude globs (.claude/** always added), doc_type: skip files, and CLAUDE.md, CLAUDE.local.md, AGENTS.md at any depth. All three hooks apply this, so marking a doc skip mid-session silences it at once.
  • Only docs edited through Write/Edit are raised. A doc that was only read, or changed by Bash or outside Claude Code, never is.
The three hooks #
FileEventMatcherAction
docsync-track.mjsPostToolUseWrite|Edit (Write(**/*.md), Edit(**/*.md)), 5 sLogs the edit; nudges once per file to add a missing last_updated
docsync-watch.mjsPostToolUseRead(**/*.md), 5 sLogs reads. Silent by design
docsync-gate.mjsStopnone, 10 sBlocks once for docs edited since its last ask that are stale, unusable or undated

After a block the gate stays silent until one of the listed docs is edited again, and never blocks when stop_hook_active is true. Claude sets a missing date itself; any other stale doc needs a sync, asking first only before deleting or wholesale rewriting content.

The hooks are self-contained ESM (Node built-ins only) and apply in the running session; restart only if they do not fire. Line 2 carries // brewcode-meta: version=… generated_by=brewdoc:docsync-setup for byte comparison with the plugin copy. Each hook resolves the project root itself: CLAUDE_PROJECT_DIR, then the nearest .git or .claude upward from cwd (a profile .claude is skipped), then cwd.

State, config and recovery #

.claude/docsync/config.json: version, content_version, generated_by, last_updated (inert provenance, read by /brewcode:setup-status), then enabled (default true), threshold_days (default 7) and exclude (absent = [".claude/**"]; deleting that entry tracks docs under .claude/).

state-<session_id>.jsonl is one append-only log per session (events edit, read, nudge, ask). The gate prunes logs, old state*.json and stray .tmp files older than 14 days.

Install and upgrade snapshot every destination and publish each file by atomic rename. If a destination changed meanwhile, setup stops. Rollback restores prior bytes only where the file still matches this run’s output, so concurrent edits survive. Recovery is per file, not all-or-nothing.

memory-sync-setup

Generates a project-local /memory-sync skill that keeps CLAUDE.md and rules truthful.

GitHub source

Hook assets and the full SKILL.md.

Brewdoc overview

Every brewdoc skill and what it does.

Setup Status

Dashboard across every -setup skill; upgrade brings the stale ones current.

Update: /brewtools:plugin-update, /reload-plugins, then /brewcode:setup-status upgrade - FAQ