flux
Copilot instructions939 starsChanged 12 months agoMITView on GitHub
Flux is a refinement type checker for Rust. This is a Rust workspace with multiple crates, requiring specific dependencies (Z3, fixpoint) and custom build tooling through cargo xtask. Languages & Frameworks: Rust (edition 2024), custom rustc integration Repository Size: ~15 crates in workspace + 4 library packages + test suites Note: Required dependencies (fixpoint and Z3 4.12.1) are automatically installed in the Copilot coding agent environment via .github/workflows/copilot-setup-steps.yml. For local development, developers need to install these dependencies manually (see CI…
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,336 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.
The file
We split this copilot-instructions.md into the rules it gives an agent
5 rules. About 0 are common, 0 are distinctive, and 5 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.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 95
Use cargo-flux to build libraries with refinement types
- Very specific: line 108
All jobs (except formatting/clippy) require fixpoint and Z3 to be installed first.
- Very specific: line 119
Error reporting: Use bug!, span_bug!, tracked_span_bug!, or QueryErr::bug for unreachable code paths
- Very specific: line 126
Test specific functionality: cargo xtask test <filter>
- Very specific: line 129
Run full test suite: cargo xtask test
≈ “Common” is an estimate: at least 1 in 5 of the 3,779 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
Flux Repository - Copilot Coding Agent Instructions
Overview
Flux is a refinement type checker for Rust. This is a Rust workspace with multiple crates, requiring specific dependencies (Z3, fixpoint) and custom build tooling through cargo xtask.
Languages & Frameworks: Rust (edition 2024), custom rustc integration
Repository Size: ~15 crates in workspace + 4 library packages + test suites
Note: Required dependencies (fixpoint and Z3 4.12.1) are automatically installed in the Copilot coding agent environment via .github/workflows/copilot-setup-steps.yml. For local development, developers need to install these dependencies manually (see CI workflow for installation steps).
Build & Test Instructions
Test Commands
- Run all regression tests:
This runs tests fromcargo xtask testtests/pos/(should pass) andtests/neg/(should fail with specific errors) - Run specific tests (filtered by substring):
cargo xtask test <filter> # Example: cargo xtask test impl_trait - Test on a single file:
This automatically sets up proper flags for Flux attributes and debuggingcargo xtask run <file.rs> # Example: cargo xtask run tests/pos/surface/impl_trait00.rs
Linting & Formatting
- Format code:
Usescargo fmt --check # Check only cargo fmt # Auto-formatrustfmt.tomlconfiguration - Run clippy:
Usescargo clippyclippy.tomlwith custom lints defined inCargo.tomlworkspace section
Project Layout
Directory Structure
/
├── crates/ - Main Flux implementation crates
│ ├── flux-bin/ - CLI binary (flux, cargo-flux)
│ ├── flux-driver/ - Rustc driver integration
│ ├── flux-middle/ - Core type system and refinement types
│ ├── flux-refineck/ - Refinement type checker
│ ├── flux-syntax/ - Parsing Flux surface syntax
│ ├── flux-errors/ - Error reporting
│ └── ... - Other supporting crates
├── lib/ - User-facing Flux libraries
│ ├── flux-rs/ - Main library with macros (#[flux::sig], etc.)
│ ├── flux-core/ - Extern specs for std library
│ ├── flux-attrs/ - Attribute proc macros
│ └── flux-alloc/ - Extern specs for alloc
├── tests/ - Regression test suite
│ ├── pos/ - Tests that should type check
│ └── neg/ - Tests that should fail with errors
├── xtask/ - Build system implementation
├── book/ - User documentation (mdBook).
├── .github/
│ └── workflows/
│ ├── ci.yml - Main CI: tests, vtock, lean-demo, rustfmt, clippy
│ └── ...
└── Configuration files (see below)Key Files
- Cargo.toml: Workspace configuration with all crates, dependencies, and lints
- rust-toolchain.toml: Specifies Rust toolchain (edition 2024, nightly features)
- clippy.toml: Clippy configuration (allowed/denied lints)
- rustfmt.toml: Code formatting rules
- typos.toml: Spell checking configuration
- book/src/guide/develop.md: Detailed developer guide
Architecture Notes
- Flux is a rustc driver: It integrates with the Rust compiler as a custom driver
- Two-stage execution:
- Build flux-driver and cargo-flux binaries
- Use cargo-flux to build libraries with refinement types
- Custom test framework: Uses
cargo xtask testwhich invokes the test harness intests/package
CI Pipeline
The .github/workflows/ci.yml runs on push/PR to main:
- tests job: Runs
cargo xtask teston ubuntu/macos/windows - vtock job: Tests Flux on the Tock OS kernel (verification use case)
- lean-demo job: Tests Flux-to-Lean translation feature
- rustfmt job: Checks code formatting
- clippy job: Runs
cargo checkandcargo clippy
All jobs (except formatting/clippy) require fixpoint and Z3 to be installed first. In the Copilot coding agent environment, these dependencies are automatically installed via .github/workflows/copilot-setup-steps.yml.
Validation Steps
Before submitting changes:
- Format code:
cargo fmt - Run regression tests:
cargo xtask test
Important Conventions
- Error reporting: Use
bug!,span_bug!,tracked_span_bug!, orQueryErr::bugfor unreachable code paths - Debugging flags:
-Ztrack-diagnostics=yto show where errors are emitted (enabled bycargo xtask run) - Backtraces: Set
RUST_BACKTRACE=1; dev profile gives better traces
Development Workflow
- Make changes to relevant crates in
crates/orlib/ - Test specific functionality:
cargo xtask test <filter> - Or test single file:
cargo xtask run <file.rs> - Run formatter:
cargo fmt - Run full test suite:
cargo xtask test
Trust These Instructions
The information above has been validated against the repository structure, CI configuration, and developer documentation. When you need to build, test, or understand Flux:
- ALWAYS use
cargo xtaskfor building and testing - NEVER run
cargo testdirectly on the workspace - Refer to these instructions first before searching the codebase for build/test commands
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.

