Treat repository instruction files as executable input, not documentation. Review AGENTS.md and similar artefacts before unsupervised execution, scan them for shell commands and credential-path access, and enforce allow or block decisions outside the model. The control objective is to prevent untrusted repository content from becoming trusted pre-task execution.
Repository instructions should be treated as executable control surface
Security teams should govern coding agents as if repository instruction files can change agent behaviour, because they can. That means AGENTS.md, workspace rules, hooks, and similar artefacts belong in the trust boundary, alongside code and build scripts. The practical goal is to stop unreviewed repo content from becoming silent pre-task execution authority.
Before allowing autonomous runs, teams should classify these files by the actions they can trigger. If an instruction file can launch shells, fetch dependencies, rewrite files, or read credential paths, it is operating guidance with security impact, not passive documentation. That distinction determines whether the agent may run at all, and under what supervision.
For teams building a broader control model for AI coding agents, the repository itself becomes part of the execution environment. The control point is not just the model prompt, but the files the agent reads before it starts to act.
What governance should examine before the agent runs
The first review should focus on the instruction paths most likely to create unsafe execution: shell commands, package install steps, pre-commit or hook behaviour, and references to local secrets, tokens, or credential stores. A repo instruction that tells an agent to “inspect”, “repair”, or “bootstrap” itself can still be dangerous if it implicitly grants tool use without a human decision.
Governance should also check whether the repository can steer the agent toward external code or dependency resolution. Even a benign-seeming setup note can become a supply chain risk if it causes the agent to install unpinned packages, trust generated patches, or accept instructions from adjacent files that were never meant to be executable.
Current practice is evolving toward treating such artefacts as policy inputs rather than developer convenience. In that model, the repo can suggest intent, but it cannot itself authorise execution, secret access, or outbound network activity.
Teams that want a deeper pattern for these attacks can use Coding Agent Configuration File Attacks as the adjacent control lens. It shows why repository rules, hooks, and agent settings need explicit review because the attack surface is often configuration, not code.
When the repository is the place where commands are sourced, governance should also apply the same discipline used for other agent controls: AI IDE and Coding Agent Security Guide. The useful lesson is that mode, allowlist, and sandbox choices must be enforced outside the model, not inferred from what the agent thinks it should do.
How to make repository-driven execution safe enough to permit
The safest pattern is to separate review from execution. One workflow inspects instruction artefacts, another approves the run, and a third executes with constrained permissions. If the same unsupervised agent can both read the repo instructions and act on them immediately, the governance model has collapsed into self-approval.
Security teams should enforce an allow or block decision outside the model, then bind the agent to that decision with technical controls. That usually means restricted file access, no implicit shell escalation, limited network reach, and explicit handling for any instruction that touches credentials, deployment targets, or production repositories.
If the organisation is standardising this across tools, the governance logic should align with AI Code Security and Agentic Coding Security Buyer's Guide, because it helps teams distinguish review controls, sandboxing, and policy enforcement from simple code scanning. The key is to require the control to exist before the agent acts, not after.
If a repository instruction file is needed for productivity, keep its scope narrow and observable. Limit which directories it can influence, require explicit approval for any command-bearing change, and log both the artefact version and the agent action it triggered. That gives reviewers a clear chain from instruction to effect.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Agentic AI Top 10 and OWASP Non-Human Identity Top 10 define the specific risk controls and attack patterns relevant to this topic.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Agentic AI Top 10 | ASI03 — Identity & Privilege Abuse | Repo instructions can grant unsafe execution authority to the agent. |
| ASI02 — Tool Misuse | Instruction files can steer an agent into unsafe shell, install, or file actions. | |
| ASI10 — Rogue Agents | Unsupervised repo-driven execution can let an agent act outside intended governance. | |
| Recommendation — Enforce external approval and least privilege before repository instructions can drive action. Restrict tool invocation to approved, policy-checked actions only. Add kill-switch and supervision gates for any agent run that can self-direct. | ||
| OWASP Non-Human Identity Top 10 | NHI-06 — Insecure Cloud Deployment Configurations | Repository-driven execution can expose unsafe runtime and access configuration choices. |
| NHI-05 — Overprivileged NHI | Agents that trust repo instructions may inherit more privilege than needed. | |
| Recommendation — Lock down execution environments so repo content cannot widen access or runtime scope. Constrain agent credentials so repository content cannot trigger privileged actions. | ||
Practitioner Guidance
What to prioritise: Treat instruction files that can trigger commands, installs, or secret access as higher risk than ordinary repo documentation. Review those artefacts before the first unattended run, then re-review them whenever the repository layout or agent permissions change.
What to verify: Confirm that the agent cannot infer execution authority from repository content alone. The control should prove that an approval step, sandbox, or policy gate is actually enforced outside the model, and that sensitive paths are unreadable unless the run has been explicitly authorised.
Decision rule: If an instruction file can alter runtime behaviour or reach credentials, require human approval and constrained execution. If it only describes workflow and cannot change tools, files, or access, it can stay in the lighter review path.
Practitioner takeaway: The real governance problem is not whether the agent can read the repository, but whether the repository can silently become the agent’s authority. That authority must always be bounded by deterministic controls outside the model.
Related resources from NHI Mgmt Group
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on October 30, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org