Skip to content

Commit f4d0b35

Browse files
authored
Merge pull request #8 from JAPACX/feat/explicit-agent-permissions
feat: make openspec-plan agent permissions fully explicit
2 parents 2691da4 + 8e9b8f8 commit f4d0b35

File tree

1 file changed

+53
-3
lines changed

1 file changed

+53
-3
lines changed

src/config.ts

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,64 @@ export function createConfigHook(ctx: { directory: string }): Hooks["config"] {
1919
description: "OpenSpec Architect - Plan and specify software architecture.",
2020
prompt: OPENSPEC_SYSTEM_PROMPT,
2121
permission: {
22+
// --- Read ---
23+
// Full read access; agent is trusted with the whole project
24+
read: {
25+
"*": "allow"
26+
},
27+
28+
// --- Exploration tools (read-only, no side effects) ---
29+
glob: "allow",
30+
grep: "allow",
31+
list: "allow",
32+
lsp: "allow",
33+
34+
// --- Task management ---
35+
todoread: "allow",
36+
todowrite: "allow",
37+
38+
// --- Web & search ---
39+
webfetch: "allow",
40+
websearch: "allow",
41+
codesearch: "allow",
42+
43+
// --- Agent tooling ---
44+
task: "allow",
45+
skill: "allow",
46+
question: "allow",
47+
48+
// --- Safety guards ---
49+
doom_loop: "ask",
50+
external_directory: "ask",
51+
52+
// --- Edit: deny everything, allow only spec files ---
53+
// Rules are evaluated last-match-wins, so "*": "deny" must come first
2254
edit: {
23-
// Allow editing specific root files
55+
"*": "deny",
2456
"project.md": "allow",
2557
"AGENTS.md": "allow",
26-
// Allow editing anything in openspec directory
2758
"openspec/**": "allow",
28-
// Allow editing anything in specs directory (standard OpenSpec structure)
2959
"specs/**": "allow"
60+
},
61+
62+
// --- Bash: deny all by default, allow read-only filesystem + git read ---
63+
bash: {
64+
"*": "deny",
65+
"grep *": "allow",
66+
"ls": "allow",
67+
"ls *": "allow",
68+
"cat *": "allow",
69+
"find *": "allow",
70+
"echo": "allow",
71+
"echo *": "allow",
72+
"pwd": "allow",
73+
"which *": "allow",
74+
"env": "allow",
75+
"printenv *": "allow",
76+
"git status*": "allow",
77+
"git log*": "allow",
78+
"git diff*": "allow",
79+
"git show*": "allow"
3080
}
3181
},
3282
color: "#FF6B6B" // Distinctive color for the agent

0 commit comments

Comments
 (0)