sockudo
AGENTS.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 AGENTS.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 AGENTS.md into the rules it gives an agent
50 rules. About 2 are common, 35 are distinctive, and 13 are very specific to this project.
≈2
Common · estimate
Many files like this have a rule of this kind.
≈35
Distinctive · estimate
This author's own choices. Worth a look.
13
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 81
Keep V2-only features gated and stripped from V1 delivery.
- Distinctive: line 83
Prefer deletion over addition.
- Distinctive: line 84
Avoid new dependencies unless the need is explicit and justified.
- Distinctive: line 85
Keep behavior changes, tests, and docs in the same change.
- Distinctive: line 86
Treat wire payloads, HTTP response shapes, config keys, and SDK public APIs as compatibility contracts.
- Common: line 88
Do not log secrets: app secrets, provider credentials, device tokens, private keys, or raw push payloads unless a debug-only option …
- Distinctive: line 98
Run narrow verification first, then widen as risk increases.
- Distinctive: line 99
Read diagnostics before deciding the task is done.
- Very specific: line 104
Prefer rg and rg --files.
- Distinctive: line 105
Read crate boundaries plus immediate call sites before changing shared Rust code.
- Distinctive: line 110
Do not assume a feature is single-node only.
- Very specific: line 114
Keep server internals under crates/.
- Very specific: line 115
Keep realtime clients under client-sdks/<repo-name>.
- Very specific: line 116
Keep HTTP/server SDKs under server-sdks/<repo-name>.
- Very specific: line 117
Keep client-sdks/sockudo-ai-transport-js with client SDKs.
- Distinctive: line 119
Treat the old per-SDK GitHub repositories as archived/legacy mirrors.
- Very specific: line 124
Do not accidentally add SDK crates to the root Cargo workspace.
- Distinctive: line 126
Do not use submodules for SDK imports unless explicitly requested.
- Distinctive: line 127
When refreshing imported SDKs, record source repository and commit in the relevant SDK group README.
- Very specific: line 132
Check touched crate Cargo.toml files and crates/sockudo-server/Cargo.toml.
- Very specific: line 133
Keep AI Transport behind Cargo feature ai-transport and runtime [ai_transport].
- Very specific: line 134
Keep push behind feature/config surfaces already used by sockudo-push and sockudo-server.
- Very specific: line 135
Keep V2 feature propagation explicit.
- Distinctive: line 141
Keep V2 fields gated and stripped from V1 clients.
- Distinctive: line 142
Add or update tests for any wire-visible change.
- Distinctive: line 143
Keep HTTP auth, channel auth, user auth, webhook validation, and idempotency compatible with server SDK expectations.
- Distinctive: line 154
Keep mutation authorization parity across HTTP and WebSocket actor contexts.
- Distinctive: line 159
Keep durable history distinct from the hot replay buffer.
- Distinctive: line 162
Use bounded retention and opaque cursors.
- Distinctive: line 169
Consider reconnect races, duplicate disconnects, multi-connection users, and degraded durable history state.
- Distinctive: line 175
Keep annotation publish/delete auth separate from message mutation auth.
- Distinctive: line 181
Keep provider outcome and durable status retention observable.
- Distinctive: line 187
Treat append rollup as egress-only.
- Very specific: line 213
Do not use error_class as a standard field.
- Distinctive: line 238
Update docs when changing:
- Distinctive: line 266
run focused tests for the touched crate, package, or module
- Distinctive: line 267
run formatting if Rust or SDK source changed
- Distinctive: line 285
use the package-local manager and scripts from that SDK README/manifest
- Very specific: line 286
run the narrow language-specific test first, then add live Sockudo integration tests when behavior depends on the server
- Distinctive: line 289
If full verification is too expensive or blocked, say exactly what was not run and why.
- Very specific: line 309
Never run destructive commands like git reset --hard, git checkout --, or broad rm -rf unless explicitly requested.
- Distinctive: line 311
Do not rewrite history unless explicitly requested.
- Distinctive: line 312
Do not amend commits unless explicitly requested.
- Common: line 313
Treat production-facing config, migrations, credentials, and destructive history operations as high risk.
- Distinctive: line 318
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 36,368 AGENTS.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
AGENTS.md
This is the top-level operating contract for coding agents working in
sockudo. It applies to the whole monorepo unless a deeper
AGENTS.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:
CLAUDE.mddocs/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
Logging is a compatibility and security surface. Every log statement uses structured tracing
fields. The subscriber lives in crates/sockudo-server/src/logging.rs; do not change its
architecture.
Logging conventions
- Variable values go in snake_case structured fields, never interpolated into message text.
- Messages are stable lowercase descriptions without trailing punctuation.
- Identity fields:
app_id,socket_id,channel,user_id,worker_id. adapter = "nats"/"redis"/...on horizontal transport logs only.queue_driver,cache_driver,app_managerin factory/shared code only; individual driver modules are identified by their module path.- Numeric suffixes:
_ms,_bytes,_count. Numbers and booleans keep their JSON types. - Optional values are omitted or unwrapped (
.as_deref().unwrap_or("")) — never rendered asSome(...)/None. error = %eis the primary diagnostic. Always log the error on every error path. Never discard toErr(_)or.is_err()without logging. Sole exception: when the errorDisplaymay contain sensitive data (URLs with credentials, request bodies, raw config) — then omit the error field and use a descriptive message.- Do not use
error_classas a standard field; it exists only in the webhook sender helpers. - Severity:
error= terminal failure;warn= degraded/rejected/retry scheduled;info= lifecycle and final outcomes;debug= mechanics;trace= per-message.
Data safety
At every level, never log app keys/secrets, signatures, tokens, authorization data, headers, raw queries, URLs, request/response bodies, payloads, provider credentials, device tokens, or private keys. Debug and trace do not relax this rule. Infrastructure endpoints, node lists, raw configuration values, serialization input, message fragments, and transport responses are also content-bearing and must not be logged. Safe: operational IDs, channel/queue/topic names (without credentials), counts, status codes, retryability, listener addresses.
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.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 28,693 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository5 other files it gives its agents.
- rust-skillsAGENTS.md
- rust-skillsCLAUDE.md
- CLAUDE.mdCLAUDE.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.

