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.60.1.tar.gz (554.7 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.60.1-py3-none-any.whl (384.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: chp_core-0.60.1.tar.gz
  • Upload date:
  • Size: 554.7 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.60.1.tar.gz
Algorithm Hash digest
SHA256 0684190d2712ce6d9995f55ffc145500deceaec343e7d99739049938c5b4e09d
MD5 de9042ddd9fb3c062841c7385c64f6f0
BLAKE2b-256 8ff4656edc1f77e0ec53b5f33ac1ab3853f2d4c79aed6d65faf5214875925340

See more details on using hashes here.

Provenance

The following attestation bundles were made for chp_core-0.60.1.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.60.1-py3-none-any.whl.

File metadata

  • Download URL: chp_core-0.60.1-py3-none-any.whl
  • Upload date:
  • Size: 384.7 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.60.1-py3-none-any.whl
Algorithm Hash digest
SHA256 37cc3b6f182cd5128b9c0b71c68a39b0e8005d6fcec02373dd7dde8f16df773d
MD5 b62cddbf4b62f81001a72ff8fea55e08
BLAKE2b-256 f8f0067f21ff95d5b96d0d3367a78da4f1b179a518b3d3fdbd18925dc1ee2272

See more details on using hashes here.

Provenance

The following attestation bundles were made for chp_core-0.60.1-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

This release

0.60.1 This release

2 files

0.60.0

2 files

0.59.0

2 files

0.58.0

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