Skip to content

bazelcode

bazelcode is a small agent harness for Bazel-based repositories. It talks to any OpenAI-compatible Chat Completions API endpoint and drives a repo via a strict JSON tool protocol (ripgrep, git, and Bazel commands).

Features

  • Bazel-aware tools (bazel query/build/test) plus “gigantic repo” helpers (rdeps / affected targets / selective tests).
  • Workflow presets (--workflow fix|feature|refactor|test|investigate).
  • Optional markdown “skills” that get appended to the system prompt.
  • Repro/proof bundles written to <workspace>/.bazelcode/runs/.

Requirements

  • Python 3.10+ (stdlib only)
  • git
  • bazel or bazelisk
  • rg (ripgrep) for search_repo (or bundle your own rg binary)

Quick start

From the repo you want the agent to operate on:

# Inspect environment and auto-detected profile
python3 /path/to/bazelcode/run.py info

# Run a task (writes artifacts to ./.bazelcode/runs/)
python3 /path/to/bazelcode/run.py run \
  --workflow fix \
  --task "Fix the logging bug"

Tip: add /.bazelcode/ to your target repo’s .gitignore if you don’t want run artifacts tracked.

If you run from inside the bazelcode checkout instead, point it at the target repo:

python3 run.py run --workspace-dir /path/to/your/repo --task "Fix the logging bug"

Install (optional)

python3 -m pip install .
bazelcode --help

LLM configuration

By default bazelcode points at http://localhost:8000/v1. Set these flags as needed:

python3 /path/to/bazelcode/run.py run \
  --llm-base-url http://localhost:8000/v1 \
  --llm-model gpt-4o-mini \
  --task "..."

To use OpenAI directly:

export OPENAI_API_KEY=...
python3 /path/to/bazelcode/run.py run \
  --llm-base-url https://api.openai.com/v1 \
  --llm-model gpt-4o-mini \
  --task "..."

Skills

Skills are markdown files named <skill>.md and are appended to the system prompt.

Default search order:

  1. --skills-dir ... if provided
  2. $BAZELCODE_SKILLS_DIR if set
  3. ~/.claude/skills if it exists (legacy)
  4. ~/.bazelcode/skills
  5. Bundled starter skills shipped in this repo

Example:

python3 /path/to/bazelcode/run.py run \
  --skills bazel dotnet \
  --task "..."

Repo profiles

--repo-profile can be set explicitly, or auto-detected:

  • default
  • dotnet (if rules_dotnet is detected)
  • gigantic_repo (if there are >1000 BUILD* files)

Layout

src/bazelcode/          # Library code
run.py                  # CLI entrypoint (no install required)
demo.py                 # Example scenarios

License

Apache-2.0 (see LICENSE).

About

is a small agent harness for Bazel-based repositories. It talks to any OpenAI-compatible Chat Completions API endpoint and drives a repo via a strict JSON tool protocol (ripgrep, git, and Bazel commands).

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages