This file provides guidance to coding agents when working with code in this repository.
AI tools may assist with implementation, but do not add Claude or another AI tool as a commit collaborator, co-author, or signatory. Commit sign-off belongs to the human contributor responsible for the change.
The AI Grid: a distributed, peer-to-peer network
for AI inference routing and agentic networking
across clusters, cloud providers, and third-party
APIs. The Grid Operator orchestrates mesh formation,
trust, capability discovery, and routing - while
Praxis AI (from ../ai/) handles all data-plane
traffic as the gateway.
The Grid Operator is an orchestration daemon, NOT a proxy. It manages:
- SWIM membership via
foca(peer discovery) - mTLS certificate lifecycle (trust establishment)
- CRDT state propagation (capabilities, metrics)
- Praxis overlay config generation (routing decisions)
Praxis AI handles:
- Request proxying, API translation, credentials
- Filter pipeline execution
- TLS termination, health checks, connection pooling
See docs/architecture/overview.md for the full
design: CRDs, controllers, operational walkthrough,
scoring model, and auth framework. See
docs/conventions.md for coding style and policies.
- Rust stable 1.96+ (edition 2024, resolver 3)
- Rust nightly (for
rustfmt-group_importsandimports_granularityare nightly-only) cargo-audit,cargo-deny(supply chain safety)cargo-machete(unused dependency detection)- Docker or Podman (for mock servers and kind)
- kind (for integration testing)
Run from the grid/ directory:
make build # workspace build
make check # type-check only (fast)
make test # all tests
make test V=1 # tests with --nocapture
make fmt # format with nightly rustfmt
make lint # clippy -D warnings + fmt check
# + machete
make lint-extra # typos + taplo + shellcheck
# + actionlint
make doc # rustdoc -D warnings, private
make audit # cargo audit + cargo deny check
make all # build + fmt + lint + test + auditSingle-test and single-crate commands:
cargo test -p scoring # one crate
cargo test -p mock-providers # one crate
cargo test test_name # one test by nameTest environment (requires Docker + kind):
cargo xtask env up # create clusters, certs
cargo xtask env down # tear down everything
cargo xtask env status # health of all components| Crate | Purpose |
|---|---|
operator |
K8s controllers, CRDs, operator binary |
overlay-sync |
K8s API-watch sidecar for overlay delivery |
swim |
foca wrapper, SWIM runtime, encryption |
crdt |
Delta CRDT types (LWW, OR-Set, G-Counter) |
scoring |
Scoring engine, backend types, grid state |
certs |
Certificate generation and provider trait |
mock-providers |
Mock OpenAI, Anthropic, Bedrock, Vertex APIs |
forge |
Generic development-environment orchestrator for Kubernetes |
xtask |
Dev task runner for test environments |
The scoring crate retains six normalized signal
fields for overlay contract and score-breakdown
compatibility. The supported GridNetwork API does
not combine them with arbitrary user weights. It
selects one provider-level strategy:
| Strategy | Active signal | Meaning |
|---|---|---|
noMetrics |
none | Generic default for external APIs |
queueDepth |
queue_depth |
Shortest normalized queue |
kvCachePressure |
kv_cache |
Most available KV-cache |
Configure via spec.scoringPolicy.strategy. When
scoringPolicy is present, strategy is required;
omitting the entire policy selects noMetrics.
CertificateProvider trait with
StaticFileProvider (current) and planned
SpiffeProvider (production). generate_ca() and
generate_site_cert() produce mTLS certs with DNS
SANs and dual EKU.
Four provider modules each exposing router():
openai- Bearer token auth, SSE streaminganthropic-x-api-keyauth, Anthropic SSEbedrock- SigV4 prefix auth, binary event streamvertex- OAuth2 bearer auth, wildcard route
Full conventions in docs/conventions.md.
Extremely strict workspace lints in Cargo.toml.
Notable denials: unwrap_used, expect_used,
panic, indexing_slicing, unsafe_code,
missing_docs, missing_docs_in_private_items,
allow_attributes.
Use #[expect(lint, reason = "...")] for
suppressions, never #[allow(...)]. The
allow_attributes = "deny" workspace lint enforces
this.
Use ? propagation, match, or unwrap_or_else. In
tests, use unwrap_or_else(|_| std::process::abort())
or return Result.
- Inline
#[cfg(test)] mod testsblocks - Order: imports, tests, test utilities
(with
// Test Utilitiesseparator) - No comments in test bodies - use assertion messages
- Async tests:
#[tokio::test]
Full-width only (77 dashes):
// ---------------------------------------------------------------------------
// Section Name
// ---------------------------------------------------------------------------All items need /// doc comments. Prose covers
intent and interface only. Prefer ample doctests.
Use reference-style rustdoc links.
Commits are attributed to people, never to tools.
Do not add Co-Authored-By lines for development
tools (e.g. linters, generators, formatters). The
human who reviews and submits the code is the author.
| Project | Purpose |
|---|---|
ai |
AI-enabled Praxis proxy (data plane) |
praxis |
Gateway framework |
operator |
Kubernetes Gateway API operator |