--- pretty_name: Codex Tool-Use Trajectories license: mit language: - en task_categories: - text-generation tags: - agent-traces - format:agent-traces - agent - tool-use - function-calling - coding-agent - trajectories - reverse-engineering size_categories: - n<1K configs: - config_name: trajectories default: true data_files: - split: train path: trajectories.train.jsonl - split: test path: trajectories.eval.jsonl - config_name: pairs data_files: - split: train path: pairs.train.jsonl - split: test path: pairs.eval.jsonl - config_name: traces data_files: - split: train path: traces/train/*.jsonl - split: test path: traces/test/*.jsonl --- # Codex Tool-Use Trajectories Multi-step tool-use trajectories from a coding agent (OpenAI Codex Desktop) working in a local Windows workspace, cleaned and redacted from raw session logs. - **`trajectories`**: 437 agent runs (one per turn, or per segment of a turn that hit context compaction), each a full chat with tool calls and tool outputs. - **`pairs`**: 314 delegation examples: the brief a parent agent gave a subagent and the final report the subagent returned. - **`traces`**: the same 437 runs as `trajectories`, rebuilt as one Codex rollout file per run, the format the Hub's [agent trace viewer](https://huggingface.co/docs/hub/agent-traces) reads for Codex sessions. The sessions were recorded between 2026-05-06 and 2026-06-01 on one developer's machine. Most of the work is C#/C++/PowerShell development and binary reverse engineering of a video codec. The raw logs were provided by Reddit user [u/-MaskNinja-](https://www.reddit.com/user/-MaskNinja-/); see [Acknowledgements](#acknowledgements). ## Dataset structure ### Configs and splits | config | split | rows | sessions | size | |---|---|---:|---:|---:| | `trajectories` | train | 403 | 301 | 41.2 MB | | `trajectories` | test | 34 | 33 | 3.6 MB | | `pairs` | train | 284 | 284 | 1.3 MB | | `pairs` | test | 30 | 30 | 0.1 MB | | `traces` | train | 403 | 301 | 44.7 MB | | `traces` | test | 34 | 33 | 3.9 MB | ```python from datasets import load_dataset traj = load_dataset("israellaguan/codex-tool-use-trajectories", "trajectories") pairs = load_dataset("israellaguan/codex-tool-use-trajectories", "pairs") traces = load_dataset("israellaguan/codex-tool-use-trajectories", "traces") ``` `traces` has the same content as `trajectories` in a different layout; use `trajectories` for training and `traces` for browsing. Each row of `trajectories` is one file in `traces`, so a split's rows and files match one to one. Loading `traces` with `datasets` makes the library ask for the `teich` package, which it uses to decode agent traces. The `test` split is stored in the `*.eval.jsonl` files and in `traces/test/`. Splits were made **by session id** (seed 42, about 10% of sessions held out), so no session appears in both splits. See the note on split independence under [Considerations](#considerations-for-using-the-data). ### `trajectories` fields | field | type | description | |---|---|---| | `id` | string | `#` | | `session_id` | string | Codex thread (session) id | | `turn_id` | string | Codex turn id | | `segment`, `segments_total` | int | A turn that hit context compaction is cut at each compaction point into segments; this is segment *k* of *n*. | | `compaction_summary_available` | bool | `false` for turns that were split. The summary text Codex generated is not in the logs, and later segments start with a note saying so. | | `source_file` | string | Relative path of the raw log the turn came from. The raw logs are not published. | | `thread_source` | string \| null | `user`, `subagent`, or `null` when Codex did not record it | | `agent_role` | string \| null | `explorer`, `worker`, `default`, or `null` | | `model`, `effort` | string \| null | Model and reasoning effort that produced the assistant turns (`gpt-5.5` for 411 of 437 rows) | | `cwd` | string | Working directory on the original machine | | `timestamp` | string | Start of the turn, ISO 8601 UTC | | `task_source` | string | `user` (a user message), `goal` (a goal objective set by the user), or `reconstructed` (see below) | | `n_tool_calls`, `n_failed_calls` | int | Tool calls in the row and how many failed (non-zero exit or failed patch) | | `flags` | list[string] | Quality flags, listed below | | `messages` | list[object] | The conversation | **Flags.** `large_patch` (an `apply_patch` input over 20,000 characters), `high_dup_calls` (more than 10% of calls repeat an earlier identical call), `short_final` (final answer under 200 characters), `manual_recovery` (turn rescued by hand, see below), `ends_on_tool_output` (the run was cut off and has no final answer). **Messages** follow the OpenAI chat format: ```json {"role": "system", "content": "You are a coding agent working in a local Windows workspace. ..."} {"role": "user", "content": ""} {"role": "assistant", "content": "", "tool_calls": [ {"id": "call_...", "type": "function", "function": {"name": "shell_command", "arguments": "{\"command\": \"...\", \"workdir\": \"...\"}"}}]} {"role": "tool", "tool_call_id": "call_...", "content": "Exit code: 0\nWall time: 0.6 seconds\nOutput:\n..."} ``` - `arguments` is a JSON string. `content` is `null` for assistant messages that only call tools (4,443 of 6,985). - Every tool call has exactly one matching tool message. - The system message is a short generic prompt; the original Codex system, developer and `AGENTS.md` messages were dropped. - Tool outputs over 4,000 characters keep the first and last 2,000 characters with `[... N chars truncated ...]` in between. Images are replaced by `[image omitted]`. - 12,121 tool calls across 24 tool names. `shell_command` (PowerShell) is 10,343 of them; the rest include `apply_patch`, `update_plan` and reverse-engineering tools such as `decompile`, `disasm` and `list_funcs`. - A row has a median of 37 messages and 22 tool calls; the largest has 241 messages and 136 calls. 569 calls (4.7%) failed, so the data contains errors and recoveries, not only clean runs. ### `pairs` fields `id`, `session_id`, `turn_id`, `agent_role`, `cwd`, `brief` (the task given to the subagent; median 730 characters) and `report` (its final message; median 3,423 characters). There are no pairs for the 6 reconstructed rows. ### `traces` format `traces/train/` and `traces/test/` hold one file per trajectory, named `_.jsonl`. Each file uses the record types of a Codex rollout log, one JSON object per line: ```json {"timestamp": "...", "type": "session_meta", "payload": {"id": "", "cwd": "...", "originator": "Codex Desktop", "model_provider": "openai", "base_instructions": {"text": ""}, "trajectory": {"id": "#", "flags": [], "...": "..."}}} {"timestamp": "...", "type": "event_msg", "payload": {"type": "task_started", "turn_id": "..."}} {"timestamp": "...", "type": "turn_context", "payload": {"turn_id": "...", "cwd": "...", "model": "gpt-5.5", "effort": "medium"}} {"timestamp": "...", "type": "response_item", "payload": {"type": "message", "role": "user", "content": [{"type": "input_text", "text": ""}]}} {"timestamp": "...", "type": "response_item", "payload": {"type": "function_call", "name": "shell_command", "arguments": "{...}", "call_id": "call_..."}} {"timestamp": "...", "type": "response_item", "payload": {"type": "function_call_output", "call_id": "call_...", "output": "Exit code: 0\n..."}} {"timestamp": "...", "type": "event_msg", "payload": {"type": "task_complete", "turn_id": "...", "last_agent_message": "..."}} ``` - These are **reconstructions** of the cleaned trajectories, not the original rollout files. The text of every user message, assistant message, tool call and tool output is identical to `trajectories`. `scripts/to_codex.py` generates the files and checks that each one reads back to its source row. - Reasoning, token counts, rate limits and injected developer messages are not present (they are not in the cleaned data), and nothing was invented in their place. - There is no per-line timing: every line carries the start time of the turn. - The metadata fields that have no Codex equivalent (`segment`, `segments_total`, `task_source`, `thread_source`, `agent_role`, `flags`, `n_tool_calls`, `n_failed_calls`, ...) are in `session_meta.payload.trajectory`. `session_meta.payload.id` is the original `session_id`, so several files can share it. - `apply_patch` calls appear as ordinary `function_call` records with `arguments` of `{"input": ""}`, as in `trajectories`. ### Auxiliary files | file | purpose | |---|---| | `redactions.jsonl` | One entry per redaction: row id, field path, kind, replacement, and the SHA-256 of the original value. Original values are not stored. | | `manifest.json` | Counts and reconciliation numbers from the build. | | `REPORT.md` | Full cleaning report: funnel, validation checks, manual recoveries, sample rows. | | `scripts/` | The pipeline (`build.py`, `validate.py`, `report.py`, `redact.py`, tests). They read the raw logs, which are not included. `to_codex.py` reads only the cleaned `trajectories.*.jsonl` and writes `traces/`. | ## Dataset creation **Source.** 361 Codex Desktop rollout files (12.5 GB, 1.1M lines) from one developer's machine, shared as a raw dump by [u/-MaskNinja-](https://www.reddit.com/user/-MaskNinja-/) on Reddit. Most are subagent sessions spawned from a few long-running parent threads. **Processing** (details in `REPORT.md`): 1. Keep turns that completed and made at least one tool call: 395 of 9,286 turn instances. The rest are chat-only turns, interrupted turns, and copies of parent history embedded in forked sessions. 2. Remove injected context (permission and `AGENTS.md` messages, subagent notifications) and non-conversational records (reasoning, token counts, telemetry). 3. Pair every tool call with its output. Drop 4 calls without output and 7 orphan outputs. 4. Truncate long tool outputs, split turns at compaction points, redact, and write. 5. Recover 10 turns by hand whose logs were partly destroyed by NUL-byte corruption (400 turns in total). Every affected row carries the `manual_recovery` flag. **Reconstructed tasks.** In 6 rows the original task message was destroyed. The tool calls, outputs and final answer are real and untouched, but the task text was **written afterwards by a reviewer** from the surviving trajectory. These rows have `task_source == "reconstructed"` and `model`/`effort` set to `null`. Filter them out if you need only original prompts. ### Personal and sensitive information Redaction was automatic and pattern-based (see `redactions.jsonl`): | kind | replacements | |---|---:| | Windows user directory (`X:\Users\\`) → `...\Users\user\` | 881 | | `sk-`-style key pattern (all false positives on hyphenated words) | 62 | | Organisation name in a work/school OneDrive folder (`OneDrive - \...`) → `OneDrive - \...` | 6 | | IPv4 address | 8 | | E-mail address | 3 | Validation found no remaining matches for AWS, GitHub, OpenAI-style, PEM, or bearer credentials, and no e-mail, IPv4, user-directory, or OneDrive organisation patterns. **What is not redacted:** project and workspace names (`M:\Codex\...`), file names, vendor product names, commit hashes, and 25 distinct phone-like strings (47 occurrences; almost all are codec numbers, one is a vendor's public business number). Redaction is best-effort and gives no guarantee that the data is free of personal or confidential information. ## Considerations for using the data **One developer, one domain.** Almost all rows come from a single Windows project area (video codec re-encoding and reverse engineering). 320 of the 334 sessions descend from the same parent thread. Expect narrow coverage of languages, tools and task types. **The test split is not independent.** It is split by session, but sessions that share a parent thread work on the same goals in the same repository over adjacent days. 32 of the 34 test rows come from parent threads that also contribute train rows. Treat `test` as a regression or sanity set, not as a measure of generalisation to new projects. **Not curated for quality.** Trajectories were selected by structure (completed, used tools), not by whether the agent was right. Assistant turns are model output, not human demonstrations. Some runs contain failed commands, repeated calls, or wrong conclusions. **Incomplete context.** System prompts, reasoning traces, images and compaction summaries are missing, and long tool outputs are truncated. 37 non-final segments end on a tool message by construction, 3 rows end on a tool output with no final answer, and 7 rows have no tool calls. Use `segment == segments_total` and `n_tool_calls > 0` to select complete runs. **Third-party material.** Tool outputs include decompiler and disassembler output and notes about proprietary software. Check that you may redistribute and use it before publishing or training. **Model outputs.** The assistant turns were generated by OpenAI models (see `model`). Check the provider's terms on using outputs to train other models. **Untrusted content.** The data contains shell commands, package installs and downloads taken from real sessions, including an install from a mutable GitHub branch. Do not execute commands from the rows, and treat tool outputs as untrusted text if you feed them to an agent. ## Additional information **License.** [MIT](https://opensource.org/license/mit). The license covers this compilation and the processing scripts. It does not grant rights to third-party material that appears inside tool outputs (see [Considerations](#considerations-for-using-the-data)). **Citation.** None yet. ### Acknowledgements The raw Codex session logs this dataset is built from were provided by the Reddit user [u/-MaskNinja-](https://www.reddit.com/user/-MaskNinja-/), who shared the initial dump. Their git author name (`MaskNinja`) therefore appears in some tool outputs. Thank you.