PLUGIN brewdoc / Skills
On this page
memory-sync-setup opus generator
A generic memory sweep cannot tell an intentional Russian trigger alias from a language violation, or a stale lint-rule claim from a correct one. /brewdoc:memory-sync-setup analyzes your repo and writes a project-local .claude/skills/memory-sync/ that knows its batches, invariants, verification commands, agent roster and language policy. That emitted skill syncs everything auto-loaded against the code.
Quick reference
| Field | Value |
|---|---|
| Command | /brewdoc:memory-sync-setup [prompt] [status|install|upgrade|enable|disable|uninstall|purge] [fine-tune-prompt] [--unattended] |
| Canonical modes | status · install · upgrade · enable · disable · uninstall · purge |
| No argument | status when .claude/skills/memory-sync/ exists, install when not |
| Invocation | user-invoked only (disable-model-invocation: true) |
| Model | opus |
| Tools | Read, Edit, Glob, Grep, Bash, Agent, AskUserQuestion |
What it does
The skill is a generator in the family of brewcode:superreview-setup and brewtools:task-board-setup: it produces a working artifact instead of doing the work itself. It scans the memory surface (root and nested CLAUDE.md, rules, conventions, the AGENTS.md family, agents, skills, the memory dir), then emits five files. docs/** is out of scope, owned by a separate doc flow (/docs, docsync-setup).
The emitted /memory-sync runs disjoint batches, verifies each with an independent checker, and is non-growth: no file ends longer than it started. Focus text steers emphasis; an explicit “only rules” narrows what may be written.
When to use
| Scenario | Command |
|---|---|
| Wire memory sync into a repo | /brewdoc:memory-sync-setup install |
| Bias toward a concern | /brewdoc:memory-sync-setup install "weight stale-fact removal over compression" |
| Check the install is still true | /brewdoc:memory-sync-setup status |
Repo gained an agent, rule or CLAUDE.md | /brewdoc:memory-sync-setup upgrade |
Pause or resume /memory-sync | /brewdoc:memory-sync-setup disable / enable |
| Drop the emitted skill (keeps your files) / the whole dir | uninstall / purge |
| Actually sync memory | /memory-sync (the emitted skill) |
Example
/brewdoc:memory-sync-setup install
memory-sync generated -> .claude/skills/memory-sync/
Surface: 68 files: 5 root, 15 rules, 3 conventions, 26 agents, 18 skills, 1 local
Batches: 6 (disjoint)
Excluded: docs/** (separate doc flow), source code, secrets,
.claude/reports/**, .claude/worktrees/**
Run it: /memory-sync -> scope session (default), whole surface
/memory-sync all "only rules" -> re-verify facts in authorized rules only
Counts are illustrative; real ones come from the scanned project.
Workflow
- Mode gate
An explicit mode wins; empty input means status or install. At most one question, before work starts.
- Analyze
generate.sh scanfinds the memory surface, VERIFY-ONLY files, exclusions, default branch, language policy and a fact catalogue (one shell command per claim). - Emit
generate.sh emitfills the template and stamps provenance frontmatter. It refuses to overwrite a live install. - Fill blocks
Thirteen multi-row placeholders are filled through
Edit: eleven inSKILL.md, two inreferences/hard-sync.md. - Validate and report
generate.sh validatefails on leftover placeholders or missing assets, then the report prints surface, batches and how to run it.
Modes in detail #
| Mode | Writes | Does |
|---|---|---|
status | nothing | Runs generate.sh status: provenance rows, surface stamped vs counted now, missing files. Verdict IN SYNC / STALE (n drifts) / STALE-LEGACY (n drifts) / NOT INSTALLED, prefixed PARKED - when disabled |
install | 5 files | Full analysis and emit. Refuses if the dir exists |
upgrade | edits | Re-scans, refreshes tables, keeps hand-edits, ends with generate.sh restamp (also deletes a pre-5.5.1 disable-model-invocation key) |
enable | one rename | SKILL.md.disabled -> SKILL.md; no regeneration |
disable | one rename | SKILL.md -> SKILL.md.disabled. Claude Code discovers a project skill only through SKILL.md, so references and hand-edits stay byte-identical |
uninstall | deletes manifest | Removes SKILL.md (or parked form) plus the 4 references, after confirmation; user-added files are kept and listed |
purge | deletes dir | The whole .claude/skills/memory-sync/, plus crashed .memory-sync-emit.* staging |
Under --unattended, upgrade skips when the emitted skill is parked or not installed; see how the flag works.
Enable/disable is entry-file parking, not a flag: status reports INSTALLED=parked, never NOT INSTALLED. Removed aliases: init, on, off, setup, remove, reset, create, update, cleanup.
What the emitted skill does #
| Axis | Behavior |
|---|---|
| Scope | session (default), branch, commit <sha> / <a>..<b>, recent[:N] (default 10), all |
| Depth | NORMAL (default) or HARD |
| Reach | MEMORY (default) or REFS (adds tracked outside references cited by always-loaded files) |
| Phases | GATHER (parallel, read-only) -> SYNC (one agent per batch, one message) -> VERIFY (checker is never the writer) -> SELF-SYNC -> PROPOSE (new agent/skill proposed, never auto-created) -> REPORT (chat only) |
| Agents | Re-audited against current best practice every sweep |
| Invocation | Model-invocable by design; no disable-model-invocation |
Emits SKILL.md plus references/memory-guide.md, agent-audit.md, hard-sync.md, prompting-guide.md, nothing else. A fresh .claude/skills/ needs /reload-skills once.
Depth: NORMAL vs HARD #
Depth comes from the request: the token hard, or the intent in prose (“too much context”, “aggressive”). Nothing is regenerated.
NORMAL | HARD | |
|---|---|---|
| Fact sync, dedup, compression | yes | yes |
Pass A: rules paths: precision audit | no | yes |
| Pass B: obvious-knowledge purge | no | yes |
- Pass A. Each
paths:entry gets a verdict:OK,TOO_BROAD,TOO_NARROW,DANGLING,MISSING,CORRECTLY_GLOBAL. ADANGLINGentry is dropped and reported; the rule file is never deleted. - Pass B. Deletes what any competent model already knows. Keeps decisions that exist because someone here made them. A line naming a path, command, version or number is kept, and a file cut by more than half is reported before the edit lands.
/memory-sync all hard Scope and safe evidence #
Scope picks change facts, depth picks processing, reach picks editable files; user narrowing overrides all three. Source code, doc-flow paths and secrets are never written at any reach. Verification reads the minimum non-secret evidence: credential names and key paths can be checked, key contents are never read or copied.
Prompt quality pass #
Each sweep applies the 18-rule table in references/prompting-guide.md to authorized instruction files (CLAUDE.md, .claude/rules/**/*.md, AGENTS.md, agent and skill bodies).
| Violation | NORMAL | HARD |
|---|---|---|
| On a line a fact/dedup edit already touches | fixed | fixed |
| On an untouched line | reported only | fixed |
A lossless guard protects paths, CLI flags, thresholds, versions, model ids, incident-backed !=/NEVER rows and canonical mode lists. The report gains a Prompt column per file.
Generator internals #
- Restamp.
generate.sh restamprewrites provenance keys in place and refuses to write if anything outside them would move. Genuine drift still needs a verified correction. - Surface counts prune
.claude/reports/**and.claude/worktrees/**(copies, not memory).surface_filesis always the script’s own count. - Version. Read from
plugin.jsonby self-location; if unreadable,emitandrestamphard-fail rather than stampunknown. - Git visibility. A real set difference (
git ls-filesvsfind,comm -23):git-tracked,git-ignored,no-commits, ormixed (N tracked, M untracked).mixedorgit-ignoredtells VERIFY to re-read files, never trustgit diffalone. - Foreign marker blocks (such as
brewcode:sembleinCLAUDE.md) are preserved byte for byte and reported asmanaged by <setup>. - Errors.
installon an existing install points toupgrade; a fact with no runnable command is left out; a symlinked or vendor-markedAGENTS.mdbecomes VERIFY-ONLY. - Re-run
upgradewhen a nestedCLAUDE.md, rule, agent or skill is added, the stack or default branch changes, orstatusshows drift.
docsync-setup
Date-based staleness tracking for edited Markdown; memory-sync verifies instruction claims against source.
Text Optimize
Compresses prompt-shaped files (CLAUDE.md, rules, agent and skill files) for token efficiency.
Brewdoc overview
Every brewdoc skill and what it does.
GitHub source
Emit templates and the full SKILL.md.
Update: /brewtools:plugin-update, /reload-plugins, then /brewcode:setup-status upgrade - FAQ