Skip to content

API Reference parrot.sdd.scripts.agy_permissions

github-actions[bot] edited this page Dec 2, 2026 · 2 revisions

parrot.sdd.scripts.agy_permissions

View source

Antigravity (agy) PreToolUse permission policy for the SDD command surface (brief agy-permission-hook).

agy (1.4.12) runs a shell command without asking only when a permissions.allow rule in the user's settings matches it. A PreToolUse hook can deny a command, force_ask (prompt even though a rule matches) or ask (leave the decision to the rules); a hook allow is accepted but ignored. This module therefore carries both halves of the policy:

  • :data:SDD_ALLOW_RULES — the managed agy rules that parrot sdd install --host google merges into the user's agy settings, broad enough for /sdd-spec, /sdd-task, /sdd-brief and /sdd-fix;
  • :func:evaluate — the hook that narrows those rules: deny for destructive commands (the C32 dangerous-actions rules plus a push to the hotfix branch), force_ask for anything a managed rule would approve that the policy cannot positively classify as routine, ask otherwise. A command no managed rule covers is never escalated: agy prompts for it anyway.

High-risk commands (git push|switch|merge|config|remote|worktree|checkout, parrot sdd, wikitoolkit) are judged against positive allowlists of options and verbs, so short-option clusters, long-option abbreviations and unknown flags fall to force_ask. Read-only tools are judged by where their path arguments resolve (attached option values, brace expansion and symlinks included). Heredocs and newlines are parsed quote-aware.

It is a narrowing layer on top of agy's own matching, not a sandbox: an approved pytest runs repository code by design. Served as parrot sdd hooks agy-permissions --hook; :func:main always exits 0 and writes one JSON object. Only the stdlib and the sibling dangerous_actions guard are imported at module level; parrot.sdd.config is loaded lazily and guarded.

Class Decision

Outcome of :func:evaluate, in agy's hook vocabulary.

Parameter Type Default Description
decision Literal['deny', 'force_ask', 'ask']
reason str ''
overwrite dict[str, str] | None None

Fields:

Field Type Default Description
decision Literal['deny', 'force_ask', 'ask']
reason str ''
overwrite dict[str, str] | None None

Attribute GIT_SUBCOMMANDS

Type: frozenset[str]

Attribute RULE_WORDS

Type: tuple[tuple[str, ...], ...]

Attribute SDD_ALLOW_RULES

Type: tuple[str, ...]

Attribute UNATTENDED_ENV

Alias dangerous_actions

Re-exported from parrot.sdd.scripts.dangerous_actions.

Function evaluate

Combine command policy and worktree verdict for one agy PreToolUse payload.

evaluate(payload: dict[str, Any], *, root: Path | None) -> Decision

Parameter Type Default Description
payload dict[str, Any]
root Path | None

Returns: Decision

Function main

Serve the agy PreToolUse hook: read the payload on stdin, write one JSON object, always exit 0.

main(argv: Sequence[str] | None = None) -> None

Parameter Type Default Description
argv Sequence[str] | None None

Function rule_covers

Whether a managed rule matches one simple command, using agy's word-prefix matching.

rule_covers(words: Sequence[str]) -> bool

Parameter Type Default Description
words Sequence[str] The command's words (leading NAME=value assignments are ignored, like agy does).

Returns: bool — True when the words of some rule in :data:RULE_WORDS are a prefix of words.

Function workspace_roots

The directories a command may touch: the workspace paths and each one's main checkout.

workspace_roots(workspace_paths: Sequence[str], fallback: Path | None) -> list[Path]

Parameter Type Default Description
workspace_paths Sequence[str] workspacePaths from the agy payload.
fallback Path | None Used when the payload names no workspace (the hook's repository root).

Returns: list[Path] — Normalized absolute roots, in order, without duplicates.

Alias worktree_environment

Re-exported from parrot.sdd.scripts.worktree_environment.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally