-
Notifications
You must be signed in to change notification settings - Fork 4
Add agents.md file for ai assistant coding #39
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,60 @@ | ||||||||||||||||||||||||||||||
| # TwisteRL | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| A hybrid Rust/Python Reinforcement Learning framework optimized for speed. | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ## Project Overview | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - **Rust (`rust/`)**: Core RL logic—environment stepping, trajectory collection, inference. | ||||||||||||||||||||||||||||||
| - **Python (`src/twisterl/`)**: Training loop, neural network optimization (PyTorch). | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ## Setup & Build Commands | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||
| # Install (editable mode, compiles Rust extension) | ||||||||||||||||||||||||||||||
| pip install -e . | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Rust check | ||||||||||||||||||||||||||||||
| cd rust && cargo check && cargo test | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Python tests | ||||||||||||||||||||||||||||||
| pytest tests/ | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ## Code Style & Conventions | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - **Rust**: Use `cargo fmt` and `cargo clippy` before committing. | ||||||||||||||||||||||||||||||
| - **Python**: PEP 8. Type hints encouraged. | ||||||||||||||||||||||||||||||
| - **Checkpoints**: Always use `safetensors` (never pickle `.pt`). | ||||||||||||||||||||||||||||||
| - **Symmetry**: Implement `TwistableEnv` for environments with symmetries. | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ## Testing Instructions | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||
| # Full Python test suite | ||||||||||||||||||||||||||||||
| pytest tests/ | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Rust unit tests | ||||||||||||||||||||||||||||||
| cd rust && cargo test | ||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # End-to-end training check | ||||||||||||||||||||||||||||||
| python -m twisterl.train --config examples/ppo_puzzle8_v1.json | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ## Directory Structure | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
| twisteRL/ | ||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||||||||||||||||||||||
| ├── rust/ # Rust crate (core RL) | ||||||||||||||||||||||||||||||
| │ ├── src/ # Rust source | ||||||||||||||||||||||||||||||
| │ └── Cargo.toml # Rust deps | ||||||||||||||||||||||||||||||
| ├── src/twisterl/ # Python package | ||||||||||||||||||||||||||||||
| ├── tests/ # Python tests | ||||||||||||||||||||||||||||||
| ├── examples/ # Configs and notebooks | ||||||||||||||||||||||||||||||
| └── pyproject.toml # Python build config | ||||||||||||||||||||||||||||||
|
Comment on lines
+47
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comments in the directory structure diagram are not vertically aligned, which slightly impacts readability. Aligning them would make the diagram cleaner and easier to parse visually.
Suggested change
|
||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ## Dev Environment Tips | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - **Hybrid Build**: `pip install -e .` rebuilds the Rust extension. | ||||||||||||||||||||||||||||||
| - **Performance**: Prefer Rust for hot paths; Python for flexibility. | ||||||||||||||||||||||||||||||
| - **Traits**: `twisterl::rl::env::Env` is the core environment trait. | ||||||||||||||||||||||||||||||
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.
The
cd rust && ...command changes the current directory. If a user is copying commands one by one, they will end up in therustdirectory, which might not be the intention for subsequent commands. To make the commands safer to copy-paste, consider running the directory-specific commands in a subshell. This ensures the user's shell session remains in the project root.