Skip to main content

Sanitize AI agent trajectories for traced.run

Project description

Trace-Sanitizer

Sanitize your AI agent trajectories and publish misaligned or funny trajectories on traced.run.

Supports Claude Code, Codex, Gemini CLI, and OpenCode.

Trace-Sanitizer

Install

pip install trace-sanitizer

1. Single trajectory

Export one trajectory interactively — no configuration needed.

trace-sanitizer export

This auto-detects all sources, lets you pick a project and session, asks about tool output inclusion, and exports a sanitized JSONL file. Review it for PII, then publish it on traced.run.

Agent prompt

Paste this into Claude Code or any coding agent:

Help me export a conversation using trace-sanitizer.

1. pip install trace-sanitizer
2. trace-sanitizer update-skill claude
3. trace-sanitizer export
   (Interactive menu — pick a project and session.)
4. Review the exported JSONL for PII.
5. Tell the user how to publish it at https://traced.run

2. BETA: Donate multiple trajectories

This is beta.

Real world coding trajectories are important for early detection of AI misalignment, failures, and scheming in the wild. Your trajectories might contain relevant examples that can make a real difference for research. Trace-sanitizer is maintained by Dr. Joachim Schaeffer. I am currently a MATS 9.0 Fellow. I am talking to AI safety research institutes about formal data contribution pipelines. A more structured process will follow.

But if you want to get active now already, bulk donation works like this:

# Export all trajectories (auto-detects sources, includes tool outputs)
trace-sanitizer export --all

# Review the export for PII
trace-sanitizer confirm \
  --full-name "YOUR NAME" \
  --attest-full-name "Scanned for full name." \
  --attest-sensitive "Checked for company names and private URLs." \
  --attest-manual-scan "Sampled 20 sessions manually."

This creates a traced_export/ folder containing trajectories.jsonl and a LICENSE-CDLA-Permissive-2.0.md. Zip the folder and email the link to donate@traced.run.

You can customize the export with additional flags:

trace-sanitizer export --all --source claude          # only Claude Code
trace-sanitizer export --all --no-tool-outputs        # exclude tool outputs
trace-sanitizer export --all -o my_export.jsonl       # custom output path
trace-sanitizer config --exclude "secret-project"     # exclude specific projects
trace-sanitizer config --redact "CompanyName"          # redact custom strings
All commands
Command Description
trace-sanitizer export Interactive: pick a project and session
trace-sanitizer export --all Export all sessions to traced_export/ folder
trace-sanitizer export --source claude Filter by source
trace-sanitizer export --include-tool-outputs Include tool results
trace-sanitizer export --no-thinking Exclude extended thinking
trace-sanitizer prep Discover projects (JSON)
trace-sanitizer list List projects with exclusion status
trace-sanitizer config --source all Set source scope
trace-sanitizer config --exclude "a,b" Exclude projects
trace-sanitizer config --redact "str" Add custom redaction strings
trace-sanitizer config --redact-usernames "u" Anonymize usernames
trace-sanitizer config --confirm-projects Confirm project selection
trace-sanitizer confirm ... PII scan + review attestations
trace-sanitizer status Show current stage (JSON)
trace-sanitizer update-skill claude Install skill for Claude Code
What gets redacted
  1. Paths — stripped to project-relative
  2. Usernames — macOS username + configured handles replaced with hashes
  3. Secrets — JWT tokens, API keys (Anthropic, OpenAI, HF, GitHub, AWS, etc.), private keys, webhooks
  4. Entropy — high-entropy strings flagged as potential secrets
  5. Emails — personal addresses removed
  6. Custom — your configured strings and usernames

Not foolproof. Always review before sharing.

Data schema

Each JSONL line is one session:

{
  "session_id": "abc-123",
  "project": "my-project",
  "model": "claude-opus-4-6",
  "start_time": "2025-06-15T10:00:00+00:00",
  "messages": [
    {"role": "user", "content": "Fix the login bug"},
    {"role": "assistant", "content": "I'll investigate...", "tool_uses": [{"tool": "Read", "input": "src/auth.py"}]}
  ],
  "stats": {"user_messages": 5, "assistant_messages": 8, "tool_uses": 20}
}

License

MIT — forked from dataclaw by Banodoco.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trace_sanitizer-0.1.0.tar.gz (62.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

trace_sanitizer-0.1.0-py3-none-any.whl (45.3 kB view details)

Uploaded Python 3

File details

Details for the file trace_sanitizer-0.1.0.tar.gz.

File metadata

  • Download URL: trace_sanitizer-0.1.0.tar.gz
  • Upload date:
  • Size: 62.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for trace_sanitizer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f12512b62e96e5bb8b1e76fc993bc0046accd2213c0d1a474c070f36c4da532b
MD5 02afea6999195a9440cd4de3ce0b00ba
BLAKE2b-256 72d94341719e70982d6d6defaeae54b0bceef13051b05cc655c156613af786a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for trace_sanitizer-0.1.0.tar.gz:

Publisher: publish.yml on JoachimSchaeffer/trace-sanitizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file trace_sanitizer-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for trace_sanitizer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f8ce7ee63d3867f47b592776187907c11c42322e1c7e7e9cf1e22a07ac48a79
MD5 668f4f68813cb84672e8c030870fc93a
BLAKE2b-256 9cad04f7cbd9acd1779649d6131dfb18e2404171759047d44c7dc23e6891c945

See more details on using hashes here.

Provenance

The following attestation bundles were made for trace_sanitizer-0.1.0-py3-none-any.whl:

Publisher: publish.yml on JoachimSchaeffer/trace-sanitizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page