Join our Newsletter — 33% off our NHI Course
Home Glossary AI Security CLAUDE.md
AI Security

CLAUDE.md

← Back to Glossary
By NHI Mgmt Group Updated August 19, 2026 Domain: AI Security

A project-level instruction file that shapes how Claude Code interprets the codebase and applies constraints. In governance terms, it acts like standing policy for the agent, defining architecture, testing, and behavioural expectations before any tool action begins.

Expanded Definition

CLAUDE.md is a repository-scoped instruction file that gives Claude Code a persistent context for how to behave inside a specific project. It typically sets expectations for architecture patterns, testing practices, naming conventions, repository structure, and any constraints that should apply before the agent starts planning or taking tool actions. In practical terms, it functions as a local governance layer for an AI agent, shaping outputs in the same way a policy document shapes human work. Unlike a prompt pasted into a single session, CLAUDE.md is intended to be reusable across interactions and can therefore create more consistent agent behaviour. That said, usage is still evolving and no single standard governs its exact structure or content. For security and engineering teams, the closest analogies are policy-as-code and repository-level operating rules, with the important difference that the file is consumed by an agent rather than a CI pipeline. NIST’s NIST SP 800-53 Rev 5 Security and Privacy Controls is useful as a control reference because it formalises how organisations define consistent safeguards and responsibilities across systems. The most common misapplication is treating CLAUDE.md as a general documentation file, which occurs when teams write guidance that is too vague to constrain agent behaviour or too stale to reflect the current repository.

Examples and Use Cases

Implementing CLAUDE.md rigorously often introduces maintenance overhead, requiring teams to balance agent consistency against the cost of keeping instructions current as the codebase changes.

  • A platform team uses CLAUDE.md to tell Claude Code which package manager, lint rules, and test commands are authoritative for the repository.
  • A security engineering team adds instructions that require the agent to preserve audit logging, avoid weakening authentication flows, and flag changes that affect secrets handling.
  • An application team encodes architectural boundaries so the agent does not introduce direct database access in a service that must remain API-mediated.
  • A compliance-sensitive project points the agent to mandatory review steps before modifying authentication, encryption, or data retention code paths, aligning with control expectations described in NIST SP 800-53 Rev 5 Security and Privacy Controls.
  • A multi-repo organisation maintains separate CLAUDE.md files so each codebase can express its own testing thresholds, deployment assumptions, and operational constraints.

These use cases are especially valuable where a project has repeated patterns that an AI agent should follow without re-explaining them in every chat. They also help reduce accidental drift when multiple contributors rely on the same agentic workflow. The strongest implementations make the file specific enough to guide action, but not so rigid that it blocks legitimate refactoring or emergency fixes.

Why It Matters for Security Teams

For security teams, CLAUDE.md matters because it turns repository expectations into something an agent can actually follow at execution time. That is useful when the goal is to keep an agent from bypassing review norms, introducing insecure shortcuts, or ignoring repository-specific controls around secrets, logging, or dependency management. In identity-heavy or agentic AI environments, the file can also express guardrails about privileged operations, approval points, and the handling of sensitive tokens or credentials, which makes it relevant to NHI governance even when the term is not explicitly about identity. It is not a substitute for access control, secure SDLC practice, or formal policy, but it can reinforce all three when maintained carefully. Security teams should treat it as an operational control surface that needs ownership, versioning, and periodic review. Where applicable, it should complement broader control mapping such as NIST-based governance and the organisation’s change-management rules. Organisations typically encounter the real cost of weak CLAUDE.md guidance only after an agent makes a repeated unsafe change or bypasses an assumed convention, at which point the file becomes operationally unavoidable to fix.

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 address the attack and risk surface, while NIST CSF 2.0, NIST AI RMF and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
NIST CSF 2.0GV.PO-01Policies and procedures align with repository-level instructions that govern agent behaviour.
NIST AI RMFGOVERNThe Govern function covers documented AI oversight and accountability for agent instructions.
NIST SP 800-53 Rev 5CM-3Configuration change control fits repository instructions that shape agent actions in codebases.
OWASP Agentic AI Top 10Agentic AI guidance addresses instruction integrity and unsafe tool use in agent workflows.
OWASP Non-Human Identity Top 10NHI governance includes machine-authored instructions that affect autonomous system behaviour.

Constrain agent actions with explicit repository rules and verify they cannot be silently overridden.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on August 19, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org