Skip to main content

peerhub

A lightweight, installable coordination layer for orchestrating multiple AI CLI agents (Claude, Codex, Antigravity, ...) as collaborating peers: dispatch, routing, consensus, and health. It's built to eventually replace an existing hand-rolled multi-peer coordination system (hub.py) with a proper, tested package.

Quick start

pip install peerhub

# Auto-detect which peer CLIs (agy/claude/codex) are installed and ready
peerhub adapter discover

# Genuinely dispatch a prompt to a real peer and get its response
peerhub ask ag "say hello in exactly three words"

# Live multi-peer quota telemetry, headroom, and failover routing
peerhub diag

# Check a workspace (reports "uninitialized" if no database yet)
peerhub status

peerhub ask works end-to-end today: it genuinely dispatches through peerhub's own governance, admission, and process-supervision layers and returns the real response. See "Key commands" below for the full reference, including the governance/room/session surface used by automated multi-peer coordination (consensus, task, lesson, room, duty, session, ...) — peerhub --help groups all of it into tiers so the everyday commands above aren't buried under the ~30 total top-level commands.

Install

pip install peerhub

Option B: Install an exact GitHub release

pip install "git+https://github.com/greatgc-flow/peerhub.git@v0.6.0"

Option C: Local editable development install

git clone https://github.com/greatgc-flow/peerhub.git
cd peerhub
pip install -e .          # runtime only
pip install -e .[dev]     # + pytest, pyright, hypothesis, alembic (needed to run tests/type-check locally)

Requires Python >= 3.11. This installs the peerhub package and registers a peerhub entrypoint on your PATH (verified via a real sdist build + install: pyproject.toml's [project.scripts] defines only peerhub, not a separate hub alias). python -m peerhub works too.

Key commands

Command What it does
peerhub adapter discover Find which peer CLIs (agy/claude/codex) are installed and ready
peerhub ask PEER PROMPT Dispatch a prompt to a real peer CLI (defaults to --capability-tier READ_ONLY)
peerhub broadcast PROMPT --peers ag,cx Fan out one prompt to multiple peers with unified consensus
peerhub diag Live multi-peer quota telemetry, headroom, and failover routing
peerhub status Workspace health check
peerhub config validate Check every config layer (workspace/global/built-in) resolves cleanly
peerhub backup workspace / backup restore Live SQLite-snapshot backup and restore

See peerhub --help for the full command list — including the governance/room/session surface (consensus, task, lesson, room, duty, session, ...), grouped into its own tier since it's primarily an API contract for automated multi-peer coordination (hub.py-parity), not something a human types day to day.

ask also accepts --workspace PATH (default .), --profile PROFILE_ID, --timeout-seconds/--silence-timeout-seconds/--max-output-bytes (process limits), and --json. Exit codes: 0 verified response, 2 usage/config/pre-spawn failure (unknown peer, executable not found, readiness probe failed), 3 definite peer/protocol failure, 4 uncertain execution (timeout, lost lease ownership), 130 interrupted. It requires the real peer CLI (agy.exe/claude.cmd/codex.cmd) to be installed and authenticated on your machine — ask will tell you clearly if it can't find or run one, rather than failing silently.

Status

Released as v0.6.0. peerhub ask and the full governance/room/session command surface are real, working, and dispatch through peerhub's own governance, admission, and process-supervision layers today — not a stub. D-CTX (dispatch-context credential verification, closing the consensus-vote impersonation gap) is fully wired end-to-end. As of this release, R4/P4b governance convergence is complete across every governance-decision domain (feedback, artifact, file-lock, task, room, lesson, duty, error review, role, leadership, consensus) — all route through a uniform ApplicationAPI.submit() gateway instead of bypassing it, with consensus vote exercising the gateway's verified-credential path. docs/design/peerhub-production-call-map-R1.json still lists 18 mutating bootstrap/session/config/health/routing/directive/node-level commands as DIRECT_CLI_BYPASS — this is a deliberate scope boundary (these are pre-authorization-context primitives, not governance decisions) documented in the call-map's own known_gaps/scope_boundary fields, not an oversight. hub.py remains the authoritative system for production multi-peer coordination; peerhub is a real, tested candidate replacement, not yet a cutover.

For the detailed development history — implementation status by feature, deferred items with their triggers, the hub.py-replacement roadmap, and the full architecture debate record — see docs/STATUS.md.

Run the tests

pytest -q                 # fast suite, no real CLI calls
pytest -q -m slow          # + the real-adapter/real-dispatch integration tests (needs real CLIs installed & authenticated, real wall-clock time)
pyright                    # static type check, should report 0 errors

This repo's own convention (see docs/history/design/2026-08/FACT-REFRESH-PROCEDURE-R1.md) is to never cite a specific "current passing count" in this file — it changes with nearly every commit. Run pytest -q yourself for the real, current number.

Metadata

Release files for peerhub 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for peerhub 0.6.0
File Size Uploaded Provenance
peerhub-0.6.0.tar.gz 481.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for peerhub 0.6.0
File Interpreter ABI Platform
peerhub-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.1 MB

Release files / peerhub-0.6.0.tar.gz

Download URL peerhub-0.6.0.tar.gz
Size 481.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b0d443ee70c3e91cfb6388f21a5ba37a61d755658010e8af2f08eb14b8ca0e4c
BLAKE2b-256 checksum
How to use checksums
07b387a9300570224aea197b0004d99d31d0203301092130445fcdaf19aeef20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.

Transparency log

Release files / peerhub-0.6.0-py3-none-any.whl

Download URL peerhub-0.6.0-py3-none-any.whl
Size 589.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6542a048040b957888f45914c49fd5fd594af8f217402875a9aa57b083bcc1ad
BLAKE2b-256 checksum
How to use checksums
6ae7a31f47f3760c2d4e609d9f97ea51870628f0848900ef5c84cea3c1eed0f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.

Transparency log

Security for peerhub 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for peerhub-0.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page