See README.md for project overview, key files, commands, and per-project state layout.
README.md is intended for end users (developers setting up or using the sandbox). It may explain how things work internally, but must not document development practices — those belong here in AGENTS.md.
Every change to the user experience (new commands, changed behaviour, new files created in target projects, etc.) must be reflected in README.md.
This project uses itself as its own sandbox — the AI agent runs inside the opencode-sandbox container for this repository. This means:
- The workspace is mounted at
/<project-name>inside the container (derived from the host project directory name) - Outbound network access is restricted to the domains whitelisted in
opencode-sandbox-config.yaml - Host environment variables are forwarded as configured in the
env-passthroughsection — in particularGH_TOKENfor GitHub CLI access dockerandpodmanare not available inside the container —ocs-rebuild-containerandocs-start-containercannot be run here; ask the user to run them on the host- The
ghCLI is available and authenticated viaGH_TOKENfor reading and commenting on PRs and issues, but not for pushing code or creating branches — do not attemptgit pushorgit fetch - SSH is not available inside the container —
git pushandgit fetchwill fail; do not modifygit remoteURLs shellcheckis available for linting
shellcheck bin/* shared entrypoint.shNo tests, no formatter, no typecheck, no CI workflows.
- All
bin/scripts:set -euo pipefail+source shared - After sourcing
shared, re-assignSCRIPT_DIRif the script references otherbin/scripts by path —sharedoverwritesSCRIPT_DIRwith its own location sharedprovides:find_sandbox_root(walks up to.opencode-sandbox/),use_sandbox_root,open_url,refresh_root_pathsocs-rebuild-containermust run from the project root (wheremise.tomllives); all otherocs-*commands auto-detect root by walking up- Container name is derived from project dir name:
opencode-<dirname> - Init templates (copied into target projects by
ocs-init) live ininit-templates/
The config file uses a YAML subset deliberately chosen to be parseable without any external dependencies. No yq, python, or other tools are required on the host.
The supported subset is intentionally narrow:
- Top-level keys only (section headers):
key: - List items one level deep:
- value - Map entries one level deep:
key: value - Line comments (
#) and blank lines
Anything outside this subset — anchors, multi-line strings, nested structures, typed values — is silently ignored by the parser in ocs-rebuild-container. Do not add configuration that relies on YAML features beyond the above. If richer configuration is ever needed, switch to a proper YAML parser (yq) rather than extending the bash parser.
macOS ships bash 3.2 as the system shell. All scripts must be compatible with it:
- Non-greedy regex quantifiers (
*?,+?) are not supported — use character classes instead (e.g.[^:]+rather than.*?[^:]) - Test regex changes on both Linux (bash 5) and macOS (bash 3.2) before committing