KognitaKognita.

Blog

Your AI Agent Is Touching the Whole Codebase. There's No Audit Trail of What It Read.

10 min read

AI coding agents are now modifying code across entire codebases in single sessions. A developer runs Claude Code in goal mode, describes a feature, and comes back an hour later to a set of changes spanning twelve files across four services. The result is in git — the diff is visible, the commit is there — but the session itself, the context the agent read, the files it accessed before deciding where to make changes, the reasoning behind each modification: none of that is recorded anywhere.

For most engineering teams, this is not a problem they have thought about. Git has always been the audit trail. If something changes, it is in git. The new question that AI agents create is what happened before the commit: what did the agent read to make the changes it made? The answer, for most popular AI coding tools in 2026, is: nobody knows, and there is no way to find out after the fact.

For teams operating under SOC 2, HIPAA, PCI DSS, or financial services regulations, this is not a theoretical concern. It is an audit gap. Auditors are starting to ask about AI systems' access to codebases, and the answers most teams can provide — "it's in git," "each developer manages their own tools," "we don't log at that level" — are not answers that satisfy a compliance requirement. They are evidence that governance does not exist.

What a SOC 2 auditor asks and what most teams cannot answer

The questions coming in SOC 2 audits about AI coding tools follow a consistent pattern. They are about governance, access control, and audit evidence — the same questions asked about every other system that has access to production code. The difference is that for every other system, there are answers. For AI coding tools in their current per-developer configuration, there are often not.

SOC 2 audit questions about AI coding tools — and what most teams cannot answer
What a SOC 2 auditor asks about AI coding tools — and what most teams cannot answer:

  "What AI systems have write access to your codebase?"
    Typical answer: "Each developer manages their own tools individually"
    What the auditor hears: "We don't know"

  "What audit log exists of AI agent activity?"
    Typical answer: "Git commit history shows what was committed"
    What the auditor hears: "We can see the output but not the AI's decision process"

  "Can you show me what code Claude Code read during a specific session?"
    Typical answer: "No — we don't log at that level"
    What the auditor hears: "AI has access to the codebase with no activity record"

  "How do you govern which team members can use AI with which codebases?"
    Typical answer: "It's at the developer's discretion"
    What the auditor hears: "No governance exists"

The "we don't know" problem is the most fundamental. Per-developer AI tool adoption means that the organization does not have a centralized record of which AI systems have codebase access. A developer who set up Claude Code six months ago and has been using it daily may have more AI access to the codebase than any single person on the team — but if you ask the security team, they cannot confirm it, cannot scope it, and cannot revoke it without revoking the developer's entire codebase access. The AI access is coextensive with the human access because there is no separate layer for it.

The Claude Cowork audit gap — explicitly documented by Anthropic

The audit gap for Claude Cowork is not an inference. It is stated in Anthropic's documentation. Cowork activity is explicitly excluded from Audit Logs, the Compliance API, and Data Exports on every plan tier including Enterprise. This is not a configuration gap that can be addressed by upgrading plans or adjusting settings. It is an architectural decision.

What Anthropic's documentation says about Claude Cowork audit coverage
What Anthropic's own documentation says about Claude Cowork audit coverage:

  Claude Cowork activity is explicitly excluded from:
    -> Audit Logs      (all plan tiers, including Enterprise)
    -> Compliance API  (all plan tiers, including Enterprise)
    -> Data Exports    (all plan tiers, including Enterprise)

  This means:
    A developer using Cowork to modify code across 15 services in one session
    generates zero auditable record of:
      -> Which files were read
      -> Which changes were suggested vs. applied
      -> What reasoning the AI used for each change
      -> Which services were accessed during the session

  Git history shows the commit. Nothing shows what the AI touched before committing.

The practical consequence is that Cowork is not auditable at the session level. An AI agent that runs for an hour across a codebase, reads dozens of files, and makes hundreds of decisions before producing a commit generates a git diff but no record of the underlying session. From a compliance perspective, this is the equivalent of a contractor who works in your office for a month but whose activity generates no access logs — only the output they deliver. Most organizations would not accept this for a human contractor. They are accepting it for AI agents because the tools do not offer an alternative.

Why git history is not an audit trail for AI access

The instinctive response to "there is no AI audit trail" is "the code is in git — that is the audit trail." For human developers, git history is a reasonable proxy for activity: what a developer committed reflects what they did. For AI agents, git history records the output of a session but not the session itself.

An AI agent that read 500 files to make changes to 12 of them leaves a git diff of the 12 files. The 488 files it read — the context it used to make its decisions — are invisible in git. If the change turns out to be wrong, or if an auditor asks which files the AI accessed during the session, git cannot answer the question. The context of the decision is not recorded; only the decision is.

For regulated industries, this distinction matters. Access to data — even read-only access for the purpose of making changes — is a governed activity. An AI agent that reads patient data-adjacent code to understand a service's data model has accessed that code, even if it did not write any of it. That access is not in git. It is not recorded anywhere. It happened.

What governed AI codebase access produces

The alternative is a managed codebase intelligence layer where access is governed at the infrastructure level rather than trusted at the individual developer level. In a governed architecture, every query against the codebase — whether from a developer using an AI coding tool, a product owner asking a system question, or an AI agent running a multi-step task — generates a record: who asked, what they asked, which repositories and files were accessed, what was returned.

What governed AI codebase access produces for compliance teams
What governed AI codebase access produces for compliance:

  For every query against the codebase:
    -> Timestamp and user identity
    -> Query content (what was asked)
    -> Which repositories and files were accessed
    -> What was returned to the user

  For access control:
    -> Which roles can query which repos
    -> Which users have what access level
    -> When access was granted and by whom

  For SOC 2 audit:
    -> Evidence that AI access is governed (not discretionary per developer)
    -> Evidence that codebase access is logged (not just git commits)
    -> Evidence that access scope is controlled (not all-or-nothing clone access)
    -> Evidence that a non-technical team member's query was answered
       without them getting raw code access

This is the access log that SOC 2 auditors are looking for. Not the git diff — the underlying access record. When an auditor asks "what did the AI access during that session?", the answer is a log entry, not a shrug. When an auditor asks "which team members can use AI with which codebases?", the answer is an access policy, not "each developer manages their own tools."

The governance conversation most engineering teams have not had

The AI access governance conversation is coming to every engineering organization that operates under compliance requirements. It is arriving through SOC 2 audits, through internal security reviews, and through the growing awareness that AI tools with unrestricted codebase access and no centralized logging represent a class of uncontrolled access that would not be acceptable in any other context.

The organizations that are ahead of this are not blocking AI tools. They are changing the architecture: moving from per-developer tool adoption with no centralized visibility to a managed layer where AI codebase access is governed, logged, and auditable. The developers continue to use AI. The compliance team can see what the AI accessed. The auditor gets answers. Security engineers who need to govern AI coding access at scale cannot do it with per-developer configurations — they need a central layer, and the managed model is where that layer lives.

Final take

AI coding agents have codebase access at a scale and depth that would require extensive governance documentation if a human team member had the same access. The tools themselves do not generate that documentation. Git records the output. Nothing records the session, the context read, the files accessed, or the decisions made. For teams under SOC 2 and similar frameworks, this is a gap — and it is the gap that managed, governed codebase access addresses by design.

The AI audit trail gap is not a future problem. It is a current gap that auditors are already starting to find. Building the governance layer now — before the audit, not in response to it — means the managed access architecture is in place when the questions arrive. The alternative is discovering, mid-audit, that the most active system touching your codebase has no access logs at all.