Role-based, scoped AI query/edit operations for any codebase.
Project description
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:
- Starts a public tunnel (
cloudflaredpreferred,ngrokfallback). - Prints a Slack app manifest with the URL pre-filled.
- Prompts for the Signing Secret.
- Waits for "Install to Workspace" in the Slack admin UI.
- 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_scopelimits 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 modeedit.
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scoped_agent_control-0.2.0.tar.gz.
File metadata
- Download URL: scoped_agent_control-0.2.0.tar.gz
- Upload date:
- Size: 70.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2673361d1bde1df1eaa7d0a397e732950c7452045a18c299b21aca071053ec49
|
|
| MD5 |
c4967943569ae1ddc1e590599ae52404
|
|
| BLAKE2b-256 |
51daf92d19ea6eab7e46386994dcc196adaac8953a0989e5fe1d43ec79ee4e88
|
Provenance
The following attestation bundles were made for scoped_agent_control-0.2.0.tar.gz:
Publisher:
publish-pypi.yml on Shriram-Vasudevan/scoped-agent-control
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scoped_agent_control-0.2.0.tar.gz -
Subject digest:
2673361d1bde1df1eaa7d0a397e732950c7452045a18c299b21aca071053ec49 - Sigstore transparency entry: 1290624226
- Sigstore integration time:
-
Permalink:
Shriram-Vasudevan/scoped-agent-control@95b99c5c02edfb31e863988b034ae21e23134812 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/Shriram-Vasudevan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@95b99c5c02edfb31e863988b034ae21e23134812 -
Trigger Event:
push
-
Statement type:
File details
Details for the file scoped_agent_control-0.2.0-py3-none-any.whl.
File metadata
- Download URL: scoped_agent_control-0.2.0-py3-none-any.whl
- Upload date:
- Size: 92.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a94769448be6115559156b3a9a6388e32e6d196a9c09c522e9e766b37bf72a4
|
|
| MD5 |
d86390d4028fba79705eaaccc5e48cc7
|
|
| BLAKE2b-256 |
e7350135dc9ca47094e9c8d05d4ab715b9f7d8caecd9d52a9b7b8328b7f1fe88
|
Provenance
The following attestation bundles were made for scoped_agent_control-0.2.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on Shriram-Vasudevan/scoped-agent-control
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scoped_agent_control-0.2.0-py3-none-any.whl -
Subject digest:
7a94769448be6115559156b3a9a6388e32e6d196a9c09c522e9e766b37bf72a4 - Sigstore transparency entry: 1290624305
- Sigstore integration time:
-
Permalink:
Shriram-Vasudevan/scoped-agent-control@95b99c5c02edfb31e863988b034ae21e23134812 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/Shriram-Vasudevan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@95b99c5c02edfb31e863988b034ae21e23134812 -
Trigger Event:
push
-
Statement type: