Markdown Editor

AI Coding Assistant Policy Template

Policy for AI coding assistants and agents: autonomy levels, tool register, secrets, sandboxing, review of generated code, provenance, OWASP ASI and SSDF mapping

Software e ingenieríaCompletaOWASP Top 10 for Agentic Applications 2026; NIST SP 800-218 SSDF 1.1; EU AI Act Art. 4codingassistantpolicy

Cómo usar: Use it when engineers use coding assistants or agents and you need rules for tools, data, agent permissions and review. Fill the autonomy levels and the tool register first, then the sandbox defaults. The main pitfall is giving an agent the engineer's own token and reviewing its output less carefully than human code.

Vista previa

AI Coding Assistant Policy: [Organisation or engineering group]

Engineering policy for AI coding assistants and coding agents: which tools are approved and at what autonomy level, what data and secrets they may see, what permissions agents get, how generated code is reviewed and tested, how provenance and licensing are handled, and how incidents, exceptions and compliance are managed. Aligned with the OWASP Top 10 for Agentic Applications 2026 (ASI01 to ASI10, released 9 December 2025), the NIST Secure Software Development Framework (SSDF) Version 1.1 (SP 800-218, February 2022) with readiness notes for the Version 1.2 initial public draft (SP 800-218r1, December 2025), and the AI literacy duty in Article 4 of the EU AI Act (Regulation (EU) 2024/1689, as amended by Regulation (EU) 2026/1744). Replace every [bracketed] value and every row marked Example. Worked examples use Corvid Commerce, a fictional SaaS company that runs an online checkout platform. This is a documentation format, not legal advice: check the current official texts and a qualified professional before relying on any legal statement.

Document control

FieldValue
Document ID[ACP-POL-001]
Version[0.1]
Status[Draft / In review / Approved / Superseded]
Owner[@engineering-director]
Approvers/reviewers[@ciso], [@appsec-lead], [@legal-counsel], [@privacy-lead], [@platform-lead]
Last updatedYYYY-MM-DD
Classification[Internal]
Applies to[Example: All employees, contractors and vendors who write, review or deploy code for Corvid Commerce]
Parent policy[Example: AI Usage Policy AIU-POL-001; Secure Coding Standard SEC-STD-004]
Next reviewYYYY-MM-DD (at least every six months, and when a tool changes its data terms or agent features)

Approvals

RoleNameDecisionDate
Engineering director[@name][Approve / Approve with conditions / Reject]YYYY-MM-DD
Chief information security officer[@name][Decision]YYYY-MM-DD
Legal counsel[@name][Decision]YYYY-MM-DD

Revision history

VersionDateAuthorChange summary
0.1YYYY-MM-DD[@name]First draft
1.0YYYY-MM-DD[@name]Example: Approved; autonomy levels L0 to L2 allowed, L3 in pilot only
1.1YYYY-MM-DD[@name]Example: Added MCP server allow-list after the quarterly tool review

Contents

1. Purpose and scope

1.1 Purpose

This policy lets engineers at [Organisation] use AI coding assistants and coding agents to work faster while keeping the same standard of security, quality and accountability that applies to code written by hand. It sets out which tools may be used, how much they may do on their own, what they may see, and what a person must check before generated code reaches production.

The policy rests on one rule: the engineer who merges a change is accountable for it, whoever or whatever wrote it. An assistant is a tool, not an author of record and not a reviewer.

1.2 Scope

In scopeOut of scope
Example: Code completion and chat assistants inside editors and terminalsGeneral AI chat use for non-code work, covered by the AI Usage Policy (ai-data/ai-usage-policy)
Example: Coding agents that edit files, run commands, open pull requests or act in CIBuilding AI features into the product, covered by the AI product lifecycle documents
Example: Review bots that comment on pull requestsModel training or fine-tuning, covered by the SSDF AI supplement in the SSDF Practice Attestation (security/ssdf-practice-attestation)
Example: MCP servers, plugins and rule files that extend those toolsVendor products that embed AI but never touch source code
[Item][Item]

1.3 Legal and regulatory context

SourceWhat to checkChecked on
EU AI Act, Regulation (EU) 2024/1689, Article 4 (as amended by Regulation (EU) 2026/1744, in force 27 July 2026)Providers and deployers of AI systems must take measures that support AI literacy of staff who use AI systems on their behalf; the amended text says this does not require a guaranteed level for each person. Check the consolidated text on EUR-LexYYYY-MM-DD
Data protection law (for example the EU GDPR, the UK GDPR and Data Protection Act 2018, or US state privacy laws)Whether personal data in code, logs or tickets may be sent to the assistant provider, and on what legal basisYYYY-MM-DD
Customer contracts and data processing agreementsWhether customer data or customer code may be processed by a third-party AI serviceYYYY-MM-DD
Open source licences of dependencies and of the repositoryObligations that apply if generated code reproduces licensed code (section 9)YYYY-MM-DD

2. Principles

  1. Human accountability. A named person approves every change that reaches a protected branch. The assistant never approves its own work.
  2. Least privilege for agents. An agent gets the smallest set of tools, files, credentials and network destinations its task needs, and only for the duration of the task.
  3. Untrusted input stays untrusted. Issue text, web pages, dependency READMEs, logs and tool output can carry instructions aimed at the agent. They are data, never commands.
  4. Same bar, same gates. Generated code passes the same review, tests, static analysis and dependency checks as any other code. No gate is relaxed because a tool claims high accuracy.
  5. Traceability. It must be possible to tell, after the fact, which changes an agent produced, under which session, with which tool and model version.
  6. Approved tools only. Company code and data go only to tools on the register in section 4.2, under company accounts and company data terms.
  7. Learn openly. Mistakes and near misses involving assistants are reported without blame, so that the policy and the guardrails improve.

3. Roles and responsibilities

RoleResponsibilities
Engineer (author)Uses only approved tools and modes; reviews every generated line before committing; labels agent-authored changes; keeps secrets and restricted data out of prompts; reports incidents
ReviewerReviews agent-authored changes with the depth set in section 8; checks tests and dependency changes; does not approve a change they could not explain
Code ownerDecides whether agents may change their paths at all, and at which level; see Code Ownership Policy (dev/code-ownership-policy)
Platform engineeringProvides managed sandboxes, scoped credentials, egress controls and logging for agents; maintains the tool register configuration
Application securityApproves tools and MCP servers; maintains the control mapping (section 14); runs periodic tests of agent guardrails
Legal and privacyReviews vendor data terms, licensing questions and data protection impact
AI governance leadOwns the literacy programme (section 11) and links this policy to the organisation's AI inventory
Policy ownerKeeps the policy current, approves exceptions, reports compliance metrics

4. Approved tools and autonomy levels

4.1 Autonomy levels

LevelNameWhat the tool may doMinimum controls
L0SuggestInline completion and chat answers; the engineer copies or accepts textApproved tool and account; data rules in section 6
L1Edit locallyEdits files in the engineer's working copy after per-change or per-session approvalL0 controls; diff shown before saving; no shell commands without approval
L2Act in a sandboxRuns commands, tests and builds in an isolated environment; may open a draft pull requestL1 controls; managed sandbox (section 7); scoped token; egress allow-list; session log
L3Act in shared systemsActs in CI, issue trackers or cloud accounts on a schedule or trigger, without a person watching each stepL2 controls; named human sponsor; written permission design (ai-data/agent-tool-permission-design); threat model (ai-data/agentic-threat-model); security approval

4.2 Tool register

Tool IDTool and modeMax levelAccount typeData terms checkedAllowed repositoriesStatus
TOOL-001 (Example)Editor assistant, completion and chatL1Enterprise tenant, SSONo training on customer content; 30-day retention; checked YYYY-MM-DDAll except restrictedApproved
TOOL-002 (Example)Terminal coding agentL2Enterprise API key via secrets brokerZero data retention addendum; checked YYYY-MM-DDProduct repositoriesApproved
TOOL-003 (Example)Pull request review botL3 (comment only)GitHub App, read and comment scopesVendor DPA signed YYYY-MM-DDProduct repositoriesPilot
TOOL-004 (Example)Any personal or free consumer accountNonePersonalNot acceptableNoneProhibited
[TOOL-NNN][Tool and mode][L0 to L3][Account][Terms and date][Scope][Approved / Pilot / Prohibited]

4.3 Adding a tool

A request to add a tool or mode goes through the intake form in the AI Use Case Intake template (ai-data/ai-use-case-intake). Application security, privacy and legal review the vendor terms, data flows, model hosting region, logging and admin controls. Approval is recorded in the register with an expiry date no later than the next policy review.

5. Policy statements

IDStatementEnforcement
ACP-POL-001Engineers MUST use only tools and modes listed as Approved or Pilot in section 4.2, under company accounts.SSO enforcement; network blocking of known consumer endpoints
ACP-POL-002Assistants MUST NOT receive secrets, credentials, private keys or production data in prompts, context files or attachments.Secret scanning on context files; pre-prompt redaction where the tool supports it
ACP-POL-003Restricted repositories (classification restricted) MUST NOT be opened with any assistant above L0 without a recorded exception.Repository setting; tool admin policy
ACP-POL-004Agents at L2 and above MUST run in a managed sandbox with scoped, short-lived credentials and an egress allow-list.Platform configuration; quarterly test
ACP-POL-005Agents MUST NOT approve, merge or deploy their own changes, and MUST NOT change branch protection, CODEOWNERS or CI permissions.Rulesets; agent identities excluded from approval counts
ACP-POL-006Every pull request with agent-authored changes MUST be labelled and MUST record the tool and session reference.Pull request template check
ACP-POL-007A human reviewer other than the author MUST approve agent-authored changes to protected branches.Code owner review rule
ACP-POL-008New dependencies proposed by an assistant MUST be verified to exist, to be the intended package, and to pass the dependency policy before merge.Dependency review check; see dev/dependency-management-policy
ACP-POL-009Generated tests MUST be reviewed for meaning: a test that asserts the current behaviour of new code is not evidence that the code is correct.Review checklist
ACP-POL-010Agent configuration files, rule files and MCP server definitions MUST be treated as code: reviewed, owned and version-controlled.CODEOWNERS entry for agent config paths
ACP-POL-011Content retrieved by an agent from issues, web pages, logs or tool output MUST be handled as untrusted input; agents MUST NOT be configured to follow instructions found in it.Agent system instructions; red-team tests
ACP-POL-012Engineers SHOULD enable the tool's filter for suggestions matching public code where available, and MUST follow section 9 when a match is reported.Tool admin setting
ACP-POL-013Engineers MUST complete the role training in section 11 before using L2 or L3 tools.Training record checked at access grant
ACP-POL-014Suspected leaks, harmful agent actions or prompt injection MUST be reported within [1 working day] through the security incident channel.Incident process

6. Data, secrets and context

6.1 Data classes

Data classL0 SuggestL1 Edit locallyL2 and L3 Agents
Public code and documentationAllowedAllowedAllowed
Internal source codeAllowed (approved tools)Allowed (approved tools)Allowed in the sandbox
Confidential design documentsAllowed if needed for the taskAllowed if needed for the taskOnly files mounted into the sandbox
Personal data, customer data, production dataNot allowedNot allowedNot allowed; use synthetic or masked fixtures
Secrets, keys, tokens, certificatesNot allowedNot allowedNot allowed; credentials come from the broker and are not readable by the model
Example: Payment card dataNot allowedNot allowedNot allowed

6.2 Context hygiene

  • Keep secrets out of the repository in the first place, following the Secrets Management Standard (security/secrets-management-standard). An agent will read whatever is in the working tree.
  • Use the tool's ignore file or admin policy to exclude .env files, key stores, data exports and customer fixtures from context.
  • Do not paste stack traces, logs or tickets that contain customer identifiers. Mask them first.
  • Treat the agent's session log as sensitive: it may contain code and command output. Store it with the same access controls as the repository.

7. Agent permissions and sandboxing

7.1 Default sandbox for L2 agents

ControlDefaultRationale (OWASP ASI)
Execution environmentEphemeral container or VM per session, destroyed after the sessionASI05 Unexpected Code Execution (RCE)
File systemOnly the target repository checkout; no home directory, no SSH keys, no cloud configASI03 Identity and Privilege Abuse
NetworkEgress allow-list: package registry mirror, source host API, approved model endpointASI01 Agent Goal Hijack, ASI02 Tool Misuse and Exploitation
CredentialsShort-lived token for one repository, contents:write on non-protected branches and pull_requests:write, nothing elseASI03 Identity and Privilege Abuse
ToolsAllow-listed commands and MCP servers only; destructive commands need approvalASI02 Tool Misuse and Exploitation
MemoryNo persistent memory across repositories; project memory files reviewed like codeASI06 Memory & Context Poisoning
LimitsSession time limit [Example: 60 minutes] and step limit [Example: 200 tool calls]ASI08 Cascading Failures
LoggingEvery command, file write and network call logged with the session IDASI10 Rogue Agents

7.2 Additional rules for L3 agents

An L3 agent acts in shared systems without a person watching each step, so it needs its own design document. Before approval, complete Agent Tool Permission Design (ai-data/agent-tool-permission-design) and Agentic Threat Model (ai-data/agentic-threat-model), name a human sponsor who answers for the agent, and give it its own workload identity, never a person's account. Multi-agent set-ups, where one agent delegates to another, also need authenticated messages between agents (ASI07 Insecure Inter-Agent Communication).

7.3 Agent change workflow

The diagram shows the default path for an L2 agent session. The agent never merges: a person reviews the draft, CI runs every gate, and a second person approves before a human merges.

8. Review and testing of generated code

8.1 Review depth

Change typeReview rule
Docs, comments, internal toolingOne reviewer; normal checklist
Application codeOne reviewer who is not the author and not an agent; reviewer runs or reads the tests
Security-sensitive paths (authentication, authorisation, cryptography, payments, input parsing, infrastructure-as-code)Code owner review plus application security review; agents limited to L1 unless an exception is approved
Dependency, build or CI configuration changesPlatform code owner review; provenance of each new package checked

8.2 Reviewer checklist for agent-authored changes

  • I can explain what every changed line does and why it is needed.
  • The change does what the ticket asked and nothing more; no unrelated rewrites.
  • New packages exist, are spelled correctly, come from the intended publisher and passed dependency review (guards against invented or look-alike package names).
  • No hard-coded secrets, disabled checks, broadened permissions or skipped tests.
  • Error handling, input validation and authorisation follow the Secure Coding Standard (security/secure-coding-standard).
  • Tests check the required behaviour, including failure cases, not only the behaviour the agent wrote.
  • Generated documentation and comments are accurate; no invented API names or options.
  • Public-code matches reported by the tool were handled under section 9.

8.3 Automated gates

All gates in the CI/CD Pipeline Design (dev/ci-cd-pipeline-design) apply unchanged: unit and integration tests, static analysis, secret scanning, software composition analysis and licence checks. [Example: Corvid Commerce adds a check that fails a pull request labelled agent-authored if it changes .github/workflows/, CODEOWNERS or ruleset files.]

9. Provenance, attribution and licensing

9.1 Recording provenance

ItemRule
Pull request labelagent-authored for L2 and L3 output; ai-assisted optional for L0 and L1
Commit trailer[Example: AI-Assisted: TOOL-002 session 7f3c2a] using Git trailer format, after the human Signed-off-by line if DCO is in use
Session logRetained for [Example: 180 days] and linked from the pull request
Model and tool versionRecorded in the session log; summarised in the pull request description

9.2 Public-code matches and licences

When a tool reports that a suggestion matches public code, or a reviewer recognises copied code, the author must either remove it and write an original implementation, or identify the source and its licence and handle it like any other third-party code under the Open Source Program Policy (dev/open-source-program-policy) and the Software Licence Review (compliance/software-licence-review). Do not strip licence headers or attribution from code an assistant reproduces.

9.3 Questions for counsel

  • Do the vendor terms assign or license output to us, and do they offer indemnity for third-party claims? Under which conditions (for example, filters enabled)?
  • Does any customer contract restrict use of AI services on code we deliver to that customer?
  • How do we answer customers or auditors who ask which parts of a deliverable were AI-generated?

10. Agent configuration and supply chain

ItemRule
Repository instruction files (AGENTS.md, CLAUDE.md, .cursor/rules/)Owned by the repository's code owners; reviewed like code; templates in dev/agents-md, dev/claude-md, dev/cursor-rules
MCP servers and pluginsOnly from the security allow-list; pinned to a version; reviewed for the scopes they request; see ai-data/mcp-server-spec
Skills and prompt packsReviewed before install; no network fetches at run time unless approved; see ai-data/agent-skill-spec
Instructions from third-party contentNever merged into agent configuration without review; forks and pull requests from outside contributors do not run agents with write tokens

11. Training and AI literacy

AudienceContentWhenRecord
All engineersThis policy; data rules; how assistants fail (invented APIs and packages, plausible but wrong code, outdated patterns)Before first use, then yearlyLearning system
L2 and L3 usersSandboxes, permissions, prompt injection, reviewing agent sessionsBefore access is grantedAccess request
Reviewers and code ownersReviewer checklist (section 8.2); spotting generated tests that prove nothingYearlyLearning system
Agent sponsorsThreat model, permission design, incident dutiesBefore L3 approvalApproval record

Link this table to the organisation's AI Literacy Plan (ai-data/ai-literacy-plan) so that one record shows the measures taken.

12. Incidents and exceptions

12.1 What to report

  • A secret, personal data or customer data sent to an assistant or written into an agent log.
  • An agent action outside its task: unexpected file deletion, network calls, permission changes, or commits to the wrong branch.
  • Signs of prompt injection: an agent following instructions found in an issue, web page, dependency or log.
  • Use of an unapproved tool or a personal account with company code.

Report through [security incident channel]. Security triages with the Security Incident Report process; AI-specific details go in the AI Incident Report (ai-data/ai-incident-report). Rotate any exposed secret at once, whatever the vendor's retention terms say.

12.2 Exceptions

Exception IDStatementReasonCompensating controlsApproved byExpires
ACP-EXC-001 (Example)ACP-POL-003Migration team needs L1 on the billing-legacy restricted repository for 8 weeksMasked fixtures only; extra code owner review; weekly log review[@ciso]YYYY-MM-DD
[ACP-EXC-NNN][Statement ID][Reason][Controls][@approver]YYYY-MM-DD

Exceptions expire after at most [six months] and are listed in the compliance report.

13. Compliance measurement

Metric IDMetricTargetSourceFrequency
ACP-MET-001Share of agent-authored pull requests with label and session reference[Example: 100%]Pull request dataMonthly
ACP-MET-002Agent-authored merges to protected branches without a second human approval0Ruleset audit logMonthly
ACP-MET-003Secrets detected in agent context or session logs[Example: 0, each one rotated within 24 hours]Secret scannerMonthly
ACP-MET-004Engineers with L2 or L3 access who completed training100%Learning systemQuarterly
ACP-MET-005Defects escaping to production from agent-authored changes, compared with other changes[Example: No higher rate]Incident and postmortem dataQuarterly
ACP-MET-006Open exceptions past expiry0Exception registerMonthly

Report to [engineering leadership] each quarter with trends and actions. Use the Developer Experience Survey (dev/developer-experience-survey) to learn whether the safe path is also the easy one.

14. Control mapping

14.1 OWASP Top 10 for Agentic Applications 2026

ASI IDRisk (short title)Policy statements and sections
ASI01Agent Goal HijackACP-POL-011; section 7.1 egress allow-list
ASI02Tool Misuse and ExploitationACP-POL-004; section 7.1 tool allow-list
ASI03Identity and Privilege AbuseACP-POL-004, ACP-POL-005; section 7.2 workload identity
ASI04Agentic Supply Chain VulnerabilitiesACP-POL-008, ACP-POL-010; section 10
ASI05Unexpected Code Execution (RCE)ACP-POL-004; section 7.1 ephemeral sandbox
ASI06Memory & Context PoisoningACP-POL-010; section 7.1 memory rule
ASI07Insecure Inter-Agent CommunicationSection 7.2 authenticated messages between agents
ASI08Cascading FailuresSection 7.1 time and step limits; ACP-POL-005
ASI09Human-Agent Trust ExploitationACP-POL-007, ACP-POL-009; section 8.2 checklist
ASI10Rogue AgentsSection 7.1 logging; ACP-POL-014; section 12

14.2 NIST SSDF Version 1.1 (SP 800-218)

SSDF taskParaphraseEvidence from this policy
PO.2.2Give role-based secure development trainingSection 11 training records
PO.3.1 and PO.3.2Specify the tools in each toolchain and deploy and maintain them securelyTool register (section 4.2)
PO.5.1Separate and protect development, build and test environmentsAgent sandbox (section 7.1)
PS.1.1Protect code from unauthorised access and changeACP-POL-005; rulesets
PW.4.1 and PW.4.4Acquire well-secured components and verify them over timeACP-POL-008
PW.5.1Follow secure coding practicesSection 8.2 checklist
PW.7.1 and PW.7.2Decide on and perform code review and analysisSection 8.1 review depth; section 8.3 gates
RV.1.1Gather information about potential vulnerabilitiesACP-POL-014 incident reporting

SSDF Version 1.2 is an initial public draft (SP 800-218r1, 17 December 2025; comment period closed 30 January 2026). Record any mapping to it as readiness work only until NIST publishes a final version.

15. Glossary and references

15.1 Glossary

TermMeaning in this policy
AI coding assistantA tool that suggests or explains code in response to a person, at L0 or L1
Coding agentA tool that plans and carries out several steps, such as editing files and running commands, with some autonomy, at L2 or L3
Agent-authored changeA change where an agent wrote the code and a person reviewed it
MCP serverA server that exposes tools or data to an agent through the Model Context Protocol
Prompt injectionInstructions hidden in content an agent reads, aimed at changing its behaviour
SandboxAn isolated, short-lived execution environment with limited files, network and credentials
Session logThe record of an agent session: prompts, tool calls, commands, file changes

15.2 References

ReferenceVersion or dateUsed for
OWASP Top 10 for Agentic Applications for 2026, OWASP GenAI Security Project, genai.owasp.orgReleased 9 December 2025Threat categories ASI01 to ASI10 (section 14.1)
NIST SP 800-218, Secure Software Development Framework Version 1.1, csrc.nist.gov/pubs/sp/800/218/finalFebruary 2022Secure development task mapping (section 14.2)
NIST SP 800-218r1 initial public draft, SSDF Version 1.2, csrc.nist.gov/pubs/sp/800/218/r1/ipd17 December 2025, draftReadiness note only
Regulation (EU) 2024/1689 (AI Act), Article 4, as amended by Regulation (EU) 2026/1744, eur-lex.europa.euAmendment in force 27 July 2026AI literacy measures (section 11)
Related templatesCurrentai-data/ai-usage-policy, ai-data/agent-tool-permission-design, ai-data/agentic-threat-model, ai-data/ai-literacy-plan, security/secure-coding-standard, security/secrets-management-standard, dev/code-ownership-policy, dev/dependency-management-policy, dev/agents-md

Standard and licence note

Based on the OWASP Top 10 for Agentic Applications 2026 (OWASP GenAI Security Project; risk IDs and short titles are cited with attribution, and OWASP content is published under CC BY-SA 4.0, so any OWASP text you adapt into this document carries the ShareAlike obligation; this template paraphrases and does not copy OWASP text), NIST SP 800-218 SSDF Version 1.1 (a US Government publication; task IDs are cited and paraphrased), and Article 4 of Regulation (EU) 2024/1689 as amended by Regulation (EU) 2026/1744 (paraphrased; the amendment was checked through published legal summaries because the EUR-Lex page did not load for automated access). Autonomy levels, policy statements, metrics and examples are original. Corvid Commerce is fictional. This is a documentation format, not legal advice; check the current official texts and a qualified professional before adoption. Template licence: MIT.

Plantillas relacionadas