setup — one-time project init

Caution

brewcode needs to know your stack before it can plan. Without setup, the PLAN.md template is generic — wrong agents, wrong reference files, no tech-specific review checks. Running /brewcode:setup once produces a template and review skill calibrated to your actual codebase.

Tip

Prerequisites are handled automatically. Phase 0 checks for brew, timeout, and jq. If everything is present it completes silently and moves on. Semantic search (grepai) is offered as an optional install — ~1.5 GB, skippable.

Quick reference

FieldValue
Command/brewcode:setup
Arguments[universal-template-path]
Modelopus
Contextfork
ToolsRead, Write, Glob, Grep, Bash, AskUserQuestion

When to use

  • New project — run once after installing brewcode to generate .claude/tasks/templates/
  • Stack changed — added a new framework, switched DB, introduced a new agent — re-run to refresh templates
  • After reinstall — templates are synced from the plugin cache; a fresh install wipes them
  • Review skill missing/brewcode:review depends on .claude/skills/brewcode-review/SKILL.md created here

Examples

# Standard: analyze the current project and generate all templates
/brewcode:setup
# Use a custom universal template instead of the plugin default
/brewcode:setup /path/to/my-PLAN.md.template
# After setup, start the workflow
/brewcode:spec "Implement payment gateway"
/brewcode:plan
/brewcode:start

Flow

  1. Prerequisites check (Phase 0)

    Detects installed tools: brew, timeout, jq (required), ollama and grepai (optional). Missing required tools are installed automatically. If timeout is absent, the skill asks before creating a gtimeout symlink. Semantic search is offered as an optional upgrade.

  2. Project scan (Phase 1)

    The Explore agent scans the repo: language, framework, build tool, test framework, assertion library, mocking library, database type and access layer, and any existing .claude/agents/ entries. Output feeds directly into the adaptation plan.

  3. Adaptation plan (Phase 2)

    The Plan agent consolidates scan findings into a structured document: tech stack, testing setup, DB config, detected project agents, key patterns from CLAUDE.md, and a list of template modifications to apply.

  4. Template generation (Phase 3)

    Creates .claude/tasks/ directory structure, syncs PLAN / SPEC / KNOWLEDGE templates from the plugin cache, then adapts the PLAN template: inserts project agents, fills Reference Examples with canonical files, customises Phase V reviewers and Final Review agents for the detected stack.

  5. Review skill + config (Phases 3.5 & 3.6)

    Copies the review skill template to .claude/skills/brewcode-review/SKILL.md and replaces placeholders ({{TECH_SPECIFIC_CHECKS}}, {{PROJECT_AGENTS_TABLE}}, etc.) from the adaptation plan. Also copies brewcode.config.json with runtime settings for KNOWLEDGE compaction and stop-hook limits.

  6. Validation + CLAUDE.md update (Phases 4 & 5)

    Validates all generated files exist and contain required sections. Then collects all installed agents (excluding internal ones) and offers to replace the agent table in ~/.claude/CLAUDE.md with an LLM-optimised format. Asks before writing.

Internals & phases — full phase dumps, scripts, and template fragments

Phase 0: Prerequisites — script details

bash "${CLAUDE_SKILL_DIR}/scripts/install.sh" state
bash "${CLAUDE_SKILL_DIR}/scripts/install.sh" check-timeout
bash "${CLAUDE_SKILL_DIR}/scripts/install.sh" required
bash "${CLAUDE_SKILL_DIR}/scripts/install.sh" grepai   # if user accepts
bash "${CLAUDE_SKILL_DIR}/scripts/install.sh" summary
ComponentTypePurpose
brewrequiredPackage manager
coreutils + timeoutrequiredCommand timeout for hooks
jqrequiredJSON processor used by hooks
ollamaoptionalLocal embedding server
bge-m3optionalMultilingual embedding model (~1.2 GB)
grepaioptionalSemantic code search CLI

Phase 1: Scan script

bash "scripts/setup.sh" scan

Phase 3: Template structure + sync scripts

bash "scripts/setup.sh" structure
bash "scripts/setup.sh" sync

Template sections the skill adapts:

SectionAdaptation
AgentsAdd project-specific agents from .claude/agents/
Reference ExamplesFill with project’s canonical files (controllers, services, tests)
Phase V agentsCustomise reviewer focus for detected testing/code patterns
Final ReviewAdd project agents (db_expert, etc.) if relevant tech detected

Required sections preserved verbatim:

## Agents — Add project agents above Core Agents
## Reference Examples — R1..RN with project's canonical files
## Phases — Each phase has: Agent, Status, Context (C#), Refs (R#)
## Phase NV: Verification — 2+ agents, one checks patterns compliance
## Final Review — 3+ agents parallel
## Context Index — C1..CN task-specific files

Phase 3.5: Review skill placeholders

PlaceholderSourceExample
{PROJECT_AGENTS_TABLE}.claude/agents/ scan| db_expert | PostgreSQL | DB layer |
{TECH_SPECIFIC_CHECKS}Detected tech stackJava/Node/Python/Go tables
{PROJECT_RULES}CLAUDE.md patternsAssertJ rules, Lombok, logging
{MAIN_AGENT}Project agent or reviewerreviewer
{TEST_AGENT}Project agent or testertester
{DB_AGENT}Project agent or sql_expertdb_expert
{CUSTOM_GROUPS}Additional review groupsSecurity, API validation
{CODEBASE_BLOCKS}Detected source patternssrc/main/**, src/test/**

Validation:

bash "scripts/setup.sh" review
test -f .claude/skills/brewcode-review/SKILL.md && echo "Review skill created" || echo "MISSING"

Phase 3.6: Configuration options

bash "scripts/setup.sh" config
SettingDefaultDescription
knowledge.maxEntries100Max KNOWLEDGE.jsonl entries after compaction
knowledge.maxTokens500Max tokens in ## K block injected to agents
knowledge.priorities["❌","✅","ℹ️"]Priority order for knowledge entries
stop.maxAttempts20Stop attempts before escape mechanism triggers
agents.system[…]System agents (excluded from ## K injection)

Phase 4: Validation script

bash "scripts/setup.sh" validate
CheckExpected path
PLAN template.claude/tasks/templates/PLAN.md.template
SPEC template.claude/tasks/templates/SPEC.md.template
KNOWLEDGE template.claude/tasks/templates/KNOWLEDGE.jsonl.template
Config file.claude/tasks/cfg/brewcode.config.json
Review skill.claude/skills/brewcode-review/SKILL.md

Phase 5: CLAUDE.md agent update

bash "scripts/setup.sh" agents > /tmp/agents-section.md

The skill reads ~/.claude/CLAUDE.md, finds all agent-related sections by LLM analysis (not grep), then asks the user before replacing. Internal agents bc-coordinator, bc-grepai-configurator, bc-knowledge-manager are excluded by the script — do not add them manually.

Output format

# Template Adaptation Complete

## Tech Stack
| Category | Value |
|----------|-------|
| Language | [detected] |
| Framework | [detected] |
| Testing | [framework] |
| Database | [type/access] |
| Project Agents | [N]: `agent1`, `agent2` |

## Adaptations
| Section | Changes |
|---------|---------|
| Agents | +[N] project agents |
| Reference Examples | [N] canonical files |
| Phase V | Reviewers for [tech] patterns |
| Review Skill | Tech-specific checks, project rules |
📄

Plan skill

Use the adapted PLAN.md.template — /brewcode:plan builds a task plan from SPEC.

🔍

Grepai skill

Configure semantic code search — offered during setup Phase 0.

🔗

GitHub source

Scripts, install.sh, setup.sh, and template sources.

🧩

Brewcode overview

All brewcode skills and the infinite-task execution model.

Updating plugins

Use /brewtools:plugin-update to check and update the brewcode plugin suite in one command. See the FAQ for details.