Datasets:
File size: 14,168 Bytes
ff581eb ca5608b ff581eb 616230d ff581eb 69019b2 ff581eb 69019b2 ff581eb 616230d ff581eb 616230d ff581eb 616230d 69019b2 616230d 69019b2 616230d 69019b2 616230d ff581eb 69019b2 ff581eb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | ---
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 | `<turn_id>#<segment>` |
| `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": "<task>"}
{"role": "assistant", "content": "<text or null>", "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 `<turn_id>_<segment>.jsonl`.
Each file uses the record types of a Codex rollout log, one JSON object per line:
```json
{"timestamp": "...", "type": "session_meta", "payload": {"id": "<session_id>", "cwd": "...", "originator": "Codex Desktop", "model_provider": "openai", "base_instructions": {"text": "<system prompt>"}, "trajectory": {"id": "<turn_id>#<segment>", "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": "<task>"}]}}
{"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": "<patch>"}`, 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\<name>\`) → `...\Users\user\` | 881 |
| `sk-`-style key pattern (all false positives on hyphenated words) | 62 |
| Organisation name in a work/school OneDrive folder (`OneDrive - <org>\...`) → `OneDrive - <ORG>\...` | 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.
|