agentleFS
calebrosariocalebrosario/agentic-armor-rust/AGENTS.md

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.

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
  1. Very specific:

    Use bd for ALL task tracking — do NOT use TodoWrite, TaskCreate, or markdown TODO lists

    line 95
  2. Very specific:

    Run bd prime for detailed command reference and session close protocol

    line 96
  3. Very specific:

    Use bd remember for persistent knowledge — do NOT use MEMORY.md files

    line 97
  4. Distinctive:

    File issues for remaining work: - Create issues for anything that needs follow-up

    line 105
  5. Distinctive:

    Verify: - All changes committed AND pushed

    line 116
  6. Distinctive:

    NEVER stop before pushing - that leaves work stranded locally

    line 121
  7. Distinctive:

    NEVER say "ready to push when you are" - YOU must push

    line 122
  8. Distinctive:

    If push fails, resolve and retry until it succeeds <!-- END BEADS INTEGRATION -->

    line 123

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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.md

WHERE TO LOOK

TaskLocation
Container operationssrc/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/downloadssrc/mcp/server.rs
Config knobssrc/config.rs — Config::default() reads env
Audit trail / tombstone recoverysrc/task/registry.rs + server.rs::replay_tombstones
Error codessrc/error.rs — ArmorError::code()
Change runtimeCONTAINER_RUNTIME=docker|podman|auto

CONTAINER RUNTIME ARCHITECTURE

  • ContainerRuntime trait abstracts the lifecycle; BollardRuntime implements it for Docker and Podman (Podman 4+ Docker-compatible API)
  • Auto-detection: Docker socket → Docker Desktop socket → Podman socket (auto_detect); main.rs pings 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=internal makes bridge egress fail closed

SECURITY MODEL (enforced in build_bollard_config — no caller knobs)

  • Hardcoded: cap-drop: ALL, read-only rootfs, no-new-privileges, user opencode, 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 (KillOutcome taxonomy), handler ceiling AA_HANDLER_TIMEOUT_SECS

CONVENTIONS

  • Rust 2021, async_trait, bollard, sqlx (SQLite, runtime queries), mcp-rust-sdk (pinned git dep), tracing, thiserror
  • ArmorResult<T>; ArmorContainerConfig deliberately has NO hardening fields (weakening is a compile error)
  • CI gates: cargo fmt --check, clippy -D warnings, cargo test --locked, gating cargo 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 work

Rules

  • Use bd for ALL task tracking — do NOT use TodoWrite, TaskCreate, or markdown TODO lists
  • Run bd prime for detailed command reference and session close protocol
  • Use bd remember for 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:

  1. File issues for remaining work - Create issues for anything that needs follow-up
  2. Run quality gates (if code changed) - Tests, linters, builds
  3. Update issue status - Close finished work, update in-progress items
  4. PUSH TO REMOTE - This is MANDATORY:
    git pull --rebase
    bd dolt push
    git push
    git status  # MUST show "up to date with origin"
  5. Clean up - Clear stashes, prune remote branches
  6. Verify - All changes committed AND pushed
  7. Hand off - Provide context for next session

CRITICAL RULES:

  • Work is NOT complete until git push succeeds
  • 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 -->

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.