Wegent / backend-rs
AGENTS.md894 starsChanged 3 months agoApache-2.0View on GitHub
Read the repository contributor guide first. This directory is the primary implementation for new Backend APIs and the Rust side of the remaining incremental API migration. - Implement every new Backend API here. Register its handler with Application, add it to the active WEGENT_RS_ROUTES_FILE, and add focused tests in the same change. Do not add a duplicate Python fallback handler. - Implement an existing API here only when it is an active Rust-owned API: it has a Rust handler registered…
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 33,398 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.
- AGENTS.mdAGENTS.md
- frontend/AGENTS.mdAGENTS.md
- wework/AGENTS.mdAGENTS.md
- wework-mobile/AGENTS.mdAGENTS.md
- tests/CLAUDE.mdCLAUDE.md
The file
We split this AGENTS.md into the rules it gives an agent
10 rules. About 0 are common, 5 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 3
Read the repository contributor guide first.
- Very specific: line 15
Keep existing APIs that are not selected for Rust in backend/.
- Distinctive: line 16
Do not copy a behavior change into both implementations unless the task explicitly requires parity on both runtime paths.
- Very specific: line 26
Treat config/routes.toml as the checked-in inventory of public APIs owned by Rust.
- Very specific: line 29
If the task sets WEGENT_RS_ROUTES_FILE, inspect that effective file instead.
- Distinctive: line 30
Do not create or maintain a separate endpoint list.
- Distinctive: line 51
Keep public handlers small and delegate reusable logic to focused modules.
- Very specific: line 52
Do not use unsafe; the crate forbids it.
- Very specific: line 53
Prefer the existing brz-* abstractions and pinned dependency versions over introducing another web, logging, metrics, or database framework.
- Distinctive: line 55
Add focused tests for changed request handling and compatibility behavior.
≈ “Common” is an estimate: at least 1 in 5 of the 43,423 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
Wegent backend-rs contributor guide
Read the repository contributor guide first. This directory is the primary implementation for new Backend APIs and the Rust side of the remaining incremental API migration.
API ownership
- Implement every new Backend API here. Register its handler with
Application, add it to the activeWEGENT_RS_ROUTES_FILE, and add focused tests in the same change. Do not add a duplicate Python fallback handler. - Implement an existing API here only when it is an active Rust-owned API:
it has a Rust handler registered by
Applicationand the activeWEGENT_RS_ROUTES_FILEselects the same method and path. - Keep existing APIs that are not selected for Rust in
backend/. - Do not copy a behavior change into both implementations unless the task explicitly requires parity on both runtime paths.
The checked-in config/routes.toml is the inventory of active Rust-owned APIs,
including migrated and newly added routes; every other request is forwarded to
Python. Shared Rust modules such as authentication, MySQL, and
FastAPI-compatibility helpers do not by themselves make an API Rust-owned.
Finding Rust-owned APIs
Treat config/routes.toml as the checked-in inventory of public APIs owned by
Rust. For an existing API, find its matching [[routes]] entry by method and
path, then verify that Application registers the corresponding Rust handler.
If the task sets WEGENT_RS_ROUTES_FILE, inspect that effective file instead.
Do not create or maintain a separate endpoint list; the route configuration is
the single source of truth. Creating or migrating a Rust API must update the
handler, route entry, and focused compatibility tests in the same change.
For a new Backend API, changing config/routes.toml and adding its Rust handler
are part of the feature change. Moving an existing Python-owned endpoint to Rust
or adding or upgrading a Rust dependency remains migration work and requires
explicit task scope. If handler registration and route selection disagree, stop
and ask for direction.
Migration compatibility
For a Rust-owned API, preserve the observable Python contract unless the task explicitly changes it: method and path matching, authentication, request and response JSON shape, status codes, error bodies, headers, uploads, streaming, and upgrade behavior. Use the existing Python endpoint and its tests as the compatibility reference. Keep gateway fallback behavior intact for all non-selected routes.
Rust conventions and verification
- Keep public handlers small and delegate reusable logic to focused modules.
- Do not use
unsafe; the crate forbids it. - Prefer the existing
brz-*abstractions and pinned dependency versions over introducing another web, logging, metrics, or database framework. - Add focused tests for changed request handling and compatibility behavior.
For Rust code changes, run the relevant commands from this directory:
cargo fmt --check
cargo testChoose when to run focused tests or the full project suite based on the scope and risk of the changes.
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.

