agentleFS
mattolsonmattolson/agent-sandbox/.agents/skills/add-agent/SKILL.md

add-agent

Skill212 starsChanged 5 months agoMITView on GitHub

Add a new AI coding agent to Agent Sandbox. Creates all required files (Dockerfile, templates, CI, docs) and wires the agent into the CLI, proxy, and build system.

  • Installs packages

9 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use setup.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • VercelSkill

    setup

    Set up Vercel CLI and project configuration. Use when the user says "set up Vercel", "configure Vercel", "link to Vercel", or "vercel init".

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

38 rules. 0 are common, 8 are distinctive, and 30 are very specific to this project.

  • 0

    Common

    Most of the 7 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 30

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Ask the user for the following (skip any already provided):

    line 18
  2. Very specific:

    VS Code extension ID: - if one exists (e.g., github.copilot-chat), or "none" for CLI-only agents

    line 41
  3. Very specific:

    JetBrains plugin ID: - if one exists (e.g., com.anthropic.code.plugin), or "none"

    line 42
  4. Very specific:

    Add labels: org.opencontainers.image.description and version label

    line 64
  5. Very specific:

    If the agent needs default config files, create them alongside the Dockerfile (e.g., images/agents/{agent}/config.toml).

    line 66
  6. Very specific:

    Do NOT include proxy config, HTTP_PROXY, HTTPS_PROXY, capabilities, or other shared settings.

    line 82
  7. Very specific:

    Add the new agent to supported_agents_display() (space-separated string)

    line 105
  8. Very specific:

    Add the new agent to supported_agents() (printf list)

    line 106
  9. Very specific:

    Add the new agent to select_agent() (option list)

    line 107
  10. Very specific:

    Add the new agent to the validate_agent() case statement

    line 108
  11. Very specific:

    If the agent has host-side config that users might want to mount (like Claude's CLAUDE.md and settings.json), add a conditional block in …

    line 113
  12. Very specific:

    Update the "switch rejects invalid --agent value" assertion(s) to include the new agent name.

    line 122
  13. Very specific:

    Update the stub select_option call in "switch prompts for agent when --agent is omitted" to include the new agent in the argument list.

    line 123
  14. Very specific:

    images/proxy/service_catalog.py: add a new entry to the SIMPLE_SERVICE_HOSTS dict.

    line 131
  15. Distinctive:

    Place alphabetically among existing entries

    line 134
  16. Very specific:

    Prefer wildcards over listing subdomains individually (e.g., *.openai.com covers api.openai.com, auth.openai.com, regional endpoints)

    line 135
  17. Very specific:

    Only use separate entries for different TLDs (e.g., chatgpt.com is separate from openai.com)

    line 136
  18. Very specific:

    If the service needs rule-level semantics (repo scoping, method narrowing beyond the generic readonly mapping), add a dedicated expander …

    line 139
  19. Very specific:

    images/proxy/render-policy: add the new agent name to the KNOWN_AGENTS set.

    line 141
  20. Very specific:

    Default env var at top (e.g., : "${GEMINI_VERSION:=latest}")

    line 146
  21. Very specific:

    Add to the case statement (both specific target and all target)

    line 149
  22. Distinctive:

    Update usage text (first line and examples)

    line 150
  23. Very specific:

    Create docs/agents/{agent}.md following this structure (see docs/agents/codex.md for exact format):

    line 154
  24. Very specific:

    Add row to the "Supported agents" table with the agent name, project URL, and status columns (CLI, VS Code, JetBrains).

    line 166
  25. Very specific:

    Add link to docs/{agent}/README.md in the "Agent-specific setup" section

    line 167
  26. Very specific:

    Create the CI files directly in .github/workflows/.

    line 171
  27. Very specific:

    Add {AGENT}_IMAGE_NAME env var (e.g., GEMINI_IMAGE_NAME)

    line 176
  28. Very specific:

    Add build-{agent} job following the pattern of build-codex (for GitHub releases) or build-copilot (for npm)

    line 177
  29. Very specific:

    Add to summary job needs array

    line 181
  30. Distinctive:

    Add agent version and digest to summary output table

    line 182
  31. Very specific:

    Create .github/workflows/check-{agent}-version.yml following the pattern of existing version check workflows.

    line 186
  32. Distinctive:

    After creating all files:

    line 195
  33. Very specific:

    Verify the binary works: docker run --rm agent-sandbox-{agent}:local {agent} --version

    line 201
  34. Very specific:

    Test init flow: agentbox init --agent {agent} --mode cli --path /tmp/test-project

    line 202
  35. Very specific:

    Run CLI tests: go test ./...

    line 203
  36. Distinctive:

    Test proxy enforcement after starting containers:

    line 204
  37. Distinctive:

    Test auth flow inside the container

    line 207
  38. Distinctive:

    When generating files, read these for the exact patterns:

    line 211

“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “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
SKILL.md

Scaffold Agent Support

This skill generates all the files needed to add a new AI coding agent to Agent Sandbox. It follows the established patterns from Claude, Copilot, and Codex implementations.

Arguments

The skill takes a single argument: the agent name (lowercase, no spaces). Example: gemini, opencode, factory.

Process

Step 1: Gather Information

Ask the user for the following (skip any already provided):

  1. Agent name (from argument)
  2. Display name - human-readable name for comments and labels (e.g., "Google Gemini CLI")
  3. Project URL - link to the agent's GitHub repo or website (for README table)
  4. Installation method - how to install the agent binary/CLI
    • npm package (like Claude and Copilot)
    • direct binary download from GitHub releases (like Codex)
    • curl installer script
    • pip package
    • go install
  5. Package identifier - npm package name, GitHub releases URL pattern, pip package, go module, or download URL
  6. Version detection source - how CI detects new releases
    • npm registry (Claude, Copilot): npm view {package} version
    • GitHub releases API (Codex): gh api repos/{owner}/{repo}/releases/latest --jq .tag_name
    • Note any tag prefix that needs stripping (e.g., Codex uses rust-v prefix)
  7. Version variable name - env var for build.sh (e.g., GEMINI_VERSION)
  8. Config directory - where the agent stores its config in the container (e.g., /home/dev/.gemini)
  9. Default config files - any config files to bake into the image (e.g., Codex bakes config.toml to disable its internal sandbox)
  10. Internal sandbox - does the agent have its own sandboxing (Landlock, seccomp, etc.) that should be disabled inside our container? If so, how to disable it.
  11. Required API domains - domains the agent needs to reach (API, auth/OAuth, CDN)
  12. Authentication method - how users authenticate (API key env var, OAuth flow, device code, etc.)
  13. Auto-approve flag - the CLI flag for unattended/yolo mode (e.g., --dangerously-skip-permissions, --yolo, --full-auto)
  14. VS Code extension ID - if one exists (e.g., github.copilot-chat), or "none" for CLI-only agents
  15. JetBrains plugin ID - if one exists (e.g., com.anthropic.code.plugin), or "none"
  16. Agent-specific environment variables - any env vars the agent needs at runtime
  17. Does the agent need Node.js? - whether to install Node.js in the Dockerfile (only if the base image doesn't include it and the agent needs it)

Step 2: Create Files

Generate all files listed below. Read the reference files first to match the exact format and structure.

2.1: Dockerfile

Create images/agents/{agent}/Dockerfile.

Pattern:

  • ARG BASE_IMAGE=agent-sandbox-base:local + FROM ${BASE_IMAGE}
  • Optional extra packages block (same pattern as existing agents)
  • Install Node.js if needed (copy pattern from Copilot Dockerfile)
  • As root: create config directory and ~/.local/bin if installing a binary there
  • Copy any default config files (e.g., COPY config.toml /home/dev/.{agent}/config.toml)
  • USER dev
  • Set ENV PATH="/home/dev/.local/bin:$PATH" if installing to ~/.local/bin
  • Install the agent (method depends on installation type)
  • For direct binary downloads: use ARG TARGETARCH for multi-arch, prefer musl (statically linked) over gnu variants
  • Add labels: org.opencontainers.image.description and version label

If the agent needs default config files, create them alongside the Dockerfile (e.g., images/agents/{agent}/config.toml).

2.2: Agent Compose Layer

Create internal/embeddata/templates/{agent}/cli/agent.yml.

This is a compose overlay that layers on top of the shared internal/embeddata/templates/compose/base.yml. It contains only agent-specific configuration. Read an existing agent.yml for the exact format.

Contents:

  • Managed-by comment header
  • services.proxy.volumes: [] (required placeholder for compose merge)
  • services.agent.image - the GHCR image reference
  • services.agent.volumes - agent-specific state and history volumes
  • services.agent.environment - agent-specific env vars (if any)
  • Named volume declarations at the bottom

Do NOT include proxy config, HTTP_PROXY, HTTPS_PROXY, capabilities, or other shared settings. Those live in base.yml.

2.3: devcontainer.json

Create internal/embeddata/templates/{agent}/devcontainer/devcontainer.json.

This file references a layered array of compose files. Read an existing devcontainer.json for the exact format.

Key points:

  • dockerComposeFile is an array of 5 paths pointing into .agent-sandbox/compose/: base.yml, agent.{name}.yml, mode.devcontainer.yml, user.override.yml, user.agent.{name}.override.yml
  • service: "agent"
  • workspaceFolder: "/workspace"
  • VS Code settings section with port forwarding disabled and security settings
  • VS Code extensions array if applicable, or omit for CLI-only agents
  • JetBrains settings section with proxy configuration
  • JetBrains plugins array if applicable
  • remoteUser: "dev"
  • overrideCommand: false

2.4: Update Agent Registry

Edit cli/lib/agent.bash:

  • Add the new agent to supported_agents_display() (space-separated string)
  • Add the new agent to supported_agents() (printf list)
  • Add the new agent to select_agent() (option list)
  • Add the new agent to the validate_agent() case statement

2.5: Update CLI Compose Scaffolding

Edit cli/lib/cli-compose.bash:

  • If the agent has host-side config that users might want to mount (like Claude's CLAUDE.md and settings.json), add a conditional block in scaffold_cli_agent_override_if_missing() following the Claude pattern. This adds commented-out volume entries to user.agent.{name}.override.yml.
  • Skip this for agents without meaningful host-side config.

2.6: Update BATS Tests

Two test files reference the agent list string:

  1. Edit cli/test/init/init.bats: update the "rejects invalid --agent value" assertion to include the new agent name.
  2. Edit cli/test/switch/switch.bats:
    • Update the "switch rejects invalid --agent value" assertion(s) to include the new agent name.
    • Update the stub select_option call in "switch prompts for agent when --agent is omitted" to include the new agent in the argument list.

Both assertions and the stub match the output of supported_agents_display() / select_agent().

2.7: Update Proxy Service Domains and Known Agents

Two files in the proxy image need updating:

images/proxy/service_catalog.py: add a new entry to the SIMPLE_SERVICE_HOSTS dict.

Guidelines:

  • Place alphabetically among existing entries
  • Prefer wildcards over listing subdomains individually (e.g., *.openai.com covers api.openai.com, auth.openai.com, regional endpoints)
  • Only use separate entries for different TLDs (e.g., chatgpt.com is separate from openai.com)
  • Include both API domains and auth/OAuth domains so authentication works through the proxy

If the service needs rule-level semantics (repo scoping, method narrowing beyond the generic readonly mapping), add a dedicated expander function following the GitHub pattern instead of using SIMPLE_SERVICE_HOSTS.

images/proxy/render-policy: add the new agent name to the KNOWN_AGENTS set. This script renders the effective proxy policy at startup and validates the AGENTBOX_ACTIVE_AGENT env var against this set. If the agent is missing, the proxy will refuse to start with an "Unknown agent" error.

2.8: Update build.sh

Edit images/build.sh to add:

  • Default env var at top (e.g., : "${GEMINI_VERSION:=latest}")
  • Extra packages env var (e.g., : "${GEMINI_EXTRA_PACKAGES:=}")
  • build_{agent}() function following the pattern of existing agent build functions
  • Add to the case statement (both specific target and all target)
  • Update usage text (first line and examples)

2.9: Agent Documentation

Create docs/agents/{agent}.md following this structure (see docs/agents/codex.md for exact format):

  1. Header: # {Display Name} Sandbox Template
  2. One-liner: "Run {display name} in a network-locked container..."
  3. Link: "See the main README for installation, architecture overview, and configuration options."
  4. Setup section: Auth instructions covering all supported auth methods. Note any gotchas (e.g., account-level settings that must be enabled).
  5. Usage section: How to start the agent, including the auto-approve flag. Include agentbox compose down for stopping.
  6. Required Network Policy section: Show the services: YAML snippet with the agent's service name.

2.10: Update Project README

Edit README.md:

  • Add row to the "Supported agents" table with the agent name, project URL, and status columns (CLI, VS Code, JetBrains). New agents are typically :large_blue_circle: Preview for CLI and devcontainer modes.
  • Add link to docs/{agent}/README.md in the "Agent-specific setup" section

Step 3: CI/CD Workflows

Create the CI files directly in .github/workflows/. They follow a clear pattern and can be written without drafting.

3.1: Build Job

Edit .github/workflows/build-images.yml:

  • Add {AGENT}_IMAGE_NAME env var (e.g., GEMINI_IMAGE_NAME)
  • Add build-{agent} job following the pattern of build-codex (for GitHub releases) or build-copilot (for npm)
  • Version detection depends on the source:
    • npm: npm view {package} version
    • GitHub releases: gh api repos/{owner}/{repo}/releases/latest --jq .tag_name with any tag prefix stripping via sed
  • Add to summary job needs array
  • Add agent version and digest to summary output table

3.2: Version Check Workflow

Create .github/workflows/check-{agent}-version.yml following the pattern of existing version check workflows.

  • Pick the next available daily cron slot (current: Claude 6am UTC, Copilot 7am, Codex 8am)
  • Match the version source to the build job (npm or GitHub releases)
  • Tag prefix: {agent}- for the GHCR tag check
  • Trigger build-images.yml if the version tag doesn't exist in GHCR

Step 4: Verify

After creating all files:

  1. List all files created/modified
  2. Note any manual steps needed
  3. Remind user to:
    • Build and test locally: ./images/build.sh {agent}
    • Verify the binary works: docker run --rm agent-sandbox-{agent}:local {agent} --version
    • Test init flow: agentbox init --agent {agent} --mode cli --path /tmp/test-project
    • Run CLI tests: go test ./...
    • Test proxy enforcement after starting containers:
      • Allowed domain returns 200: curl -x http://proxy:8080 https://{api-domain}
      • Blocked domain returns 403: curl -x http://proxy:8080 https://example.com
    • Test auth flow inside the container

Reference Files

When generating files, read these for the exact patterns:

  • images/agents/claude/Dockerfile (npm install pattern)
  • images/agents/copilot/Dockerfile (npm install with Node.js pattern)
  • images/agents/codex/Dockerfile (direct binary download pattern, multi-arch, config file baking)
  • images/agents/codex/config.toml (baked config file example)
  • internal/embeddata/templates/compose/base.yml (shared compose base layer with proxy and agent skeleton)
  • internal/embeddata/templates/compose/mode.devcontainer.yml (devcontainer mode overlay)
  • internal/embeddata/templates/claude/cli/agent.yml (agent compose layer with env vars)
  • internal/embeddata/templates/copilot/cli/agent.yml (simplest agent compose layer)
  • internal/embeddata/templates/claude/devcontainer/devcontainer.json (devcontainer with extensions and JetBrains plugins)
  • internal/embeddata/templates/codex/devcontainer/devcontainer.json (CLI-only agent, no extensions)
  • internal/runtime/agents.go (agent registry: supported list and validation)
  • internal/scaffold/init.go (CLI and devcontainer init flow entrypoints)
  • internal/scaffold/devcontainer.go (devcontainer JSON rendering and merge behavior)
  • internal/cli/init_test.go (init command assertions and prompting expectations)
  • internal/cli/switch_test.go (switch command assertions and agent validation coverage)
  • images/proxy/addons/enforcer.py (service domains, alphabetical ordering)
  • images/proxy/render-policy (KNOWN_AGENTS set, policy rendering validation)
  • images/build.sh (build functions and case statement)
  • docs/agents/codex.md (simplest agent doc, CLI-only)
  • docs/agents/copilot.md (agent doc with IDE notes)
  • README.md (supported agents table and setup links)
  • .github/workflows/build-images.yml (build jobs)
  • .github/workflows/check-codex-version.yml (GitHub releases version check)
  • .github/workflows/check-copilot-version.yml (npm version check)

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.