AI in GTM · CRM governance

AI Agent Audit Trails in HubSpot and Salesforce: A Practical Guide

An AI agent audit trail is the record that lets you answer one question months later: what did the agent change, when, from what, and why? Native CRM logs were sized for human-paced change. This guide shows how to close the gap in an afternoon.

Joe LaGrutta, Founder of JayOh
Joe LaGrutta, Founder, JayOh14 min read · Updated November 2026
Meme: an auditor asks what the AI agent changed on March 3, the CRM audit log only keeps 30 days, and a shrugging man says Guess I will die
The question never arrives during the project. It arrives in an incident review or a diligence request.
30 days of UI log vs. a question asked 8 months later
Where this started

The original LinkedIn post

This guide expands a post about the most boring way an AI rollout goes wrong: nobody can explain what the agent did.

Read the post
Joe LaGrutta, Founder of JayOh
Joe LaGrutta, Founder, JayOhLinkedIn

Your agent made a change in March. Your audit log goes back 30 days. That's the whole incident review. There isn't one. Native retention is shorter than most people assume, and nobody checks until the moment they need it. HubSpot audit log: 30 days. Salesforce Setup Audit Trail: 180 days. Salesforce field history: 20 fields per object. Those windows were sized for human-paced change. An agent writing hundreds of records a day fills and ages out that history far faster than a team of admins ever did. The fix is boring and takes an afternoon: Export logs on a cadence shorter than the retention window. Weekly, to your own store. Turn on field history for the specific fields agents write, and respect the 20-field limit. Stamp every agent-written record with which agent, which version, which run. Keep the export after you stop using the agent. That last one matters more than it sounds. The question never arrives during the project. It arrives in a diligence request or a board review, months after everyone moved on. An action you can't reconstruct is an action you can't defend.

Why this breaks

Why the agent's trail goes missing

Your CRM logs were built to answer "which admin changed this setting?" Agents ask a different question at a different speed.

Cause 1 · the big one

Windows sized for humans

The HubSpot activity log views cover 30 days. Salesforce Setup Audit Trail rolls at about 180. An agent that writes all day makes those windows feel shorter, and nobody checks them until a question shows up.

Cause 2

Logs attribute to users, not agents

HubSpot's account log only records HubSpot-user actions. If three agents share one integration user or one admin's login, every change looks like the same person did it.

Cause 3

History is capped by count

HubSpot keeps 20 revisions per deal, company and ticket property (45 for contacts). Salesforce tracks 20 fields per object. High-frequency agent writes push the old values out.

Cause 4

No run-level metadata

Even when you can see that a value changed, nothing on the record says which agent, which prompt version or which run did it. You can't tie a bad batch to the change that caused it.

Cause 5

Nobody owns retention

The project team owns the build. Nobody owns the evidence. When the agent is switched off, its logs usually go with it, right before someone asks about it.

The cost

An action you can't defend

A stage that moved, an owner that flipped, an amount that changed. If you can't reconstruct it, you can't defend it in an incident review, a board meeting or diligence.

What good looks like

Native limits, then the benchmarks to beat them

Know the windows you're working inside, then set your own retention longer than the longest question you'll be asked.

What HubSpot and Salesforce keep out of the box

SystemWhat it recordsWindow or limitAgent gotcha
HubSpot account activity logUser actions; Professional adds CRM objects, property updates, workflows, lists, associationsUI views: last 30 days. Security export: 1 year. Super Admin onlyOnly HubSpot-user actions, so agents need their own identity
HubSpot property historyPrior values, including API changes; export can include the source45 revisions per contact property, 20 for companies, deals, tickets, custom objectsA busy deal property can roll 20 revisions in weeks
HubSpot restore toolsDeleted records; bulk "restore CRM changes"90 days for deleted records; 14 days for bulk restoreRestore is not evidence; export before you need it
Salesforce Setup Audit TrailSetup and configuration changes, not field valuesAbout 180 days rolling; CSV export must be downloaded within 72 hoursShows the permission change, not what the agent then did with it
Salesforce Field History TrackingBefore and after values on tracked fields20 fields per object; about 18 months in UI, 24 via APINo values for formula, roll-up, long text or multi-select fields
Salesforce Field Audit Trail (Shield or add-on)Archived history in FieldHistoryArchiveUp to 200 fields per object; retention set by HistoryRetentionPolicyPaid add-on; archive is API-only
EU AI Act, Article 26Logs of high-risk AI systems kept by deployersAt least 6 monthsMost GTM agents aren't high-risk, but it's a sane floor

Sources: HubSpot Knowledge Base, account activity history (Oct 2026) and property history (Sep 2026); Gearset, Salesforce audit trail guide (Jan 2026); Salesforce Developers, Field Audit Trail; EU AI Act Service Desk, Article 26 (2026). Limits change; check your own tier.

Benchmarks: weak, acceptable, strong

MetricWeakAcceptableStrong
Export cadence vs. shortest native windowNever or ad hocMonthlyWeekly or streamed
Retention of exported agent logsUnder 6 months6 to 12 months24 months or more
Agent-written fields with history onUnder 50%50 to 90%100%
Agent writes stampedNothing on the recordAgent name onlyAgent, version and run ID
Agent identityRuns as a human adminShared integration userOne identity per agent
Time to reconstruct one changeCan'tDays of diggingUnder 1 hour

Windows from HubSpot and Salesforce documentation (2026). The 6-month floor follows EU AI Act Article 26 (2026). The 24-month target, identity and reconstruction-time ranges come from JayOh's experience with diligence lookbacks and incident reviews. Context: Gartner (June 2025) expects over 40% of agentic AI projects to be canceled by the end of 2027, citing cost, unclear value and inadequate risk controls.

The playbook

How to build an AI agent audit trail in 9 steps

Steps 2, 3 and 5 do most of the work. Everything else makes them hold up under questions.

Inventory every agent that writes

What
A list of every agent, connector and automation that writes to the CRM: Breeze agents, Agentforce, Claude or other MCP connectors, Clay, Zapier, custom scripts.
Why
You can't log what you don't know exists. Most teams find two agents they forgot about.
How
HubSpot: Settings, Integrations, Connected Apps and Private Apps, plus the account activity log filtered to integration installs. Salesforce: Setup, Connected Apps OAuth Usage and Installed Packages. For each one, record its identity, objects, fields and writes per day.

Give each agent its own identity

What
One identity per agent, never a human's login and never one shared "integration" user for everything.
Why
HubSpot's log records user actions, and Salesforce history stamps the running user. Shared identities make every change look like the same author.
How
HubSpot: a separate private app per agent with only the scopes it needs. Salesforce: a dedicated integration user (Salesforce Integration license) per agent, with a permission set scoped to its objects. Our HubSpot AI connector write access guide covers scoping.

Stamp every write

What
Fields on each object the agent touches: Last Agent Writer, Agent Version, Agent Run ID, Agent Write Time and Agent Change Reason.
Why
History tells you a value changed. The stamp tells you which agent, which prompt version and which run did it, so a bad batch traces to its cause.
How
HubSpot: custom properties in an "Agent Audit" property group on contacts, companies and deals, written in the same API call as the change. Salesforce: custom fields, or a lookup to an Agent_Run__c custom object that holds the run details once.

Turn on history where agents write

What
Field history on the exact fields agents change, starting with stage, amount, close date, owner and lifecycle stage.
Why
Tracked fields are a scarce budget. Most orgs spent their 20 on fields that mattered in 2022.
How
Salesforce: Object Manager, the object, Fields and Relationships, Set History Tracking. Swap out low-value fields; if you need more than 20 or longer than 24 months, license Field Audit Trail and set HistoryRetentionPolicy. HubSpot: history is automatic, but watch the 20-revision cap on deal properties and export before busy ones roll.

Export on a cadence shorter than the window

What
A weekly export of every log to storage you control.
Why
Retention you don't control is retention you don't have.
How
HubSpot: Settings, Account Management, Account activity, export all logs weekly; property history export with Include Source Information for agent-written properties. Salesforce: download the Setup Audit Trail CSV weekly (within 72 hours), and pull FieldHistory tables such as OpportunityFieldHistory by SOQL through Data Loader or your ETL into the warehouse.

Log the agent side, not just the CRM side

What
An agent run log: run ID, agent, version, config or prompt hash, inputs referenced, records touched, before and after values, approver, outcome.
Why
The CRM shows the write. Only the agent's log shows the reasoning and the context it used.
How
A warehouse table for most teams; a simple database for small ones. Agentforce: use the Einstein Trust Layer audit trail and Command Center session tracing, and export them on the same cadence.

Gate the writes that move revenue

What
No direct agent overwrites on stage, amount, close date, owner or lifecycle stage.
Why
The cheapest audit trail is the change that never happened without a human.
How
Write to a "Proposed" field and let a HubSpot workflow create an approval task, or use a Salesforce Approval Process. Pair this with the decision boundaries in our AI agent governance guide.

Name an owner and a retention period

What
One named person owns the exports, with written retention: at least 6 months, ideally 24.
Why
Diligence lookbacks and renewal disputes regularly reach back more than a year.
How
Add it to the agent's operating doc (see the 90-day agent ownership model). Set lifecycle rules on the storage so exports can't be deleted early, and keep them after the agent is retired.

Test reconstruction every quarter

What
Pick a random agent-written record and answer: what changed, when, from what, which run, who approved.
Why
An untested trail is a hope. The test finds the missing export before an auditor does.
How
Time it. Under an hour is strong. Log the result and fix the gap it shows the same week.
Best practices and mistakes

What separates a trail that holds from one that doesn't

Boring discipline beats tooling. Most of these cost nothing but a decision.

Best practices

  • One agent, one identity, one owner.
  • Stamp version and run ID, not just the agent's name.
  • Spend tracked fields on the fields agents write.
  • Prefer proposed-value fields over direct overwrites on revenue fields.
  • Export before the window closes, not when someone asks.
  • Store exports outside the CRM with retention locks.
  • Log what the agent read as well as what it wrote.
  • Keep logs after the agent is switched off.
  • Rehearse a reconstruction every quarter.
  • Set retention to the longest likely question, not the shortest native window.

Common mistakes and what they cost

Agent runs as a human admin. Every change looks like that person made it.

Wrong person blamed

Relying on the 30-day UI view. Anything older than a month is unexplainable.

No incident review

Tracked fields spent on legacy fields. Stage and amount changes go unrecorded.

Forecast disputes

Missing the 72-hour CSV download. The Setup Audit Trail export quietly disappears.

Silent gap

No version stamp. A bad batch can't be tied to the prompt change that caused it.

Repeat failures

Logs deleted with the agent. The diligence question arrives months later.

Indefensible numbers

Shared integration user for every tool. Agent, sync and enrichment changes blur together.

Hours of guesswork
Interactive tool · Calculator

Audit trail gap calculator

Enter your setup. It calculates how far back you can actually defend an agent change, how fast history rolls over, and where the gaps are.

Defensible lookback
0days
vs. a 730-day (24-month) target
Trail score0 /100
Gradeweak
History coverage0%
History rolls over in0
Top gaps
    Template + Claude skill

    Copy the agent audit trail spec

    Paste this into your agent's operating doc or a ticket. It is the playbook above as a checklist with field names.

    AGENT AUDIT TRAIL SPEC (JayOh)
    Agent: ____________   Owner: ____________   CRM: HubSpot / Salesforce
    
    1. IDENTITY
    [ ] Dedicated identity (HubSpot private app / Salesforce integration user)
    [ ] Scopes limited to: ____________ objects, ____________ fields
    
    2. RECORD STAMPS (written in the same call as the change)
    [ ] Last Agent Writer      (text)
    [ ] Agent Version          (text, e.g. v1.4)
    [ ] Agent Run ID           (text)
    [ ] Agent Write Time       (datetime)
    [ ] Agent Change Reason    (text, one line)
    
    3. HISTORY
    [ ] Salesforce: history tracking on every agent-written field (20 per object max)
    [ ] Over 20 fields or over 24 months: Field Audit Trail + HistoryRetentionPolicy
    [ ] HubSpot: busiest properties exported before 20 revisions roll
    
    4. EXPORTS (weekly, to storage we control)
    [ ] HubSpot account activity log export
    [ ] HubSpot property history export, Include Source Information on
    [ ] Salesforce Setup Audit Trail CSV (download within 72 hours)
    [ ] Salesforce field history tables via SOQL / ETL
    [ ] Agent run log (run ID, version, inputs, records, before/after, approver)
    
    5. GATES
    [ ] Stage, amount, close date, owner, lifecycle stage: proposed value + approval
    
    6. RETENTION
    [ ] Minimum 6 months, target 24 months
    [ ] Retention lock on storage
    [ ] Kept after the agent is retired
    
    7. TEST
    [ ] Quarterly reconstruction test, target under 1 hour
        Last test date: ________  Result: ________
    Free Claude skill

    agent-audit-trail-review

    Hand Claude your agent inventory and CRM settings. It applies this guide and returns a gap report.

    • Calculates each agent's defensible lookback and how fast HubSpot revision caps roll over.
    • Grades identity, stamping, history coverage, export cadence and retention against the benchmarks above, quoting your input as evidence.
    • Ranks the top five gaps and writes a fix plan with the exact HubSpot or Salesforce setting to change.

    Install: In Claude on the web or desktop, open Settings, then Capabilities, make sure code execution and file creation is on, click Upload skill under Skills, choose the .zip and toggle it on. In Claude Code, save the file as ~/.claude/skills/agent-audit-trail-review/SKILL.md, or in .claude/skills/ inside your repo.

    Skills are available on Claude Pro, Max, Team and Enterprise plans. New to skills? Read how to use skills in Claude.

    Preview SKILL.md
    ---
    name: agent-audit-trail-review
    description: Reviews whether a team can reconstruct what its AI agents changed in HubSpot or Salesforce. Use when someone shares an agent inventory, CRM audit settings, field history settings or export schedules and asks "can we prove what the agent did", "audit our AI agents", "check our agent audit trail" or "are we ready for an incident review or diligence request".
    ---
    
    # Agent Audit Trail Review
    
    You review a team's AI agent audit trail in HubSpot or Salesforce and return a gap report and a fix plan. You apply the JayOh framework from the post "AI Agent Audit Trails in HubSpot and Salesforce: A Practical Guide".
    
    ## Inputs to ask for (use what the user gives; do not block on missing items)
    1. CRM and tier: HubSpot (Starter, Professional, Enterprise) or Salesforce (edition, and whether Shield or Field Audit Trail is licensed).
    2. Agent inventory: for each agent, its name, the identity it runs as (named user, shared integration user, private app, connected app), the objects it writes, the fields it writes, and roughly how many writes per day.
    3. History settings: which fields have Field History Tracking on (Salesforce), and which HubSpot properties the agents write most often.
    4. Export practice: what is exported (activity log, Setup Audit Trail, property or field history, agent run logs), how often, where it is stored, and for how long.
    5. Record stamping: whether agent-written records carry the agent name, agent version and run ID.
    6. Approval gates: which fields an agent can overwrite without a human approving.
    
    ## Native limits to check against (verified November 2026)
    - HubSpot account activity log: UI views show the last 30 days; security activity export covers one year; Professional adds CRM object, property, workflow, list and association categories. It records HubSpot-user actions, so agents need their own identity to be attributable.
    - HubSpot property history: up to 45 revisions per contact property and 20 per company, deal, ticket and custom object property, including API changes. Export with source information shows which user or app made each change.
    - Salesforce Setup Audit Trail: about 180 days rolling; CSV exports must be downloaded within 72 hours.
    - Salesforce Field History Tracking: 20 fields per object; about 18 months in the UI and 24 months via API; no values for formula, roll-up, long text or multi-select fields.
    - Salesforce Field Audit Trail: up to 200 fields per object, retention set by HistoryRetentionPolicy.
    - EU AI Act Article 26: deployers of high-risk AI systems keep automatically generated logs for at least six months. Most GTM agents are not high-risk, but use six months as a floor.
    
    ## Benchmarks (grade each one weak, acceptable or strong)
    - Export cadence: weak = never or ad hoc; acceptable = monthly; strong = weekly or streamed.
    - Export retention: weak = under 6 months; acceptable = 6 to 12 months; strong = 24 months or more.
    - Agent-written fields with history on: weak = under 50 percent; acceptable = 50 to 90 percent; strong = 100 percent.
    - Stamping: weak = none; acceptable = agent name only; strong = agent name, version and run ID on every write.
    - Identity: weak = runs as a human admin; acceptable = shared integration user; strong = one dedicated identity per agent.
    - Reconstruction time for one change: weak = cannot; acceptable = days; strong = under one hour.
    
    ## Steps
    1. Restate the inventory as a table: agent, identity, objects, fields written, writes per day.
    2. For each agent, compute the defensible lookback in days. If exports run more often than the shortest native window, the lookback is the export retention. If not, it is the native window (30 days for the HubSpot UI log, 180 days for Setup Audit Trail, 18 to 24 months for Salesforce field history).
    3. For each high-churn HubSpot property, estimate how many days 20 revisions last: 20 divided by writes per record per day. Flag anything under 90 days.
    4. Count agent-written fields without history tracking. In Salesforce, check the 20-field cap per object and say which fields to swap in or whether Field Audit Trail is needed.
    5. Grade every benchmark above and quote the user's own input as evidence for each grade.
    6. List the top five gaps ranked by risk: revenue fields (stage, amount, close date, owner, lifecycle stage) first.
    7. Write a fix plan in the JayOh order: separate identities, stamp every write, history on agent-written fields, weekly exports to your own store, an agent run log, approval gates on revenue fields, a retention owner, and a quarterly reconstruction test.
    
    ## Output format
    - Summary: one paragraph with an overall grade (weak, acceptable or strong) and the defensible lookback in days.
    - Table 1: agent inventory with identity and lookback.
    - Table 2: benchmark grades with the evidence quoted from the input.
    - Top 5 gaps with what each one risks.
    - Fix plan: numbered steps with the HubSpot or Salesforce setting to change.
    - Missing evidence: a list of what you could not verify.
    
    ## Guardrails
    - Quote the user's input as evidence for every grade. Never invent write volumes, field counts or settings.
    - If something is not provided, put it under Missing evidence instead of guessing.
    - Do not claim legal compliance. Say when a question needs counsel.
    - Do not recommend deleting history or logs.
    
    Built by JayOh (jayoh.io). Full guide: https://jayoh.io/ai-agent-audit-trail/
    
    FAQ

    AI agent audit trail questions

    Short answers to what people ask before they build one.

    How long does HubSpot keep the audit log?

    The account activity log views in HubSpot show the last 30 days. Security activity can be exported for the last year, and Professional and Enterprise add CRM object, property, workflow, list and association categories. Property history is kept by count instead: up to 45 revisions per contact property and 20 for other objects.

    How many fields can Salesforce field history track?

    Standard Field History Tracking covers 20 fields per object, kept about 18 months in the UI and 24 months through the API. Field Audit Trail, part of Shield or sold as an add-on, raises that to 200 fields per object with retention you set in a HistoryRetentionPolicy.

    Does HubSpot's audit log show changes made by an AI agent or integration?

    The account activity log only records HubSpot-user actions. Property history does capture API changes, and its export can include the source of each change. Give each agent its own private app and stamp its writes so changes are attributable.

    How do I prove what an AI agent changed in my CRM?

    Combine four things: a dedicated identity per agent, a stamp on every write with the agent, version and run ID, field history on the fields it writes, and weekly exports of CRM and agent logs to storage you control. Then test a reconstruction every quarter.

    How often should I export CRM audit logs?

    Weekly. The export cadence must be shorter than the shortest window you rely on, which is 30 days for the HubSpot log views, and Salesforce Setup Audit Trail CSVs must be downloaded within 72 hours of the export.

    Does the EU AI Act require logs for AI agents?

    Article 26 requires deployers of high-risk AI systems to keep automatically generated logs for at least six months. Most GTM agents are not high-risk, but six months is a sensible floor. Ask counsel about your specific systems.

    What should an AI agent write to each record it changes?

    At minimum: the agent's name, its version, the run ID, the time of the write and a one-line reason. Store full run details, such as inputs and before and after values, in a separate agent run log.

    The JayOh take

    Reliability isn't a model feature. Neither is accountability.

    Every agent rollout we audit has the same blind spot. The team tested whether the agent could do the job. Nobody tested whether they could explain the job afterward.

    The fix isn't a new tool. It's an identity per agent, a stamp on every write, history on the right fields and a weekly export someone owns. That's an afternoon of work that saves you from the worst question in a diligence room: "we don't know."

    If you want a second set of eyes on your agent setup before it touches revenue fields, see what good agentic readiness looks like, or talk to us.