How shroudb/cargo-shroudb works
cargo-shroudb is a Cargo subcommand that discovers ShrouDB dependencies and manages the corresponding agent-instruction section in a Rust project. The main workflow is init-agents: inspect dependencies and lockfile versions, locate crate sources and their AGENTS.md files, then generate or update the project reference, optionally copying instructions locally. Separate commands check whether that reference is stale and remove generated content. Runtime details come from the README and partial src/main.rs excerpts; internal links not established by those excerpts are omitted.
Main entry points: main.rs Init agents
Components 18
Command handling
- Command dispatch
src/main.rs - Init agents
src/main.rs - Check agents
src/main.rs - Clean agents
src/main.rs
Dependency discovery
- Cargo.toml
- Cargo.lock
- Find dependencies
src/main.rs - Resolve versions
src/main.rs - Locate crate sources
src/main.rs - Crate AGENTS.md
Agent reference management
- Project AGENTS.md
- Generate section
src/main.rs - Copy local instructions
src/main.rs - Compare dependencies
src/main.rs - Remove generated content
src/main.rs - Local agent copies
Other components
- CLI user
- Cargo source caches
Connections 22
- CLI user → Command dispatch: runs command
- Command dispatch → Init agents: dispatches
- Command dispatch → Check agents: dispatches
- Command dispatch → Clean agents: dispatches
- Init agents → Find dependencies: discovers dependencies
- Find dependencies → Cargo.toml: reads
- Init agents → Resolve versions: resolves versions
- Resolve versions → Cargo.lock: reads
- Init agents → Locate crate sources: locates sources
- Locate crate sources → Cargo source caches: searches
- Locate crate sources → Crate AGENTS.md: checks for
- Init agents → Generate section: builds reference
- Generate section → Project AGENTS.md: writes or updates
- Init agents → Copy local instructions: optionally copies
- Copy local instructions → Local agent copies: writes
- Check agents → Find dependencies: discovers current dependencies
- Check agents → Resolve versions: resolves current versions
- Check agents → Project AGENTS.md: reads
- Check agents → Compare dependencies: checks freshness
- Compare dependencies → Project AGENTS.md: parses listed crates
- Clean agents → Project AGENTS.md: removes marked section
- Clean agents → Local agent copies: removes directory