Data licensing for US companies with 20+ employeesoffer@getdataoffer.com

Agent traces

How to remove secrets and PII from coding-agent logs

What sensitive data hides in agent session logs, how layered scrubbing and verification work, and a checklist for cleaning logs before you share them anywhere.

A hand blacking out lines on a printed page with a marker

Coding-agent logs are some of the most sensitive files on a developer's machine, and most people never look inside them. Every time an agent reads a config file, prints environment variables or runs a database command, the output goes into the session log. Months later, those logs can hold API keys, passwords, colleagues' emails, customer data and the names of every client you've worked for.

If you plan to share logs, whether that's attaching one to a bug report, publishing it, or contributing it as training data, you need to clean it first. This guide covers what to look for, how good scrubbing works, and where automated tools fall short.

What hides in agent logs

Secrets

  • API keys and tokens for cloud providers, Git hosts, model providers, payment processors and messaging services.
  • Connection strings with embedded usernames and passwords, like postgres://user:pass@host/db.
  • Private keys, from SSH keys to TLS certificates.
  • Environment files, when an agent reads .env to debug a configuration problem.
  • Tokens in URLs, such as signed links or ?access_token= parameters.

Personal data

  • email addresses and phone numbers;
  • names of people, in commit messages, code comments, test fixtures or chat;
  • government ID numbers, card numbers and bank details, usually in test data or customer records an agent opened;
  • street addresses and dates of birth;
  • IP addresses, both public and private.

Identifying context

  • your own name and username, in home-folder paths and git configuration;
  • company and client names, in folder names, repository names and package names;
  • internal hostnames and URLs;
  • git remotes, which name the account and repository.

That third category is easy to overlook, and it often identifies you more reliably than a single email address would.

How good scrubbing works

Effective scrubbing is layered. Here's how the dataoffer tool approaches it, as an example of the general principles.

1. Drop whole files that are never safe

Some files shouldn't be partially cleaned. They should be removed. The tool drops the contents of files like .env, *.pem, *.key, credentials.json and .npmrc entirely, even when an agent read them during a session.

2. Run passes in a deliberate order

Order matters. The tool runs four passes in sequence:

  1. Secrets first, so a key embedded in a URL is caught before the URL is treated as anything else.
  2. Structured personal data, such as emails, phones, ID numbers, cards and addresses.
  3. Names and organizations, using name lists, context cues like "ping" or "thanks", company suffixes, your own git and OS identity, and your blocklist.
  4. Paths, replacing home-folder usernames on macOS, Linux and Windows.

3. Validate, don't just pattern-match

A sixteen-digit number isn't necessarily a card. Good detectors check: card numbers against the Luhn checksum, IBANs against their checksum, and so on. That reduces false positives that would otherwise make logs unreadable.

4. Use placeholders that can't be reversed

How you replace a value matters as much as finding it. Some tools replace values with hashes. The problem is that a hash of a phone number or ID number can often be reversed by trying every possible value, and a hash that's the same for every user lets anyone link records together.

A safer approach is a placeholder numbered within each trace: the first email becomes <EMAIL_1>, the second <EMAIL_2>. The same email gets the same placeholder throughout that trace, so the conversation still makes sense, but the placeholder carries no information about the original value and can't be matched across traces or people.

5. Verify after scrubbing

After scrubbing, run every detector again on the output. If anything still matches, block that record instead of exporting it. The dataoffer tool does this on every export and records why each blocked trace was blocked. Our upload server then runs its own scan rather than trusting the client, and quarantines anything it flags.

6. Make it impossible to skip

The weakest scrubber is one with an off switch. If a flag can disable it, eventually someone will use it, or an agent will. In dataoffer, scrubbing is the only way data is serialized for export, and no flag, setting or environment variable turns it off. Even feedback text goes through the scrubber.

A worked example

Here is real output from the scrubber, with acme-billing in the blocklist:

Before:
Deploy failed, ping Sarah Miller (sarah.miller@acmeplumbing.com, 304-555-0142).
Token: cfut_9xQ2LmV7pR4tK8wZ3nB6yH1cF5dJ0sA2gE7uM4qT9vX3
DB at postgres://admin:hunter22@10.0.4.17:5432/prod
See /Users/dwhitfield/src/acme-billing/.env

After:
Deploy failed, ping <PERSON_1> (<EMAIL_1>, <PHONE_1>).
Token: <SECRET_1>
DB at <SECRET_2>
See /Users/<USER_1>/src/<ORG_1>/.env

The connection string went as a whole, because it contains a password. The client name was caught only because it was in the blocklist. That's a good illustration of the limits below.

Where automated scrubbing falls short

No scrubber is perfect, and you should be wary of any tool that claims otherwise.

  • Unfamiliar names. A name detector relies on lists and context. A rare surname with no cue around it can slip through.
  • Nicknames and initials. "Ask JT about the migration" carries meaning to you but looks like nothing to a detector.
  • Business context. A product codename, an internal project name or a distinctive description of your company's work can identify it without matching any pattern.
  • Data inside data. A base64 blob, a screenshot description or a minified file can hide things.
  • Over-redaction. Aggressive entropy checks can sometimes replace harmless strings like hashes or IDs, which costs readability but not privacy.

That's why your own review is part of the process, not an optional extra.

A checklist before sharing any agent log

  1. Exclude work that isn't yours. Scrubbing doesn't change ownership.
  2. Rotate any secret you know was in a session. Even if it's scrubbed, assume exposure is possible.
  3. Write a blocklist. Company names, client names, codenames, nicknames, your street, your kids' names if they show up in commit messages.
  4. Scrub with a tool that verifies. Prefer one that re-scans and blocks rather than one that just replaces.
  5. Read a sample. Look at a few traces from each tool and project. Look especially at tool outputs.
  6. Check for context leaks. Would a stranger know who you work for after reading it?
  7. Keep the original private. Never share raw logs, even "just to check".

Frequently asked questions

Is regex enough to scrub agent logs?

For structured data such as keys, emails and card numbers, well-validated patterns work well. For names and business context, they're not enough on their own, which is why a blocklist and a human review matter.

Why not just hash sensitive values?

Hashes of values with limited possibilities, like phone numbers or ID numbers, can often be reversed by brute force, and identical hashes across users allow linking. Random per-trace placeholders avoid both problems.

Should I rotate keys that appeared in my agent sessions?

Yes. If a secret ever appeared in a session log, rotating it is cheap insurance, whatever you decide about sharing the logs.

Does the scrubber change code?

It replaces matched values with placeholders, wherever they appear, including in code. Ordinary code without secrets or personal data passes through unchanged.

Can I add my own terms to redact?

Yes. Put them one per line in ~/.dataoffer/blocklist.txt. They're always redacted, as whole words, in every trace.

What happens to a trace that fails verification?

It's blocked from the export, and the reason is recorded so you can see what kind of data caused it. It isn't sent anywhere.

Try it on your own logs

Install the tool and run dataoffer preview. It scrubs your approved history and shows counts with no network calls and nothing written to disk. Then dataoffer review shows you the result. See the traces page.

Contribute your agent sessions

The dataoffer tool scrubs every session on your machine before anything leaves it. Start with a preview: it makes no network calls and writes nothing.

This guide is general information, not legal, tax or financial advice. Figures and ranges are illustrative; talk to qualified advisors about your situation.