PLUGIN brewcode / Skills

semble-setup — semantic search with isolated content variants

opus mcp human-invoked

Wires the semble_code MCP server into a project so Claude finds code by intent, not by exact string: pinned install, project rule, hooks, permissions and agent migration. It reports state before every change and delegates every mutation to a script.

Terminal animation of semble-setup: one install command, a reload and resume, then a behaviour question answered by a semble_code search with ranked file hits, ending on a status card.
Illustrative animation: install wires the server, resume warms the index, a behaviour question runs a semantic search, a status card closes. File names, scores and timings are invented.

View README on GitHub (opens in a new tab)

Quick reference

FieldValue
Command/brewcode:semble-setup [status|install|upgrade|enable|disable|uninstall|purge|reindex|optimize|resume] [--unattended]
Argumentsa mode keyword, or free text in RU/EN
No-arg defaultalways status (read-only)
Modelopus
Outputsix-section report: Detection, Before, Actions, Verification, Current Status, Next Step

A bare call never installs

Unlike most -setup skills, semble-setup never falls back to install: it runs brew install uv, a machine-level change outside the project. Empty input is always read-only status; type the verb to install.

Modes

ModeDoesMutates
statusfull report: prereqs, MCP, cache, guidance, agents, coverage, stateno
installinstall uv, register semble_code, wire rule, hooks, permissions, agents; stop at reloadyes
upgraderepair to the pin 0.6.2, re-sync wiring, delete retired hooksyes
enable / disableback on (verify, warm) / hooks go silent, nothing deletedyes
uninstallintegration, mcp, cli or purge flavouryes
purgeeverything of this project, typed confirmationyes
reindexstage and swap only this repo’s index-code-config-docsyes
optimizeread-only audit with concrete recommendationsno
resumeafter the reload: smoke query, self-repairing re-run, phase=readyyes

The first six rows hold the seven modes shared by every -setup skill; reindex, optimize and resume are semble-specific. setup, update and remove stay accepted as free-text synonyms.

Under --unattended, upgrade never repairs the MCP pin (drift is reported as pending) and skips when uv or uvx is absent; see how the flag works.

When to use

SituationCommand
First time on a project/brewcode:semble-setup install
Just reloaded after install/brewcode:semble-setup resume
Check state, no changes/brewcode:semble-setup
Index looks stale/brewcode:semble-setup reindex
Remove wiring or everything/brewcode:semble-setup uninstall / purge

Example

/brewcode:semble-setup install

The skill probes uv, asks once before brew install uv, registers the server at user scope, wires the project, then stops at the reload checkpoint:

## Actions
changed:   brew install uv, semble_code registered @ user, rule installed, CLAUDE.md block installed, 3 hooks wired, permissions merged, 2 agents patched

## Current Status
reload required — MCP registered, waiting for a new session

## Next Step
Reload Claude Code (new session), then run: /brewcode:semble-setup resume

After the reload, /brewcode:semble-setup resume runs the pinned smoke query and closes at phase=ready. Searches then take {"query": "how sessions are persisted", "repo": "/abs/project/root", "top_k": 5}.

How it works

  1. Status first

    Runs the read-only status script and prints the Before snapshot in every mode.

  2. Resolve the mode

    Empty input is status; a pending reload routes to resume; otherwise the most matched keywords win. The mode and reason are stated before acting.

  3. Prerequisite gate

    uv is required and asked for once; coreutils is an optional offer.

  4. Register and wire

    Registers the pinned server, wires rule, .sembleignore, CLAUDE.md block, hooks, permissions and agents, then writes the reload checkpoint.

  5. Resume

    Verifies in the new session (up to 600 s on a cold model download) and self-repairs drift.

  6. Report

    Re-runs status after the last write and prints the six sections with every command run.

Good to know

  • The first query on a cold cache downloads hundreds of MB; allow up to 600 s. Offline with a cold cache, every call errors.
  • .json, .csv, .mdx and .txt are never indexed; use rg for those, exact identifiers and exhaustive counts.
  • Both tools require repo (absolute root or https:// git URL); optional content=code|docs|config|all.
  • disable is the reversible off switch; purge is the only wipe.

Technical details

More situations #

Free text works too: /brewcode:semble-setup rebuild the index. warm the cache routes to reindex and its no-delete warm branch.

What install installs, and where #
SurfaceLocation
MCP serverprofile .claude.json .mcpServers.semble_code, user scope (-s user; CLI default is local), alwaysLoad: true. Default profile: ~/.claude.json
Commanduvx --from 'semble[mcp]==0.6.2' semble --content <SEMBLE_CONTENT_ARGS> (default code docs config)
Shared cachemacOS ~/Library/Caches/semble-code, Linux ${XDG_CACHE_HOME:-$HOME/.cache}/semble-code; per repo index (code-only) and index-<sorted-content> siblings
State<repo>/.claude/semble/state.json, gitignored unless a repo rule already covers it
Rule<repo>/.claude/rules/semble-first.md
Ignore file<repo>/.sembleignore, gitignore syntax; managed like the rule (edits reported, --force backs up)
CLAUDE.mdmarked <!-- BEGIN brewcode:semble --> block, replaced in place, never duplicated; only uninstall removes it
Hookssemble-session.mjs, semble-stats.mjs, semble-subagent.mjs in .claude/hooks/; four settings rows, timeout: 5, portable ${CLAUDE_PROJECT_DIR} path
Permissionsexactly mcp__semble_code__search and mcp__semble_code__find_related, never a wildcard; written only if no layer grants them
Agentsproject .claude/agents/**/*.md get the two tool names; agents without tools: inherit; global agents untouched. Patching records which tool names it added; uninstall and --revert strip only those recorded names, never a user-authored tool name, and decline when no record exists

The project root is CLAUDE_PROJECT_DIR (else the git toplevel): a session started in a subdirectory wires that subdirectory. The MCP registration is per profile, the rest per project, so another profile reports version: not registered until install runs there. Installation is uvx-ephemeral: no semble on PATH.

Prerequisites: uv/uvx (brew install uv) is required and asked first; the fallback curl -LsSf https://astral.sh/uv/install.sh | sh is printed, never run. coreutils (gtimeout) is optional; without it a pure-bash watchdog keeps every shell-out time-bounded.

CLAUDE.md conflict scan #

install --part claudemd scans the root CLAUDE.md outside the marked block, backs it up to a timestamped .bak first and removes whole lines only, echoed verbatim.

LineResult
denies semantic search (Grep/Glob are no-ops, never use semble)removed, even if it also scopes the tool
puts grep/Bash/rg first (grep-first, search via the Bash tool)removed unless it scopes the tool to exact identifiers, regexes, paths or enumeration
merely mentions a search toolreported, untouched

An unpaired or duplicated marker is malformed: exit 3, nothing changes. SEMBLE_DRY_RUN=1 previews. A controlled A/B found no conversion effect (36% with the line vs 22% without, p = 0.45, n = 32), so this is hygiene for false statements, not an adoption fix.

State file and phases #

state.json is what semble-session.mjs reads; its phase follows a transition machine.

absent -> prereq_ready -> awaiting_reload -> verifying -> ready
                                  \                        |
                                   +-> disabled <----------+

ready is reachable only from verifying, so a run that dies half-way leaves an accurate record. Re-registration parks the phase at awaiting_reload; disable reaches disabled from any set-up state. Installer-owned fields (resumePrompt, cacheRoot, repoHash, approvedVersion, projectRoot, schema, metadata) are recomputed on every write; enabled, phase, completed and notes are never reset as a side effect.

Hooks and measured delivery #

Retired and deleted by install/upgrade/uninstall with their settings rows and markers (.reminder-ts, .prefetch-ts, reminder.json): semble-explore.mjs (5.0.0, replaced by semble-subagent.mjs), semble-reminder.mjs and semble-prefetch.mjs (6.5.0, no gain in a same-profile A/B: 42% vs 42% semble share, one repetition per cell).

Measured on CC 2.1.226: SubagentStart text reached 8/8 subagents when installed, 0/6 removed. That proves delivery, not routing: first-tool semble was 14/14 with and without the hook because the spawn prompts already said to start with mcp__semble_code__search. Never quote a conversion percentage for a nudge. Status reports conversion per source; 0/0 means never delivered, 0/N delivered and ignored.

Version tracking and upgrade verdicts #

status compares the version stamped in the installed rule (frontmatter version:) and hooks (line 2, // brewcode-meta:) against the running plugin; a mismatch drops ready to partial with Next Step upgrade. The resolver refuses to stamp a value it cannot resolve.

Rule and .sembleignore are compared with the stamp stripped: identical is unchanged; metadata-only is re-synced; a byte-pristine v4.5.0-v6.4.0 copy is upgraded (pristine prior-release copy) without --force or backup; anything else is user_modified, skipped with a diff, replaced only by --force after a backup. Absolute-path hook rows (<= 6.5.0 shape) are drifted; upgrade and install rewrite them to ${CLAUDE_PROJECT_DIR}/.claude/hooks/.... Leftover retired hooks print retired: <names> - stale (remove via upgrade).

Skipped is not failed: SEMBLE_NO_NETWORK=1, SEMBLE_DRY_RUN=1 or a missing uvx skip smoke, warm and staged rebuilds with exit 3 and "status":"skipped"; phase stays verifying and status reports partial. A guidance section that errored always downgrades ready to partial; a null measurement (section not requested) never does.

Gap in a partial projectNext Step
warm/smoke unrecorded, index variant missingresume
hand-edited rule at an old stampreview diff -u, or upgrade --force (backup first)
pin moved, retired hooks, prior-release copy, agents need patching, absolute-path rowsupgrade
any install step missinginstall
Tool contract and corpus #

Both tools require repo, never inferred, and accept optional content=code|docs|config|all. Results carry file_path, start_line, end_line, score and optional content; there is no line field. Defaults: top_k=5, max_snippet_lines=10. Routing: intent to semble; symbols to LSP; literals, regexes, paths and counts to rg.

The registered corpus is code docs config in index-code-config-docs; all reuses it, docs and config resolve narrower siblings. docs is what includes Markdown and .html. .json, .json5, .csv, .tsv, .psv are unreachable at any setting; .mdx and .txt are absent from semble’s extension table. A ! un-ignore ending in an extension bypasses the extension filter; .sembleignore re-ignores win.

Limits: read before trusting it #
FactConsequence
No watcher, no daemonstaleness is re-checked per call behind a 3x last-build-duration cooldown; nothing runs in the background
Cold cachefirst query downloads the embedding model, up to 600 s; offline fails
Retrieval split (0.5.4, 16 questions, not rerun on 0.6.2)semble won 8 of 9 behaviour questions, lost 2 of 5 exhaustive ones
semble clear index wipes every index under the shared rootreindex stages and proves a replacement, then swaps only index-code-config-docs; siblings stay live
New MCP server invisible to the running sessioninstall stops at a reload checkpoint; resume finishes
Staleness detection approximates semble’s ownreported as likely stale, offers reindex, never acts alone
Upstream server named semble (from semble install)reported as a conflict, never removed automatically
Windowsunsupported; every mutation refused
Config backups <file>.bak.<epoch>mode 0600, newest 3 kept, each pruned one named on stderr
Removal flavours #
FlavourRule / hooks / CLAUDE.mdMCPAgent frontmatterCacheuv tool
integrationremovedkeptentries removedkeptkept
mcpkeptremovedkeptkeptkept
clikeptkeptkeptkeptuninstalled
purgeremovedremovedremovedthis project’s entry (shared root kept unless empty)uninstalled

MCP removal covers the active profile only. purge prints every path first and needs the typed confirmation purge semble code cache. Settings are unwired before any hook file is deleted; if unwiring fails, nothing is deleted. A pre-0.5.5 semble-docs directory is removed only when its sole entry is RESERVED-FOR-DOCS.txt.

Troubleshooting #
SymptomFix
Tools missing after installreload Claude Code, then /brewcode:semble-setup resume
First search hangs for minutesthe model is downloading; wait up to 600 s, once per model
Every call errors offlinerun once online, or set SEMBLE_NO_NETWORK=1 to skip warm steps
search rejects the callpass the absolute repo
.json/.csv/.mdx/.txt never foundnot in the corpus by design; use rg
partial, retired: ... stale or portable: N absolute-path hook entriesupgrade
partial, nextStep is resumewarm/smoke unrecorded or index variant missing: resume
partial, rule hand-edited at an old stampreview the diff yourself, or upgrade --force
partial, hooks N/4 wireda drifted or duplicated hook row: re-run install, the merge repairs it
malformedthe profile .claude.json or project .mcp.json is invalid JSON: fix by hand, re-run
ready but tools missing in this profileversion: not registered: run install from this profile; scripts/semble-status.sh --versions --all-profiles lists them
Reference files #
PathWhat
SKILL.mdthe router: status first, mode selection, delegation
scripts/semble-{status,install,mcp,cache,state,project,remove,guidance,agents}.shone script per concern; status is read-only (--json, --section, --versions)
references/intent-routing.mdrouting table, 5-step resolution, worked examples
references/output-contract.mdthe report template
references/mcp-and-cache.md, language-coverage.md, project-agent-migration.md, engine-landscape.mdregistration and cache layout, indexed suffixes, agent migration, engine decision record
assets/INSTALL.mdrunbook for the guidance and hooks install

Every script takes --json. Exit codes: 0 ok, 1 hard failure, 2 bad usage, 3 recoverable precondition or skipped verification, 4 confirmation required.

brewcode overview

All skills, agents and hooks in one place.

agents skill

Manages the agent roster whose tools: lists install patches.

setup-status

Dashboard that flags stale semble wiring; upgrade refreshes it.

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