Project Info
Inspiration
Scope Guard came from a problem I have repeatedly faced while working with coding agents in real development environments. I often manage several projects at the same time, sometimes on the same machine or server. Each project may have its own repository, database, service, port, environment variables, deployment configuration, and domain. When I ask a coding agent to work on one application, the task may sound simple: Update this project, run the migration, restart the service, and verify the deployment. The problem is that an agent does not always understand the operational boundaries that are obvious to the developer. A command can be technically valid and still target the wrong service. A configuration change can fix one application while breaking another. A deployment script can restart a shared dependency, read an unrelated environment file, or modify a project that was never part of the original request. I experienced this concern while working with projects such as RD Social and EngageFlow. Both applications had different responsibilities, but they could exist within the same broader infrastructure. Whenever I gave an agent access to help with deployment or debugging, I found myself repeatedly adding instructions such as: Work only on RD Social. Do not modify EngageFlow. Do not restart unrelated services. Do not touch any other database or configuration. That made me realize that the real issue was not simply sandboxing. Traditional sandboxing asks: What can the agent technically access? The question I wanted Scope Guard to answer was: Does this specific action belong to the task the developer actually approved? That distinction became the foundation of the project. What Scope Guard Does Scope Guard is an intent-bound execution control plane for coding agents. It converts a developer's natural-language task into a structured project boundary containing: Allowed repositories and filesystem paths Protected projects and configuration files Approved services and containers Databases Ports and domains Operations requiring human approval Actions that must always be blocked Once the boundary is approved, every proposed action is evaluated before it is executed. Scope Guard can return one of several deterministic decisions: ALLOW ALLOW_WITH_APPROVAL BLOCK_OUT_OF_SCOPE BLOCK_PROTECTED_RESOURCE BLOCK_DESTRUCTIVE BLOCK_UNKNOWN_RESOURCE BLOCK_SECRET_ACCESS BLOCK_NETWORK_DESTINATION BLOCK_POLICY_AMBIGUITY The language model can interpret intent, propose a plan, explain risks, and suggest corrections, but it does not make the final security decision. That responsibility belongs to a deterministic policy engine. This separation was one of the most important design choices in the project: GPT-5.6 helps Scope Guard understand the task. The policy engine decides what is permitted. The Demonstration Scenario I built the project around a synthetic shared-server scenario containing two applications: RD Social The target project that the agent is allowed to update and deploy. EngageFlow A separate protected project that must remain healthy and unchanged. The developer submits the task: Update and deploy RD Social, run its approved migration, restart its API, and verify its health without modifying EngageFlow. GPT-5.6 interprets the request and produces a structured boundary and execution plan. Codex then proposes the development and deployment actions. During the demonstration, the agent attempts to restart the EngageFlow service. Scope Guard detects that the service belongs to a protected project and blocks the operation before execution. The rejection includes: The blocked command The affected protected resource The policy rule that was violated A human-readable explanation A structured machine-readable explanation A suggested corrected action The Codex workflow then receives that rejection context and revises the plan to restart the correct RD Social service. The corrected operation proceeds through an approval gate. Scope Guard creates a snapshot before the mutation, applies the approved change, runs health checks, and verifies that EngageFlow remained unchanged. The demonstration also injects a deliberate RD Social failure. Scope Guard detects the failed health check, restores the target project's previous state, and verifies that the protected EngageFlow application was never modified during execution or rollback. How I Built It Scope Guard is implemented as a monorepo with a clear separation between the user interface, orchestration layer, policy engine, agent integrations, evaluation suite, and synthetic execution environment. Frontend I built the control plane using: Next.js TypeScript Tailwind CSS Typed API validation Responsive layouts Real-time execution events The interface is intentionally designed as a developer operations dashboard rather than a generic chat application. It includes six main product areas: Overview dashboard Environment inventory Guarded task creation Boundary review Live execution and approvals Reports and SentryBench results The most important screen is the blocked-action view. It makes the reason for a policy rejection understandable without requiring the developer to inspect raw logs. Backend The orchestration layer is built with: FastAPI Python Pydantic Structured API contracts Server-side event streaming Typed task and policy models The backend manages: Task creation Environment inventory Boundary generation Boundary approval Agent action proposals Policy evaluation Human approvals Execution events Snapshots Validation Rollback Reports GPT-5.6 I integrated GPT-5.6 as the planning and interpretation layer. It receives: The developer's task The available infrastructure inventory Resource relationships Existing constraints Supported operations It returns structured information including: Interpreted intent Target project Allowed resources Protected resources Proposed steps Risk summary Validation plan Rollback plan Confidence All model output is validated against strict schemas before it can enter the execution workflow. GPT-5.6 is never treated as the final authority. A plausible explanation from the model cannot override a deterministic block. Codex Codex played two roles in the project. First, I used Codex extensively to accelerate the implementation itself. It helped scaffold the monorepo, build the policy engine, create the synthetic environment, write tests, refine the frontend, improve documentation, and repeatedly verify the full workflow. Second, Scope Guard includes a Codex integration layer that can receive coding-agent proposals and pass them through the policy engine. The guarded flow is: This allows the agent to remain useful without allowing it to silently expand its own permissions. Synthetic Docker Environment I did not test Scope Guard against my live projects. Instead, I created a Docker-only synthetic environment that models the operational relationship between RD Social and EngageFlow. The environment runs with: Non-root users No host Docker socket No privileged containers Restricted mounts No production credentials No access to real databases No connection to production infrastructure The runner operates as UID 10001, with zero effective Linux capabilities and NoNewPrivs enabled. This was important because a project about agent safety should also demonstrate disciplined isolation during its own development. Deterministic Enforcement One of the biggest challenges was avoiding security theatre. It would have been easy to ask a language model whether a command looked safe and display its answer. That would create an attractive demonstration, but it would not create an enforceable boundary. I therefore separated the system into distinct stages: The command-analysis layer identifies: Filesystem paths Relative path escapes Service names Database names Ports Domains Environment files Network destinations Destructive shell operations Secret access patterns The policy engine then compares those resources against the approved boundary manifest. Unknown resources are denied by default. The language model can suggest that an action is safe, but the policy engine can still block it. Snapshots, Validation, and Rollback Blocking unsafe actions is only part of the problem. A valid in-scope action can still fail. Before a mutating action, Scope Guard records: Relevant file hashes Repository state Service state Health-check state Migration state Protected-resource integrity state After execution, it validates both sides of the boundary. For the target project, it checks whether the expected deployment succeeded. For the protected project, it verifies that: Files remained unchanged Service health remained stable Configuration remained intact No unauthorized operation occurred If the target validation fails, Scope Guard performs a target-only rollback and verifies the environment again. This made rollback a controlled part of the execution transaction rather than an afterthought. Auditability Every significant workflow event is recorded in a chronological audit timeline. Examples include: Task received Inventory loaded Boundary proposed Boundary approved Snapshot created Action proposed Policy decision made Protected action blocked Corrected action received Approval granted Execution completed Health check failed Rollback started Previous state restored Protected resources verified The audit events are hash-chained, making accidental or unauthorized modifications to the event sequence detectable. Scope Guard also generates downloadable execution reports containing: Target resources changed Protected resources preserved Actions blocked Approvals required Validation results Rollback outcome Audit-chain status SentryBench I created a dedicated evaluation suite called SentryBench to test the policy engine beyond the main demonstration. It contains 32 scenarios across four categories: Safe in-scope operations Examples include editing RD Social files, running its tests, and restarting its approved service. Cross-project operations Examples include restarting EngageFlow, accessing its database, or modifying its environment variables. Destructive operations Examples include recursive deletion, unrelated database operations, secret access, and unsafe configuration changes. Ambiguous operations Examples include generic service names, unknown paths, shared resources, and attempted workspace escapes. The current evaluation result is: I also added regression tests to ensure the main guarded execution story continues to work as the policy system evolves. Challenges I Faced Building without weakening the security model The hardest design challenge was deciding where AI reasoning should stop and deterministic enforcement should begin. GPT-5.6 is excellent at understanding intent and explaining complex situations, but infrastructure permissions should not depend entirely on probabilistic output. The final architecture uses AI for interpretation and correction while preserving deterministic enforcement. Keeping the project generic while demonstrating a real story A completely generic infrastructure-security platform would have been too broad for the hackathon. A hard-coded demonstration would have been easier but less credible. I addressed this by using a concrete RD Social and EngageFlow scenario while designing the internal models around typed resources, actions, manifests, and decisions. Simulating realistic infrastructure safely I wanted the system to execute real operations, detect failures, and perform rollback, but I did not want the hackathon project to touch production systems. The Docker environment had to behave realistically enough to demonstrate the workflow while remaining disposable and isolated. WSL and Docker stability I built the project on a Windows PC using Ubuntu through WSL2. During development, Docker Desktop integration and browser automation occasionally destabilized the WSL session. This forced me to improve container cleanup, browser-test isolation, resource controls, and documentation around WSL recovery. Those interruptions were frustrating, but they reinforced one of the central lessons behind Scope Guard: powerful automation must operate within explicit resource boundaries. Designing a clear user experience Security tools often expose raw policy logs and expect the developer to interpret them. I wanted Scope Guard to explain: What the agent attempted What resource was affected Why it was blocked Which rule made the decision What the corrected action should be Making those decisions understandable was as important as implementing the underlying policy engine. What I Learned The most important lesson was that agent safety is not only about restricting access. An agent may have legitimate access to a workspace and still perform the wrong operation. The missing layer is task-specific authorization. I also learned that language models and deterministic systems are strongest when they are given different responsibilities: GPT-5.6 interprets intent and explains risk. Codex performs development work and revises plans. The policy engine enforces boundaries. The human approves sensitive operations. The sandbox limits the execution environment. Validation and rollback verify the outcome. No single layer is sufficient on its own. I also gained a deeper appreciation for evaluation. Building SentryBench forced me to define what “safe” actually meant in measurable terms rather than relying on an impressive demonstration alone. Accomplishments I Am Proud Of I am particularly proud that Scope Guard is not only a visual prototype. The project includes: A real deterministic policy engine A structured GPT-5.6 planning adapter A live Codex proposal integration Human approval gates A Docker-based synthetic shared-server environment Real blocked-action handling Failure injection Target-only rollback Protected-resource integrity verification Hash-chained audit events Downloadable reports A responsive six-route control plane Desktop and mobile browser verification 32 SentryBench scenarios Comprehensive backend and frontend testing The complete verification suite currently includes: Ruff passing Strict MyPy passing 30 backend tests passing Frontend tests passing ESLint passing TypeScript passing Next.js production build passing Docker Compose validation passing Playwright verification across all six routes Successful full signature scenario Successful rollback with EngageFlow remaining healthy and unchanged What Comes Next Scope Guard currently demonstrates the core safety loop in a controlled environment. The next stage is to expand it into a broader agent-safety platform with: Generic caller-defined resource manifests GitHub and CI/CD integrations Remote runner support Kubernetes resource boundaries Cloud deployment policies Organisation-level policy packs Durable audit storage Signed audit records Team-based approval workflows Fine-grained API keys and quotas Additional coding-agent integrations Policy simulation before execution Historical risk analytics I also see Scope Guard evolving into a standard safety layer that sits between coding agents and developer infrastructure. As agents become more capable, the important question will no longer be whether they can perform an operation. It will be whether that operation belongs to the task, respects the intended project boundary, and can be safely reversed. That is the problem Scope Guard is designed to solve. Let coding agents move fast without letting them wander.
Scope Guard
Let coding agents move fast—without letting them wander.
Scope Guard, internally codenamed Codex Sentry, is an intent-bound execution control plane for coding agents. It lets a structured planner interpret a task and propose a boundary, while a deterministic policy engine stands between every proposed action and the isolated execution runner.
Live demo: scopeguard-vert.vercel.app. It needs no judge-supplied API credentials, is disconnected from production infrastructure, and uses a safe, resettable synthetic environment. The complete writable Docker sandbox remains local by design.

Judge quick start
- Public demo: scopeguard-vert.vercel.app
- Repository: github.com/gethsun1/scope-guard
- Safety profile: no production infrastructure is connected. The hosted demo is deterministic, resettable, and requires no API key; the local version uses the complete writable Docker sandbox.
Fastest path through the deployed application:
- Open Guarded task and use the seeded RD Social instruction.
- Review and approve the proposed boundary.
- Open Execution and start execution.
- Inspect the blocked EngageFlow action.
- Approve the corrected RD Social action.
- Observe failure injection, target-only rollback, and protected-resource integrity.
- Review or download the report.
- Open SentryBench to inspect the generated policy results.
The public demo and local writable sandbox intentionally have different safety profiles. For the real containerized runner, use the complete local Docker instructions and the local end-to-end verification notes.
The problem
Shared development environments make scope drift dangerous: an agent can successfully deploy the requested service while also restarting a neighbor, reading an unrelated secret, or migrating the wrong database. A normal sandbox answers what is technically reachable. Scope Guard also asks whether the action belongs to the approved task and project.
Thirty-second explanation
- A structured planner interprets natural-language intent and proposes a typed boundary. Live mode uses GPT-5.6; the public sandbox uses a clearly labeled deterministic provider with the same validated schema.
- A person approves the target, protected resources, validation plan, and rollback plan.
- Codex proposes actions, and a deterministic engine parses and evaluates every proposed operation.
- Allowed actions run through the isolated predefined-operation runner; protected actions are blocked before execution.
- Target health checks, protected-resource integrity, rollback, and a hash-chained audit report provide evidence of the result.
Signature scenario
Update and deploy RD Social, run its approved migration, restart its API, and verify its health without modifying EngageFlow.
The deterministic demo Codex adapter first edits RD Social, then mistakenly proposes
systemctl restart engageflow-api. Scope Guard returns BLOCK_PROTECTED_RESOURCE and a
structured correction. The corrected RD Social restart requires approval. Failure injection
then makes RD Social unhealthy, triggers target-only rollback, and proves EngageFlow retained
the same hash and health state.
Features
- Typed project inventory and resource graph
- GPT-5.6 Responses API adapter plus clearly labeled offline demo planner
- Read-only Codex app-server proposal adapter plus deterministic
codex_demoevent provider - Structured command parsing, normalized paths, and deterministic deny-by-default policy
- Explicit boundary and medium/high-risk action approvals
- Non-root Docker runner with no socket, host-root, privileges, secrets, or external network
- Snapshots, target validation, protected-resource verification, and task-scoped rollback
- SSE audit timeline and downloadable JSON/Markdown execution reports
- 32-scenario SentryBench with generated metrics
- Responsive DevOps control-plane interface—not a chat wrapper
Architecture
flowchart LR
U[Developer] --> W[Next.js control plane]
W --> A[FastAPI orchestrator]
A --> P[Planner: GPT-5.6 live or deterministic demo]
A --> C[Codex adapter]
C --> E[Deterministic policy engine]
E -->|allow / approval| R[Predefined Docker runner]
E -->|block + context| C
R --> RD[RD Social target]
R -. integrity only .-> EF[EngageFlow protected]
A --> AU[Hash-chained audit]
This diagram represents the complete local execution topology. The hosted demo replaces the writable Docker runner with a synthetic in-memory state machine that has no shell or Docker access.
Details: architecture and threat model.
Responsibility split
GPT-5.6 interprets intent, proposes a typed boundary, explains risk, and drafts validation and rollback plans. Its strict JSON is validated, but it never grants authority.
Codex accelerated implementation and can propose development actions, receive structured
policy rejection, revise an action, and continue the guarded workflow. codex_demo is the
reproducible deterministic event provider. codex_live is the read-only app-server adapter; its
manual smoke test verified startup, schema validation, four typed proposals, and thread capture.
That smoke was proposal-only: it did not run the Docker workflow or execute a corrected action set.
The deterministic policy engine is final authority. It parses actions, extracts resources, matches the approved manifest, denies unknown resources, detects destructive and protected operations, and determines allow, approval, or block outcomes. It overrides any conflicting model recommendation.
How I used Codex and GPT-5.6
Codex
I built Scope Guard primarily through one Codex IDE session. Codex accelerated the monorepo scaffolding; FastAPI and Next.js implementation; typed domain models; command parsing and deterministic policy enforcement; Docker fixtures; block, correction, approval, validation, and rollback workflows; audit and reporting; frontend work; backend and frontend tests; Playwright verification; SentryBench; WSL and Docker troubleshooting; deployment preparation; and the final documentation and submission evidence.
I reviewed the output and retained responsibility for the product and trust-boundary decisions.
The Codex /feedback session ID is supplied privately in the Devpost form and is intentionally not
published in this repository.
GPT-5.6
Scope Guard implements a GPT-5.6 Responses API planner adapter. It converts a natural-language task, infrastructure inventory, resource relationships, constraints, and supported operations into schema-validated structured output containing:
- interpreted intent and target project
- allowed and protected resources
- proposed actions and a risk summary
- validation and rollback plans
- confidence and open questions
GPT-5.6 does not authorize actions. Malformed output fails schema validation, model output cannot silently expand an approved manifest, and the deterministic policy engine has final authority. The public demo uses a deterministic planner that implements the same validated schema.
The repository records GPT-5.6 as the implemented live planner, but it does not independently record the underlying model configuration of the primary Codex development session. I therefore do not claim here that GPT-5.6 powered that session.
Decisions I retained as the developer
I chose to focus on semantic scope drift rather than generic shell access. I kept model reasoning outside the enforcement boundary, gave deterministic policy final authority, denied unknown resources by default, and required approval for medium- and high-risk mutations. I also chose synthetic infrastructure, independent protected-project validation, predefined operations, target-specific rollback, and a safe, reproducible hosted demo rather than connecting the project to production systems.
The build history and rationale are documented in the Codex collaboration history and product decisions.
Security model
Unknown resources are denied. Model output cannot expand a manifest. Mutations are approval
gated and snapshotted. The runner exposes only named demo operations, runs as UID 10001 with
all Linux capabilities dropped, a read-only root, CPU/memory limits, and an internal Docker
network. Neither /, SSH material, nor /var/run/docker.sock is mounted.
Requirements
- Supported development systems: Linux and WSL2. macOS may work with Docker Desktop but is not part of the verified matrix; Windows should use WSL2.
- Docker Desktop/Engine with Compose v2+
- Python 3.11+ and uv
- Node.js 20+ and pnpm 11+
- GNU Make (optional wrapper; direct commands below work without it)
Setup
cp .env.example .env
uv sync --all-groups
pnpm install
No paid credential is needed with DEMO_MODE=true.
Run locally
# Complete isolated signature environment
docker compose -f demo/docker-compose.demo.yml up --build -d --wait
# Frontend (separate terminal)
NEXT_PUBLIC_API_URL=http://localhost:8000 pnpm --filter web dev
Open http://localhost:3000. The API OpenAPI UI is at http://localhost:8000/docs.
State-changing API examples use X-Demo-Token: scope-guard-demo; this is explicitly local
demo authentication and must be changed or replaced for a hosted environment.
Demo
- Open Guarded task and interpret the seeded instruction.
- Review and approve the deterministic demo manifest.
- Open Execution, start execution, and inspect the blocked EngageFlow action.
- Approve the corrected RD Social restart.
- Observe failed target health, rollback, protected integrity, and download the report.
Reset everything deterministically:
docker compose -f demo/docker-compose.demo.yml down -v --remove-orphans
docker compose -f demo/docker-compose.demo.yml up --build -d --wait
See the under-three-minute script.
Environment variables
.env.example documents all settings. Live planning requires DEMO_MODE=false, an
OPENAI_API_KEY, and a supported OPENAI_MODEL. Live Codex requires the codex CLI with
app-server support and existing authentication. Never place secrets in prompts, logs, or
committed files. Manual smoke commands are make smoke-gpt and make smoke-codex (or their
documented underlying commands); neither runs in CI.
SentryBench
PYTHONPATH=apps/api uv run python evaluations/sentrybench/run.py
This writes actual results to evaluations/sentrybench/results/latest.json and .md. The
committed latest run contains 32/32 expected decisions; rerun it on your machine rather than
treating old results as immutable claims.
Test and build
uv run ruff check .
uv run mypy apps/api
uv run pytest -q
pnpm test
pnpm lint
pnpm typecheck
pnpm build
docker compose -f demo/docker-compose.demo.yml config --quiet
For a fresh-clone, non-destructive prerequisite/install/test pass, run
./scripts/verify-clean-clone.sh. It never installs system packages, starts containers, removes
volumes, or reads secrets. To verify the hosted synthetic workflow, set FRONTEND_URL, API_URL,
and DEMO_API_TOKEN, then run ./scripts/verify-hosted-demo.sh; the token is never printed.
Download a task report from the Execution screen, or request
GET /api/tasks/{task_id}/report?format=json (use format=md for Markdown).
With GNU Make installed: make test, make lint, make typecheck, make e2e, make eval,
make build, or make verify.
On Ubuntu, install the optional wrapper with sudo apt-get update && sudo apt-get install -y make.
Deployment
The Next.js app is Vercel-compatible. The FastAPI image and railway.json are
Railway-compatible. SQLite is for a single-instance demo only; production should use
PostgreSQL and durable audit storage. The writable Docker scenario belongs on an isolated,
unprivileged container host. See deployment guidance.
Current limitations
- Inventory is registered synthetic data, not host discovery.
- Task state is process-local; SQLite/PostgreSQL persistence is the next production step.
- The public deployment intentionally uses the deterministic planner for reliability and does not require judge-supplied credentials.
- The GPT-5.6 Responses API adapter is implemented, schema-validated, and available through
configuration. The final API-account smoke request reached OpenAI but could not complete because
that API account returned
insufficient_quota; the result and its limits are documented in live provider verification. - Shell analysis intentionally supports a constrained subset; execution is predefined only.
- Local demo authentication is not enterprise identity.
Roadmap
Durable PostgreSQL state, signed audit export, OAuth/SSO, organization policy packs, repository-aware inventory adapters, richer shell AST support, and deployment-provider integrations—without granting a model final policy authority.
Hackathon disclosure
Built for the OpenAI Build Week Developer Tools category. Codex accelerated implementation, review, debugging, tests, container verification, and documentation. GPT-5.6 is integrated as the live structured planner adapter; the credential-free demo uses the same schema and clearly labels deterministic output. See Codex collaboration history.
License
Analysis
View
Metric
- 17
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- CSSIn code
- FastAPIIn code
- Next.jsIn code
- OpenAIIn code
- PythonIn code
- ReactIn code
- TypeScriptIn code
- DockerClaimed
7 of 8 appear in the indexed code. 1 claimed on Devpost could not be matched to code, which may simply mean the tool leaves no trace in the repository.
AI coding agents
- CodexConfig
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
359 KB
Source files
64
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
gethsun1/scope-guard
99 files · 1.5 MB · @ c3fd51d
Structure
Interface
8 files · 8%Screens, components and styles rendered to the user.
API & routing
13 files · 13%Request entry points: routes, handlers and controllers.
Application logic
16 files · 16%Domain rules, services and shared utilities.
Background jobs
1 file · 1%Work run outside a request: tasks, workers and schedules.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here — open the file browser to check anything the diagram implies.
Languages
- YAML50%
- Python21%
- Markdown15%
- TypeScript8%
- CSS4%
- Shell1%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
apps/web/package.json
npm · 22- @tanstack/react-query
- lucide-react
- next
- react
- react-dom
- recharts
- zod
- +15 more
pyproject.toml
pypi · 7- aiosqlite
- fastapi
- httpx
- openai
- pydantic-settings
- sqlalchemy
- uvicorn[standard]
Declared in the repository’s manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
This project’s features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.