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).
- 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/.
- Python 3.10+ (stdlib only)
gitbazelorbazeliskrg(ripgrep) forsearch_repo(or bundle your ownrgbinary)
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"python3 -m pip install .
bazelcode --helpBy 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 are markdown files named <skill>.md and are appended to the system prompt.
Default search order:
--skills-dir ...if provided$BAZELCODE_SKILLS_DIRif set~/.claude/skillsif it exists (legacy)~/.bazelcode/skills- Bundled starter skills shipped in this repo
Example:
python3 /path/to/bazelcode/run.py run \
--skills bazel dotnet \
--task "..."--repo-profile can be set explicitly, or auto-detected:
defaultdotnet(ifrules_dotnetis detected)gigantic_repo(if there are >1000BUILD*files)
src/bazelcode/ # Library code
run.py # CLI entrypoint (no install required)
demo.py # Example scenarios
Apache-2.0 (see LICENSE).