synadia-agents
CLAUDE.md81 starsChanged 7 months agoApache-2.0View on GitHub
This file orients Claude Code when working anywhere in this repo. For language-specific deep dives, defer to the package-level CLAUDE.md (e.g. client-sdk/python/CLAUDE.md) and to per-package READMEs. The home for everything around the Synadia Agent Protocol for NATS — language SDKs that callers use, agent plugins that host the protocol, and example apps that exercise both. The root README.md covers the user-facing view: layout, subject namespace, wire shape, quickstart. Read it before making changes that touch user-visible surface. The protocol spec…
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
14 rules. About 0 are common, 6 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 23
Every SDK in this repo ships a spec-compliant reference agent that implements the full §12 agent-checklist (service registration, prompt …
- Very specific: line 151
Update client-sdk/typescript/CHANGELOG.md under [Unreleased].
- Very specific: line 152
Search for from "@synadia-ai/agents" in examples/ — anything affected by the change?
- Very specific: line 154
Update client-sdk/typescript/README.md if the change is part of the documented quickstart / API matrix.
- Distinctive: line 156
If examples need the change, follow the release ladder below.
- Distinctive: line 175
Update the other SDK to match.
- Distinctive: line 177
Update every agent harness that hard-codes the protocol version string.
- Distinctive: line 182
Update its README if user-visible config / subject layout changed.
- Very specific: line 183
Prefer the SDK package over inlined @nats-io/* logic where it helps (see "Agents _should_ reuse the SDK package" above).
- Distinctive: line 187
Update the example's README if its CLI / config / quickstart changed.
- Distinctive: line 189
If the example consumes a new SDK feature, you need a published SDK version first (see release ladder).
- Very specific: line 192
If you're unsure whether you touched something load-bearing, search for references to the file or symbol you changed (grep -r, or ask an …
- Very specific: line 226
After publish: open the example-migration PR, bump examples/*/package.json to the new SDK semver, refresh bun.lock, verify bun run …
- Very specific: line 241
All three workflows run in the pypi GitHub Environment, whose tag-deployment policy gates them to those three prefixes.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file orients Claude Code when working anywhere in this repo. For
language-specific deep dives, defer to the package-level CLAUDE.md (e.g.
client-sdk/python/CLAUDE.md) and to per-package READMEs.
What this repo is
The home for everything around the Synadia Agent Protocol for NATS — language
SDKs that callers use, agent plugins that host the protocol, and example
apps that exercise both. The root README.md covers the user-facing
view: layout, subject namespace, wire shape, quickstart. Read it before
making changes that touch user-visible surface.
The protocol spec is not vendored here. Canonical source:
synadia-ai/synadia-agent-sdk-docs
— always link to the GitHub URL when reasoning about wire shape. Local
docs/protocol-mapping.md files inside each SDK translate spec → impl;
they are not the spec itself.
Reference agents — canonical implementations
Every SDK in this repo ships a spec-compliant reference agent that
implements the full §12 agent-checklist (service registration, prompt
endpoint, status endpoint, heartbeats on agents.hb.*.*.*, terminator
semantics). When reasoning about wire shape, expected on-the-wire
behaviour, or testing a new SDK / agent, read these first — they are
the authoritative on-the-wire counterpart to the spec doc.
- TypeScript:
agent-sdk/typescript/src/testing/reference-agent.ts— theReferenceAgentclass, importable from third-party packages via@synadia-ai/agent-service/testing(post-SDK-split — pre-split it lived under@synadia-ai/agents/testing). Runnable script:client-sdk/typescript/examples/_run-reference-agent.ts. - Python:
agent-sdk/python/examples/_reference_agent.py— a runnable echo agent with conversation memory, used as the test harness for the numbered demos and as a wire-compat counterparty. (Moved with the host-side split intosynadia-ai-agent-service; pre- split it lived underclient-sdk/python/examples/.)
Each SDK also has a parallel set of numbered demo scripts that exercise discovery, prompting (text + attachments), mid-stream queries, and liveness against the reference agent — useful both as documentation and as a smoke surface:
- TS:
client-sdk/typescript/examples/01-discover.ts…05-liveness.ts, plus06-chat.ts(interactive REPL). - Python:
client-sdk/python/examples/01-discover.py…05-liveness.py, plus06-chat.py(interactive REPL). Seeclient-sdk/python/examples/README.mdfor the full table.
The Python interop test (client-sdk/python/tests/test_interop_e2e.py)
runs the TS reference agent as a subprocess and validates wire
compatibility between the two SDKs.
Repository layout (and what's published)
| Path | Package | Published as | Notes |
client-sdk/typescript/ | @synadia-ai/agents | npm (public) | TS SDK — Node/Bun callers |
client-sdk/python/ | synadia-ai-agents (import: synadia_ai.agents) | PyPI | Python SDK — has its own CLAUDE.md |
agents/pi/ | @synadia-ai/nats-pi-channel | npm (public) | PI extension plugin |
agents/openclaw/ | @synadia-ai/nats-channel | npm (public) | OpenClaw plugin |
agents/claude-code/ | claude-channel-nats | Claude marketplace | Claude Code MCP plugin; package and plugin descriptor versions must agree |
agents/hermes/ | — | not in repo | README only; ships from upstream Hermes |
agents/flue/ | @synadia-ai/flue-nats-channel | npm (public; first publish pending) | Flue sidecar channel |
agents/opencode/ | @synadia-ai/opencode-nats-channel | npm (public; first publish pending) | OpenCode plugin channel |
agents/codex/ | @synadia-ai/codex-nats-channel | npm (public; first publish pending) | Codex app-server-backed channel |
agents/acp/ | @synadia-ai/acp-nats-channel | npm (public; first publish pending) | Generic ACP channel (grok preset + custom) |
agents/grok/ | @synadia-ai/grok-nats-channel | npm (public; first publish pending) | Grok Build front door — thin pin over agents/acp |
agents/eve/ | @synadia-ai/eve-nats-channel | npm (public; first publish pending) | Eve sidecar channel |
examples/pi-headless/ | @synadia-ai/nats-pi-headless | npm (public) | depends on @synadia-ai/agents@^0.5.x |
examples/agent-web-ui/ | @synadia-ai/nats-ai-testui | github only | local-clone test client; private: true so it never publishes |
examples/dspy/ | @synadia-ai/nats-dspy-agent | private | uses file: link to local SDK |
No root package.json, no workspace manager. Each subtree manages
its own deps and tooling. Examples that ship to npm pin the SDK by
semver range (^0.1.x); private/dev-only examples (currently just
dspy) use file:../../client-sdk/typescript.
Agents should reuse the SDK package where it helps. The SDK
(primarily the TS one) has accumulated meaningful shared logic —
framing, validation, helpers — and the direction of travel is an SDK
that covers both client and agent sides of the protocol. If an
agent harness needs functionality the SDK already provides, prefer
adding @synadia-ai/agents to its package.json and importing from
there over inlining or copy-pasting.
This is a reversal of the prior rule that agents must stay on raw
@nats-io/*. That rule no longer applies — duplicated hand-written
code in the agent harnesses is now technical debt, not a deliberate
boundary.
Caveat: this is a forward-looking rule, not a retroactive sweep. The
existing agents (agents/pi/extensions/nats-channel.ts,
agents/claude-code/server.ts, agents/openclaw/) still use
@nats-io/transport-node and @nats-io/services directly. Migrating
them is opportunistic — do it when you're already in the file for
another reason, or when the duplication actively bites. Don't open a
standalone "convert agent X to the SDK" PR without checking with the
user first.
Protocol vs package versions — don't read skew
Two distinct version axes:
- Wire protocol version —
0.3everywhere right now.- TS:
SDK_PROTOCOL_VERSION = { major: 0, minor: 3 }inclient-sdk/typescript/src/version.ts. - Python:
_PROTOCOL_VERSION = "0.3"inagent-sdk/python/src/synadia_ai/agent_service/service.py(host-side after the Python split landed in PR #45). - Agent harnesses derive the string from the SDK's
SDK_PROTOCOL_VERSIONrather than hard-coding it (seeagents/pi/extensions/nats-channel.ts,agents/claude-code/server.ts,agents/openclaw/src/gateway.ts). If the spec ever bumps, change the SDK constants in both languages and the harnesses pick it up automatically.
- TS:
- Package version (npm/PyPI) — independent per SDK pair.
- TS:
@synadia-ai/agents+@synadia-ai/agent-service— released in lockstep (0.5.2on npm; the sender-identity work lands as0.6.0). The release flow is inREADME-DEV.md. - Python:
synadia-ai-agents(0.8.0— the sender-identity caller side;0.7.1is the last release on PyPI untilpython-v0.8.0is tagged) +synadia-ai-agent-service(0.5.0— the host side, floorsynadia-ai-agents>=0.8;0.4.1is the last release on PyPI untilpython-agent-service-v0.5.0is tagged, which needspython-v0.8.0on PyPI first) — both published to PyPI; versions diverge per package.
- TS:
- Sender-identity extension — additive on top of
0.3, no protocol bump. Spec: §13 ofcore-protocol.mdinsynadia-ai/synadia-agent-sdk-docs. Public behavior is documented in both SDKs' README and protocol-mapping documents. Shared fixtures and the TS-generated known-answer vectors live undertest-fixtures/identity/; keep those four-language fixtures authoritative when changing identity code.
The package versions differ for historical reasons. They are not a
protocol skew. The Python tests/test_interop_e2e.py runs the TS
reference agent as a subprocess and validates wire compat — it
pytest.skips only when bun isn't on PATH (a prereq check, not an
xfail).
Ripple-check before declaring a change "done"
Most regressions in this repo come from forgetting that work in one subtree affects another. Before finishing a change, walk the list:
- Touched the TS SDK public surface (
client-sdk/typescript/src/index.tsexports, error classes, helpers)?- Update
client-sdk/typescript/CHANGELOG.mdunder[Unreleased]. - Search for
from "@synadia-ai/agents"inexamples/— anything affected by the change? - Update
client-sdk/typescript/README.mdif the change is part of the documented quickstart / API matrix. - If examples need the change, follow the release ladder below.
- Update
- Touched any TS SDK source (
client-sdk/typescript/src/**oragent-sdk/typescript/src/**, public surface or not)?- Rebuild and commit the Claude Code plugin's runtime bundle
(
agents/claude-code/runtime/server.js): it is a committedBun.buildofserver.tsplus bothfile:-linked SDKs, and CI rebuilds it from packed SDK artifacts and fails on any byte difference. Runbun run buildin both SDKs, refresh the plugin's copiednode_modules/@synadia-ai/*/dist(bun copiesfile:deps there, it does not symlink), thenbun run buildandbun run verify:bundleinagents/claude-code/and commit the result in the same PR as the SDK change.
- Rebuild and commit the Claude Code plugin's runtime bundle
(
- Touched the Python SDK public surface?
- Update
client-sdk/python/CHANGELOG.md. - Re-read
client-sdk/python/CLAUDE.md— it has stricter rules (agentidentifier, default registration, etc.) than the root guidance here.
- Update
- Touched wire format / protocol behavior in either SDK or any
agent?
- Update the other SDK to match. Wire compat between TS and Python is a hard requirement; the interop test catches drift.
- Update every agent harness that hard-codes the protocol version string.
- Re-read the spec at
synadia-ai/synadia-agent-sdk-docs— the spec doc, not the localprotocol-mapping.md, is the source of truth.
- Touched an agent harness (
agents/*)?- Update its README if user-visible config / subject layout changed.
- Prefer the SDK package over inlined
@nats-io/*logic where it helps (see "Agents should reuse the SDK package" above); migrating an existing harness is opportunistic, not a standalone PR.
- Touched an example?
- Update the example's README if its CLI / config / quickstart changed.
- If the example consumes a new SDK feature, you need a published SDK version first (see release ladder).
If you're unsure whether you touched something load-bearing, search for
references to the file or symbol you changed (grep -r, or ask an
Explore agent for cross-cutting cases). When in doubt, document the
change in the relevant CHANGELOG.md and call it out in the PR
description.
Release ladder for SDK changes that examples need
The normal sequence below releases from main. The coordinated rollout tracked in
docs/sdk-release-rollout-roadmap.md has an explicit exception: reviewed, clean commits on the
sdk-release-rollout branch may be version-tagged and published so their cooldown clocks
start before final cutover. Integrations first use local/packed artifacts from that branch, then
exact registry versions. After aging, the exact tagged release commits are reconciled into main;
artifact-affecting differences require a new version. Every publication still requires the normal
explicit approval.
The trap: consumers that pin the SDK from npm (agents/acp, codex,
opencode at ^0.5.2, agents/claude-code at ^0.5.0) do not see an
unpublished change; the in-repo examples and the file:-linked harnesses
(flue, open-agent, openclaw, pi) pick it up on their next install. A new SDK
export does not exist for them until it is published. Don't try to
land an example migration alongside an unpublished SDK change — typecheck
will fail in CI, and you'll waste a force-push fixing it.
Sequence:
- Land the SDK change on
main(own PR, reviewer bot, merge). - Cut the release: bump
client-sdk/typescript/package.jsonversion, add aCHANGELOG.mdentry under the new version heading, open a PR, merge. - Get explicit user approval before
npm publish— every publish invocation is a separate gate, run by whoever has@synadia-ai/*publish rights on their machine. Don't batch and don't assume which identity is logged in. - After publish: open the example-migration PR, bump
examples/*/package.jsonto the new SDK semver, refreshbun.lock, verifybun run typecheckin each example. - Merge the example-migration PR.
The same shape applies to each Python SDK. Releases are tag-driven
and publish to PyPI via pypa/gh-action-pypi-publish (trusted
publishing — no long-lived API token):
python-v*→synadia-ai-agentsviarelease-python.ymlpython-agent-service-v*→synadia-ai-agent-serviceviarelease-python-agent-service.ymlpython-deerflow-v*→synadia-ai-nats-deerflow-channelviarelease-python-deerflow.yml
All three workflows run in the pypi GitHub Environment, whose
tag-deployment policy gates them to those three prefixes. Gotcha
when adding a new tag-triggered release workflow: the pypi env
policy must be extended to cover the new tag prefix, or the
publish job fails with "Tag X is not allowed to deploy to pypi
due to environment protection rules" before OIDC ever runs. Add
it via:
gh api -X POST repos/synadia-ai/synadia-agents/environments/pypi/deployment-branch-policies \
-f name='new-prefix-v*' -f type=tag(Repo Admin required. Sanity check:
gh api repos/synadia-ai/synadia-agents --jq '.permissions.admin'
should print exactly true. Anything else means no admin in the
current auth context — false is a real "you don't have it,"
while null typically means a fine-grained PAT or GitHub App
token that doesn't surface the permissions sub-object at all.)
CI and the Claude reviewer bot
- Per-SDK workflows under
.github/workflows/:client-sdk-typescript.yml— lint, typecheck, unit + integration tests across Node 20/22/24 and Bun 1.2/latest; runs jobs inclient-sdk/typescript/.agent-sdk-typescript.yml— same matrix; runs jobs inagent-sdk/typescript/.- Both TS workflows fire on changes under either
client-sdk/typescript/**oragent-sdk/typescript/**, since the host package depends on the caller and the two are kept in lockstep. client-sdk-python.yml— ruff, mypy, pytest across Python 3.11/3.12/3.13 inclient-sdk/python/. Triggers only onclient-sdk/python/**.client-sdk-python-agent-service.yml(filename prefix is historical) — same matrix inagent-sdk/python/. Triggers onagent-sdk/python/**andclient-sdk/python/**, because the agent-sdk's tests resolvesynadia-ai-agentsto the local client-sdk checkout via[tool.uv.sources].release-python.yml— publishessynadia-ai-agentsto PyPI onpython-v*tags.release-python-agent-service.yml— publishessynadia-ai-agent-serviceto PyPI onpython-agent-service-v*tags.
- No automated TS publish workflow. TS releases are manual (see
release ladder). The TypeScript agent CI workflow validates npm package
contents, but it does not publish
@synadia-ai/*packages. claude.ymlruns the Claude reviewer bot on PRs. Treat its inline findings as review feedback to address before merge — they catch real issues (path traversal, missing test coverage, formatting drift). Acknowledge or address each one; don't ignore.
Conventions worth knowing
publishConfig.access: "public"is set on every publishable package. The@synadia-ai/*scope is published openly to npm; theclaude-channel-natspackage ships via the Claude marketplace subtree rather than npm.- No
--no-verify, no--forcewithout--force-with-lease. Hooks exist for a reason. - Don't amend or force-push to other contributors' PR branches unless explicitly authorized — open a parallel PR that supersedes instead. The repo allows it (same-org branches), the harness blocks it by default.
- Prefer PRs over direct-to-
mainfor substantive work. The reviewer bot is part of the review loop and only runs on PRs. - Pull before making changes. Multiple humans + AI agents iterate here on tight cycles; stale local main produces avoidable conflicts.
Where to look first
README.md— repo overview, layout, subject namespace, wire shape.agent-sdk/typescript/src/testing/reference-agent.tsandagent-sdk/python/examples/_reference_agent.py— canonical spec-compliant reference agents (see "Reference agents" section above). Read these before touching anything wire-shape-y.client-sdk/typescript/examples/andclient-sdk/python/examples/— parallel numbered demo scripts (01-discover…) that exercise the SDKs end-to-end against the reference agent.client-sdk/typescript/CHANGELOG.md,client-sdk/python/CHANGELOG.md— recent API moves (Keep a Changelog format).client-sdk/python/CLAUDE.md— package-specific deep guide; mirror it if you need the same depth on the TS side.agents/*/README.md— per-agent config, subject layout, install.examples/README.md— runnable end-to-end demos in the monorepo (browser test client, headless controllers, DSPy ReAct).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

