sockudo
CLAUDE.md828 starsChanged 4 months agoMITView on GitHub
This is the top-level operating contract for coding agents working in sockudo. It applies to the whole monorepo unless a deeper CLAUDE.md overrides a subset of directories. Sockudo is a Rust realtime server and SDK monorepo. The server must preserve strict Protocol V1 Pusher compatibility while advancing Protocol V2 Sockudo-native features: Default posture: execute clear tasks directly, keep diffs reviewable, verify before claiming completion, and preserve existing behavior unless the task explicitly changes it. Server workspace: - crates/sockudo-protocol: protocol message…
- Deletes or force-pushes
We split this CLAUDE.md into the rules it gives an agent
49 rules. About 0 are common, 37 are distinctive, and 12 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈37
Distinctive · estimate
This author's own choices. Worth a look.
12
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 22
Default posture: execute clear tasks directly, keep diffs reviewable, verify before claiming completion, and preserve existing behavior …
- Distinctive: line 28
Ask only when the choice is materially ambiguous, destructive, or changes product scope.
- Distinctive: line 29
If blocked, try the next reasonable path before escalating.
- Distinctive: line 30
Use bounded subagents only when they materially improve throughput or correctness.
- Distinctive: line 31
Never revert unrelated work.
- Distinctive: line 80
Keep V2-only features gated and stripped from V1 delivery.
- Distinctive: line 82
Prefer deletion over addition.
- Distinctive: line 83
Avoid new dependencies unless the need is explicit and justified.
- Distinctive: line 84
Keep behavior changes, tests, and docs in the same change.
- Distinctive: line 85
Treat wire payloads, HTTP response shapes, config keys, and SDK public APIs as compatibility contracts.
- Distinctive: line 87
Do not log secrets: app secrets, provider credentials, device tokens, private keys, or raw push payloads unless a debug-only option …
- Distinctive: line 97
Run narrow verification first, then widen as risk increases.
- Distinctive: line 98
Read diagnostics before deciding the task is done.
- Very specific: line 103
Prefer rg and rg --files.
- Distinctive: line 104
Read crate boundaries plus immediate call sites before changing shared Rust code.
- Distinctive: line 109
Do not assume a feature is single-node only.
- Very specific: line 113
Keep server internals under crates/.
- Very specific: line 114
Keep realtime clients under client-sdks/<repo-name>.
- Very specific: line 115
Keep HTTP/server SDKs under server-sdks/<repo-name>.
- Very specific: line 116
Keep client-sdks/sockudo-ai-transport-js with client SDKs.
- Distinctive: line 118
Treat the old per-SDK GitHub repositories as archived/legacy mirrors.
- Very specific: line 123
Do not accidentally add SDK crates to the root Cargo workspace.
- Distinctive: line 125
Do not use submodules for SDK imports unless explicitly requested.
- Distinctive: line 126
When refreshing imported SDKs, record source repository and commit in the relevant SDK group README.
- Very specific: line 131
Check touched crate Cargo.toml files and crates/sockudo-server/Cargo.toml.
- Very specific: line 132
Keep AI Transport behind Cargo feature ai-transport and runtime [ai_transport].
- Very specific: line 133
Keep push behind feature/config surfaces already used by sockudo-push and sockudo-server.
- Very specific: line 134
Keep V2 feature propagation explicit.
- Distinctive: line 140
Keep V2 fields gated and stripped from V1 clients.
- Distinctive: line 141
Add or update tests for any wire-visible change.
- Distinctive: line 142
Keep HTTP auth, channel auth, user auth, webhook validation, and idempotency compatible with server SDK expectations.
- Distinctive: line 153
Keep mutation authorization parity across HTTP and WebSocket actor contexts.
- Distinctive: line 158
Keep durable history distinct from the hot replay buffer.
- Distinctive: line 161
Use bounded retention and opaque cursors.
- Distinctive: line 168
Consider reconnect races, duplicate disconnects, multi-connection users, and degraded durable history state.
- Distinctive: line 174
Keep annotation publish/delete auth separate from message mutation auth.
- Distinctive: line 180
Keep provider outcome and durable status retention observable.
- Distinctive: line 186
Treat append rollup as egress-only.
- Distinctive: line 205
Update docs when changing:
- Distinctive: line 233
run focused tests for the touched crate, package, or module
- Distinctive: line 234
run formatting if Rust or SDK source changed
- Distinctive: line 252
use the package-local manager and scripts from that SDK README/manifest
- Very specific: line 253
run the narrow language-specific test first, then add live Sockudo integration tests when behavior depends on the server
- Distinctive: line 256
If full verification is too expensive or blocked, say exactly what was not run and why.
- Very specific: line 276
Never run destructive commands like git reset --hard, git checkout --, or broad rm -rf unless explicitly requested.
- Distinctive: line 278
Do not rewrite history unless explicitly requested.
- Distinctive: line 279
Do not amend commits unless explicitly requested.
- Distinctive: line 280
Treat production-facing config, migrations, credentials, and destructive history operations as high risk.
- Distinctive: line 285
When closing a task, report what changed, how it was verified, and remaining risks or gaps.
≈ “Common” is an estimate: at least 1 in 5 of the 25,680 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 is the top-level operating contract for coding agents working in
sockudo. It applies to the whole monorepo unless a deeper
CLAUDE.md overrides a subset of directories.
Mission
Sockudo is a Rust realtime server and SDK monorepo. The server must preserve strict Protocol V1 Pusher compatibility while advancing Protocol V2 Sockudo-native features:
- horizontal fanout across multiple nodes
- durable history, rewind, and two-tier recovery
- versioned mutable messages
- presence and presence history
- annotations
- push notifications
- metrics, webhooks, rate limits, and operator APIs
- delta compression and tag filtering
- optional AI Transport built on the same durable primitives
Default posture: execute clear tasks directly, keep diffs reviewable, verify before claiming completion, and preserve existing behavior unless the task explicitly changes it.
Autonomy
- Proceed automatically on clear, reversible next steps.
- Ask only when the choice is materially ambiguous, destructive, or changes product scope.
- If blocked, try the next reasonable path before escalating.
- Use bounded subagents only when they materially improve throughput or correctness.
- Never revert unrelated work. The tree may already contain user changes.
Repository Map
Server workspace:
crates/sockudo-protocol: protocol message types, V1/V2 prefixing, extras, versioned wire payloadscrates/sockudo-filter: tag filteringcrates/sockudo-core: shared traits, config, errors, auth, history, version store, annotations, presence history, common typescrates/sockudo-app: app-manager backendscrates/sockudo-cache: cache backendscrates/sockudo-queue: queue backendscrates/sockudo-rate-limiter: rate limiting and middlewarecrates/sockudo-metrics: Prometheus metricscrates/sockudo-webhook: webhook deliverycrates/sockudo-delta: delta compressioncrates/sockudo-push: push providers, device registrations, channel subscriptions, publish pipeline, durable status, feedback, schedulercrates/sockudo-ai-transport: AI Transport validation, rollup, and conformance helperscrates/sockudo-adapter: connection handling, presence, horizontal scaling, replay/recovery, fanoutcrates/sockudo-server: binary, HTTP/WS handlers, bootstrap, durable history/version stores, push API
Other permanent areas:
benches/ai: Criterion benchmark suite and budgets for AI hot pathsclient-sdks: official realtime client SDKs plussockudo-ai-transport-jsserver-sdks: official HTTP/server SDKsdashboard: operator API and Vue UIdocs: documentation siteconfig,ops,charts,docker-compose*.yml: configuration, migrations, Helm, Composetests,tools: conformance, load, dashboard, chaos, probes, and support tooling
High-value reference surfaces:
docs/content/docs/server/*docs/content/docs/clients/*docs/content/docs/server-sdks/*docs/content/docs/reference/*docs/specs/ai-transport-wire-protocol.mddocs/specs/ai-transport-capacity.mdconfig/config.tomlMakefile
Core Principles
- Preserve V1 compatibility unless explicitly changing it.
- Keep V2-only features gated and stripped from V1 delivery.
- Reuse current abstractions before adding new ones.
- Prefer deletion over addition.
- Avoid new dependencies unless the need is explicit and justified.
- Keep behavior changes, tests, and docs in the same change.
- Treat wire payloads, HTTP response shapes, config keys, and SDK public APIs as compatibility contracts.
- Do not log secrets: app secrets, provider credentials, device tokens, private keys, or raw push payloads unless a debug-only option explicitly permits it.
Execution Protocol
- Inspect relevant code, docs, and package metadata first.
- State the working understanding briefly while working.
- For cleanup/refactor work, write a cleanup plan and lock behavior with tests when not already protected.
- Make the smallest coherent change that solves the task.
- Run narrow verification first, then widen as risk increases.
- Read diagnostics before deciding the task is done.
- End with what changed, what was verified, and any remaining risks.
Search And Reading
- Prefer
rgandrg --files. - Read crate boundaries plus immediate call sites before changing shared Rust code.
- For SDK changes, read the package manifest, public README, tests, and release/build scripts before editing public API.
- For protocol, adapter, versioned messages, recovery, history, presence, annotations, push, or AI Transport work, inspect runtime code and docs before editing.
- Do not assume a feature is single-node only. Check horizontal and failure-path code.
Monorepo And SDK Rules
- Keep server internals under
crates/; do not move production Rust crates into SDK folders. - Keep realtime clients under
client-sdks/<repo-name>. - Keep HTTP/server SDKs under
server-sdks/<repo-name>. - Keep
client-sdks/sockudo-ai-transport-jswith client SDKs; it is a client-side AI Transport SDK layered on@sockudo/client. - Treat the old per-SDK GitHub repositories as archived/legacy mirrors. New source changes, examples, and install docs should point at this monorepo and package-local paths until registry publishing is fixed.
- Preserve imported SDK package names, manifests, README files, and release metadata unless the task is explicitly about changing them.
- Do not accidentally add SDK crates to the root Cargo workspace. Independently released Rust SDKs
belong in
Cargo.tomlworkspace.exclude. - Do not use submodules for SDK imports unless explicitly requested.
- When refreshing imported SDKs, record source repository and commit in the relevant SDK group README.
Feature Flag Discipline
- Check touched crate
Cargo.tomlfiles andcrates/sockudo-server/Cargo.toml. - Keep AI Transport behind Cargo feature
ai-transportand runtime[ai_transport]. - Keep push behind feature/config surfaces already used by
sockudo-pushandsockudo-server. - Keep V2 feature propagation explicit; do not assume
fullis the only supported build. - Compile targeted feature combinations when behavior crosses feature boundaries.
Protocol And Compatibility
- Preserve Pusher-compatible Protocol V1 wire behavior.
- Keep V2 fields gated and stripped from V1 clients.
- Add or update tests for any wire-visible change.
- Keep HTTP auth, channel auth, user auth, webhook validation, and idempotency compatible with server SDK expectations.
- Link significant AI Transport protocol work to
docs/specs/ai-transport-wire-protocol.md.
Stateful Subsystems
Versioned Messages
- Build on
MessageActionandVersionStore; do not add parallel mutable-message state. - Preserve
message_serial,version_serial,history_serial, anddelivery_serialcontinuity. - Keep mutation authorization parity across HTTP and WebSocket actor contexts.
- Own-scoped mutations require verified actor identity and matching original creator identity.
Durable History And Recovery
- Keep durable history distinct from the hot replay buffer.
- Preserve continuity semantics for
stream_id,serial, cursors, and replay. - Fail closed when continuity cannot be proven.
- Use bounded retention and opaque cursors.
- For late-join/history work, respect
until_attachgaplessness.
Presence And Presence History
- Preserve first-join and last-leave correctness.
- Distinguish current membership from historical transition records.
- Consider reconnect races, duplicate disconnects, multi-connection users, and degraded durable history state.
Annotations
- Preserve raw annotation delivery gating and summary projection semantics.
- Keep annotation publish/delete auth separate from message mutation auth.
Push
- Preserve device registration, channel subscription, provider credential, publish status, idempotency, queue, retry, feedback, and scheduler contracts.
- Keep provider outcome and durable status retention observable.
AI Transport
- Build on versioned messages, durable history, recovery, presence, annotations, and push.
- Validate external AI extras/headers at the edge with precise errors.
- Treat append rollup as egress-only; persistence, history, recovery, webhooks, and push see every original mutation.
- Protect fanout hot paths: no unbounded buffers, no locks held across
.await, no avoidable per-subscriber payload copies.
Observability
For stateful/distributed changes, consider metrics and logs for:
- success/failure counters
- degraded or reset-required state
- duplicate suppression
- bounded queue/backlog depth
- recovery source and failure code
- push provider outcome and status retention
- AI rollup ratio, flush latency, active streams, turn outcomes
Documentation Sync
Update docs when changing:
- HTTP API request or response shapes
- protocol-visible payloads
- SDK public APIs or install instructions
- feature availability or comparison claims
- scaling semantics
- versioned messages, history, recovery, presence history, annotations, push, or AI Transport
- configuration or feature-flag behavior
Likely docs:
README.mddocs/content/docs/server/http-api.mdxdocs/content/docs/server/history-recovery.mdxdocs/content/docs/server/mutable-messages.mdxdocs/content/docs/server/ai-transport-*.mdxdocs/content/docs/clients/*.mdxdocs/content/docs/server-sdks/*.mdxdocs/content/docs/reference/configuration.mdxdocs/content/docs/reference/environment-variables.mdxdocs/content/docs/reference/http-endpoints.mdxdocs/specs/ai-transport-wire-protocol.md
Verification Standard
Small local change:
- run focused tests for the touched crate, package, or module
- run formatting if Rust or SDK source changed
Standard backend/API/docs-with-guard change:
cargo fmt --all- focused tests
- docs type/build checks when docs changed
High-risk protocol, presence, scaling, recovery, history, annotations, push, or AI Transport:
cargo fmt --all- focused subsystem tests
- relevant integration/conformance tests
cargo test --workspacecargo clippy --workspace --all-targets -- -D warnings
SDK changes:
- use the package-local manager and scripts from that SDK README/manifest
- run the narrow language-specific test first, then add live Sockudo integration tests when behavior depends on the server
If full verification is too expensive or blocked, say exactly what was not run and why.
Useful Commands
cargo fmt --all
cargo test --workspace
cargo test -p sockudo-core
cargo test -p sockudo-adapter
cargo test -p sockudo-ai-transport
cargo test -p sockudo-push
cargo clippy --workspace --all-targets -- -D warnings
cargo build -p sockudo --features "v2,ai-transport,redis,postgres,push"
scripts/ai-transport-bench-guard.sh
AIT_CONFORMANCE_OFFLINE=1 scripts/ai-conformance-node.sh
cd docs && npm run types:check && npm run buildSafety Constraints
- Never run destructive commands like
git reset --hard,git checkout --, or broadrm -rfunless explicitly requested. - Do not rewrite history unless explicitly requested.
- Do not amend commits unless explicitly requested.
- Treat production-facing config, migrations, credentials, and destructive history operations as high risk.
Final Response Contract
When closing a task, report what changed, how it was verified, and remaining risks or gaps.
Other versions1 project uses a version of this.
Word for word · 1
- sockudo/sockudo★ 841100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- rust-skillsAGENTS.md
- rust-skillsCLAUDE.md
- rust-skillsSkill
- security-auditSkill
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.

