Skip to main content

Bub it. Build it. Batteries-included, hook-first AI framework.

Project description

Bub

Bub is a hook-first AI framework built on pluggy: the core stays small and orchestrates turns, while builtins and plugins provide behavior.

Current Implementation

  • 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

Quick Start

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"

CLI Commands

  • bub run MESSAGE: execute one inbound turn and print outbound messages
  • bub hooks: print hook-to-plugin bindings
  • bub install PLUGIN_SPEC: install plugin from PyPI or owner/repo (GitHub shorthand)

Runtime Behavior

  • 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 -lc in workspace
  • Session event log: .bub/runtime/<session-hash>.jsonl
  • AGENTS.md: if present in workspace, appended to runtime system prompt

Skills

  • Discovery roots with deterministic override:
    1. <workspace>/.agent/skills
    2. ~/.agent/skills
    3. src/bub_skills
  • Each skill directory must include SKILL.md
  • Supported frontmatter fields:
    • required: name, description
    • optional: license, compatibility, metadata, allowed-tools

Plugin Development

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.

Runtime Environment Variables

  • BUB_RUNTIME_ENABLED: auto (default), 1, 0
  • BUB_MODEL: default openrouter:qwen/qwen3-coder-next
  • BUB_API_KEY: runtime provider key
  • BUB_API_BASE: optional provider base URL
  • BUB_RUNTIME_MAX_STEPS: default 8
  • BUB_RUNTIME_MAX_TOKENS: default 1024
  • BUB_RUNTIME_MODEL_TIMEOUT_SECONDS: default 90

Documentation

  • docs/index.md: overview
  • docs/architecture.md: lifecycle, precedence, and failure isolation
  • docs/skills.md: skill discovery and frontmatter constraints
  • docs/cli.md: CLI usage and comma command mode
  • docs/features.md: implemented capabilities and limits

Development Checks

uv run ruff check .
uv run mypy src
uv run pytest -q

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bub-0.3.0a1.tar.gz (64.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bub-0.3.0a1-py3-none-any.whl (74.6 kB view details)

Uploaded Python 3

File details

Details for the file bub-0.3.0a1.tar.gz.

File metadata

  • Download URL: bub-0.3.0a1.tar.gz
  • Upload date:
  • Size: 64.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for bub-0.3.0a1.tar.gz
Algorithm Hash digest
SHA256 293c2a6553446d9217dcb9d976b9fdab15ac75eb5d043f241da21d7a36efc332
MD5 4b418f68014c45d76843fc05877f5d68
BLAKE2b-256 41d358aa6a2de465f8b3a65f9a0ac6b2c521cefb428a9d8efa491f1c32b0b37d

See more details on using hashes here.

File details

Details for the file bub-0.3.0a1-py3-none-any.whl.

File metadata

  • Download URL: bub-0.3.0a1-py3-none-any.whl
  • Upload date:
  • Size: 74.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for bub-0.3.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 6358e827453737ed45a474e77b068791d6883eaa1622343896fb5b71efc661a7
MD5 13f05b494761ea2c15f87fcb5cb77549
BLAKE2b-256 d6d38c609754c14c23360decdcaecae2e24b257927c2fd153c789483d9c58c84

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page