Bub is a common shape for agents.
It starts from a simple question: if there are many agents in the world, what kind of agent is a Bub?
A Bub is an agent that can live inside shared operator environments with explicit boundaries, visible execution evidence, and safe handoff.
The point is not only to complete tasks, but to remain understandable, reviewable, and continuable when more humans and agents join the work.
This repository is the current Python implementation of Bub.
It is hook-first, built on pluggy, and keeps the core small while builtins and plugins provide behavior.
In this implementation, Bub uses Republic as its context runtime and constructs context from tape.
- CLI bootstrap:
src/bub/__main__.py(Typer app) - Turn orchestrator:
src/bub/framework.py - Hook contract:
src/bub/hookspecs.py - Builtin hooks/runtime:
src/bub/builtin/hook_impl.py+src/bub/builtin/engine.py - Skill discovery and validation:
src/bub/skills.py
git clone https://github.com/bubbuild/bub.git
cd bub
uv sync
uv run bub --help# Runtime off: falls back to model_output=prompt
BUB_RUNTIME_ENABLED=0 uv run bub run "hello"# Internal command mode (line starts with ',')
BUB_RUNTIME_ENABLED=0 uv run bub run ",help"# Model runtime (hosted providers usually require a key)
BUB_API_KEY=your_key uv run bub run "Summarize this repository"# OpenAI Codex OAuth (no provider API key required)
uv run bub login openai
BUB_MODEL=openai:gpt-5-codex uv run bub chatbub run MESSAGE: execute one inbound turn and print outbound messagesbub login openai: persist OpenAI Codex OAuth credentials for later runsbub hooks: print hook-to-plugin bindingsbub install PLUGIN_SPEC: install plugin from PyPI orowner/repo(GitHub shorthand)
- Regular text input: uses
run_model; if runtime is unavailable, output falls back to the prompt text - Comma commands:
,help,,tools,,fs.read ..., etc. - Unknown comma commands: executed as
bash -lcin workspace - Session event log:
.bub/runtime/<session-hash>.jsonl AGENTS.md: if present in workspace, appended to runtime system prompt
- Discovery roots with deterministic override:
<workspace>/.agent/skills~/.agent/skillssrc/bub_skills
- Each skill directory must include
SKILL.md - Supported frontmatter fields:
- required:
name,description - optional:
license,compatibility,metadata,allowed-tools
- required:
Plugins are loaded from Python entry points in group="bub":
[project.entry-points."bub"]
my_plugin = "my_package.my_plugin"Implement hooks with @hookimpl following BubHookSpecs.
BUB_RUNTIME_ENABLED:auto(default),1,0BUB_MODEL: defaultopenrouter:qwen/qwen3-coder-nextBUB_API_KEY: runtime provider key; optional when usingopenai:*models withbub login openaiBUB_API_BASE: optional provider base URLBUB_RUNTIME_MAX_STEPS: default8BUB_RUNTIME_MAX_TOKENS: default1024BUB_RUNTIME_MODEL_TIMEOUT_SECONDS: default90
docs/index.md: overviewdocs/architecture.md: lifecycle, precedence, and failure isolationdocs/skills.md: skill discovery and frontmatter constraintsdocs/cli.md: CLI usage and comma command modedocs/features.md: implemented capabilities and limits
uv run ruff check .
uv run mypy src
uv run pytest -q