Credentials. Training on unscanned chats can teach a model to repeat API keys or other secrets that appear in code_context or tool_use.
Reverse engineering. Chat records can include proprietary code from employers or clients, so confirm you have the rights to use that data for training.
Who it is forAn ML engineer who wants to fine-tune a model on their own coding conversations and needs a clean, filtered dataset.
The problemRaw chat exports contain secrets, proprietary code, and personal file paths that must be removed before training.
The outcomeA filtered Hugging Face dataset of conversations that contain at least one assistant message, ready for chat-template formatting.
What you need first
- Python 3.9 or newer installed on the machine that holds the chat history
- The AI coding tools installed under your own user account, with local chat history present
- Permission to read and store your own local data, and a secure place to keep the output
- For the fine-tuning case: the Hugging Face datasets library and a tokenizer for your target model
Steps
- Run
python extract.py --sources cursor,claude_code,aiderto extract only the sources you want to train on. - Run
pip install detect-secrets --break-system-packages, thendetect-secrets scan extracted_data/*.jsonl. - Review code_context and tool_use fields for proprietary code, API keys, and personal file paths, and remove those records.
- In Python, load the cleaned files with
load_dataset("json", data_files="extracted_data/*.jsonl", split="train")from the datasets library, then apply the README filter for assistant messages. (inferred, check the README) - Format each example with
tokenizer.apply_chat_template, after defining the tokenizer for your target model.
Prompt for your agent
Using the repo jatechan/ai-data-extractor, extract the sources cursor and claude_code, run detect-secrets on the output, and load the JSONL files in <project folder>/extracted_data with the datasets library. Report how many conversations remain after filtering for assistant messages. Verify that no record still contains a flagged secret before using it for training.
Caveat. The README example calls tokenizer.apply_chat_template without showing how to define the tokenizer, so you must supply it yourself.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for jatechan/ai-data-extractor and "Turn your coding chats into a fine-tuning dataset"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer