Skip to main content

jchat

Decentralized signal & notification bus for coordinating AI agents (Python API, CLI, MCP). Standard library only, SQLite-backed, zero runtime dependencies.

Install

Requires Python >= 3.15.

pip install jchat

Verify your environment with the built-in loopback self-test:

jchat doctor

Quick Start

CLI

jchat serve                                          # start node on 127.0.0.1:8765
jchat register agent-b --pid $$                      # register live agent
jchat ping agent-b                                   # live online handshake
jchat send agent-b "review ready" --sender agent-a --ref git:HEAD --kind verify
jchat pull agent-b                                   # lease messages (30 s default)
jchat ack <msg-id> agent-b                           # hard-delete message on read
jchat status                                         # node, agents, queue depth (no bodies)

Python API

from jchat import Client, NetPolicy, Node, wrap_untrusted

policy = NetPolicy(netmode="localhost")
with Node(node_name="local", db_path="/tmp/jchat.db", net_policy=policy, port=0) as node:
    client = Client(node.url)
    client.send(sender="agent-a", recipient="agent-b", kind="notify", body="done", ref="git:HEAD")
    for msg in client.pull("agent-b"):
        print(wrap_untrusted(msg))
        client.ack_read(msg["id"], "agent-b")

MCP (stdio)

Run the MCP stdio server for agent harnesses:

jchat mcp

Envelope Contract (<= 1000 chars)

jchat is a signal and pointer bus, not a chat history store:

  • body: strictly <= 1000 characters (ValidationError / 400 payload_too_large if exceeded).
  • ref: optional resource pointer (<= 512 chars, no newlines or embedded tokens/secrets) prefixed with git:, gh:, drive:, file:, or https:.
  • kind: notify, verify, claim, ask, or status.
  • priority: normal or urgent (urgent delivered first).
  • ttl_s: 1..604800 (default 86400), plus optional dedup_key (idempotent push) and reply_to.

Message Lifecycle

  1. queued: validated envelope persisted in SQLite (messages) awaiting pull or peer /ingest.
  2. delivered: leased by POST /pull (lease_s=30 default). If a consumer crashes before ack, the lease expires and the message returns to queued.
  3. read: POST /ack hard-deletes the row (DELETE FROM messages WHERE id = ?) and leaves only a 1 h in-memory body-less receipt (id -> {status, reason, ts}).
  4. failed: body-less receipt recorded on ttl_expired, agent_offline (when require_online=True), node_unreachable, or node_out_of_mesh.

Netmodes (JCHAT_NETMODE)

Wildcard binds (0.0.0.0, ::, *) are always refused. Non-localhost modes authenticate every request with HMAC-SHA256 (X-JChat-Ts, X-JChat-Nonce, X-JChat-Sig) using a 30 s skew window and nonce replay cache.

Mode Requirements Inbound / Outbound Rule
localhost (default) None Binds 127.0.0.1 only; remote peer pushes refused (node_out_of_mesh).
allowlist JCHAT_KEY, JCHAT_ALLOW_IPS Loopback + listed JCHAT_ALLOW_IPS only (DNS-resolved outbound).
tailscale JCHAT_KEY Loopback, 100.64.0.0/10, or fd7a:115c:a1e0::/48 only.
cloud JCHAT_KEY, https:// JCHAT_CLOUD_URL Relays via configured HTTPS endpoint.

Key environment variables: JCHAT_NETMODE, JCHAT_KEY, JCHAT_ALLOW_IPS, JCHAT_CLOUD_URL, JCHAT_BIND, JCHAT_PEERS, JCHAT_NODE, JCHAT_DB, JCHAT_URL.

Hooks & Diagnostics

  • jchat install-hooks <claude|agy|opencode|cursor> installs turn-boundary hooks with automatic backups (--remove restores).
  • jchat doctor runs an isolated loopback self-test covering send, pull, ack, and delete-on-read.

License

MIT. See LICENSE.

Metadata

Release files for jchat 0.2.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 jchat 0.2.0
File Size Uploaded Provenance Actions
jchat-0.2.0.tar.gz 51.4 kB With provenance Details for jchat-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 87.1 kB

Release files / jchat-0.2.0.tar.gz

Download URL jchat-0.2.0.tar.gz
Size 51.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c22518458adc318a90480594f368f852a918349dce661e56955244a0699fac6c
BLAKE2b-256 checksum
How to use checksums
ee011460d4f9517cf28548837b2d8bdee2b937a6efba69891604365644f76e23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 29, 2026.

Transparency log

Release files / jchat-0.2.0-py3-none-any.whl

Download URL jchat-0.2.0-py3-none-any.whl
Size 35.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2cf62da67d59ce28841907cbb0f3d9f02321a9a911408ecc8215297b01303c96
BLAKE2b-256 checksum
How to use checksums
67fe7c8b7792e6e79766e4ec8a8538ac8d7ba500ee1bce27e5ba409942e4c9ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 29, 2026.

Transparency log

Security for jchat 0.2.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for jchat-0.2.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 Nov 29, 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.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