PLUGIN brewdoc / Skills
On this page
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
| Field | Value |
|---|---|
| Command | /brewdoc:docsync-setup [prompt] [mode] [--unattended] |
| Canonical modes | status · install · upgrade · enable · disable · uninstall · purge |
| Extras | sync [--all] · reread · frontmatter · free text (RU/EN) |
| No argument | status when installed, install when not |
| Invocation | user-invoked only (disable-model-invocation: true) |
| Model | sonnet |
| Tools | Read, 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.
| Scenario | Command |
|---|---|
| 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
- Track silently
Edits and reads of
.mdfiles are logged. No output, no interruption. - Block on stale
At
Stop, the gate blocks once for edited docs whoselast_updatedis missing, unusable or behind the file. - Sync
synclists stale docs, asks which to sync, follows eachsync_procedureand bumpslast_updated.
Technical details #
Modes
| Mode | Does |
|---|---|
install | Asks 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 |
upgrade | Re-copies hooks, rewrites registrations, refreshes the provenance keys; enabled, threshold_days, exclude and logs stay |
enable / disable | Flip enabled in config.json. Hooks stay wired and no-op from the next call, no restart |
uninstall | Removes docsync hook entries and files, keeps .claude/docsync/; foreign entries untouched |
purge | uninstall plus deletes .claude/docsync/ |
sync [--all] | Per-doc sync_procedure, then last_updated = today; depth follows doc_type (llm deep, user light) |
reread / frontmatter | Re-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 realYYYY-MM-DDdate (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 compareslast_updatedwith the file’s modification day (>threshold_days= stale);statusandsyncage against today. - Quote
last_updatedandsync_procedure, leavedoc_typebare: a YAML consumer types an unquoted date as a Date, and other tooling matches^doc_type: llm$. sync_procedureis a model-only hint; no hook parses it.- Scope: all
*.mdminusexcludeglobs (.claude/**always added),doc_type: skipfiles, andCLAUDE.md,CLAUDE.local.md,AGENTS.mdat any depth. All three hooks apply this, so marking a docskipmid-session silences it at once. - Only docs edited through
Write/Editare raised. A doc that was only read, or changed by Bash or outside Claude Code, never is.
The three hooks #
| File | Event | Matcher | Action |
|---|---|---|---|
docsync-track.mjs | PostToolUse | Write|Edit (Write(**/*.md), Edit(**/*.md)), 5 s | Logs the edit; nudges once per file to add a missing last_updated |
docsync-watch.mjs | PostToolUse | Read(**/*.md), 5 s | Logs reads. Silent by design |
docsync-gate.mjs | Stop | none, 10 s | Blocks 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