beadhub 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. beadhub-0.1.0/.dockerignore +14 -0
  2. beadhub-0.1.0/.env.example +87 -0
  3. beadhub-0.1.0/.gitattributes +3 -0
  4. beadhub-0.1.0/.gitignore +157 -0
  5. beadhub-0.1.0/.python-version +1 -0
  6. beadhub-0.1.0/CHANGELOG.md +23 -0
  7. beadhub-0.1.0/CODE_OF_CONDUCT.md +6 -0
  8. beadhub-0.1.0/CONTRIBUTING.md +67 -0
  9. beadhub-0.1.0/LICENSE +21 -0
  10. beadhub-0.1.0/PKG-INFO +254 -0
  11. beadhub-0.1.0/README.md +220 -0
  12. beadhub-0.1.0/SECURITY.md +17 -0
  13. beadhub-0.1.0/pyproject.toml +142 -0
  14. beadhub-0.1.0/src/beadhub/__init__.py +12 -0
  15. beadhub-0.1.0/src/beadhub/api.py +260 -0
  16. beadhub-0.1.0/src/beadhub/auth.py +101 -0
  17. beadhub-0.1.0/src/beadhub/aweb_context.py +65 -0
  18. beadhub-0.1.0/src/beadhub/aweb_introspection.py +70 -0
  19. beadhub-0.1.0/src/beadhub/beads_sync.py +514 -0
  20. beadhub-0.1.0/src/beadhub/cli.py +330 -0
  21. beadhub-0.1.0/src/beadhub/config.py +65 -0
  22. beadhub-0.1.0/src/beadhub/db.py +129 -0
  23. beadhub-0.1.0/src/beadhub/defaults/invariants/01-tracking-bdh-only.md +11 -0
  24. beadhub-0.1.0/src/beadhub/defaults/invariants/02-communication-mail-first.md +36 -0
  25. beadhub-0.1.0/src/beadhub/defaults/invariants/03-communication-chat.md +60 -0
  26. beadhub-0.1.0/src/beadhub/defaults/invariants/04-identity-no-impersonation.md +17 -0
  27. beadhub-0.1.0/src/beadhub/defaults/invariants/05-collaborate.md +12 -0
  28. beadhub-0.1.0/src/beadhub/defaults/roles/backend.md +55 -0
  29. beadhub-0.1.0/src/beadhub/defaults/roles/coordinator.md +44 -0
  30. beadhub-0.1.0/src/beadhub/defaults/roles/frontend.md +77 -0
  31. beadhub-0.1.0/src/beadhub/defaults/roles/implementer.md +73 -0
  32. beadhub-0.1.0/src/beadhub/defaults/roles/reviewer.md +56 -0
  33. beadhub-0.1.0/src/beadhub/defaults/roles/startup-expert.md +93 -0
  34. beadhub-0.1.0/src/beadhub/defaults.py +262 -0
  35. beadhub-0.1.0/src/beadhub/events.py +704 -0
  36. beadhub-0.1.0/src/beadhub/internal_auth.py +121 -0
  37. beadhub-0.1.0/src/beadhub/jsonl.py +68 -0
  38. beadhub-0.1.0/src/beadhub/logging.py +62 -0
  39. beadhub-0.1.0/src/beadhub/migrations/beads/001_initial.sql +70 -0
  40. beadhub-0.1.0/src/beadhub/migrations/beads/002_search_indexes.sql +20 -0
  41. beadhub-0.1.0/src/beadhub/migrations/server/001_initial.sql +279 -0
  42. beadhub-0.1.0/src/beadhub/names.py +33 -0
  43. beadhub-0.1.0/src/beadhub/notifications.py +275 -0
  44. beadhub-0.1.0/src/beadhub/pagination.py +125 -0
  45. beadhub-0.1.0/src/beadhub/presence.py +495 -0
  46. beadhub-0.1.0/src/beadhub/rate_limit.py +152 -0
  47. beadhub-0.1.0/src/beadhub/redis_client.py +11 -0
  48. beadhub-0.1.0/src/beadhub/roles.py +35 -0
  49. beadhub-0.1.0/src/beadhub/routes/__init__.py +1 -0
  50. beadhub-0.1.0/src/beadhub/routes/agents.py +303 -0
  51. beadhub-0.1.0/src/beadhub/routes/bdh.py +655 -0
  52. beadhub-0.1.0/src/beadhub/routes/beads.py +778 -0
  53. beadhub-0.1.0/src/beadhub/routes/claims.py +141 -0
  54. beadhub-0.1.0/src/beadhub/routes/escalations.py +471 -0
  55. beadhub-0.1.0/src/beadhub/routes/init.py +348 -0
  56. beadhub-0.1.0/src/beadhub/routes/mcp.py +338 -0
  57. beadhub-0.1.0/src/beadhub/routes/policies.py +833 -0
  58. beadhub-0.1.0/src/beadhub/routes/repos.py +538 -0
  59. beadhub-0.1.0/src/beadhub/routes/status.py +568 -0
  60. beadhub-0.1.0/src/beadhub/routes/subscriptions.py +362 -0
  61. beadhub-0.1.0/src/beadhub/routes/workspaces.py +1642 -0
  62. beadhub-0.1.0/src/beadhub/workspace_config.py +202 -0
  63. beadhub-0.1.0/tests/__init__.py +1 -0
  64. beadhub-0.1.0/tests/conftest.py +347 -0
  65. beadhub-0.1.0/tests/data/beads/issues.jsonl +4 -0
  66. beadhub-0.1.0/tests/data/beads-cross-a/issues.jsonl +3 -0
  67. beadhub-0.1.0/tests/data/beads-cross-b/issues.jsonl +2 -0
  68. beadhub-0.1.0/tests/data/beads-repo2/issues.jsonl +2 -0
  69. beadhub-0.1.0/tests/db_utils.py +8 -0
  70. beadhub-0.1.0/tests/test_aweb_import_surface.py +49 -0
  71. beadhub-0.1.0/tests/test_bdh_endpoints.py +209 -0
  72. beadhub-0.1.0/tests/test_beadhub_agents_auth.py +215 -0
  73. beadhub-0.1.0/tests/test_beadhub_aweb_introspection_auth.py +149 -0
  74. beadhub-0.1.0/tests/test_beadhub_init.py +167 -0
  75. beadhub-0.1.0/tests/test_beads_sync.py +249 -0
  76. beadhub-0.1.0/tests/test_beads_upload.py +2342 -0
  77. beadhub-0.1.0/tests/test_claims.py +445 -0
  78. beadhub-0.1.0/tests/test_db.py +62 -0
  79. beadhub-0.1.0/tests/test_defaults.py +359 -0
  80. beadhub-0.1.0/tests/test_embedded_aweb_protocol.py +121 -0
  81. beadhub-0.1.0/tests/test_error_paths.py +115 -0
  82. beadhub-0.1.0/tests/test_escalation_events.py +200 -0
  83. beadhub-0.1.0/tests/test_escalation_tenant_isolation.py +291 -0
  84. beadhub-0.1.0/tests/test_escalation_validation.py +262 -0
  85. beadhub-0.1.0/tests/test_heartbeat.py +382 -0
  86. beadhub-0.1.0/tests/test_library_mode.py +285 -0
  87. beadhub-0.1.0/tests/test_lifespan_cleanup.py +183 -0
  88. beadhub-0.1.0/tests/test_mcp_minimal.py +65 -0
  89. beadhub-0.1.0/tests/test_pagination.py +230 -0
  90. beadhub-0.1.0/tests/test_pgdbm_boundaries.py +24 -0
  91. beadhub-0.1.0/tests/test_pgdbm_module_names.py +44 -0
  92. beadhub-0.1.0/tests/test_policies.py +1104 -0
  93. beadhub-0.1.0/tests/test_presence.py +842 -0
  94. beadhub-0.1.0/tests/test_status.py +335 -0
  95. beadhub-0.1.0/tests/test_subscriptions.py +768 -0
  96. beadhub-0.1.0/tests/test_tenant_isolation.py +681 -0
  97. beadhub-0.1.0/tests/test_workspace_config.py +384 -0
  98. beadhub-0.1.0/tests/test_workspace_id.py +292 -0
  99. beadhub-0.1.0/uv.lock +923 -0
@@ -0,0 +1,14 @@
1
+ .venv/
2
+ .git/
3
+ .pytest_cache/
4
+ __pycache__/
5
+ *.pyc
6
+ *.pyo
7
+ .env
8
+ .env.*
9
+ tests/
10
+ *.md
11
+ !README.md
12
+ Dockerfile
13
+ .dockerignore
14
+ .gitignore
@@ -0,0 +1,87 @@
1
+ # .env.example - BeadHub Environment Variables
2
+ # Copy to .env and customize for your environment
3
+ # See README.md for full documentation
4
+
5
+ # =============================================================================
6
+ # DATABASE (required)
7
+ # =============================================================================
8
+
9
+ # PostgreSQL connection URL (one of these is required)
10
+ BEADHUB_DATABASE_URL=postgresql://user:password@localhost:5432/beadhub
11
+ # DATABASE_URL=postgresql://user:password@localhost:5432/beadhub
12
+
13
+ # For docker-compose only
14
+ POSTGRES_PASSWORD=your-secure-password
15
+
16
+ # =============================================================================
17
+ # REDIS (optional - defaults to localhost)
18
+ # =============================================================================
19
+
20
+ BEADHUB_REDIS_URL=redis://localhost:6379/0
21
+ # REDIS_URL=redis://localhost:6379/0
22
+
23
+ # =============================================================================
24
+ # SERVER
25
+ # =============================================================================
26
+
27
+ BEADHUB_HOST=0.0.0.0
28
+ BEADHUB_PORT=8000
29
+
30
+ # Hot reload for development (default: false)
31
+ # BEADHUB_RELOAD=true
32
+
33
+ # =============================================================================
34
+ # LOGGING
35
+ # =============================================================================
36
+
37
+ # Log level: DEBUG, INFO, WARNING, ERROR (default: INFO)
38
+ BEADHUB_LOG_LEVEL=INFO
39
+
40
+ # JSON format for structured logging (default: false in dev, true in production)
41
+ # BEADHUB_LOG_JSON=true
42
+
43
+ # =============================================================================
44
+ # AUTHENTICATION (optional - enables tenant isolation)
45
+ # =============================================================================
46
+
47
+ # When set, admin endpoints require X-API-Key header
48
+ # BEADHUB_API_KEY=aw_sk_your-secret-api-key
49
+
50
+ # =============================================================================
51
+ # PRESENCE & COORDINATION
52
+ # =============================================================================
53
+
54
+ # How long before a workspace is considered offline (default: 1800 = 30 min)
55
+ BEADHUB_PRESENCE_TTL_SECONDS=1800
56
+
57
+ # Human name shown in dashboard (default: admin)
58
+ # BEADHUB_DASHBOARD_HUMAN=admin
59
+
60
+ # =============================================================================
61
+ # CLIENT (bdh CLI) - used during bdh :init
62
+ # =============================================================================
63
+
64
+ # BeadHub server URL (default: http://localhost:8000)
65
+ BEADHUB_URL=http://localhost:8000
66
+
67
+ # Project slug (required if repo not registered)
68
+ BEADHUB_PROJECT=my-project
69
+
70
+ # Workspace alias - display name (default: auto-suggested based on role)
71
+ # BEADHUB_ALIAS=claude-code
72
+
73
+ # Human owner name (default: $USER)
74
+ # BEADHUB_HUMAN=YourName
75
+
76
+ # Workspace role (default: agent)
77
+ # BEADHUB_ROLE=agent
78
+
79
+ # =============================================================================
80
+ # TESTING ONLY (do not use in production)
81
+ # =============================================================================
82
+
83
+ # Override git remote origin (testing only)
84
+ # BEADHUB_REPO_ORIGIN=git@github.com:test/repo.git
85
+
86
+ # Skip repo validation (testing only)
87
+ # BEADHUB_SKIP_REPO_CHECK=1
@@ -0,0 +1,3 @@
1
+
2
+ # Use bd merge for beads JSONL files
3
+ .beads/issues.jsonl merge=beads
@@ -0,0 +1,157 @@
1
+ # Created by .ignore support plugin (hsz.mobi)
2
+ ### Node template
3
+ # Logs
4
+ /logs
5
+ *.log
6
+ npm-debug.log*
7
+ yarn-debug.log*
8
+ yarn-error.log*
9
+
10
+ # Runtime data
11
+ pids
12
+ *.pid
13
+ *.seed
14
+ *.pid.lock
15
+
16
+ # Directory for instrumented libs generated by jscoverage/JSCover
17
+ lib-cov
18
+
19
+ # Coverage directory used by tools like istanbul
20
+ coverage
21
+
22
+ # nyc test coverage
23
+ .nyc_output
24
+
25
+ # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
26
+ .grunt
27
+
28
+ # Bower dependency directory (https://bower.io/)
29
+ bower_components
30
+
31
+ # node-waf configuration
32
+ .lock-wscript
33
+
34
+ # Compiled binary addons (https://nodejs.org/api/addons.html)
35
+ build/Release
36
+
37
+ # Dependency directories
38
+ node_modules/
39
+ jspm_packages/
40
+
41
+ # TypeScript v1 declaration files
42
+ typings/
43
+
44
+ # Optional npm cache directory
45
+ .npm
46
+
47
+ # Optional eslint cache
48
+ .eslintcache
49
+
50
+ # Optional REPL history
51
+ .node_repl_history
52
+
53
+ # Output of 'npm pack'
54
+ *.tgz
55
+
56
+ # Yarn Integrity file
57
+ .yarn-integrity
58
+
59
+ # dotenv environment variables file
60
+ .env
61
+
62
+ # parcel-bundler cache (https://parceljs.org/)
63
+ .cache
64
+
65
+ # next.js build output
66
+ .next
67
+
68
+ # nuxt.js build output
69
+ .nuxt
70
+
71
+ # Nuxt generate
72
+ **/dist-*
73
+
74
+ # vuepress build output
75
+ .vuepress/dist
76
+
77
+ # Serverless directories
78
+ .serverless
79
+
80
+ # IDE / Editor
81
+ .idea
82
+
83
+ # Service worker
84
+ sw.*
85
+
86
+ # macOS
87
+ .DS_Store
88
+
89
+ # Vim swap files
90
+ *.swp
91
+
92
+ # It is a symlink, generated by makefile, pointing to the right association
93
+ static/.well-known/apple-developer-merchantid-domain-association
94
+
95
+ # It will autogenerate with the commit and timestamp
96
+ static/deploy.txt
97
+
98
+ hola
99
+
100
+ *.pyc
101
+ .emacs-bu
102
+ Pipfile
103
+
104
+ *.xfasl
105
+ example
106
+ **/gsk.core
107
+ **/gsk-stable.core
108
+ **/tsm.core
109
+
110
+ ***/.venv
111
+ aws-reference
112
+ gsk.db.core
113
+ dist
114
+ .aider*
115
+ tmp
116
+ .pytest_cache
117
+
118
+ # generated types
119
+ .astro/
120
+
121
+ # dependencies
122
+ node_modules/
123
+
124
+ # logs
125
+ npm-debug.log*
126
+ yarn-debug.log*
127
+ yarn-error.log*
128
+ pnpm-debug.log*
129
+
130
+ # environment variables
131
+ .env
132
+ .env.*
133
+ !.env.example
134
+ !.env.dev
135
+ !.env.docker
136
+ staging-env-vars.json
137
+ .env.staging
138
+ .env.production
139
+
140
+ # worktrees and symlinks
141
+ tsm-main
142
+ pgdbm
143
+
144
+ # macOS-specific files
145
+ .DS_Store
146
+
147
+ # jetbrains setting folder
148
+ .idea/
149
+
150
+ .DS_Store
151
+ llmring-api
152
+ llmring-server
153
+ .beadhub
154
+ .beads/redirect
155
+ .playwright-mcp/
156
+ .env.beadhub
157
+ .aw/
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,23 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ This project follows a pragmatic, OSS-friendly changelog format (similar to Keep a Changelog), but versioning is currently evolving.
6
+
7
+ ## Unreleased
8
+
9
+ ## 0.1.0 — 2026-01-06
10
+
11
+ Initial open-source release.
12
+
13
+ ### Added
14
+ - FastAPI server with Redis + Postgres backing services
15
+ - Real-time dashboard (SSE) for status, workspaces, claims, escalations, issues, and policies
16
+ - Beads integration (client-push sync of `.beads/issues.jsonl`)
17
+ - Agent messaging + chat sessions
18
+ - `bdh` CLI wrapper for bead-level coordination (preflight approve/reject + sync)
19
+
20
+ ### Security
21
+ - Project-scoped tenant isolation model (`project_id`)
22
+ - CLI safety checks for repo identity / destructive actions
23
+
@@ -0,0 +1,6 @@
1
+ # Code of Conduct
2
+
3
+ This project follows the Contributor Covenant Code of Conduct.
4
+
5
+ See: https://www.contributor-covenant.org/version/2/1/code_of_conduct/
6
+
@@ -0,0 +1,67 @@
1
+ # Contributing
2
+
3
+ Thanks for helping improve BeadHub.
4
+
5
+ ## Development setup
6
+
7
+ Prereqs:
8
+ - Python 3.12+
9
+ - `uv`
10
+ - Node.js + `pnpm` (for the frontend)
11
+ - PostgreSQL and Redis (via brew or Docker)
12
+
13
+ Clone and set up:
14
+ ```bash
15
+ git clone https://github.com/beadhub/beadhub.git
16
+ cd beadhub
17
+ uv sync --group dev
18
+ pnpm -C frontend install
19
+ make hooks-install
20
+ ```
21
+
22
+ ## Run locally
23
+
24
+ The easiest way to run locally (uses local postgres/redis via brew):
25
+ ```bash
26
+ make dev-setup # One-time: starts postgres/redis, creates database
27
+ make dev-backend # Run backend on port 8000
28
+ make dev-frontend # Run frontend on port 5173 (separate terminal)
29
+ ```
30
+
31
+ Or use Docker for everything:
32
+ ```bash
33
+ make docker # Runs full stack on port 9000
34
+ ```
35
+
36
+ ## Code quality
37
+
38
+ **All linting happens locally via pre-push hooks.** CI only verifies builds.
39
+
40
+ Install the hooks (required):
41
+ ```bash
42
+ make hooks-install
43
+ ```
44
+
45
+ The pre-push hook runs:
46
+ - Python: `ruff`, `black`, `isort`, `mypy`
47
+ - Frontend: `eslint`
48
+
49
+ To run checks manually:
50
+ ```bash
51
+ make check # Run all checks
52
+ make check-python # Python lint + typecheck
53
+ make check-frontend # Frontend lint + build
54
+ make fmt-python # Auto-format Python
55
+ ```
56
+
57
+ Run tests:
58
+ ```bash
59
+ uv run pytest # Python tests
60
+ ```
61
+
62
+ ## Pull requests
63
+
64
+ - Keep PRs focused and small when possible.
65
+ - Add tests for behavior changes.
66
+ - Update docs when you change UX or external interfaces.
67
+ - Pre-push hooks must pass before pushing.
beadhub-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Juan Reyero
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
beadhub-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,254 @@
1
+ Metadata-Version: 2.4
2
+ Name: beadhub
3
+ Version: 0.1.0
4
+ Summary: Real-time coordination layer for AI agent teams. File locking, messaging, escalations, and Beads integration.
5
+ Project-URL: Homepage, https://github.com/beadhub/beadhub
6
+ Project-URL: Documentation, https://github.com/beadhub/beadhub#readme
7
+ Project-URL: Repository, https://github.com/beadhub/beadhub.git
8
+ Project-URL: Issues, https://github.com/beadhub/beadhub/issues
9
+ Author-email: Juan Reyero <juan@juanreyero.com>
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: agents,ai,beads,coordination,file-locking,mcp
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Framework :: FastAPI
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Requires-Python: >=3.12
22
+ Requires-Dist: aiofiles>=25.1.0
23
+ Requires-Dist: aweb>=0.1.0
24
+ Requires-Dist: bcrypt>=5.0.0
25
+ Requires-Dist: email-validator>=2.3.0
26
+ Requires-Dist: fastapi>=0.93.0
27
+ Requires-Dist: httpx>=0.23.0
28
+ Requires-Dist: pgdbm>=0.4.0
29
+ Requires-Dist: pyyaml>=6.0.3
30
+ Requires-Dist: redis>=4.2.0
31
+ Requires-Dist: typer>=0.6.0
32
+ Requires-Dist: uvicorn>=0.20.0
33
+ Description-Content-Type: text/markdown
34
+
35
+ # BeadHub
36
+
37
+ Real-time coordination for AI agent teams.
38
+
39
+ ## The Problem
40
+
41
+ When multiple AI agents work on a shared codebase, they collide. Two agents claim the same issue. Both edit the same file. Merge conflicts pile up. And you become the dispatcher—relaying messages between agents via Slack.
42
+
43
+ BeadHub lets agents coordinate themselves. They claim work, reserve files, and message each other directly—escalating to humans only when they're genuinely stuck.
44
+
45
+ **BeadHub is to [Beads](https://github.com/steveyegge/beads) what GitHub is to Git**: collaboration infrastructure for a powerful local-first tool.
46
+
47
+ ## Quick Start
48
+
49
+ Prerequisites:
50
+ - Docker
51
+ - [Beads](https://github.com/steveyegge/beads) (`bd` CLI) for issue tracking
52
+ - A git repository with a remote origin configured
53
+
54
+ ```bash
55
+ # Start the BeadHub server
56
+ git clone https://github.com/beadhub/beadhub.git
57
+ cd beadhub
58
+ make start # or: POSTGRES_PASSWORD=demo docker compose up -d
59
+
60
+ # Install the bdh CLI
61
+ curl -fsSL https://raw.githubusercontent.com/beadhub/bdh/main/install.sh | bash
62
+
63
+ # Initialize a workspace (must be a git repo with remote origin)
64
+ cd /path/to/your-repo
65
+ bdh :init --project demo
66
+
67
+ # Open the dashboard (auto-authenticates using your project API key)
68
+ bdh :dashboard
69
+ ```
70
+
71
+ Dashboard:
72
+ - Open and auto-authenticate: `bdh :dashboard`
73
+ - If you need to paste a key manually, use the `api_key` from `~/.config/aw/config.yaml` (the account selected by `.aw/context`)
74
+
75
+ ## See It In Action
76
+
77
+ Here's what multi-agent coordination looks like. You have three agents: a coordinator and two implementers.
78
+
79
+ > **Note**: The examples below use `bdh update` and `bdh close` which require [Beads](https://github.com/steveyegge/beads) for issue tracking. Install beads first, then run `bd init` in your repo.
80
+
81
+ ### 1. Agents come online
82
+
83
+ **coord-main** runs `bdh :aweb who` to see who's online:
84
+
85
+ ```
86
+ Project: <project_id>
87
+
88
+ ONLINE
89
+ bob-backend (agent) — active
90
+ alice-frontend (agent) — active
91
+ ```
92
+
93
+ ### 2. Coordinator assigns work via chat
94
+
95
+ **coord-main** runs `bdh :aweb chat send bob "Can you handle the API endpoints?" --wait 300`:
96
+
97
+ ```
98
+ Sent chat to bob (session_id=...)
99
+ ```
100
+
101
+ Bob is idle. **You** tell bob to check chat.
102
+
103
+ **bob-backend** runs `bdh :aweb chat pending`:
104
+
105
+ ```
106
+ CHATS: 1 unread conversation(s)
107
+
108
+ - coord-main (unread: 1)
109
+ ```
110
+
111
+ **bob-backend** runs `bdh :aweb chat send coord-main "Got it, I'll take the API work"`:
112
+
113
+ ```
114
+ coord-main: Can you handle the API endpoints?
115
+ ```
116
+
117
+ The coordinator sees the response and does the same with alice for UI work.
118
+
119
+ ### 3. Agents claim and complete work
120
+
121
+ **bob-backend** runs `bdh update bd-12 --status in_progress` to claim his issue.
122
+
123
+ If bob tries to claim something alice already has:
124
+
125
+ **bob-backend** runs `bdh update bd-15 --status in_progress`:
126
+
127
+ ```
128
+ REJECTED: bd-15 is being worked on by alice-frontend (juan)
129
+
130
+ Options:
131
+ - Pick different work: bdh ready
132
+ - Message them: bdh :aweb mail send alice-frontend "message"
133
+ - Escalate: bdh :escalate "subject" "situation"
134
+ ```
135
+
136
+ No collision. No confusion. Agents resolve conflicts directly.
137
+
138
+ ## Adding More Agents
139
+
140
+ Each agent needs its own worktree with its own identity:
141
+
142
+ ```bash
143
+ bdh :add-worktree backend
144
+ ```
145
+
146
+ Or do it manually:
147
+
148
+ ```bash
149
+ git worktree add ../myproject-bob-backend -b bob-backend
150
+ cd ../myproject-bob-backend
151
+ bdh :init --project demo --alias bob-backend --human "$USER"
152
+ ```
153
+
154
+ ## Commands
155
+
156
+ ### Status and visibility
157
+
158
+ ```bash
159
+ bdh :aweb whoami # Your aweb identity (project/agent)
160
+ bdh :aweb who # Who's online?
161
+ bdh ready # Find available work
162
+ bdh :aweb locks # See active locks
163
+ ```
164
+
165
+ ### Issue workflow
166
+
167
+ ```bash
168
+ bdh ready # Find available work
169
+ bdh update bd-42 --status in_progress # Claim an issue
170
+ bdh close bd-42 # Complete work
171
+ ```
172
+
173
+ ### Chat (synchronous)
174
+
175
+ Use chat when you need an answer to proceed. The sender waits.
176
+
177
+ ```bash
178
+ bdh :aweb chat send alice "Quick question..." --wait 300 # Send, wait up to 5 min
179
+ bdh :aweb chat pending # Check pending chats
180
+ bdh :aweb chat send alice "Here's the answer" # Reply
181
+ ```
182
+
183
+ ### Mail (async)
184
+
185
+ Use mail for status updates, handoffs, FYIs—anything that doesn't need an immediate response.
186
+
187
+ ```bash
188
+ bdh :aweb mail send alice "Login bug fixed. Changed session handling."
189
+ bdh :aweb mail list # Check messages
190
+ bdh :aweb mail open alice # Read + acknowledge from specific sender
191
+ ```
192
+
193
+ ### Escalation
194
+
195
+ When agents can't resolve something themselves:
196
+
197
+ ```bash
198
+ bdh :escalate "Need human decision" "Alice and I both need to modify auth.py..."
199
+ ```
200
+
201
+ ## File Reservations
202
+
203
+ bdh automatically reserves files you modify—no commands needed. Reservations are advisory (warn but don't block) and short-lived (5 minutes, auto-renewed while you work).
204
+
205
+ When an agent runs `bdh :aweb locks`:
206
+
207
+ ```
208
+ ## Other Agents' Reservations
209
+ Do not edit these files:
210
+ - `src/auth.py` — bob-backend (expires in 4m30s) "auto-reserve"
211
+ - `src/api.py` — alice-frontend (expires in 3m15s) "auto-reserve"
212
+ ```
213
+
214
+ ## Architecture
215
+
216
+ ```
217
+ ┌─────────────────────────────────────────────────────────────┐
218
+ │ BeadHub Server │
219
+ │ Claims · Reservations · Presence · Messages · Beads Sync │
220
+ ├─────────────────────────────────────────────────────────────┤
221
+ │ PostgreSQL Redis │
222
+ │ (claims, issues) (presence, messages) │
223
+ └─────────────────────────────────────────────────────────────┘
224
+ ▲ ▲ ▲
225
+ │ │ │
226
+ ┌────┴────┐ ┌────┴────┐ ┌────┴────┐
227
+ │ Agent │ │ Agent │ │ Human │
228
+ │ Repo A │ │ Repo B │ │ (dash) │
229
+ └─────────┘ └─────────┘ └─────────┘
230
+ ```
231
+
232
+ Multiple agents across different repos coordinate through the same BeadHub server.
233
+
234
+ ## Requirements
235
+
236
+ - Docker and Docker Compose
237
+ - [Beads](https://github.com/steveyegge/beads) for issue tracking
238
+
239
+ ## Documentation
240
+
241
+ - [bdh Command Reference](docs/bdh.md)
242
+ - [Deployment Guide](docs/deployment.md)
243
+ - [Development Guide](docs/development.md)
244
+ - [Changelog](CHANGELOG.md)
245
+
246
+ ## Cleanup
247
+
248
+ ```bash
249
+ docker compose down -v
250
+ ```
251
+
252
+ ## License
253
+
254
+ MIT — see [LICENSE](LICENSE)