An autonomous AI developer that opens pull requests without strict guardrails will quickly flood your repository with inconsistent patterns, messy imports, and formatting violations. Sweep handles this problem through a single root configuration file: sweep.yaml.
At 365Finds, we evaluate AI developer tools on how effectively they bridge the gap between probabilistic LLM generation and deterministic CI requirements. Sweep succeeds here only when you set up a dual-layer enforcement model. Natural language instructions in rules: tell the model what patterns to write, while the isolated sandbox: check commands force Sweep to run your linters and fix its own errors before you ever see a PR.
Here is how to configure both layers to match your production pipeline.
1. Where sweep.yaml Lives and How It Works
Place sweep.yaml (or .sweep.yaml) in the root directory of your repository on your default base branch (typically main).
Sweep reads this file on every trigger—whether invoked via a GitHub issue, an inline comment, or an issue comment. The file splits code quality control into two distinct mechanisms:
- Prompt-Layer Directives (
rules,description): Injected directly into Sweep’s system context to guide generation before code is written. - Runtime Verification (
sandbox,gha_enabled): Commands executed inside an isolated sandbox after code is generated. If a check command exits with a non-zero code, Sweep captures stderr and iterates on the file until the check passes.
Core Configuration Keys
| Key | Type | Purpose |
|---|---|---|
rules | List of strings | Specific architectural constraints, library choices, and conventions Sweep must respect. |
sandbox | Object | Defines install and check bash commands executed inside Sweep's verification environment. |
description | String | High-level summary of repository stack, directory layout, and architectural conventions. |
gha_enabled | Boolean | When true, Sweep reads failed GitHub Actions logs and attempts auto-correction. |
blocked_dirs | List of strings | Directories Sweep is forbidden from reading or altering (e.g., migrations, vendor folders). |
draft | Boolean | When true, opens all Sweep PRs as GitHub draft pull requests. |
branch | String | Target base branch for Sweep branches and PRs (defaults to main). |
2. Defining Natural Language Coding Standards with rules:
The rules: key accepts an array of imperative strings. Do not use this section for trivial whitespace formatting; Prettier and Ruff handle that deterministically. Instead, reserve rules: for library selection, error-handling conventions, and architectural boundaries that linters cannot easily parse.
Here is an example configuring strict Python and TypeScript patterns:
# sweep.yaml
branch: "main"
draft: false
gha_enabled: true
description: "FastAPI backend with a React TypeScript frontend managed in a monorepo."
blocked_dirs:
- "alembic/versions"
- "dist"
- "build"
- "node_modules"
rules:
# Library and pattern enforcement
- "Use Loguru for all backend logging. Never use standard library logging or raw print statements."
- "For backend error handling, raise HTTPException from fastapi with structured detail dictionaries."
- "Use modern Python 3.10+ type annotations (list[str], dict[str, Any], int | None) instead of typing module equivalents."
# Architectural boundaries
- "All database queries must go through repository classes in app/repositories/; never make raw SQL calls inside routers."
- "Every newly introduced backend route must include a matching test file in tests/ matching test_*.py naming."
# Frontend conventions
- "Use Tailwind CSS utility classes exclusively; do not create separate CSS module files."
- "Frontend state management must use TanStack Query for server state; do not sync server responses into Redux."
- "All React functional components must have explicit return types and typed props interfaces."
At 365Finds, our testing shows that keeping rules: under eight to ten crisp, declarative statements delivers significantly higher adherence than long, discursive rulebooks. When prompts become overloaded with conflicting style suggestions, models begin ignoring lower-ranked instructions.
3. Enforcing Linters and Formatters via sandbox:
Natural language prompt rules guide code generation, but they do not guarantee compliance. The sandbox block turns your repository's existing linters into an automated feedback loop.
The sandbox lifecycle operates in two phases:
install: Runs shell commands to configure runtime dependencies and install linters.check: Runs formatting, linting, or typechecking commands against modified files.
Sweep provides a special {file_path} variable. When present, Sweep substitutes {file_path} with the exact file it just touched, keeping check cycles under a few seconds rather than analyzing the entire repository.
Setup for Python Projects (Ruff, Flake8, MyPy)
sandbox:
install:
- pip install ruff mypy
check:
- ruff format {file_path}
- ruff check --fix {file_path}
- mypy {file_path}
If ruff check detects an unused import or undefined variable, Sweep reads the error output, applies a fix, re-runs the sandbox check, and only pushes the commit once the exit status is 0.
Setup for TypeScript / Node.js Projects (ESLint, Prettier, TSC)
sandbox:
install:
- yarn install --frozen-lockfile --ignore-engines
check:
- yarn prettier --write {file_path}
- yarn eslint --fix {file_path}
- yarn tsc --noEmit
Setup Using Trunk
If your repository already runs Trunk as a universal linter manager, Sweep integrates with it out of the box:
sandbox:
install:
- trunk init
check:
- trunk fmt {file_path}
- trunk check {file_path}
4. Closing the Loop with GitHub Actions (gha_enabled)
Local file-level checks inside sandbox: cannot always catch distributed regressions, such as integration test breakages or database schema conflicts.
Setting gha_enabled: true connects Sweep to your existing GitHub Actions workflows:
gha_enabled: true
When Sweep pushes a branch and an existing CI workflow fails, Sweep intercepts the workflow run logs, identifies the failing test or assertion, and creates a supplementary commit addressing the issue.
365Finds recommends keeping gha_enabled: true alongside sandbox. While sandbox intercepts 90% of syntax, lint, and formatting bugs locally in seconds, gha_enabled serves as the final safety net for broader end-to-end test suites.
5. 365Finds Strategic Assessment & Common Pitfalls
Through our evaluations of autonomous code generators, teams configuring Sweep usually run into three common operational traps:
- Attempting to replace linters with prompt rules: Asking Sweep in
rules:to "always indent with 2 spaces" or "alphabetize imports" wastes context tokens and produces inconsistent results. Leave formatting to Prettier, Black, or Biome insandbox.check, where execution is instant and deterministic. - Heavy sandbox install steps: If your
sandbox.installscript executes a full container build or downloads gigabytes of development assets, Sweep's turnaround time per task will balloon from two minutes to twenty minutes. Only install the linters and minimal dependencies needed to run static checks on{file_path}. - Omitting
blocked_dirs: Failing to block generated asset folders (dist/,coverage/,.next/) risks Sweep attempting to refactor bundled artifacts or large lockfiles, rapidly exhausting context windows.
Sweep's sandbox container executes as an unprivileged Linux environment with internet access; commands specified under install and check run sequentially using /bin/sh.