Skip to main content

chp-core

The reference local host for the Capability Host Protocol — the open protocol for declaring, governing, and proving what agents, tools, and systems do.

See what your agents and tools actually did — and what governed it.

Try it in two minutes

Your coding agent reads files, runs commands, calls tools. This puts a governed boundary at the point of action — no application code changes:

pip install chp-core
chp hooks install                     # Claude Code
chp hooks install --all-harnesses     # ...or Claude Code + Codex + Gemini CLI

Use your agent normally, then look at what it did:

chp session list
chp session tree <session_id>

Every tool call becomes a typed evidence event, hash-chained and stored locally in ~/.chp/evidence.sqlite. A denial is a first-class event with a reason code — not a swallowed exception — and the chain is tamper-evident, so someone who did not run the agent can still tell whether the record is intact.

Docs: docs.capabilityhostprotocol.com · Source: github.com/capabilityhostprotocol/chp-core

Install

pip install chp-core                 # zero runtime dependencies
pip install 'chp-core[schema]'       # enforce capabilities' declared input_schema
pip install 'chp-core[signing]'      # ed25519 — signed hosts, bundles, mandates

Without [schema], a capability's declared input_schema is not enforced — the host warns at registration and chp host verify reports it rather than letting the gap pass silently. Without [signing], evidence stays at the hash-chain tier rather than the signed tier.

chp host verify     # smoke-tests the host and evidence store in under a second

From a checkout of this repository:

python -m pip install -e packages/python

What this package is

Intentionally small:

  • register capabilities
  • discover declarations
  • invoke through a governed envelope
  • preserve or generate correlation IDs
  • emit append-only SQLite evidence
  • replay evidence by correlation ID
  • optionally serve discovery, invocation, and replay over local HTTP

Quick Example

from chp_core import LocalCapabilityHost, capability

host = LocalCapabilityHost("example-host")

@capability(
    id="math.add",
    version="1.0.0",
    description="Add two numbers.",
)
def add(a: int, b: int):
    return {"sum": a + b}

host.register(add)

result = host.invoke(
    "math.add",
    {"a": 2, "b": 3},
    correlation_id="demo-correlation",
)

events = host.replay("demo-correlation")

Async handlers are supported. Use await host.ainvoke(...) when already inside an event loop.

By default, invocation payloads are not copied into evidence. Handlers can emit explicit redacted evidence through ctx.emit(...).

Payloads emitted through ctx.emit(...) are redacted by default for common sensitive keys such as token, secret, password, authorization, and api_key.

Adapters

Group related capabilities into an adapter class using BaseAdapter and the @capability decorator. All decorated methods are auto-discovered:

from chp_core import BaseAdapter, capability, LocalCapabilityHost, register_adapter

class MathAdapter(BaseAdapter):
    adapter_id = "math"
    adapter_name = "Math Capabilities"

    @capability(id="math.add", version="1.0.0", description="Add two numbers.")
    async def add(self, ctx, payload):
        return {"sum": payload["a"] + payload["b"]}

    @capability(id="math.mul", version="1.0.0", description="Multiply two numbers.")
    async def multiply(self, ctx, payload):
        return {"product": payload["a"] * payload["b"]}

host = LocalCapabilityHost()
register_adapter(host, MathAdapter())

For standalone functions, use SimpleAdapter:

from chp_core import SimpleAdapter, capability, register_adapter

@capability(id="greet.hello", version="1.0.0", description="Greet someone.")
def hello(name: str):
    return {"message": f"Hello, {name}!"}

register_adapter(host, SimpleAdapter("greet", [hello]))

Shipping an adapter package

Publish your adapter as a standalone package (e.g. chp-linear) and declare it under the chp.adapters entry-point group so hosts can discover it automatically:

# your_adapter/pyproject.toml
[project.entry-points."chp.adapters"]
linear = "chp_linear:LinearAdapter"

Once installed, any host can load all registered adapters:

from chp_core import auto_register_adapters

host = LocalCapabilityHost()
auto_register_adapters(host)  # loads every installed chp.adapters entry point

Or discover them manually:

from chp_core import discover_adapters

for name, adapter_cls in discover_adapters().items():
    print(name, adapter_cls)

chp-core ships a built-in chp-git adapter that exposes Git version-control governance capabilities. It is registered automatically when the package is installed.

HTTP Endpoint

The HTTP helper is transport glue around the same LocalCapabilityHost:

from chp_core import create_http_server

server = create_http_server(host, port=8765)
server.serve_forever()

Routes:

  • GET /host
  • GET /capabilities
  • POST /invoke
  • POST /replay
  • GET /replay/{correlation_id}

See examples/capability-host-endpoint-demo/.

The package also installs a small CLI:

chp demo endpoint
chp serve-demo --port 8765
chp host
chp invoke demo.search_information --payload '{"query":"CHP vs MCP"}' --correlation-id corr_demo
chp replay corr_demo

Development Evidence Controls

Use chp work to record local engineering work as CHP evidence:

chp work run \
  --intent "Verify the Python test suite." \
  --correlation-id chp-dev-001 \
  --test-run unit \
  -- python -m unittest discover -s packages/python/tests

chp work summary chp-dev-001
chp work replay chp-dev-001
chp work explain chp-dev-001

Tests

cd packages/python
python -m unittest discover -s tests

Download files

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

Source Distribution

chp_core-0.58.0.tar.gz (471.1 kB view details)

Uploaded Source

Built Distribution

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

chp_core-0.58.0-py3-none-any.whl (341.9 kB view details)

Uploaded Python 3

File details

Details for the file chp_core-0.58.0.tar.gz.

File metadata

  • Download URL: chp_core-0.58.0.tar.gz
  • Upload date:
  • Size: 471.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for chp_core-0.58.0.tar.gz
Algorithm Hash digest
SHA256 a40af3c4b07cf7710be08aae5afd665c13f68bc8be0de0feb213d97e65eee7f5
MD5 61420cff85ca4ef7b2065c83b0649201
BLAKE2b-256 5edeef45aeec59ad31bb4b3f365dbe1234639fe038b132b268a822df86b054f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for chp_core-0.58.0.tar.gz:

Publisher: release.yml on capabilityhostprotocol/chp-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chp_core-0.58.0-py3-none-any.whl.

File metadata

  • Download URL: chp_core-0.58.0-py3-none-any.whl
  • Upload date:
  • Size: 341.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for chp_core-0.58.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8137d2d5cc29c1c4ff29b6cd58bdc5939af0f47954178d5c6ddf50c1e576475a
MD5 bde00ca7f1c87607e70dc0c475a78723
BLAKE2b-256 a119b7fce85a52d8f17707790d6a33c434fbbf74bbafd06104bfb23cf2c4da92

See more details on using hashes here.

Provenance

The following attestation bundles were made for chp_core-0.58.0-py3-none-any.whl:

Publisher: release.yml on capabilityhostprotocol/chp-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.60.1

2 files

0.60.0

2 files

0.59.0

2 files

This release

0.58.0 This release

2 files

0.57.0

2 files

0.56.0

2 files

0.55.0

2 files

0.54.0

2 files

0.53.0

2 files

0.50.0

2 files

0.48.0

2 files

0.47.0

2 files

0.46.0

2 files

0.45.0

2 files

0.44.0

2 files

0.43.1

2 files

0.43.0

2 files

0.42.2

2 files

0.42.1

2 files

0.42.0

2 files

0.41.0

2 files

0.40.0

2 files

0.39.0

2 files

0.38.0

2 files

0.37.0

2 files

0.36.0

2 files

0.35.0

2 files

0.34.0

2 files

0.33.0

2 files

0.32.0

2 files

0.31.0

2 files

0.30.1

2 files

0.30.0

2 files

0.29.0

2 files

0.28.0

2 files

0.27.0

2 files

0.26.0

2 files

0.25.0

2 files

0.24.0

2 files

0.23.0

2 files

0.22.0

2 files

0.21.0

2 files

0.20.0

2 files

0.19.0

2 files

0.18.0

2 files

0.17.0

2 files

0.16.0

2 files

0.15.0

2 files

0.14.0

2 files

0.13.1

2 files

0.13.0

2 files

0.12.0

2 files

0.11.0

2 files

0.10.0

2 files

0.9.1

2 files

0.9.0

2 files

0.8.0

2 files

0.7.0

2 files

0.6.3

2 files

0.6.0

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.7

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

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