Imported from alessandrobologna/agentcore-rust (
AGENTS.md). Install upstream withnpx skills add alessandrobologna/agentcore-rust. Copyright stays with the author.
Repository Guidelines
Project Structure & Module Organization
- Core Axum entrypoint lives in
src/main.rs; add new routes as submodules undersrc/to keep the handler tree cohesive. - Helper automation sits in
scripts/(Python invokers) andtools/(bench harness); extend these instead of sprinkling one-off scripts. - Deployment assets span
Makefile,Dockerfile,template.yaml, andsamconfig.toml; update them together when altering Lambda packaging. - Reference design notes in
docs/, and drop benchmark artifacts intoperformance-results/after each tuning pass.
Build, Test, and Development Commands
cargo buildcompiles the service; append--releasefor perf testing or images.cargo runlaunches the local server on0.0.0.0:8080for manual curl checks.cargo fmt && cargo clippy --all-targets --all-featuresenforces style and lint hygiene before any PR.make buildmirrors CI’s debug build;make test-localspins the ARM64 Docker image for smoke tests.make deploybuilds, pushes to ECR, and triggerssam deploy; ensure AWS credentials are active.
Coding Style & Naming Conventions
- Follow Rust 2021 defaults: four-space indent,
snake_casefor modules/functions,UpperCamelCasefor types,SHOUTY_SNAKE_CASEfor constants. - Keep handlers async and side-effect free; push shared helpers into dedicated modules.
- Prefer structured logs via
tracing; limit startupprintln!output to essential diagnostics.
Testing Guidelines
- Use
cargo testfor unit coverage; colocate module tests behind#[cfg(test)]with descriptive names. - Place integration scenarios under
tests/usingtokio::testand fixture payloads fromtests/data/. - Capture latency regressions by rerunning the bench harness in
tools/router-benchwhen touching routing logic.
Commit & Pull Request Guidelines
- Write imperative commits ≤72 characters, e.g.,
Add sandbox UUID logging. - PRs must link the tracking issue, describe functional impact, and document manual or automated test evidence.
- Attach curl transcripts or screenshots for API changes and call out any AWS resources touched.
- Request review before merge and verify
cargo fmt,cargo clippy,cargo test, andmake buildare green.
Security & Configuration Tips
- Store secrets outside the repo; rely on AWS Parameter Store or Secrets Manager during deploys.
- Validate IAM tweaks with least-privilege diffs before running
make deploy. - When adding environment variables, mirror them in
template.yamland local.envexamples if applicable.