An AI coding assistant security policy should state which tools are approved, what data may enter them, how secrets are protected, how AI-written code is reviewed, what gets logged, and who grants exceptions. Keep it to two pages that a developer will actually read, and enforce what you can in settings rather than in prose.
Definition: what the policy covers
An AI coding assistant is any tool that suggests, edits or writes code using a language model. That includes inline autocomplete, chat panels in the editor, and agentic tools that can run commands and open pull requests. The policy should name all three, because the risks differ. Autocomplete mostly raises data and quality questions. Agents add questions about actions, credentials and autonomy.
The eight sections to write
| Section | The question it answers | Example rule |
|---|---|---|
| Scope | Who and what is covered? | All employees and contractors, all repositories, all tools that send code to a model |
| Approved tools | Which tools may be used? | Only tools on the approved list, on company accounts |
| Data rules | What may be sent to a model? | No customer data, no credentials, no regulated records |
| Secrets | How do keys stay out of prompts and output? | Block reads of secret files, scan before commit |
| Review | How is AI output checked? | Same review and tests as human code, a named human approves |
| Agent limits | What may an agent do alone? | No production credentials, no direct pushes to protected branches |
| Logging | What can we reconstruct later? | Record tool, user, repository and merged changes |
| Exceptions | How do we deviate safely? | Written request, owner, expiry date |
Write rules that can be checked
A rule like "use AI responsibly" cannot be audited. A rule like "agents run with a deny rule for reading .env files and need approval for shell commands" can. For every sentence in the policy, ask who would notice if it were broken and how. If the answer is nobody, move the rule into a setting, a pipeline check or a branch protection rule.
The OWASP Top 10 for LLM Applications (2025) is a useful checklist for the risk list behind the policy. Entries such as sensitive information disclosure, supply chain, improper output handling and excessive agency map directly onto the sections above.
Keep one source of truth
Tool vendors let administrators set organization policies for features, models and agents, and recommend reviewing who can change those policies. Treat your written policy as the intent and the admin settings as the enforcement, and review both on a schedule. When they drift apart, the settings win in practice, so fix the document.
Try it yourself
Click through it at your own pace, or open it full screen.
Click through the pull request gate and look at how a written rule becomes a check that blocks a merge.
Quick check
How long should the policy be?
Two pages is a good target. Put the detail in linked standards, such as a secrets handling guide, so the policy itself stays readable.
Do we need a separate policy for AI agents?
Usually a section is enough, provided it covers actions, credentials and approval. Add a separate document only if agents become widespread.
Who should own it?
A named owner in security or engineering, with input from legal and a few developers who use the tools daily.
Safeguard supports this with policies and gates that enforce rules in pull requests, MCP Guardrail for agent tool access, and a free scan at gold.safeguard.sh/scan.
Sources
Last reviewed: 19 October 2026.