mirror of
https://github.com/zenlm/agent-sanitizer.git
synced 2026-07-26 22:31:10 +00:00
4.1 KiB
4.1 KiB
🚀 Quick Start - Agent Sanitizer
For Claude Code Users
Turn your Claude Code logs into a shareable dataset in 3 steps:
Step 1: Run the Tool
uvx agent-sanitizer
That's it! The tool will:
- Auto-detect your
~/.claude/projectsdirectory - Scan for security issues
- Show you what it found
- Ask for confirmation before cleaning
Step 2: Review the Results
You'll see a report like:
Security Audit Results
┌────────────┬───────┬────────────┐
│ Category │ Found │ Severity │
├────────────┼───────┼────────────┤
│ Credentials│ 12 │ 🔴 Critical│
│ Names │ 8 │ 🟡 Medium │
│ Emails │ 5 │ 🟡 Medium │
└────────────┴───────┴────────────┘
Step 3: Share Your Dataset
Option A: Save Locally
uvx agent-sanitizer --output ./my-dataset
Option B: Upload to HuggingFace
# Login first
huggingface-cli login
# Sanitize and upload
uvx agent-sanitizer --upload yourusername/my-coding-dataset
Advanced Usage
Dry Run First
See what would change without modifying files:
uvx agent-sanitizer --dry-run
Specify Directories
uvx agent-sanitizer \
--input ~/.claude/projects \
--output ./clean-dataset
Non-Interactive Mode
For scripts/automation:
uvx agent-sanitizer \
--input ~/.claude/projects \
--output ./clean-dataset \
--no-interactive
What Gets Cleaned
✅ Removed
- API keys (OpenAI, Anthropic, DeepSeek, etc.)
- Passwords and tokens
- Email addresses
- Phone numbers
- Personal names
- Cryptocurrency private keys
✅ Preserved
- Code examples and snippets
- Test data (Hardhat accounts, test seeds)
- Tool usage patterns
- Thinking traces
- Error handling flows
- Technical usernames
Example Output
After running, you'll have:
clean-dataset/
├── splits/
│ ├── train.jsonl # 80% of your data
│ ├── val.jsonl # 10% of your data
│ └── test.jsonl # 10% of your data
└── audit_report.json # What was found and cleaned
Using Your Dataset
Load in Python
from datasets import load_dataset
# If uploaded to HuggingFace
dataset = load_dataset("yourusername/my-coding-dataset")
# Or load locally
import json
with open("clean-dataset/splits/train.jsonl") as f:
data = [json.loads(line) for line in f]
print(f"Loaded {len(data)} coding interactions!")
Train a Model
Use the dataset to fine-tune your own coding assistant:
# Using transformers
python train.py \
--dataset yourusername/my-coding-dataset \
--model zenlm/zen-coder-14b \
--output ./my-coding-assistant
Troubleshooting
"No agent logs found"
Make sure you're pointing to the right directory:
# For Claude Code
uvx agent-sanitizer --input ~/.claude/projects
# For Cursor
uvx agent-sanitizer --input ~/.cursor/logs
# For Continue
uvx agent-sanitizer --input ~/.continue/sessions
"huggingface_hub not found"
Install it:
pip install huggingface_hub
Or use uvx with dependencies:
uvx --with huggingface_hub agent-sanitizer --upload user/dataset
"Permission denied"
Login to HuggingFace first:
huggingface-cli login
Community
Share your dataset and help grow the community!
- Tag it: Add
agent-coding-datasettag on HuggingFace - Link back: Mention Agent Sanitizer in your dataset card
- Share: Post on Twitter/X with #AgentSanitizer
Example datasets:
- zenlm/agent-coding-dataset - 161k Claude Code interactions
Next Steps
- ⭐ Star the repo: https://github.com/zenlm/agent-sanitizer
- 📚 Read full docs: https://github.com/zenlm/agent-sanitizer#readme
- 🐛 Report issues: https://github.com/zenlm/agent-sanitizer/issues
- 💬 Discuss: https://github.com/zenlm/agent-sanitizer/discussions
Happy dataset sharing! 🎉