88# it must only write `.md` files and must never create helper scripts or other
99# non-Markdown artifacts. The installed `runtime_ci_tooling` package may also
1010# apply this policy from its template tree at invocation time.
11+ #
12+ # This policy replaces the deprecated `--allowed-tools` CLI flag (removed in
13+ # Gemini CLI 1.0). Tool-surface restriction is handled entirely by these rules:
14+ # explicit allows for the tools the autodoc pipeline needs, and a catch-all deny
15+ # for everything else. When loaded via `--policy`, these rules operate at User
16+ # tier (base priority 2) which overrides both the built-in defaults (tier 1)
17+ # and `--yolo` mode's allow-all rule (priority 1.999).
18+
19+ # ── Allowed tools ────────────────────────────────────────────────────────────
1120
1221# Allow docs-only file edits for .md files only
1322# (Gemini CLI 0.34+: file edits use `write_file` / `replace`; `edit_file` is not a registered tool.)
@@ -17,24 +26,47 @@ decision = "allow"
1726priority = 100
1827argsPattern = ' "(file_path|path)"\s*:\s*"[^"]*\.md"'
1928
29+ # Allow all read operations unconditionally
30+ [[rule ]]
31+ toolName = [" read_file" , " read_many_files" , " glob" , " grep_search" , " list_directory" , " search_file_content" ]
32+ decision = " allow"
33+ priority = 100
34+
35+ # ── Denied tools ─────────────────────────────────────────────────────────────
36+
2037# Deny docs-only file edits for all non-.md files
2138[[rule ]]
2239toolName = [" write_file" , " replace" ]
2340decision = " deny"
2441priority = 90
2542deny_message = " Autodoc safety: only .md files may be edited. Source code and config files are read-only."
2643
27- # Allow all read operations unconditionally
28- [[rule ]]
29- toolName = [" read_file" , " read_many_files" , " glob" , " grep_search" , " list_directory" ]
30- decision = " allow"
31- priority = 100
32-
3344# Deny shell access entirely for docs-only Gemini runs. The tooling already
3445# provides the required prompt and file context, so shell access is unnecessary
3546# and can be abused to create helper scripts or other non-Markdown files.
3647[[rule ]]
37- toolName = [ " run_shell_command" ]
48+ toolName = " run_shell_command"
3849decision = " deny"
3950priority = 100
4051deny_message = " Autodoc safety: shell access is disabled during docs-only Gemini runs."
52+
53+ # Deny web access — docs-only runs should not fetch external resources.
54+ [[rule ]]
55+ toolName = [" web_fetch" , " google_web_search" ]
56+ decision = " deny"
57+ priority = 100
58+ deny_message = " Autodoc safety: web access is disabled during docs-only Gemini runs."
59+
60+ # Deny agent delegation — sub-agents could bypass the policy restrictions.
61+ [[rule ]]
62+ toolName = [" codebase_investigator" ]
63+ decision = " deny"
64+ priority = 100
65+ deny_message = " Autodoc safety: agent delegation is disabled during docs-only Gemini runs."
66+
67+ # Deny memory and planning tools — not needed for docs generation.
68+ [[rule ]]
69+ toolName = [" save_memory" , " write_todos" , " enter_plan_mode" ]
70+ decision = " deny"
71+ priority = 100
72+ deny_message = " Autodoc safety: memory/planning tools are disabled during docs-only Gemini runs."
0 commit comments