Skip to the content.

TorrAi rules (R1–R33)

🌐 Language / Язык: English · Русский · Short overview · Detailed guide · Architecture

Core rules R1–R19

ID Rule
R1 A file enters the working cache only after SHA-256 of every piece and a valid manifest signature.
R2 Unverified data goes to quarantine; the Run button is disabled.
R3 The catalog key is pinned in the config; user publishing requires explicit consent.
R4 Tokenizer, config and quantization version are verified like weights.
R5 Disk quota; writes only inside the sandbox; seeding through a hardlink/read-only view.
R6 Seeding only after a full check; upload limit ≈ 85% of the channel.
R7 Priority: critical path first, then rare layers (rarest-first).
R8 Run only if critical layers are local or available from reliable peers.
R9 Remote layers only over an encrypted HMAC channel; the RPC port is not exposed.
R10 Limit remote hops and the latency budget per token.
R11 KV cache lives on the owner node; the layer plan is fixed per request.
R12 Ignore peers with a foreign hash; ban them; respect licenses.
R13 Chat only with a model in READY state and with a verified signature.
R14 Streaming response is mandatory.
R15 Stop really interrupts generation in the runtime.
R16 Loss of a remote layer pauses generation and marks the answer incomplete.
R17 Session context is bound to the model version; changing the model creates a new session.
R18 Prompts do not go to the catalog/telemetry; remote nodes receive activations only.
R19 Automatic model unload after idle time with a warning.

Extended rules R20–R33

These rules define trust policy for observers, nodes and credits. They are implemented in torr_ai/trust/reputation.py, torr_ai/trust/credits.py, torr_ai/swarm/dht.py and torr_ai/inference/node.py, and are enabled by flags in Settings.

ID Rule
R20 Sybil protection: challenge-response proves key control and a minimum confirmed service volume; identity is not globally unique.
R21 An observer vote is bound to the release and layer by SHA-256 from the signed manifest.
R22 The vote source must be announced in the DHT/LAN catalog of that release; one key cannot be used from different addresses.
R23 A vote is confirmed by real byte exchange for that exact release/layer (-1 means the whole release).
R24 Observer identity costs computational work via PoW (0–16 bits) in challenge-response.
R25 Node announcements are signed with an independent Ed25519 key and checked against pinned node_id=HEX values.
R26 node_id is self-certifying: n- + the first 16 hex chars of SHA-256(pubkey).
R27 The DHT catalog rejects records whose pubkey does not match node_id.
R28 Catalog pointers are spread over 16 slots so publish races lose fewer nodes.
R29 Local service accounting is replaced by a portable signed receipt from the byte recipient.
R30 A self-certified node_id (R26) is accepted instead of a manual HEX pin for votes, challenges and R29 receipts.
R31 Spending credits requires a payer-signed voucher with a limit, monotonic sequence and replay protection.
R32 The last voucher number is published as a DHT checkpoint; the provider checks it before serving layers.
R33 The provider signs a receipt for every accepted voucher; a conflict between two receipts for one number is recorded and blocks further spending.

Full statements and implementation: torr_ai/core/rules.py (R1–R19), torr_ai/trust/reputation.py (R12, R20–R30), torr_ai/trust/credits.py (R31–R33), torr_ai/swarm/dht.py (R27/R28/R32), torr_ai/inference/node.py (R20/R24/R29/R31–R33).

Repository workflow rules (W1–W6)

ID Rule
W1 Every change is accompanied by updated documentation in both Russian and English.
W2 Changes are recorded as atomic commits using Conventional Commits.
W3 After verification, changes are pushed to origin/main; no uncommitted work is left behind.
W4 The repository description, topics, homepage and README keywords are kept up to date.
W5 Secrets, private keys, mesh_secret, model weights and torrents never enter the repository.
W6 python tools/check_docs.py and relevant tests run before push; failures are not hidden.

These rules are mandatory for agents and contributors; see AGENTS.md and CONTRIBUTING.md.