agentic-armor-rust
AGENTS.md0 starsChanged 51 days agoMITView on GitHub
Repo: agentic-armor-rust Branch: main Hardened container-sandbox execution for AI agents via MCP (stdio). One Rust binary: embedded SQLite registry + append-only audit trail, Docker and Podman through a unified ContainerRuntime trait, 8 MCP tools. Rust port of agentic-armor (the TypeScript original required PostgreSQL; this one has zero runtime services).
- Commits and pushes
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,774 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
The file
We split this AGENTS.md into the rules it gives an agent
8 rules. About 0 are common, 5 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 95
Use bd for ALL task tracking — do NOT use TodoWrite, TaskCreate, or markdown TODO lists
- Very specific: line 96
Run bd prime for detailed command reference and session close protocol
- Very specific: line 97
Use bd remember for persistent knowledge — do NOT use MEMORY.md files
- Distinctive: line 105
File issues for remaining work: - Create issues for anything that needs follow-up
- Distinctive: line 116
Verify: - All changes committed AND pushed
- Distinctive: line 121
NEVER stop before pushing - that leaves work stranded locally
- Distinctive: line 122
NEVER say "ready to push when you are" - YOU must push
- Distinctive: line 123
If push fails, resolve and retry until it succeeds <!-- END BEADS INTEGRATION -->
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
PROJECT KNOWLEDGE BASE
Repo: agentic-armor-rust Branch: main
OVERVIEW
Hardened container-sandbox execution for AI agents via MCP (stdio). One Rust binary: embedded SQLite registry + append-only audit trail, Docker and Podman through a unified ContainerRuntime trait, 8 MCP tools. Rust port of agentic-armor (the TypeScript original required PostgreSQL; this one has zero runtime services).
STRUCTURE
agentic-armor-rust/
├── Cargo.toml # mcp-rust-sdk pinned git dep; Cargo.lock IS committed
├── src/
│ ├── lib.rs # Public API re-exports
│ ├── main.rs # Binary: config → runtime detect+ping → SQLite pool → MCP serve
│ ├── config.rs # Config (env-driven), RuntimeChoice, TaskNetworkEgress, parse_csv_list
│ ├── error.rs # ArmorError + machine codes (IMAGE_NOT_ALLOWED, FORBIDDEN_MOUNT, …)
│ ├── docker/
│ │ ├── types.rs # ArmorContainerConfig, Mount, ExecRequest/Result, KillOutcome, NetworkConfig
│ │ └── manager.rs # BollardRuntime + ContainerRuntime trait; build_bollard_config (pure, testable)
│ ├── task/
│ │ ├── registry.rs # TaskRegistry (sqlx SQLite): tasks + task_events (append-only, monotonic seq)
│ │ └── lifecycle.rs # TaskLifecycle: create / mark_running / cancel / delete + audit events
│ └── mcp/
│ └── server.rs # 8 MCP tools, path validation, upload chunking, base64 downloads, tombstones
├── tests/
│ ├── hardening_test.rs # build_bollard_config contract: hardening flags, clamps, mount policy
│ ├── mcp_server_test.rs # pure helpers: paths, base64, chunking, audit formats, tombstone replay
│ ├── registry_test.rs # migrations (v1→v2 seq), status lifecycle, audit survival
│ ├── config_test.rs / error_test.rs / runtime_test.rs / types_test.rs
│ └── adversarial/ # 13-scenario escape/exfil harness (real agent; manual, ~1h) + reports
└── docs/ADVERSARIAL-TESTING.mdWHERE TO LOOK
| Task | Location |
| Container operations | src/docker/manager.rs — ContainerRuntime trait |
| Security enforcement (caps / mounts / limits / userns) | src/docker/manager.rs — build_bollard_config() (pure fn; tested via tests/hardening_test.rs) |
| MCP tool behavior, path rules, uploads/downloads | src/mcp/server.rs |
| Config knobs | src/config.rs — Config::default() reads env |
| Audit trail / tombstone recovery | src/task/registry.rs + server.rs::replay_tombstones |
| Error codes | src/error.rs — ArmorError::code() |
| Change runtime | CONTAINER_RUNTIME=docker|podman|auto |
CONTAINER RUNTIME ARCHITECTURE
ContainerRuntimetrait abstracts the lifecycle;BollardRuntimeimplements it for Docker and Podman (Podman 4+ Docker-compatible API)- Auto-detection: Docker socket → Docker Desktop socket → Podman socket (
auto_detect);main.rspings the daemon at startup with an actionable hint - Per-task isolated bridge networks
armor-<taskId>(taskId ≤ 58 chars — network names cap at 64);TASK_NETWORK_EGRESS=internalmakes bridge egress fail closed
SECURITY MODEL (enforced in build_bollard_config — no caller knobs)
- Hardcoded:
cap-drop: ALL, read-only rootfs,no-new-privileges, useropencode, 512MB memory floor, PID clamp 10–1000 - Image allowlist via
ALLOWED_IMAGES(defaults:opencode-sandbox-{base,developer}:latest) →ArmorError::ImageNotAllowed - Mounts: blocklist (
forbidden_mount_patterns) AND canonicalized source allowlist (ALLOWED_MOUNT_PREFIXES, empty = deny all bind/volume;..segments rejected; tmpfs exempt) - Upload/download: prefix + charset allowlist, in-container canonicalization, final-symlink guard; downloads base64 round-trip (
encoding: utf8|base64) - Exec: process-group wrap, verified timeout kills (
KillOutcometaxonomy), handler ceilingAA_HANDLER_TIMEOUT_SECS
CONVENTIONS
- Rust 2021,
async_trait,bollard,sqlx(SQLite, runtime queries),mcp-rust-sdk(pinned git dep),tracing,thiserror ArmorResult<T>;ArmorContainerConfigdeliberately has NO hardening fields (weakening is a compile error)- CI gates:
cargo fmt --check,clippy -D warnings,cargo test --locked, gatingcargo audit - Commits: conventional
type(scope): summary
COMMANDS
cargo test --locked # 93 tests
cargo clippy --all-targets --locked
cargo fmt
cargo build --release<!-- BEGIN BEADS INTEGRATION v:1 profile:minimal hash:ca08a54f -->Beads Issue Tracker
This project uses bd (beads) for issue tracking. Run bd prime to see full workflow context and commands.
Quick Reference
bd ready # Find available work
bd show <id> # View issue details
bd update <id> --claim # Claim work
bd close <id> # Complete workRules
- Use
bdfor ALL task tracking — do NOT use TodoWrite, TaskCreate, or markdown TODO lists - Run
bd primefor detailed command reference and session close protocol - Use
bd rememberfor persistent knowledge — do NOT use MEMORY.md files
Session Completion
When ending a work session, you MUST complete ALL steps below. Work is NOT complete until git push succeeds.
MANDATORY WORKFLOW:
- File issues for remaining work - Create issues for anything that needs follow-up
- Run quality gates (if code changed) - Tests, linters, builds
- Update issue status - Close finished work, update in-progress items
- PUSH TO REMOTE - This is MANDATORY:
git pull --rebase bd dolt push git push git status # MUST show "up to date with origin" - Clean up - Clear stashes, prune remote branches
- Verify - All changes committed AND pushed
- Hand off - Provide context for next session
CRITICAL RULES:
- Work is NOT complete until
git pushsucceeds - NEVER stop before pushing - that leaves work stranded locally
- NEVER say "ready to push when you are" - YOU must push
- If push fails, resolve and retry until it succeeds
<!-- END BEADS INTEGRATION -->Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

