Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Run BrassCoders Automatically in a Claude Code Hook

说明与用途

在 Claude Code 中自动运行 BrassCoders,消除手动扫描,保持助手上下文的最新性。

问题

Developers manually run BrassCoders scans after editing files or before commits, which is error‑prone and slows the workflow.

结果

Automatic per‑edit and pre‑commit scans keep the assistant’s context fresh, eliminating manual scan steps and reducing the chance of stale or missed findings.

工作流

  • 1. Open .claude/settings.json for the project.
  • 2. Add a PostToolUse hook with matcher "Edit|Write" and a command that changes to the project dir and runs brasscoders --offline scan . --incremental.
  • 3. (Optional) Add a SessionStart hook that runs the scan once and echoes a pointer to the YAML file.
  • 4. (Optional) Add a PreToolUse hook for Bash with an if clause matching git commit to refresh findings before a commit.
  • 5. Commit the settings file and reload Claude Code. The assistant will now see up‑to‑date findings after each edit or commit.

证据

BrassCoders plugs into Claude Code as an ordinary command — brasscoders --offline scan . — that Claude Code runs at a lifecycle event defined in .claude/settings.json

来源

The hook’s only job is to guarantee that list is current.

来源

  • 记录日期: 2026-09-05T17:30:28.164Z