4.8 KiB
Tier 2 Autonomous Sandbox
Why this exists
When you run Tier 2 in the main repo, every edit and every bash
call prompts you for approval (permission: ask). For well-regularized
tracks (TDD red/green with atomic per-task commits), this is noise.
This track adds an autonomous mode in a sibling clone where Tier 2
runs unattended, with a 3-layer enforcement stack to keep it contained.
One-time bootstrap
cd C:\projects\manual_slop
pwsh -File scripts\tier2\setup_tier2_clone.ps1 -WhatIf # dry run first
pwsh -File scripts\tier2\setup_tier2_clone.ps1 # actual bootstrap
The bootstrap:
- Clones the main repo to
C:\projects\manual_slop_tier2\ - Sets
origin = C:\projects\manual_slop(local path; no remote) - Copies the agent, slash command, and opencode.json templates to the clone
- Installs the git hooks (
pre-pushrefuses all pushes;post-checkoutlogs checkouts) - Creates
C:\Users\Ed\AppData\Local\manual_slop\tier2\with restricted ACLs - Creates a "Tier 2 (Sandboxed)" desktop shortcut
Per-track invocation
- Double-click the "Tier 2 (Sandboxed)" desktop shortcut
(or run
pwsh -File C:\projects\manual_slop\scripts\tier2\run_tier2_sandboxed.ps1manually) - In the OpenCode session, type:
Examples:
/tier-2-auto-execute <track-name>/tier-2-auto-execute result_migration_review_pass/tier-2-auto-execute data_structure_strengthening_20260606 --resume/tier-2-auto-execute rag_test_failures_20260615 --toast
- Tier 2 runs the track autonomously, commits per task, monitors failcount
- On success: prints a summary
- On give-up: writes a failure report and prints the path
Review and merge
After Tier 2 finishes (success or give-up):
cd C:\projects\manual_slop(back to main)git fetch C:/projects/manual_slop_tier2 tier2/<track-name>- Review the diff with Tier 1 (interactive)
- On approval:
git merge --no-ff tier2/<track-name>to main
The 4 hard bans (enforced at 3 layers)
| Ban | Layer 1 (OpenCode) | Layer 2 (OS) | Layer 3 (git hook) |
|---|---|---|---|
git push* (any push) |
permission.bash deny rule |
n/a | pre-push hook refuses all pushes |
git checkout* (any form) |
permission.bash deny rule |
n/a | post-checkout hook logs the checkout |
git restore* (any form) |
permission.bash deny rule |
n/a | n/a |
git reset* (any form) |
permission.bash deny rule |
n/a | n/a |
| File access outside Tier 2 clone + app-data dir | permission.read/write path allowlist |
Windows ACL | n/a |
The failcount threshold
Tier 2 gives up if ANY of these hit:
- 3 consecutive red-phase failures (the test doesn't fail when it should)
- 3 consecutive green-phase failures (the implementation doesn't make the test pass)
- 30 minutes with no progress (no commit, no green test)
Override via scripts/tier2/failcount.toml.
The failure report
Written to C:\Users\Ed\AppData\Local\manual_slop\tier2_failures\<track>_<timestamp>.md with 7 sections:
- Header (track, branch, started, stopped, duration, give-up signal)
- Tasks completed
- Current task (where it stopped)
- Last 3 failures
- Failcount state
- Git state (
git log tier2/<track> ^origin/main) - Recommendation (heuristic-based)
A .STOPPED flag file is created alongside the report. The main repo
can check for it on next Tier 1 session start (an opt-in banner).
Verify the sandbox (manual checklist)
After bootstrap, run these inside the Tier 2 sandboxed OpenCode session to verify the bans are enforced:
- Try
git restore tests/test_failcount.py— should print "denied" - Try
git push origin main— should print "denied" (or the pre-push hook fires) - Try
git checkout -- src/foo.py— should print "denied" - Try
git reset --hard HEAD~1— should print "denied" - Try to read
C:\Users\Ed\Documents\test.txt(from a Python subprocess) — should print "ACCESS_DENIED"
And verify allowed operations work:
git status— worksgit switch -c test-branch— works- Edit a file in the Tier 2 clone — works
git add <file> && git commit -m "test"— works
Troubleshooting
- "Tier 2 (Sandboxed) shortcut doesn't work": check that
pwsh.exeis on the PATH (where.exe pwsh). - "Permission denied" on file access inside the sandbox: the
Windows ACL may be too restrictive. Re-run the bootstrap
(
setup_tier2_clone.ps1is idempotent). - "Failcount state not found": the
<app-data>/tier2/<track>/dir may be missing. The bootstrap creates it; check$env:LOCALAPPDATA. - "Pre-push hook not firing": check that
.git/hooks/pre-pushis executable. On Windows, Git Bash runs the hook; checkgit config core.hooksPathif you have a custom hooks dir. - "Tier 2 keeps giving up at 30 min": increase
no_progress_minutesinscripts/tier2/failcount.toml.