scope-guard

v0.1.3
io.github.mdfifty50-boop/scope-guard Checked 2 days ago Published 7 months ago

Hard scope boundaries to prevent AI agent drift

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

create_scope_contract

Define an agent's scope boundaries: allowed/forbidden tools, file access paths, and delegation limits.

ParameterTypeDescription
agent_id *stringUnique identifier for the agent
allowed_files *arrayFile path patterns the agent can access. Supports glob-like prefixes (e.g. "src/lib/*"). Empty array means all files allowed.
allowed_tools *arrayList of tools the agent is permitted to use. Empty array means all tools allowed.
description *stringHuman-readable description of what this agent is responsible for
forbidden_tools *arrayList of tools the agent is explicitly forbidden from using. Takes priority over allowed_tools.
max_delegationsintegerMaximum number of delegations this agent can make before being told to execute directly (default 3)

validate_action

Check if a proposed action (tool call, file access) is within an agent's scope contract. Call this BEFORE the agent executes.

ParameterTypeDescription
agent_id *stringAgent identifier to validate against
tool_name *stringName of the tool the agent wants to call
file_pathstringFile path the agent wants to access (optional)

detect_delegation_loop

Check a delegation chain for circular patterns. Detects when agents delegate back to each other creating infinite loops.

ParameterTypeDescription
delegation_chain *arrayOrdered list of delegation steps to analyze

log_agent_action

Track what an agent is doing. Logs tool calls, delegations, file accesses, and completions for compliance monitoring and duplication detection.

ParameterTypeDescription
action_type *stringType of action being performed
agent_id *stringAgent identifier
details *objectAction details — for tool_call: {tool_name, args, file_path}; for delegation: {to, task}; for file_access: {file_path, operation}; for completion: {result}

get_compliance_report

Get a compliance summary for all agents: total actions, scope violations, delegation counts, and scope utilization percentage.

detect_work_duplication

Find agents doing the same work. Compares action logs across all agents — if 2+ agents called the same tool with similar arguments, flags as potential duplication.