Generic AI suggestions are the fastest way to clutter a clean codebase. Left unguided, GitHub Copilot will happily propose deprecated APIs, violate your layered architecture, or invent utility methods that already exist elsewhere in your repository. Sweep, acting as an autonomous background contributor on GitHub issues, will generate pull requests that fail your continuous integration pipeline simply because it didn't know you preferred Zod over Joi or loguru over standard Python logging.
At 365Finds, we consider repository-level configuration mandatory rather than optional. If you want AI assistants to act like seasoned teammates instead of reckless interns, you must anchor them to your repository's conventions.
Fortunately, GitHub Copilot and Sweep approach this problem through complementary, Git-tracked configuration files: .github/copilot-instructions.md for interactive developer workflows, and sweep.yaml for autonomous PR generation. Here is how to configure both, keep them aligned, and eliminate style drift across your team.
1. Configuring GitHub Copilot via .github/copilot-instructions.md
GitHub Copilot reads repository-wide instructions through a dedicated Markdown file placed directly inside your repository. When a developer triggers Copilot Chat, uses Copilot in VS Code or Visual Studio, or requests Copilot Code Review, this file is loaded into the prompt context.
File Location
Create the file at:
.github/copilot-instructions.md
(If you are hosting on Azure DevOps, the equivalent path is .azuredevops/copilot-instructions.md.)
Core Content to Include
365Finds strongly advises keeping this file concise—under 250 lines. Large documents waste context window space and dilute model attention. Focus strictly on what Copilot cannot guess from inspecting a single file:
- Tech Stack & Explicit Versions: List language versions, runtime targets, and major frameworks.
- Directory Architecture: State which layers hold business logic, controllers, database models, and types.
- Strict Invariants and Anti-Patterns: Tell Copilot what it is strictly forbidden from doing (e.g., raw SQL strings,
anytypes in TypeScript, mutative state updates). - Testing and Linting Commands: Specify test runners and formatting tools so Copilot suggests appropriate commands during chat sessions.
Concrete Example
# Repository Coding Standards & Architecture
## Tech Stack
- TypeScript 5.4, Node.js 20 LTS, Next.js 14 (App Router)
- PostgreSQL with Prisma ORM
- Zod for payload schema validation
- Vitest for unit testing
## Architectural Boundaries
- Server Actions & Route Handlers reside in `app/api/` or `app/actions/`.
- Core domain logic must live in `lib/services/`. Do not execute database queries inside React components.
- Database models must only be imported through `lib/db.ts`.
## Coding Conventions
- Always declare explicit return types on public functions. Never use `any`.
- Prefer functional components and named exports.
- Use early returns to reduce indentation depth.
- Handle expected errors using custom domain classes (`AppError`), not bare string throws.
## Commands
- Lint: `pnpm run lint`
- Typecheck: `pnpm run typecheck`
- Test: `pnpm run test:unit`
2. Configuring Sweep via sweep.yaml
While GitHub Copilot assists the engineer writing code in the IDE, Sweep operates asynchronously. It reads GitHub issues, inspects the codebase, plans changes, and submits ready-to-review pull requests.
Because Sweep generates commits autonomously, its configuration file—sweep.yaml—requires structured operational parameters alongside coding guidelines.
File Location
Place the configuration file at the root of your repository:
sweep.yaml
Key Configuration Keys
rules: A list of explicit natural language constraints passed into Sweep's code generation prompts.description: A high-level description of what the project does and where core modules live, aiding Sweep's code-search and retrieval mechanisms.blocked_dirs: Directories Sweep must never modify, such as generated code, legacy folders, or migration histories.sandbox: Commands Sweep executes in an isolated environment to verify that its own code compiles, lints, and passes tests before opening a pull request.branch: The target base branch for pull requests (typicallymain).
Concrete Example
# sweep.yaml
branch: "main"
gha_enabled: true
draft: false
# Contextual summary for Sweep's RAG index
description: >
Next.js 14 App Router project written in TypeScript.
Domain logic sits in lib/services, and tests live in tests/.
We use Prisma for database operations and Zod for validation.
# Paths Sweep is forbidden from editing
blocked_dirs:
- "prisma/migrations/"
- ".github/workflows/"
- "dist/"
# Coding standards enforced during generation
rules:
- "Always define Zod validation schemas for any incoming request payload."
- "Do not write database queries inside API route handlers; call services in lib/services instead."
- "Never use TypeScript 'any'; explicitly type all parameters and returns."
- "All new utility functions or service methods must include a matching unit test in tests/."
- "Use pnpm rather than npm or yarn for all package references."
# Pre-PR validation sandbox
sandbox:
install:
- pnpm install --frozen-lockfile
check:
- pnpm run typecheck
- pnpm run lint
- pnpm run test:unit
3. Comparing the Enforcement Mechanisms
365Finds views these two tools not as competitors, but as two checkpoints along the development lifecycle. Understanding how each engine applies rules prevents team frustration.
| Feature / Dimension | GitHub Copilot (.github/copilot-instructions.md) | Sweep (sweep.yaml) |
|---|---|---|
| Execution Surface | Real-time in IDE (Chat, inline suggestions, PR review) | Asynchronous GitHub bot (Issue to PR) |
| Configuration Format | Markdown (.md) | YAML (.yaml) |
| Enforcement Method | Prompt context injection in chat and code generation | Prompt rules plus active sandbox test execution |
| Directory Scope Control | Contextual Markdown files (or scoped .instructions.md) | Explicit blocked_dirs array |
| Self-Verification | None natively in editor; relies on local developer runner | sandbox.check runs linters and test suites before PR creation |
| Best Suited For | Interactive drafting, immediate style hints, in-editor reviews | Chores, isolated bugfixes, automated refactoring PRs |
4. How 365Finds Recommends Managing Both
Maintaining two configuration files often risks rule divergence. When the team adopts a new linter rule or replaces an ORM, someone updates Copilot's prompt and forgets Sweep, or vice versa.
To keep both tools strictly in sync, 365Finds recommends the following workflow:
- Treat
.github/copilot-instructions.mdas the human-readable specification. Write your architecture principles, banned patterns, and style preferences there in clear bullet points. - Derive
sweep.yamlrules as an exact subset of those bullet points. Each bullet incopilot-instructions.mdthat governs code syntax or import boundaries should map directly to an entry underrules:insweep.yaml. - Leverage Sweep's
sandbox.checkas the ultimate filter. While Copilot cannot run tests for you before suggesting a snippet, Sweep can. Adding your linter and test command tosandbox.checkensures that even if Sweep bends a prompt rule, your automated test suite catches it before human review. - Focus on negative constraints. Generative AI models struggle with broad positive affirmations like "Write clean, maintainable code." They excel when given precise negative boundaries: "Never use
console.loginsrc/", "Do not import lodash directly; use lodash-es", or "Never query Prisma inside UI components."
Both files live in Git alongside your code, meaning modifications to coding standards go through regular pull request reviews. When you change an architectural convention, the prompt updates land in the exact same commit as the code change.