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 /hostGET /capabilitiesPOST /invokePOST /replayGET /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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chp_core-0.55.0.tar.gz.
File metadata
- Download URL: chp_core-0.55.0.tar.gz
- Upload date:
- Size: 435.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43b17b7e22aefd97b0cc7f5365bd2162ea8f5523df6f9d373e0a2ccc53f08d19
|
|
| MD5 |
fa9f37477057d668c80d1e06d128f360
|
|
| BLAKE2b-256 |
33b56cae1d3c70ac5e42adfc4febf09c39b715daaf1b8adfc9d147c1834deaa8
|
Provenance
The following attestation bundles were made for chp_core-0.55.0.tar.gz:
Publisher:
release.yml on capabilityhostprotocol/chp-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chp_core-0.55.0.tar.gz -
Subject digest:
43b17b7e22aefd97b0cc7f5365bd2162ea8f5523df6f9d373e0a2ccc53f08d19 - Sigstore transparency entry: 2513675705
- Sigstore integration time:
-
Permalink:
capabilityhostprotocol/chp-core@84025faf2bf9c1046e63c5e8caf41f991cbff91f -
Branch / Tag:
refs/tags/v0.55.0 - Owner: https://github.com/capabilityhostprotocol
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@84025faf2bf9c1046e63c5e8caf41f991cbff91f -
Trigger Event:
push
-
Statement type:
File details
Details for the file chp_core-0.55.0-py3-none-any.whl.
File metadata
- Download URL: chp_core-0.55.0-py3-none-any.whl
- Upload date:
- Size: 315.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a72ee02de565b14d3d72d25c24de09e5ff8ffae312cad9df2067b391a216b391
|
|
| MD5 |
d078f849ae2976af6a0a90b9195500a3
|
|
| BLAKE2b-256 |
8a1fc6debcb543db33d6dfd6fcbeb90c3133b1d49f29c1bc4460215de89b8fdd
|
Provenance
The following attestation bundles were made for chp_core-0.55.0-py3-none-any.whl:
Publisher:
release.yml on capabilityhostprotocol/chp-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chp_core-0.55.0-py3-none-any.whl -
Subject digest:
a72ee02de565b14d3d72d25c24de09e5ff8ffae312cad9df2067b391a216b391 - Sigstore transparency entry: 2513675722
- Sigstore integration time:
-
Permalink:
capabilityhostprotocol/chp-core@84025faf2bf9c1046e63c5e8caf41f991cbff91f -
Branch / Tag:
refs/tags/v0.55.0 - Owner: https://github.com/capabilityhostprotocol
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@84025faf2bf9c1046e63c5e8caf41f991cbff91f -
Trigger Event:
push
-
Statement type: