control-layer
Copilot instructions96 starsChanged 30 days agoApache-2.0View on GitHub
Offline mode alternative: Set SQLX_OFFLINE=true to use the workspace query metadata in .sqlx/ for builds without database access.
- Reads credentials
- Installs packages
We split this copilot-instructions.md into the rules it gives an agent
4 rules. About 0 are common, 0 are distinctive, and 4 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.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 130
Use --no-default-features flag to skip embedded PostgreSQL:
- Very specific: line 140
Never: run sqlx migrate run --source ...
- Very specific: line 143
If queries change, regenerate the workspace cache with cargo sqlx prepare --workspace from the repository root.
- Very specific: line 148
Test database: Default postgres://postgres:password@localhost:5432/dwctl
≈ “Common” is an estimate: at least 1 in 5 of the 3,669 Copilot instructions 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
Copilot Instructions for Control Layer
Overview
The Doubleword Control Layer (dwctl) is a high-performance AI model gateway providing unified routing, management, and security for LLM inference. It's a Rust/TypeScript monorepo with:
- dwctl (Rust): Core API server at
dwctl/ - onwards (Rust): Embedded AI proxy and routing layer at
onwards/ - fusillade, fusillade-core, fusillade-arsenal (Rust): Embedded batch processing workspace crates
- dashboard (React/TypeScript): Web frontend at
dashboard/
Build Requirements
Prerequisites
- Rust 1.88+ (SQLx compatibility requirement)
- Node.js 20.19+ (or 22.12+) — required by Vite 7; declared in
dashboard/package.jsonengines - PostgreSQL (running database required for Rust compilation due to SQLx)
- just (command runner):
cargo install just - Docker with Compose plugin
Critical: Database Required for Rust Builds
SQLx performs compile-time SQL validation. Always ensure PostgreSQL is running before building Rust code:
# Start test postgres container
just db-start
# Setup databases and .env files
just db-setupOffline mode alternative: Set SQLX_OFFLINE=true to use the workspace query metadata in .sqlx/ for builds without database access.
Build Commands
Rust Backend
# Check/compile (requires database OR SQLX_OFFLINE=true)
cargo check --no-default-features # Skip embedded-db feature to avoid GitHub API calls
cargo build --no-default-features
# For offline builds:
SQLX_OFFLINE=true cargo check --no-default-featuresTypeScript Frontend
cd dashboard
npm ci # Install dependencies (use ci, not install, for reproducible builds)
npm run build # Build production bundleTest Commands
Rust Tests (require running PostgreSQL)
just test rust # Run all Rust tests
just test rust --coverage # With coverage (requires cargo-llvm-cov)
cargo test <test_name> # Run specific testTypeScript Tests
just test ts # Run frontend tests
cd dashboard && npm test -- --run # Direct vitest executionLint Commands
Rust
just lint rust # Full lint (fmt + clippy + sqlx prepare check)
cargo fmt --check # Check formatting only
cargo clippy --workspace --all-features # Clippy only
cargo sqlx prepare --check --workspaceTypeScript
just lint ts # Full lint (tsc + eslint)
just lint ts --fix # Auto-fix ESLint issues
cd dashboard && npx tsc -b --noEmit # TypeScript check onlyCI Pipeline
CI runs just ci rust and just ci ts. These commands combine linting, testing with coverage, and (for TypeScript) building.
Reproduce CI locally:
# Backend CI
just db-start && just db-setup # Required first
DB_PASS=password just ci rust -- -D warnings
# Frontend CI
just ci tsProject Layout
Root Files
justfile- Build/test/lint command definitionsCargo.toml- Rust workspace configconfig.yaml- Application configurationdocker-compose.yml- Production container setup.sqlx/- shared workspace SQLx query cache used by local and container builds
Rust Backend (dwctl/)
src/main.rs- Entry pointsrc/lib.rs- Core application and router setupsrc/api/handlers/- HTTP request handlerssrc/db/handlers/- Database repositoriessrc/auth/- Authentication middlewaremigrations/- PostgreSQL migrations (run automatically on startup)Cargo.toml- Dependencies and features
Frontend (dashboard/)
src/main.tsx- React entry pointsrc/App.tsx- Root component with routingsrc/api/- API client and hookssrc/components/- React componentspackage.json- npm dependenciesvite.config.ts- Build configuration
GitHub Workflows (.github/workflows/)
ci.yaml- Main CI: frontend tests, backend tests, Docker build, security scan, E2E tests
Common Issues and Workarounds
SQLx "database required" errors
Set SQLX_OFFLINE=true or ensure PostgreSQL is running with just db-start && just db-setup.
embedded-db feature fails (GitHub API rate limit)
Use --no-default-features flag to skip embedded PostgreSQL:
cargo check --no-default-featuresMigrations
Navigate to dwctl/ before running migrations:
cd dwctl && sqlx migrate runNever run sqlx migrate run --source ... --database-url ... from root.
SQLx prepared queries out of sync
If queries change, regenerate the workspace cache with cargo sqlx prepare --workspace from the repository root.
Configuration
- Environment variables: Prefix with
DWCTL_, use__for nested keys (e.g.,DWCTL_AUTH__NATIVE__ENABLED=false) - Database URL:
DATABASE_URLenv var orconfig.yaml - Test database: Default
postgres://postgres:password@localhost:5432/dwctl
Trust These Instructions
The commands above have been validated. Only search for additional information if these instructions are incomplete or produce errors.
Where files are headingNew Copilot instructions files have more rules about branches and pull requests, and fewer about code style.
Of the Copilot instructions files we read, the 2,297 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
- CLAUDE.mdCLAUDE.md
- rust-test-efficiencySkill
- sqlx-index-migrationsSkill
- sqlx-queriesSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

