agentperm 0.4.0__tar.gz → 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {agentperm-0.4.0 → agentperm-0.5.0}/.gitignore +4 -0
- agentperm-0.5.0/PKG-INFO +270 -0
- agentperm-0.5.0/README.md +206 -0
- agentperm-0.5.0/apps/macos/AgentpermConfig/LICENSE +21 -0
- agentperm-0.5.0/apps/macos/AgentpermConfig/README.md +61 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/docs/README.md +4 -2
- {agentperm-0.4.0 → agentperm-0.5.0}/pyproject.toml +12 -8
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/__init__.py +34 -5
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/adapters/__init__.py +14 -6
- agentperm-0.5.0/src/agentperm/adapters/antigravity.py +96 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/adapters/apply_patch.py +3 -3
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/adapters/base.py +88 -36
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/adapters/claude.py +45 -16
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/adapters/codex.py +39 -10
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/adapters/gemini.py +21 -31
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/adapters/kiro.py +59 -105
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/adapters/opencode.py +55 -27
- agentperm-0.5.0/src/agentperm/api.py +213 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/cli.py +87 -36
- agentperm-0.5.0/src/agentperm/command_arguments.py +21 -0
- agentperm-0.5.0/src/agentperm/config.py +43 -0
- agentperm-0.5.0/src/agentperm/domain/__init__.py +144 -0
- agentperm-0.5.0/src/agentperm/domain/evaluation.py +327 -0
- agentperm-0.5.0/src/agentperm/domain/json_value.py +42 -0
- agentperm-0.5.0/src/agentperm/domain/mcp.py +44 -0
- agentperm-0.4.0/src/agentperm/domain.py → agentperm-0.5.0/src/agentperm/domain/model.py +143 -293
- agentperm-0.5.0/src/agentperm/domain/tools.py +238 -0
- agentperm-0.5.0/src/agentperm/explanation.py +64 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/fileio.py +3 -5
- agentperm-0.5.0/src/agentperm/hook_passthrough.py +28 -0
- agentperm-0.5.0/src/agentperm/json_boundary.py +21 -0
- agentperm-0.5.0/src/agentperm/mcppattern.py +106 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/policy.py +190 -23
- agentperm-0.5.0/src/agentperm/policy_api.py +400 -0
- agentperm-0.5.0/src/agentperm/policy_edit.py +570 -0
- agentperm-0.5.0/src/agentperm/python_local_values.py +73 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/pythoncode.py +347 -69
- agentperm-0.5.0/src/agentperm/rule_description.py +47 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/rules.py +137 -4
- agentperm-0.5.0/src/agentperm/scoped_policy.py +93 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/shell.py +133 -229
- agentperm-0.5.0/src/agentperm/shell_redirection.py +83 -0
- agentperm-0.5.0/src/agentperm/shell_tokens.py +214 -0
- agentperm-0.5.0/src/agentperm/shell_words.py +99 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/shellpattern.py +206 -234
- agentperm-0.5.0/src/agentperm/sql/__init__.py +6 -0
- agentperm-0.5.0/src/agentperm/sql/documents.py +74 -0
- agentperm-0.5.0/src/agentperm/sql/domain.py +179 -0
- agentperm-0.5.0/src/agentperm/sql/parser.py +264 -0
- agentperm-0.5.0/src/agentperm/sql/python_adapters.py +31 -0
- agentperm-0.5.0/src/agentperm/sql/python_analysis.py +85 -0
- agentperm-0.5.0/src/agentperm/sql/python_capture.py +301 -0
- agentperm-0.5.0/src/agentperm/sql/service.py +69 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/templates/file-inspection.jsonc +4 -3
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/validate.py +42 -23
- agentperm-0.5.0/tests/conftest.py +58 -0
- agentperm-0.5.0/tests/fixtures/hook_contracts/allow/.agent-permissions.jsonc +18 -0
- agentperm-0.5.0/tests/fixtures/hook_contracts/ask/.agent-permissions.jsonc +8 -0
- agentperm-0.5.0/tests/fixtures/hook_contracts/deny/.agent-permissions.jsonc +8 -0
- agentperm-0.5.0/tests/fixtures/hook_contracts/files/.agent-permissions.jsonc +10 -0
- agentperm-0.5.0/tests/fixtures/hook_contracts/sql/.agent-permissions.jsonc +34 -0
- agentperm-0.5.0/tests/json_support.py +41 -0
- agentperm-0.5.0/tests/pattern_support.py +27 -0
- agentperm-0.5.0/tests/policy_support.py +9 -0
- agentperm-0.5.0/tests/test_adapter_decisions.py +695 -0
- agentperm-0.5.0/tests/test_antigravity_adapter.py +47 -0
- agentperm-0.5.0/tests/test_api.py +414 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/tests/test_cli.py +136 -14
- agentperm-0.5.0/tests/test_hook_contracts.py +403 -0
- agentperm-0.5.0/tests/test_hook_installation.py +421 -0
- agentperm-0.5.0/tests/test_hook_uninstallation.py +218 -0
- agentperm-0.5.0/tests/test_kiro_adapter.py +460 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/tests/test_opencode_guard.py +5 -3
- agentperm-0.5.0/tests/test_parser_control_flow.py +349 -0
- agentperm-0.5.0/tests/test_parser_words.py +469 -0
- agentperm-0.5.0/tests/test_pattern_matching.py +399 -0
- agentperm-0.5.0/tests/test_pattern_parser.py +422 -0
- agentperm-0.5.0/tests/test_pattern_policy.py +228 -0
- agentperm-0.5.0/tests/test_policy_api.py +274 -0
- agentperm-0.5.0/tests/test_policy_decisions.py +307 -0
- agentperm-0.5.0/tests/test_policy_edit.py +332 -0
- agentperm-0.5.0/tests/test_policy_layers.py +264 -0
- agentperm-0.5.0/tests/test_pythoncode.py +324 -0
- agentperm-0.5.0/tests/test_redirection_policy.py +442 -0
- agentperm-0.5.0/tests/test_rule_description.py +68 -0
- agentperm-0.5.0/tests/test_rule_matching.py +513 -0
- agentperm-0.5.0/tests/test_scoped_policy.py +193 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/tests/test_semantic_file_adapters.py +48 -37
- agentperm-0.5.0/tests/test_shell_policy.py +359 -0
- agentperm-0.5.0/tests/test_sql.py +515 -0
- agentperm-0.5.0/tests/test_tool_capabilities.py +318 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/tests/test_validate.py +75 -8
- agentperm-0.4.0/PKG-INFO +0 -267
- agentperm-0.4.0/README.md +0 -206
- agentperm-0.4.0/tests/test_adapters.py +0 -1558
- agentperm-0.4.0/tests/test_parser.py +0 -809
- agentperm-0.4.0/tests/test_policy.py +0 -1550
- agentperm-0.4.0/tests/test_pythoncode.py +0 -185
- agentperm-0.4.0/tests/test_shellpattern.py +0 -1047
- {agentperm-0.4.0 → agentperm-0.5.0}/LICENSE +0 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/errors.py +0 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/templates/aws-read-only.jsonc +0 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/templates/docker-read-only.jsonc +0 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/templates/gh-read-only.jsonc +0 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/templates/git-read-only.jsonc +0 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/templates/packages-read-only.jsonc +0 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/templates/python-checks.jsonc +0 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/src/agentperm/templates/safety-baseline.jsonc +0 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/tests/__init__.py +0 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/tests/test_templates.py +0 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/zellij-plugin/README.md +0 -0
- {agentperm-0.4.0 → agentperm-0.5.0}/zellij-plugin/src/main.rs +0 -0
agentperm-0.5.0/PKG-INFO
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: agentperm
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: Permission policy mediator for Claude Code, Codex, OpenCode, Gemini CLI, Kiro, and Antigravity.
|
|
5
|
+
Project-URL: Homepage, https://github.com/jacks0n/agentperm
|
|
6
|
+
Project-URL: Repository, https://github.com/jacks0n/agentperm
|
|
7
|
+
Project-URL: Documentation, https://github.com/jacks0n/agentperm/tree/main/docs
|
|
8
|
+
Project-URL: Changelog, https://github.com/jacks0n/agentperm/blob/main/CHANGELOG.md
|
|
9
|
+
Project-URL: Issues, https://github.com/jacks0n/agentperm/issues
|
|
10
|
+
Author-email: Jackson Cooper <jackson@jacksonc.com>
|
|
11
|
+
License: MIT License
|
|
12
|
+
|
|
13
|
+
Copyright (c) 2026 Jackson Cooper
|
|
14
|
+
|
|
15
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
16
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
17
|
+
in the Software without restriction, including without limitation the rights
|
|
18
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
19
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
20
|
+
furnished to do so, subject to the following conditions:
|
|
21
|
+
|
|
22
|
+
The above copyright notice and this permission notice shall be included in all
|
|
23
|
+
copies or substantial portions of the Software.
|
|
24
|
+
|
|
25
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
26
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
27
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
29
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
|
+
SOFTWARE.
|
|
32
|
+
License-File: LICENSE
|
|
33
|
+
Keywords: ai-agents,antigravity,claude-code,codex-cli,coding-agent,gemini-cli,hooks,kiro,llm,opencode,permissions,policy-engine,tree-sitter-bash
|
|
34
|
+
Classifier: Development Status :: 4 - Beta
|
|
35
|
+
Classifier: Environment :: Console
|
|
36
|
+
Classifier: Intended Audience :: Developers
|
|
37
|
+
Classifier: Intended Audience :: System Administrators
|
|
38
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
39
|
+
Classifier: Operating System :: MacOS
|
|
40
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
41
|
+
Classifier: Programming Language :: Python :: 3
|
|
42
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
43
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
44
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
45
|
+
Classifier: Topic :: Security
|
|
46
|
+
Classifier: Topic :: Software Development
|
|
47
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
48
|
+
Classifier: Topic :: System :: Shells
|
|
49
|
+
Classifier: Topic :: System :: Systems Administration
|
|
50
|
+
Classifier: Typing :: Typed
|
|
51
|
+
Requires-Python: >=3.12
|
|
52
|
+
Requires-Dist: pyjson5<3,>=2.0
|
|
53
|
+
Requires-Dist: sqlglot<31,>=30.0
|
|
54
|
+
Requires-Dist: tomlkit<0.14,>=0.13
|
|
55
|
+
Requires-Dist: tree-sitter-bash<0.26,>=0.25
|
|
56
|
+
Requires-Dist: tree-sitter<0.26,>=0.25
|
|
57
|
+
Provides-Extra: dev
|
|
58
|
+
Requires-Dist: basedpyright>=1.13; extra == 'dev'
|
|
59
|
+
Requires-Dist: pylint>=4.0.6; extra == 'dev'
|
|
60
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
61
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
62
|
+
Requires-Dist: vulture>=2.16; extra == 'dev'
|
|
63
|
+
Description-Content-Type: text/markdown
|
|
64
|
+
|
|
65
|
+
# agentperm
|
|
66
|
+
|
|
67
|
+
**One permission policy for every coding agent. Parsed like a shell, not matched like a string.**
|
|
68
|
+
|
|
69
|
+
agentperm is a pre-tool hook for [Claude Code](https://docs.anthropic.com/en/docs/claude-code),
|
|
70
|
+
[Codex CLI](https://github.com/openai/codex), [OpenCode](https://opencode.ai),
|
|
71
|
+
[Gemini CLI](https://github.com/google-gemini/gemini-cli), [Kiro](https://kiro.dev), and
|
|
72
|
+
[Google Antigravity](https://antigravity.google). Before a
|
|
73
|
+
command runs, it parses the whole shell program, judges every piece against one layered policy,
|
|
74
|
+
and returns **allow / ask / deny**. You approve *intent* once; you stop re-approving `git status`
|
|
75
|
+
because a flag moved, it entered a pipe, or a different agent asked.
|
|
76
|
+
|
|
77
|
+
[](https://pypi.org/project/agentperm/)
|
|
78
|
+
[](https://pypi.org/project/agentperm/)
|
|
79
|
+
[](https://github.com/jacks0n/agentperm/actions/workflows/ci.yml)
|
|
80
|
+
[](https://github.com/jacks0n/agentperm/blob/main/LICENSE)
|
|
81
|
+
|
|
82
|
+
## Everything it does, on one screen
|
|
83
|
+
|
|
84
|
+
```jsonc
|
|
85
|
+
// ~/.agent-permissions.jsonc
|
|
86
|
+
{
|
|
87
|
+
"version": 1,
|
|
88
|
+
"permissions": {
|
|
89
|
+
"deny": [
|
|
90
|
+
"Shell(git push --force)",
|
|
91
|
+
{"Write(**/src/generated/**)": {"reason": "Generated — run `just generate`."}},
|
|
92
|
+
{"SQL(no-file-io)": {"dialect": "postgres", "functions": {"any": ["pg_read_file"]}}}
|
|
93
|
+
],
|
|
94
|
+
"ask": ["Shell(aws ec2 terminate-*)"],
|
|
95
|
+
"allow": [
|
|
96
|
+
"Shell(git values(-C) {status,diff,log} only(-C, --short, --stat))",
|
|
97
|
+
"Shell(aws values(--profile) ec2 describe-* only(--profile))",
|
|
98
|
+
"Shell(jq only(-r))",
|
|
99
|
+
"Shell(echo *)",
|
|
100
|
+
"Shell(psql values(-d) sqlvalues(<SQL:ro>, -c))",
|
|
101
|
+
"Shell(psql values(-d) stdin(<SQL:ro>))",
|
|
102
|
+
{"SQL(ro)": {"dialect": "postgres", "effects": {"only": ["read"]}}},
|
|
103
|
+
"Python(readonly)",
|
|
104
|
+
"Python(query_db(<SQL:ro>))",
|
|
105
|
+
"Write(**/src/**)"
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Agent tries to run:
|
|
112
|
+
|
|
113
|
+
```sh
|
|
114
|
+
aws ec2 describe-vpcs --profile=dev 2>/dev/null | jq -r .Vpcs[].VpcId &&
|
|
115
|
+
git -C . diff --stat &&
|
|
116
|
+
echo "SELECT count(*) FROM users" | psql -d app
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
agentperm sees:
|
|
120
|
+
|
|
121
|
+
```text
|
|
122
|
+
aws ec2 describe-vpcs --profile=dev allow Shell(aws values(--profile) ec2 describe-* only(--profile))
|
|
123
|
+
2>/dev/null allow redirect to /dev/null is harmless
|
|
124
|
+
jq -r .Vpcs[].VpcId allow Shell(jq only(-r))
|
|
125
|
+
git -C . diff --stat allow Shell(git values(-C) {status,diff,log} only(-C, --short, --stat))
|
|
126
|
+
echo "SELECT count(*) FROM users" allow Shell(echo *)
|
|
127
|
+
psql -d app allow Shell(psql values(-d) stdin(<SQL:ro>)) ← stdin is SQL; read-only
|
|
128
|
+
──────────────────────────────────────────────
|
|
129
|
+
allow — no prompt
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Same policy, other attempts. The strictest segment decides: `deny > ask > allow > no-opinion`.
|
|
133
|
+
|
|
134
|
+
```text
|
|
135
|
+
allow git -C . status --short flags reorder freely; only(…) admits --short
|
|
136
|
+
allow bash -lc 'git diff --stat | jq -r .' wrapper unwrapped; inner pipe split and matched
|
|
137
|
+
no-opinion aws ec2 describe-vpcs --endpoint-url http://x unreviewed flag → no match → your agent prompts
|
|
138
|
+
allow python -c "print(open('x.json').read())" Python AST is read-only
|
|
139
|
+
ask python -c "import shutil; shutil.rmtree('x')" Python AST finds a mutation
|
|
140
|
+
allow psql -d app -c 'SELECT id FROM users' SQL parsed; effects = {read}
|
|
141
|
+
ask echo 'DELETE FROM users' | psql -d app stdin SQL parsed; DELETE is not a read
|
|
142
|
+
deny psql -d app -c "SELECT pg_read_file('/etc/passwd')" function deny beats the read-only allow
|
|
143
|
+
allow python -c "query_db('SELECT id FROM users')" literal SQL through a declared Python helper
|
|
144
|
+
ask python -c "query_db(sql)" query text is not static
|
|
145
|
+
deny git status && git push --force one denied segment denies the chain
|
|
146
|
+
ask git status | ./deploy.sh one unknown segment prompts for the chain
|
|
147
|
+
ask git diff --stat > out.txt redirect writes a file; allowlist paths if you want
|
|
148
|
+
deny Write src/generated/client.py "Generated — run `just generate`."
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
The last line is one capability for every host: Claude `Edit`/`Write`/`NotebookEdit`, Codex
|
|
152
|
+
`apply_patch`, OpenCode `edit`, Gemini `replace`, and Kiro `fs_write` are all `Write`, so a create,
|
|
153
|
+
an overwrite, and an in-place edit are one decision. Likewise supported native read, list, glob,
|
|
154
|
+
and search tools are `Read` ([tool capabilities](docs/capabilities.md#tool-capabilities)). A shell
|
|
155
|
+
call remains `Shell` even when it runs `cat`, `grep`, or another file reader; current Codex textual
|
|
156
|
+
reads therefore use `Shell` rules. Real parsers, not regex: tree-sitter-bash for
|
|
157
|
+
shell, Python's `ast` for inline Python, SQLGlot for SQL. Anything agentperm cannot statically
|
|
158
|
+
understand is never allowed — it asks, or defers to your agent's own prompt.
|
|
159
|
+
`agentperm why "<command>"` prints this breakdown for any command without running it.
|
|
160
|
+
|
|
161
|
+
Confirmed defects and integration incidents are tracked in the [bug register](BUGS.md).
|
|
162
|
+
|
|
163
|
+
https://github.com/user-attachments/assets/9abcd24d-147c-4323-a1c3-970544e0d86a
|
|
164
|
+
|
|
165
|
+
[GIF fallback](https://raw.githubusercontent.com/jacks0n/agentperm/main/docs/media/demo.gif)
|
|
166
|
+
|
|
167
|
+
## Install
|
|
168
|
+
|
|
169
|
+
```sh
|
|
170
|
+
uv tool install agentperm # or: pipx install agentperm
|
|
171
|
+
agentperm install --dry-run # preview every hook file it would touch, then:
|
|
172
|
+
agentperm install # hook into every supported agent it finds
|
|
173
|
+
agentperm init # conservative starter policy → ~/.agent-permissions.jsonc
|
|
174
|
+
agentperm why "git status | head" # check a decision without running anything
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Python 3.12+, macOS or Linux. Native agent settings stay in place; agentperm adds a decision in
|
|
178
|
+
front of them. `agentperm uninstall` removes only what `install` wrote. Full walkthrough:
|
|
179
|
+
[Getting started](docs/getting-started.md).
|
|
180
|
+
|
|
181
|
+
### Agentperm Config for macOS
|
|
182
|
+
|
|
183
|
+
The optional native [Agentperm Config app](apps/macos/AgentpermConfig) explains effective policy
|
|
184
|
+
across repositories and turns pasted commands into reviewable multi-file proposals with Codex.
|
|
185
|
+
Agentperm itself owns target discovery, rule serialization, JSON5-preserving diffs, validation,
|
|
186
|
+
compare-and-swap apply, and undo through its versioned local JSON API. Tagged app releases publish
|
|
187
|
+
a signed and notarized universal DMG; Alfred support adds a real script-filter workflow rather than
|
|
188
|
+
embedding a personal hotkey.
|
|
189
|
+
|
|
190
|
+
## Why not native allowlists?
|
|
191
|
+
|
|
192
|
+
| | Native allowlists · string/regex hooks | agentperm |
|
|
193
|
+
|---|---|---|
|
|
194
|
+
| Unit of matching | one opaque command string | every segment of a parsed shell program |
|
|
195
|
+
| `git -C . status`, `--region=x`, `-la` vs `-al` | a new rule each time | one rule: `values(…)`, `only(…)`, `{a,b}`, `*` |
|
|
196
|
+
| Pipes, `&&`, `bash -c`, `$(…)`, heredocs | defeated by the first `\|` | decomposed; strictest segment wins |
|
|
197
|
+
| Python, SQL, file edits | strings | AST, SQL effect classification, semantic `Write` |
|
|
198
|
+
| Five agents | five formats to keep in sync | one file, wired through each agent's native hooks |
|
|
199
|
+
| "Why was I prompted?" | guess | `agentperm why`, per-rule `reason`, opt-in JSONL traces |
|
|
200
|
+
|
|
201
|
+
Sandboxes are a different tool: they contain what runs, agentperm decides what runs. Use both.
|
|
202
|
+
|
|
203
|
+
## How policies compose
|
|
204
|
+
|
|
205
|
+
- `~/.agent-permissions.jsonc` merges with directory policies discovered from the command cwd, and
|
|
206
|
+
from each target for path-bearing structured tools.
|
|
207
|
+
- Relative path patterns are anchored to the directory containing their root policy. Included
|
|
208
|
+
fragments inherit that root anchor; absolute patterns can cover paths anywhere.
|
|
209
|
+
- **Deny anywhere is a floor.** For Ask and Allow the nearest matching policy wins, so a project can
|
|
210
|
+
allow something your global policy asks about — but never un-deny anything.
|
|
211
|
+
- Any policy file can `include` explicit paths or globs; fragments merge into that same layer.
|
|
212
|
+
- Directory policies are not trust-gated. Review a cloned repo's `.agent-permissions.jsonc` the same
|
|
213
|
+
way you review its `.envrc`.
|
|
214
|
+
|
|
215
|
+
## Rules cheat sheet
|
|
216
|
+
|
|
217
|
+
| Form | Meaning |
|
|
218
|
+
|---|---|
|
|
219
|
+
| `{status,log,diff}` | one of these command-path tokens |
|
|
220
|
+
| `describe-*` | glob within one token |
|
|
221
|
+
| `values(--region)` | `--region` consumes the following token |
|
|
222
|
+
| `only(--region, --profile)` | reject every other flag |
|
|
223
|
+
| `!--force` | reject this flag |
|
|
224
|
+
| `!-*` | reject every flag |
|
|
225
|
+
| `!...` | reject trailing operands |
|
|
226
|
+
| `<SQL:name>` · `stdin(<SQL>)` · `sqlvalues(<SQL>, -c)` | parse SQL from an operand, stdin, or option values |
|
|
227
|
+
| `<EXEC>` · `<SHELL>` | evaluate a wrapper's nested command or nested shell source |
|
|
228
|
+
| `Python(readonly)` · `Python(f(<SQL>))` | AST-check inline Python; capture SQL passed to a helper |
|
|
229
|
+
| `Write(src/**)` · `Read(**)` | config-relative file capabilities shared by every agent — `Write` covers create, overwrite, edit, and patch |
|
|
230
|
+
| `MCP(server.{read_*,search})` | match canonical MCP server/tool identities across every agent; supports `*`, `{a,b}`, and escaping |
|
|
231
|
+
| `shell.redirection` | `>/dev/null` and `2>&1` pass; `> file` asks unless the path is allowlisted |
|
|
232
|
+
|
|
233
|
+
`agentperm validate` after editing. Exact grammar: [Shell pattern DSL](docs/pattern-dsl.md) ·
|
|
234
|
+
[Semantic SQL policies](docs/sql-policy.md) · [Policy reference](docs/policy-reference.md).
|
|
235
|
+
|
|
236
|
+
## Agents
|
|
237
|
+
|
|
238
|
+
Claude Code · Codex CLI · OpenCode · Gemini CLI · Kiro · Antigravity. All use the same policy
|
|
239
|
+
engine. See the [capability matrix](docs/capabilities.md) for hook behavior, installation modes,
|
|
240
|
+
and native policy import coverage.
|
|
241
|
+
|
|
242
|
+
## Not a sandbox
|
|
243
|
+
|
|
244
|
+
agentperm is a **permission intent layer**. It sees only tool calls the host routes through hooks,
|
|
245
|
+
matches argv shape rather than proving program behaviour, and does not isolate processes, files, or
|
|
246
|
+
network. Bypass semantics are host-specific: Claude's explicit bypass makes agentperm defer, while
|
|
247
|
+
Codex full-auto suppresses prompts but still runs `PreToolUse` hard denies. Traces are diagnostic,
|
|
248
|
+
off by default, and unredacted. Threat model, bypass surfaces, and failure behaviour:
|
|
249
|
+
[SECURITY.md](SECURITY.md).
|
|
250
|
+
|
|
251
|
+
## Zellij pane bypass
|
|
252
|
+
|
|
253
|
+
The bundled [Zellij plugin](zellij-plugin/) adds a per-pane "skip prompts" toggle: Ask and
|
|
254
|
+
no-opinion become Allow for that pane only, Deny still holds — far narrower than a host-wide
|
|
255
|
+
"dangerously skip permissions" mode.
|
|
256
|
+
|
|
257
|
+
## Documentation
|
|
258
|
+
|
|
259
|
+
- [Getting started](docs/getting-started.md) — install, initialize, verify.
|
|
260
|
+
- [Capability matrix](docs/capabilities.md) — exact behaviour per agent.
|
|
261
|
+
- [Policy reference](docs/policy-reference.md) — schema, semantic tools, hierarchy, includes, redirects.
|
|
262
|
+
- [Shell pattern DSL](docs/pattern-dsl.md) · [Semantic SQL policies](docs/sql-policy.md) — matching grammars.
|
|
263
|
+
- [CLI reference](docs/cli.md) — commands, hook installation, traces, exit behaviour.
|
|
264
|
+
- [Troubleshooting](docs/troubleshooting.md) — symptom-led fixes.
|
|
265
|
+
- [Architecture](docs/architecture.md) · [Adapter notes](docs/adapters.md) — contributor internals.
|
|
266
|
+
- [Changelog](CHANGELOG.md) · [Contributing](CONTRIBUTING.md) · [Security](SECURITY.md)
|
|
267
|
+
|
|
268
|
+
## License
|
|
269
|
+
|
|
270
|
+
MIT
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# agentperm
|
|
2
|
+
|
|
3
|
+
**One permission policy for every coding agent. Parsed like a shell, not matched like a string.**
|
|
4
|
+
|
|
5
|
+
agentperm is a pre-tool hook for [Claude Code](https://docs.anthropic.com/en/docs/claude-code),
|
|
6
|
+
[Codex CLI](https://github.com/openai/codex), [OpenCode](https://opencode.ai),
|
|
7
|
+
[Gemini CLI](https://github.com/google-gemini/gemini-cli), [Kiro](https://kiro.dev), and
|
|
8
|
+
[Google Antigravity](https://antigravity.google). Before a
|
|
9
|
+
command runs, it parses the whole shell program, judges every piece against one layered policy,
|
|
10
|
+
and returns **allow / ask / deny**. You approve *intent* once; you stop re-approving `git status`
|
|
11
|
+
because a flag moved, it entered a pipe, or a different agent asked.
|
|
12
|
+
|
|
13
|
+
[](https://pypi.org/project/agentperm/)
|
|
14
|
+
[](https://pypi.org/project/agentperm/)
|
|
15
|
+
[](https://github.com/jacks0n/agentperm/actions/workflows/ci.yml)
|
|
16
|
+
[](https://github.com/jacks0n/agentperm/blob/main/LICENSE)
|
|
17
|
+
|
|
18
|
+
## Everything it does, on one screen
|
|
19
|
+
|
|
20
|
+
```jsonc
|
|
21
|
+
// ~/.agent-permissions.jsonc
|
|
22
|
+
{
|
|
23
|
+
"version": 1,
|
|
24
|
+
"permissions": {
|
|
25
|
+
"deny": [
|
|
26
|
+
"Shell(git push --force)",
|
|
27
|
+
{"Write(**/src/generated/**)": {"reason": "Generated — run `just generate`."}},
|
|
28
|
+
{"SQL(no-file-io)": {"dialect": "postgres", "functions": {"any": ["pg_read_file"]}}}
|
|
29
|
+
],
|
|
30
|
+
"ask": ["Shell(aws ec2 terminate-*)"],
|
|
31
|
+
"allow": [
|
|
32
|
+
"Shell(git values(-C) {status,diff,log} only(-C, --short, --stat))",
|
|
33
|
+
"Shell(aws values(--profile) ec2 describe-* only(--profile))",
|
|
34
|
+
"Shell(jq only(-r))",
|
|
35
|
+
"Shell(echo *)",
|
|
36
|
+
"Shell(psql values(-d) sqlvalues(<SQL:ro>, -c))",
|
|
37
|
+
"Shell(psql values(-d) stdin(<SQL:ro>))",
|
|
38
|
+
{"SQL(ro)": {"dialect": "postgres", "effects": {"only": ["read"]}}},
|
|
39
|
+
"Python(readonly)",
|
|
40
|
+
"Python(query_db(<SQL:ro>))",
|
|
41
|
+
"Write(**/src/**)"
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Agent tries to run:
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
aws ec2 describe-vpcs --profile=dev 2>/dev/null | jq -r .Vpcs[].VpcId &&
|
|
51
|
+
git -C . diff --stat &&
|
|
52
|
+
echo "SELECT count(*) FROM users" | psql -d app
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
agentperm sees:
|
|
56
|
+
|
|
57
|
+
```text
|
|
58
|
+
aws ec2 describe-vpcs --profile=dev allow Shell(aws values(--profile) ec2 describe-* only(--profile))
|
|
59
|
+
2>/dev/null allow redirect to /dev/null is harmless
|
|
60
|
+
jq -r .Vpcs[].VpcId allow Shell(jq only(-r))
|
|
61
|
+
git -C . diff --stat allow Shell(git values(-C) {status,diff,log} only(-C, --short, --stat))
|
|
62
|
+
echo "SELECT count(*) FROM users" allow Shell(echo *)
|
|
63
|
+
psql -d app allow Shell(psql values(-d) stdin(<SQL:ro>)) ← stdin is SQL; read-only
|
|
64
|
+
──────────────────────────────────────────────
|
|
65
|
+
allow — no prompt
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Same policy, other attempts. The strictest segment decides: `deny > ask > allow > no-opinion`.
|
|
69
|
+
|
|
70
|
+
```text
|
|
71
|
+
allow git -C . status --short flags reorder freely; only(…) admits --short
|
|
72
|
+
allow bash -lc 'git diff --stat | jq -r .' wrapper unwrapped; inner pipe split and matched
|
|
73
|
+
no-opinion aws ec2 describe-vpcs --endpoint-url http://x unreviewed flag → no match → your agent prompts
|
|
74
|
+
allow python -c "print(open('x.json').read())" Python AST is read-only
|
|
75
|
+
ask python -c "import shutil; shutil.rmtree('x')" Python AST finds a mutation
|
|
76
|
+
allow psql -d app -c 'SELECT id FROM users' SQL parsed; effects = {read}
|
|
77
|
+
ask echo 'DELETE FROM users' | psql -d app stdin SQL parsed; DELETE is not a read
|
|
78
|
+
deny psql -d app -c "SELECT pg_read_file('/etc/passwd')" function deny beats the read-only allow
|
|
79
|
+
allow python -c "query_db('SELECT id FROM users')" literal SQL through a declared Python helper
|
|
80
|
+
ask python -c "query_db(sql)" query text is not static
|
|
81
|
+
deny git status && git push --force one denied segment denies the chain
|
|
82
|
+
ask git status | ./deploy.sh one unknown segment prompts for the chain
|
|
83
|
+
ask git diff --stat > out.txt redirect writes a file; allowlist paths if you want
|
|
84
|
+
deny Write src/generated/client.py "Generated — run `just generate`."
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The last line is one capability for every host: Claude `Edit`/`Write`/`NotebookEdit`, Codex
|
|
88
|
+
`apply_patch`, OpenCode `edit`, Gemini `replace`, and Kiro `fs_write` are all `Write`, so a create,
|
|
89
|
+
an overwrite, and an in-place edit are one decision. Likewise supported native read, list, glob,
|
|
90
|
+
and search tools are `Read` ([tool capabilities](docs/capabilities.md#tool-capabilities)). A shell
|
|
91
|
+
call remains `Shell` even when it runs `cat`, `grep`, or another file reader; current Codex textual
|
|
92
|
+
reads therefore use `Shell` rules. Real parsers, not regex: tree-sitter-bash for
|
|
93
|
+
shell, Python's `ast` for inline Python, SQLGlot for SQL. Anything agentperm cannot statically
|
|
94
|
+
understand is never allowed — it asks, or defers to your agent's own prompt.
|
|
95
|
+
`agentperm why "<command>"` prints this breakdown for any command without running it.
|
|
96
|
+
|
|
97
|
+
Confirmed defects and integration incidents are tracked in the [bug register](BUGS.md).
|
|
98
|
+
|
|
99
|
+
https://github.com/user-attachments/assets/9abcd24d-147c-4323-a1c3-970544e0d86a
|
|
100
|
+
|
|
101
|
+
[GIF fallback](https://raw.githubusercontent.com/jacks0n/agentperm/main/docs/media/demo.gif)
|
|
102
|
+
|
|
103
|
+
## Install
|
|
104
|
+
|
|
105
|
+
```sh
|
|
106
|
+
uv tool install agentperm # or: pipx install agentperm
|
|
107
|
+
agentperm install --dry-run # preview every hook file it would touch, then:
|
|
108
|
+
agentperm install # hook into every supported agent it finds
|
|
109
|
+
agentperm init # conservative starter policy → ~/.agent-permissions.jsonc
|
|
110
|
+
agentperm why "git status | head" # check a decision without running anything
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Python 3.12+, macOS or Linux. Native agent settings stay in place; agentperm adds a decision in
|
|
114
|
+
front of them. `agentperm uninstall` removes only what `install` wrote. Full walkthrough:
|
|
115
|
+
[Getting started](docs/getting-started.md).
|
|
116
|
+
|
|
117
|
+
### Agentperm Config for macOS
|
|
118
|
+
|
|
119
|
+
The optional native [Agentperm Config app](apps/macos/AgentpermConfig) explains effective policy
|
|
120
|
+
across repositories and turns pasted commands into reviewable multi-file proposals with Codex.
|
|
121
|
+
Agentperm itself owns target discovery, rule serialization, JSON5-preserving diffs, validation,
|
|
122
|
+
compare-and-swap apply, and undo through its versioned local JSON API. Tagged app releases publish
|
|
123
|
+
a signed and notarized universal DMG; Alfred support adds a real script-filter workflow rather than
|
|
124
|
+
embedding a personal hotkey.
|
|
125
|
+
|
|
126
|
+
## Why not native allowlists?
|
|
127
|
+
|
|
128
|
+
| | Native allowlists · string/regex hooks | agentperm |
|
|
129
|
+
|---|---|---|
|
|
130
|
+
| Unit of matching | one opaque command string | every segment of a parsed shell program |
|
|
131
|
+
| `git -C . status`, `--region=x`, `-la` vs `-al` | a new rule each time | one rule: `values(…)`, `only(…)`, `{a,b}`, `*` |
|
|
132
|
+
| Pipes, `&&`, `bash -c`, `$(…)`, heredocs | defeated by the first `\|` | decomposed; strictest segment wins |
|
|
133
|
+
| Python, SQL, file edits | strings | AST, SQL effect classification, semantic `Write` |
|
|
134
|
+
| Five agents | five formats to keep in sync | one file, wired through each agent's native hooks |
|
|
135
|
+
| "Why was I prompted?" | guess | `agentperm why`, per-rule `reason`, opt-in JSONL traces |
|
|
136
|
+
|
|
137
|
+
Sandboxes are a different tool: they contain what runs, agentperm decides what runs. Use both.
|
|
138
|
+
|
|
139
|
+
## How policies compose
|
|
140
|
+
|
|
141
|
+
- `~/.agent-permissions.jsonc` merges with directory policies discovered from the command cwd, and
|
|
142
|
+
from each target for path-bearing structured tools.
|
|
143
|
+
- Relative path patterns are anchored to the directory containing their root policy. Included
|
|
144
|
+
fragments inherit that root anchor; absolute patterns can cover paths anywhere.
|
|
145
|
+
- **Deny anywhere is a floor.** For Ask and Allow the nearest matching policy wins, so a project can
|
|
146
|
+
allow something your global policy asks about — but never un-deny anything.
|
|
147
|
+
- Any policy file can `include` explicit paths or globs; fragments merge into that same layer.
|
|
148
|
+
- Directory policies are not trust-gated. Review a cloned repo's `.agent-permissions.jsonc` the same
|
|
149
|
+
way you review its `.envrc`.
|
|
150
|
+
|
|
151
|
+
## Rules cheat sheet
|
|
152
|
+
|
|
153
|
+
| Form | Meaning |
|
|
154
|
+
|---|---|
|
|
155
|
+
| `{status,log,diff}` | one of these command-path tokens |
|
|
156
|
+
| `describe-*` | glob within one token |
|
|
157
|
+
| `values(--region)` | `--region` consumes the following token |
|
|
158
|
+
| `only(--region, --profile)` | reject every other flag |
|
|
159
|
+
| `!--force` | reject this flag |
|
|
160
|
+
| `!-*` | reject every flag |
|
|
161
|
+
| `!...` | reject trailing operands |
|
|
162
|
+
| `<SQL:name>` · `stdin(<SQL>)` · `sqlvalues(<SQL>, -c)` | parse SQL from an operand, stdin, or option values |
|
|
163
|
+
| `<EXEC>` · `<SHELL>` | evaluate a wrapper's nested command or nested shell source |
|
|
164
|
+
| `Python(readonly)` · `Python(f(<SQL>))` | AST-check inline Python; capture SQL passed to a helper |
|
|
165
|
+
| `Write(src/**)` · `Read(**)` | config-relative file capabilities shared by every agent — `Write` covers create, overwrite, edit, and patch |
|
|
166
|
+
| `MCP(server.{read_*,search})` | match canonical MCP server/tool identities across every agent; supports `*`, `{a,b}`, and escaping |
|
|
167
|
+
| `shell.redirection` | `>/dev/null` and `2>&1` pass; `> file` asks unless the path is allowlisted |
|
|
168
|
+
|
|
169
|
+
`agentperm validate` after editing. Exact grammar: [Shell pattern DSL](docs/pattern-dsl.md) ·
|
|
170
|
+
[Semantic SQL policies](docs/sql-policy.md) · [Policy reference](docs/policy-reference.md).
|
|
171
|
+
|
|
172
|
+
## Agents
|
|
173
|
+
|
|
174
|
+
Claude Code · Codex CLI · OpenCode · Gemini CLI · Kiro · Antigravity. All use the same policy
|
|
175
|
+
engine. See the [capability matrix](docs/capabilities.md) for hook behavior, installation modes,
|
|
176
|
+
and native policy import coverage.
|
|
177
|
+
|
|
178
|
+
## Not a sandbox
|
|
179
|
+
|
|
180
|
+
agentperm is a **permission intent layer**. It sees only tool calls the host routes through hooks,
|
|
181
|
+
matches argv shape rather than proving program behaviour, and does not isolate processes, files, or
|
|
182
|
+
network. Bypass semantics are host-specific: Claude's explicit bypass makes agentperm defer, while
|
|
183
|
+
Codex full-auto suppresses prompts but still runs `PreToolUse` hard denies. Traces are diagnostic,
|
|
184
|
+
off by default, and unredacted. Threat model, bypass surfaces, and failure behaviour:
|
|
185
|
+
[SECURITY.md](SECURITY.md).
|
|
186
|
+
|
|
187
|
+
## Zellij pane bypass
|
|
188
|
+
|
|
189
|
+
The bundled [Zellij plugin](zellij-plugin/) adds a per-pane "skip prompts" toggle: Ask and
|
|
190
|
+
no-opinion become Allow for that pane only, Deny still holds — far narrower than a host-wide
|
|
191
|
+
"dangerously skip permissions" mode.
|
|
192
|
+
|
|
193
|
+
## Documentation
|
|
194
|
+
|
|
195
|
+
- [Getting started](docs/getting-started.md) — install, initialize, verify.
|
|
196
|
+
- [Capability matrix](docs/capabilities.md) — exact behaviour per agent.
|
|
197
|
+
- [Policy reference](docs/policy-reference.md) — schema, semantic tools, hierarchy, includes, redirects.
|
|
198
|
+
- [Shell pattern DSL](docs/pattern-dsl.md) · [Semantic SQL policies](docs/sql-policy.md) — matching grammars.
|
|
199
|
+
- [CLI reference](docs/cli.md) — commands, hook installation, traces, exit behaviour.
|
|
200
|
+
- [Troubleshooting](docs/troubleshooting.md) — symptom-led fixes.
|
|
201
|
+
- [Architecture](docs/architecture.md) · [Adapter notes](docs/adapters.md) — contributor internals.
|
|
202
|
+
- [Changelog](CHANGELOG.md) · [Contributing](CONTRIBUTING.md) · [Security](SECURITY.md)
|
|
203
|
+
|
|
204
|
+
## License
|
|
205
|
+
|
|
206
|
+
MIT
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 agentperm contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Agentperm Config
|
|
2
|
+
|
|
3
|
+
A native macOS policy editor for explaining why commands were allowed, denied, or prompted and turning those commands into explicit, reviewable agentperm configuration changes.
|
|
4
|
+
|
|
5
|
+
The app always explains the global policy baseline and compares it with any selected repositories. Configure mode uses Codex headlessly with `--sandbox read-only`; Codex emits a schema-constrained proposal and cannot edit policies. Agentperm's versioned local JSON API owns policy discovery, rule parsing and serialization, lossless JSON5 diffs, validation, compare-and-swap application, rollback, and undo. The native app owns workflow instructions, target selection, review, feedback, and approval.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
Requirements: macOS 14+, Codex CLI, and agentperm. Alfred 5 with Powerpack is optional.
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
./scripts/install.sh
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Open the app directly, or install the optional Alfred workflow and type `ap`. Alfred immediately shows the current global verdict and offers **Explain** or **Propose Changes**; leave the argument blank to use the clipboard. You can also assign a key to its Hotkey trigger.
|
|
16
|
+
|
|
17
|
+
Published releases include a universal Apple Silicon/Intel DMG: open it and drag **Agentperm Config** to **Applications**. The source installer above is for contributors and also installs the optional Alfred workflow.
|
|
18
|
+
|
|
19
|
+
Settings provide optional Codex and agentperm executable overrides (otherwise resolved from the inherited `PATH`), a Codex profile/model, additional repository roots, exclusions, global instructions, and named workflows. Agentperm owns policy discovery beginning at `~/.agent-permissions.jsonc`. Git discovery always covers the home directory and ignores missing roots. It skips system, privacy-protected, application, cache, dependency, and build directories; add a protected folder explicitly if you want macOS to grant access. The seeded **Read-only generalisation** workflow preserves the conservative broad-safe behavior; custom workflows can propose allow, ask, or deny rules while retaining the same local diff and approval boundary.
|
|
20
|
+
|
|
21
|
+
## Explain workflow
|
|
22
|
+
|
|
23
|
+
1. Paste a command or compound shell program.
|
|
24
|
+
2. Optionally choose repositories to compare with the automatic global policy baseline.
|
|
25
|
+
3. See the effective decision, the winning rule or unmatched segment, compound-command breakdown, and every contributing policy file.
|
|
26
|
+
4. Open a policy file in Finder or carry the same command into Propose Changes.
|
|
27
|
+
|
|
28
|
+
## Propose Changes workflow
|
|
29
|
+
|
|
30
|
+
1. Edit the captured command and choose any repositories whose local scripts or configuration matter. The searchable picker shows selections as removable chips and can toggle all filtered results.
|
|
31
|
+
2. Analyse. Codex reads the global include graph, selected repositories, relevant manifests, local docs, and the active workflow instructions.
|
|
32
|
+
3. Review each generalized rule, its positive examples, its mutating neighbours, rejected command segments, target policies, and exact multi-file diff.
|
|
33
|
+
4. Toggle rules and global/project targets directly, or request a revision in natural language.
|
|
34
|
+
5. Apply selected changes. Agentperm applies the exact reviewed plan with compare-and-swap checks; the app then performs structured behavioral checks through the same API. Any failure restores every affected file.
|
|
35
|
+
6. Undo from the success screen if needed.
|
|
36
|
+
|
|
37
|
+
Choose **Ad hoc…** to provide one-off instructions without creating a saved workflow. Workflow instructions define what Codex should propose; agentperm independently parses, canonicalizes, targets, and validates every proposed rule.
|
|
38
|
+
|
|
39
|
+
No terminal window is opened. `--demo` launches the editor with a non-applying sample proposal:
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
swift run AgentpermConfig --demo
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Safety model
|
|
46
|
+
|
|
47
|
+
- Codex is read-only and returns data, not patches.
|
|
48
|
+
- The seeded workflow tells Codex to propose only defensible read-only surfaces. Agentperm can mechanically classify semantic rules such as `Python(readonly)`, SQL effects, and native read/write capabilities, but it does not claim to prove that every arbitrary executable named by `Shell(...)` is observational.
|
|
49
|
+
- Global and project targets are opaque IDs issued from agentperm's actual policy/include discovery. Codex cannot invent a writable path.
|
|
50
|
+
- Reusable tool permissions are global-first; project policies are for repository-dependent scripts and toolchains.
|
|
51
|
+
- Compound commands are split, so read-only segments can be proposed while writes and uncertain segments stay rejected.
|
|
52
|
+
- Each rule carries allow examples and nearby mutation examples. Apply fails if positives still prompt or a negative becomes allowed.
|
|
53
|
+
- Multi-file application is all-or-nothing and stale proposals cannot overwrite later edits.
|
|
54
|
+
|
|
55
|
+
Commands are redacted for common secret assignments and credential flags before being sent to Codex. Selected repository evidence and global/workflow instructions are also part of that request; Explain mode itself is local and invokes only `agentperm why`.
|
|
56
|
+
|
|
57
|
+
## Development and releases
|
|
58
|
+
|
|
59
|
+
`swift test` runs the deterministic suite. `scripts/build-app.sh` creates an ad-hoc-signed universal app for local development; `scripts/package-release.sh VERSION` adds a drag-to-Applications DMG, app ZIP, Alfred workflow, and checksums.
|
|
60
|
+
|
|
61
|
+
Tags named `config-vX.Y.Z` run the macOS release workflow. It requires a Developer ID Application certificate and App Store Connect API key in the documented repository secrets, signs the app and DMG, submits the DMG to Apple's notary service, staples the ticket, and publishes the artifacts to a GitHub release. See [publishing](docs/publishing.md).
|
|
@@ -12,6 +12,7 @@ authoritative home.
|
|
|
12
12
|
| See what each supported agent can enforce | [Capability matrix](capabilities.md) |
|
|
13
13
|
| Write or organize a policy | [Policy reference](policy-reference.md) |
|
|
14
14
|
| Match flags, permutations, pipes, and wrappers | [Shell pattern DSL](pattern-dsl.md) |
|
|
15
|
+
| Allow SQL by dialect, effect, relation, or function | [Semantic SQL policies](sql-policy.md) |
|
|
15
16
|
| Understand a decision or inspect a trace | [`why`](cli.md#why) and [diagnostic traces](cli.md#diagnostic-traces) |
|
|
16
17
|
| Fix prompting, hook, policy, or parsing problems | [Troubleshooting](troubleshooting.md) |
|
|
17
18
|
| Assess the security boundary | [Security model](../SECURITY.md) |
|
|
@@ -22,7 +23,8 @@ authoritative home.
|
|
|
22
23
|
- **Evaluate and try:** [project README](../README.md) and [getting started](getting-started.md).
|
|
23
24
|
- **Operate:** [CLI reference](cli.md), [capability matrix](capabilities.md), and
|
|
24
25
|
[troubleshooting](troubleshooting.md).
|
|
25
|
-
- **Specify:** [policy reference](policy-reference.md)
|
|
26
|
+
- **Specify:** [policy reference](policy-reference.md), [Shell pattern DSL](pattern-dsl.md), and
|
|
27
|
+
[Semantic SQL policies](sql-policy.md).
|
|
26
28
|
- **Maintain:** [architecture](architecture.md), [adapter notes](adapters.md), and
|
|
27
29
|
[contributing](../CONTRIBUTING.md).
|
|
28
30
|
|
|
@@ -31,7 +33,7 @@ authoritative home.
|
|
|
31
33
|
| Term | Meaning |
|
|
32
34
|
|---|---|
|
|
33
35
|
| **policy** | The merged global and directory `.agent-permissions.jsonc` files used for a request. |
|
|
34
|
-
| **rule** | One allow, ask, or deny entry
|
|
36
|
+
| **rule** | One allow, ask, or deny entry, including shell, Python, SQL, and named/scoped tool rules. |
|
|
35
37
|
| **segment** | One executable command extracted from shell source. `a | b && c` has three. |
|
|
36
38
|
| **request** | A shell operation, semantic tool operation, compound operation, or rejected operation produced by an adapter. |
|
|
37
39
|
| **verdict** | `allow`, `ask`, `deny`, or `no-opinion`, plus a rationale. |
|
|
@@ -4,8 +4,8 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "agentperm"
|
|
7
|
-
version = "0.
|
|
8
|
-
description = "Permission policy mediator for Claude Code, Codex, OpenCode, Gemini CLI, and
|
|
7
|
+
version = "0.5.0"
|
|
8
|
+
description = "Permission policy mediator for Claude Code, Codex, OpenCode, Gemini CLI, Kiro, and Antigravity."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { file = "LICENSE" }
|
|
11
11
|
requires-python = ">=3.12"
|
|
@@ -16,6 +16,7 @@ keywords = [
|
|
|
16
16
|
"gemini-cli",
|
|
17
17
|
"opencode",
|
|
18
18
|
"kiro",
|
|
19
|
+
"antigravity",
|
|
19
20
|
"coding-agent",
|
|
20
21
|
"ai-agents",
|
|
21
22
|
"permissions",
|
|
@@ -45,6 +46,7 @@ classifiers = [
|
|
|
45
46
|
]
|
|
46
47
|
dependencies = [
|
|
47
48
|
"pyjson5>=2.0,<3",
|
|
49
|
+
"sqlglot>=30.0,<31",
|
|
48
50
|
"tomlkit>=0.13,<0.14",
|
|
49
51
|
"tree-sitter>=0.25,<0.26",
|
|
50
52
|
"tree-sitter-bash>=0.25,<0.26",
|
|
@@ -65,6 +67,8 @@ dev = [
|
|
|
65
67
|
"pytest>=8.0",
|
|
66
68
|
"ruff>=0.6",
|
|
67
69
|
"basedpyright>=1.13",
|
|
70
|
+
"pylint>=4.0.6",
|
|
71
|
+
"vulture>=2.16",
|
|
68
72
|
]
|
|
69
73
|
|
|
70
74
|
[tool.hatch.build.targets.wheel]
|
|
@@ -78,18 +82,18 @@ line-length = 120
|
|
|
78
82
|
target-version = "py312"
|
|
79
83
|
|
|
80
84
|
[tool.ruff.lint]
|
|
81
|
-
select = ["E", "F", "I", "N", "UP", "B", "SIM", "RUF"]
|
|
85
|
+
select = ["E", "F", "I", "N", "UP", "B", "SIM", "RUF", "ANN"]
|
|
82
86
|
|
|
83
87
|
[tool.basedpyright]
|
|
84
88
|
include = ["src", "tests"]
|
|
85
89
|
pythonVersion = "3.12"
|
|
86
90
|
typeCheckingMode = "strict"
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
reportAny = "error"
|
|
92
|
+
reportExplicitAny = "error"
|
|
93
|
+
reportIgnoreCommentWithoutRule = "error"
|
|
94
|
+
enableTypeIgnoreComments = false
|
|
95
|
+
reportUnnecessaryTypeIgnoreComment = "error"
|
|
89
96
|
reportMissingTypeStubs = false
|
|
90
|
-
reportUnknownMemberType = false
|
|
91
|
-
reportUnknownVariableType = false
|
|
92
|
-
reportUnknownArgumentType = false
|
|
93
97
|
|
|
94
98
|
[tool.pytest.ini_options]
|
|
95
99
|
testpaths = ["tests"]
|