Imported from jswarup/Segue (
agents/AGENTS.md). Install upstream withnpx skills add jswarup/Segue --skill agents. Copyright stays with the author.
Trellis Engineering Directives
These directives apply to all code in Trellis. Follow the configured formatter and the conventions already established in the owning module.
Architecture and Performance
- Keep hot paths allocation-conscious. Prefer stack storage, borrowing (
Arr,MutArr,USeg), moves, and compact contiguous representations. - Use fixed-capacity
Buffwhere practical. Do not add heap-backed storage without a clear ownership or growth requirement. - Keep traits small and purpose-specific. Pure interface traits use the
Iprefix, such asIArr,IStream, andIWorker. - Preserve subsystem boundaries. The core subsystems are
cove,silo,stalks,heist,flux,shard,swarm,karst,zephyr,crew, andfascia. - Do not introduce
serdeortokio; use the project'sfluxserialization andheistexecution facilities.
Data and APIs
- Keep struct fields private and name them with a leading underscore, such as
_Ptr,_Size, or_Inner. Expose state through methods. - Do not expose Rust slices or
Vec<T>in core public APIs. UseArr<'a, T>,MutArr<'a, T>,Buff<T>,Stash<T>, andUSegas appropriate. - Avoid use of Hashmaps, prefer using sorted arrays.
- Prefer the project construction helpers:
Buff![...],Stash![...],USeg::New, andUSeg::FromLen. - Use
u32for container indexes, counts, and segment bounds unless another width is explicitly required by an external API or address space. - Prefer
Fromand.into()for conversion. Where callers would otherwise need routine numeric casts, acceptimpl Into<u32>or an equivalent bounded generic type.
Traversal
- Do not use native
forloops or integer ranges for project algorithms. - Use
USegand the Trellis traversal methods.- Use
TraverseandTraverseRevfor forward and reverse traversal,TraverseMutandTraverseRevMutfor mutable traversal, andSpanfor early exit.
- Use
- Use
USegsearch and sort operations rather than the corresponding std methods. - Prefer
Fromand.into()to routine call-site casts. - Accept
impl Into<u32>or another appropriate conversion bound when it keeps the call site cast-free.
Naming and Syntax
- Use
PascalCasefor types, functions, and methods. - Prefix pure interface traits with
I, such asIArrandIStream. - Use
camelCasefor local variables and parameters. - Keep standard Rust trait implementation methods in
snake_case. - Use private, underscore-prefixed struct fields, such as
_First,_Size, and_Ptr. - Place
returnon its own statement line.
Formatting
- Follow FORMATTING.md for source layout, braces, separators conventions.
Tests and Verification
- Put component tests in that component's established
_tests.rs, and declare them withjeeves_test!so each case is registered with both Cove and Rust's standard test harness. cargo run -- -truns the registered test suite.-cruns console tests and-eruns examples; without-t, their assertions are disabled.- Before completing a change, run the narrowest relevant check. For broad changes, run
cargo check --all-targets,cargo clippy -- -D warnings, and the relevant test commands. - Maintain
trellis.natvisvisualizers when changing a core data structure that needs MSVC debugger inspection.
Execution Principles & Agent Workflow
- Think Before Coding:
- State assumptions explicitly.
- Surface trade-offs before implementing changes.
- If a simpler approach exists, push back. If unclear, stop and ask.
- Surgical Precision:
- Touch only what you must. Do not "improve" adjacent code, comments, or formatting.
- Clean up only your own mess (remove unused variables/headers orphaned by your changes).
- Simplicity First:
- Write the minimum code needed to solve the problem. Do not build speculative features, "flexible" abstractions, or unnecessary error handling.
- Goal-Driven Execution:
- Define clear success criteria.
- Loop and verify independently before declaring completion.
- Verification:
- Always verify modifications with a clean build.
- Commit Directive:
- Never run
git commitorgit pushwithout an explicit directive from the user.
- Never run
- Always Review:
- Review the final diff for minimal footprint and strict compliance with project invariants before declaring completion.