-
Notifications
You must be signed in to change notification settings - Fork 2
Add AGENTS.md AI guardrails #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cjrolo
wants to merge
4
commits into
main
Choose a base branch
from
ai-enablement-forge
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # Agents Guide (fft-compression / ATSC workspace) | ||
|
|
||
| This repository is a Rust workspace containing ATSC (Advanced Time Series Compressor) and supporting crates. This file provides **project-specific guidance and guardrails** for AI-assisted changes, especially around on-disk formats and performance-sensitive code. | ||
|
|
||
| ## Codebase map (high-signal entry points) | ||
|
|
||
| - **CLI**: `atsc/src/main.rs` | ||
| - Reads `.wbro` or `.csv`, produces `.bro` (values). `.vsri` (timestamps) output for CSV is handled by the `csv-compressor` crate. | ||
| - **Stream container (on-disk payload)**: `atsc/src/data.rs` (`CompressedStream`) | ||
| - **Frame container (per chunk)**: `atsc/src/frame/mod.rs` (`CompressorFrame`) | ||
| - **Header / magic**: `atsc/src/header.rs` (`"BRRO"`) | ||
| - **Compressors**: `atsc/src/compressor/` | ||
| - FFT: `atsc/src/compressor/fft.rs` | ||
| - Polynomial / IDW: `atsc/src/compressor/polynomial.rs` | ||
| - Constant: `atsc/src/compressor/constant.rs` | ||
| - VSRI (timestamps): `vsri/src/lib.rs` (separate workspace crate) | ||
| - **Chunking / planning**: `atsc/src/optimizer/mod.rs` (`OptimizerPlan`) | ||
|
|
||
| ## How to build, test, lint, benchmark | ||
|
|
||
| - **Build**: `cargo build --release` | ||
| - **Format**: `cargo fmt` | ||
| - **Clippy**: `cargo clippy --workspace --all-targets` | ||
| - **Unit tests**: `cargo test --workspace` | ||
| - **Benchmarks (Criterion)**: | ||
| - `cargo bench -p atsc --bench fft_bench` | ||
| - `cargo bench -p atsc --bench polynomial_bench` | ||
|
|
||
| If you change compressor logic, prefer adding/adjusting a Criterion benchmark alongside unit tests. | ||
|
|
||
| ## On-disk format compatibility (do not break silently) | ||
|
|
||
| ATSC writes `.bro` payloads using **bincode v2** (`bincode = 2.0.0-rc.3`) with a shared config (`atsc/src/compressor/mod.rs::BinConfig::get()`). `.vsri` files are written by the `vsri` crate as a line-based text format (not bincode). | ||
|
|
||
| Implications: | ||
| - **Changing the shape/order of `Encode`/`Decode` structs is format-breaking**, even if Rust still compiles. | ||
| - High-risk types include (non-exhaustive): `atsc::data::CompressedStream`, `atsc::frame::CompressorFrame`, `atsc::header::CompressorHeader`, and any compressor frame types in `atsc/src/compressor/*` (e.g. `FFT`, `FrequencyPoint`). | ||
|
|
||
| Guardrails: | ||
| - If you need to evolve the format, prefer **explicit versioning** (header/version field) and **versioned decode paths** rather than “just changing the struct”. | ||
| - When adding fields, consider whether they must be encoded; if not, follow the existing pattern (e.g. `FFT` manually omits `error` from encoding). | ||
| - Add a **roundtrip test** that reads representative bytes and validates decode behavior. | ||
|
|
||
| ## Performance expectations | ||
|
|
||
| ATSC is designed for **fast decompression** and “reasonable” compression throughput. When optimizing: | ||
| - Treat **allocations and per-sample conversions** in hot paths as first suspects. | ||
| - Use existing Criterion benches as baselines and add focused micro-benches when needed. | ||
| - Prefer changes that are **measurable** (bench evidence) and **local** (don’t destabilize format without intent). | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the “High-risk types” list,
atsc::data::CompressedStreamis called out as anEncode/Decodestruct, but in the code it’s not bincode-encoded (it has customto_bytes/from_bytesand only theVec<CompressorFrame>is bincode-encoded). Suggest tweaking the wording to distinguish: (1) bincode-encoded types where field order is format-breaking (e.g.CompressorFrame, compressor structs), and (2) format-critical types with custom serialization (CompressedStream,CompressorHeader).