Skip to main content

scoped-agent-control

scoped-agent-control is a framework for enforcing role-based, scoped AI interactions with a codebase.

It allows teams to define exactly who can read or modify which parts of a repository and under what constraints. Simple inline annotations and a repo-level config enable AI agents (e.g. Claude Code, Codex, etc.) to operate within approved, role-specific boundaries.

In practice, this enables non-technical users (e.g. PMs, GTM, etc.) to safely make targeted changes without risking unintended or disallowed side effects across the system.

Install

pipx install git+https://github.com/Shriram-Vasudevan/scoped-agent-control
# or
uv tool install git+https://github.com/Shriram-Vasudevan/scoped-agent-control

Both put scoped-control on PATH globally. Requires Python 3.12+.

For local development:

git clone https://github.com/Shriram-Vasudevan/scoped-agent-control
cd scoped-agent-control
uv sync --dev
uv run scoped-control

Quick start

cd path/to/any/repo
scoped-control

The TUI opens. On first run, a wizard asks four questions — role name, description, what to read, what to edit. Press Enter to accept defaults. Setup writes .scoped-control/config.yaml and drops into the main console.

Commands

Type slash commands at the TUI prompt:

Command Purpose
/setup (or /init) Guided role wizard
/role list | add | edit | remove Manage roles
/surface list | show <id> Inspect indexed surfaces
/scan Rebuild the index
/query <role> <request> Scoped read
/edit <role> <request> Scoped edit with enforcement
/annotate --role <name> Add file-scope annotations
/cleanup --dry-run | --force Remove all artifacts
/install claude-code | github | slack Install integrations
/help, /clear, /quit TUI controls

The same commands work as CLI subcommands without the slash:

scoped-control role list
scoped-control query maintainer "explain the auth flow"
scoped-control edit recruiter "update the careers intro" --executor codex

CLI-only commands (long-running or guided):

Command Purpose
triage <request> Classify a request without running it
install slack-bot Guided Slack bot setup with auto-tunneling
serve-slack Run the Slack bot server
remote-edit --event-file <path> Process a GitHub remote-edit payload
remote-triage --event-file <path> Process a GitHub remote-triage payload

End-to-end example

$ cd ~/my-repo
$ scoped-control
# Wizard:
#   Role name → recruiter
#   Description → Recruiting copy editor
#   Read → careers folder and hiring docs
#   Write → only careers/**/*.md
# Output: Role `recruiter` created.

# In the TUI prompt:
> /query recruiter what does the careers intro say
> /edit recruiter update the careers intro to mention remote work

# Or from a shell:
$ scoped-control triage "refactor src/auth.py"
Triage decision: mode=blocked role=None
Reason: No configured role has edit access to the requested target(s).

Slack bot

scoped-control install slack-bot

A guided five-step flow:

  1. Starts a public tunnel (cloudflared preferred, ngrok fallback).
  2. Prints a Slack app manifest with the URL pre-filled.
  3. Prompts for the Signing Secret.
  4. Waits for "Install to Workspace" in the Slack admin UI.
  5. Smoke-tests the round trip and prints a team announcement template.

Total time: ~3 minutes. Requires cloudflared or ngrok on PATH. The tunnel URL is valid only while the process runs; production deployments need a stable domain.

GitHub workflows

scoped-control install github

Writes two workflow_dispatch workflows:

  • scoped-control.yml — explicit role + request.
  • scoped-control-triage.yml — triage picks the role and mode from a request alone.

Add ANTHROPIC_API_KEY and/or OPENAI_API_KEY as Actions secrets before running.

Claude Code slash commands

scoped-control install claude-code

Writes .claude/commands/sc-{setup,triage,query,edit,surfaces}.md. The slash commands work inside any Claude Code session in the repo.

Annotations

Setup writes config only; no files are modified. Files matching a role's globs are accessible without per-file annotations — the resolver synthesizes whole-file surfaces on demand.

Annotations are inline overrides for two cases:

  • Carve-outs — restrict one file to a narrower role than its directory's role.
  • Span rules — invariants: span_scope limits edits to a specific function or class.
# surface: core.compute_total
# roles: maintainer
# modes: query, edit
# invariants: span_scope
def compute_total(items):
    ...

Fields: surface, roles, modes, invariants, depends_on. # and // comment styles supported.

Apply with /annotate --role <name> or scoped-control setup --annotate-files.

Enforcement

Edits run in a sandbox workspace and pass through:

  • Scope — target file matches edit_paths.
  • Span — modifications stay within the target surface's line range.
  • Diff limit — limits.max_changed_files, limits.max_diff_lines.
  • Validators — commands listed under validators: with mode edit.

Failures roll back the sandbox and surface the reason.

Configuration

.scoped-control/config.yaml:

roles:
  - name: recruiter
    description: Recruiting copy editor
    query_paths: ["careers/**"]
    edit_paths: ["careers/**/*.md"]

limits:
  max_changed_files: 5
  max_diff_lines: 400

validators:
  - name: lint
    command: "ruff check"
    modes: [edit]

Testing

uv run pytest

Metadata

Release files for scoped-agent-control 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scoped-agent-control 0.2.0
File Size Uploaded Provenance
scoped_agent_control-0.2.0.tar.gz 70.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for scoped-agent-control 0.2.0
File Interpreter ABI Platform
scoped_agent_control-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 163.2 kB

Release files / scoped_agent_control-0.2.0.tar.gz

Download URL scoped_agent_control-0.2.0.tar.gz
Size 70.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2673361d1bde1df1eaa7d0a397e732950c7452045a18c299b21aca071053ec49
BLAKE2b-256 checksum
How to use checksums
51daf92d19ea6eab7e46386994dcc196adaac8953a0989e5fe1d43ec79ee4e88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 13, 2026.

Transparency log

Release files / scoped_agent_control-0.2.0-py3-none-any.whl

Download URL scoped_agent_control-0.2.0-py3-none-any.whl
Size 92.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7a94769448be6115559156b3a9a6388e32e6d196a9c09c522e9e766b37bf72a4
BLAKE2b-256 checksum
How to use checksums
e7350135dc9ca47094e9c8d05d4ab715b9f7d8caecd9d52a9b7b8328b7f1fe88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 13, 2026.

Transparency log

Security for scoped-agent-control 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for scoped_agent_control-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 13, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page