agentleFS
weave-osweave-os/router/cmd/AGENTS.md

router / cmd

AGENTS.md5.6k starsChanged 2 months agoApache-2.0View on GitHub

Mirror notice. Generated from CLAUDE.md. Edit CLAUDE.md, then run make generate-agent-guides; CI rejects drift. Composition root. Only place that constructs concrete adapters + wires them together. Read root CLAUDE.md first. ROUTER_DEPLOYMENT_MODE is read at boot: Provider registration: Single source of truth for provider→env-var mapping = providers.APIKeyEnvVars in ../internal/providers/provider.go. Admin /config view reads it so it can't drift from actual wiring.

Trending

More talk lately.thin dataabout the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 0 mentionsSep 2026: 0 mentionsOct 2026: 4 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the weave-os/router repository that our weekly crawl found: only 4 in all, so this is a hint, not a trend. There is no adoption data for this file yet.

The file

We split this AGENTS.md into the rules it gives an agent

3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Keep main.go focused on wiring.

    line 10
  2. Very specific:

    No more heuristic-fallback router: If cluster routing fails to boot, main.go panics.

    line 19
  3. Very specific:

    Every provider goes into providerMap regardless of mode.

    line 34

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

cmd — AGENTS

Mirror notice. Generated from CLAUDE.md. Edit CLAUDE.md, then run make generate-agent-guides; CI rejects drift.

Composition root. Only place that constructs concrete adapters + wires them together. Read root CLAUDE.md first.

Rules

  • cmd/router/main.go wires worker provider adapters and persistence. cmd/router-gateway/main.go wires only gateway authentication, admission persistence, the registry and IAM forwarding. The gateway must not construct provider clients, billing, ONNX routing or policy-selection runtimes. Keep its image independent of worker releases.
  • Keep main.go focused on wiring. Today's helpers:
    • buildClusterScorer — per-version Scorer assembly + embedder warmup
    • buildExploringRouter — optionally wraps the cluster router in banditexplore (env-flag gated; off by default)
    • buildSemanticCache — response-cache assembly
    • buildOtelEmitter — OTel span exporter
    • runSessionPinSweep — TTL sweep loop
    • resolveHardPinModel / resolveCompactionModel / resolveDefaultBaselineModel / resolveAvailableModels — boot-time model resolution
    • registerDeploymentKeyedProvider — shared "resolve key → build client → log" registration for the providers whose gating collapses to that shape (Fireworks, Makora, Together, Bedrock, Google); OpenRouter and Anthropic/OpenAI stay bespoke
    • small env parsers (e.g. envVarHint, parseEnvInt, parseEnvFloat, parseEnvDurationMs)
  • No more heuristic-fallback router. If cluster routing fails to boot, main.go panics. Misconfiguration must abort the process rather than silently degrade.
  • Validate deployment target overrides through policy.Registry.ValidateDeployment after provider/model configuration is resolved. A partial or catalog-incompatible explicit target is a startup error, not permission to substitute a default.
  • Never introduce DI container, reflection-based wiring, or service locator. Composition = plain Go function calls.
  • panic is reserved for startup-time fail-fast (config.MustGet, cluster-scorer boot failure, invalid ROUTER_DEPLOYMENT_MODE). Never panic on request path.

Deployment-mode dispatch

ROUTER_DEPLOYMENT_MODE is read at boot:

  • selfhosted (default): mounts dashboard at /ui/*, /admin/v1/* API, dashboard cookie auth. Provider keys read from env vars.
  • managed: dashboard + /admin/v1/* not mounted. Billing-backed managed deployments load platform keys and enforce balance checks. Only managed deployments without billing remain BYOK-only with empty deployment keys; a billing boot-check error defaults to billing-enabled, not BYOK-only.
  • Any other value → panic at boot.

Provider registration:

  • Every provider goes into providerMap regardless of mode.
  • envKeyedProviders (parallel set) tracks which providers have a deployment-level key configured so the hard-pin resolver knows what's safe to pin to.
  • Provider credential mode follows byokOnly in cmd/router/main.go, not managed alone. Preserve installation BYOK opt-in and client subscription routing when changing registration.

Single source of truth for provider→env-var mapping = providers.APIKeyEnvVars in ../internal/providers/provider.go. Admin /config view reads it so it can't drift from actual wiring.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.