How iliasalmerekov/aegis-shellguard works
Aegis is a Rust CLI that proxies agent shell commands, assesses risk, asks for approval when needed, and may capture recovery snapshots before execution. The main flow runs from the shell or agent hook through command analysis and planning to a decision, then execution or refusal. Supporting branches include audit, watch mode, installation, and opt-in update notices. The excerpts show selected orchestration and worker details; other links below rely on explicit README descriptions or SOURCE INDEX references, so unsampled implementation details are not inferred.
Main entry points: mod.rs Command execution · orchestrate.rs Command analysis · main.rs CLI dispatch · core.rs Interception planning
Components 26
Command entry
- CLI dispatch
src/main.rs - Shell proxy
src/shell_wrapper.rs - Agent hooks
src/install/hook.rs - Watch mode
src/watch/runner.rs
Command analysis
- Command analysis
src/analysis/orchestrate.rs - Shell routing
src/analysis/router.rs - Script source reader
src/analysis/source_reader.rs - Language worker
crates/aegis-language/src/worker.rs - Language adapters
crates/aegis-language/src/languages - Command parser
crates/aegis-parser/src/embedded_scripts.rs - Risk scanner
crates/aegis-scanner/src/lib.rs
Policy and recovery
- Interception planning
src/planning/core.rs - Policy engine
crates/aegis-policy/src/engine.rs - Configuration
crates/aegis-config/src/model.rs - Snapshot providers
crates/aegis-snapshot/src/lib.rs - Snapshot state
crates/aegis-snapshot/src/sqlite.rs
Execution and records
- Command execution
src/execution/mod.rs - Sandbox confinement
crates/aegis-sandbox/src/lib.rs - Audit logging
crates/aegis-audit/src/logger.rs - Decision explanations
src/explanation/formatter.rs
User integrations
- Approval interface
crates/aegis-tui/src/confirm_screen.rs - Rollback command
src/rollback.rs - Shell and hook setup
src/install/mod.rs - Update notices
src/update/mod.rs - npm registry
Other components
- User or agent
Connections 27
- User or agent → Shell proxy: runs command
README.md - User or agent → Agent hooks: configures hooks
README.md - User or agent → Watch mode: starts watch
README.md - Shell proxy → CLI dispatch: invokes binary
README.md - Agent hooks → CLI dispatch: invokes command
README.md - CLI dispatch → Command analysis: starts analysis
src/main.rs - Watch mode → Interception planning: plans commands
src/watch/runner.rs - Command analysis → Shell routing: routes targets
src/analysis/orchestrate.rs - Shell routing → Script source reader: reads scripts
src/analysis/router.rs - Command analysis → Language worker: requests analysis
src/analysis/orchestrate.rs - Language worker → Language adapters: parses source
crates/aegis-language/src/worker.rs - Shell routing → Command parser: resolves commands
src/analysis/router.rs - Command analysis → Risk scanner: assesses risk
- Command analysis → Interception planning: supplies assessment
- Interception planning → Policy engine: evaluates policy
- Interception planning → Configuration: uses settings
- Interception planning → Command execution: authorizes execution
README.md - Command execution → Approval interface: requests approval
README.md - Command execution → Snapshot providers: creates snapshots
src/execution/mod.rs - Snapshot providers → Snapshot state: stores metadata
crates/aegis-snapshot/src/lib.rs - Command execution → Sandbox confinement: confines process
src/execution/mod.rs - Command execution → Audit logging: records decision
README.md - Command execution → Decision explanations: renders rationale
- Rollback command → Snapshot providers: restores snapshot
README.md - CLI dispatch → Shell and hook setup: dispatches setup
src/main.rs - CLI dispatch → Update notices: dispatches update
src/main.rs - Update notices → npm registry: checks versions
src/update/mod.rs