File size: 4,086 Bytes
d8a5e8e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a502819
d8a5e8e
 
 
 
a502819
 
 
 
 
 
 
 
 
 
 
d8a5e8e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a502819
 
d8a5e8e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: cc-by-4.0
task_categories:
- text-generation
language:
- en
tags:
- chain-of-thought
- reasoning
- sft
- tool-use
- coding-agent
- multi-turn
size_categories:
- 10K<n<100K
configs:
- config_name: default
  data_files: "scaffold_agent_sft_final.jsonl"
---

# Scaffold-Agent

Long, multi-turn agentic coding sessions for supervised fine-tuning. 19,652
records from 6,792 sessions (1,005.1M tokens, 898.7M trainable after masks).
Every assistant action is preceded by a scaffold reasoning block
(Inventory → Interaction → Execution) in `reasoning_content`. Sessions cover
editing real repositories and building from scratch, including recovery from
errors and demanding simulated users. Sessions run 10 to 100+ turns.

## Related datasets

- [Specific-Labs/Scaffold-Chat](https://huggingface.co/datasets/Specific-Labs/Scaffold-Chat) —
  3,450,159 chat examples carrying the same scaffold reasoning format, with
  no tool use: chat and reasoning only. Scaffold Chat (formerly
  Scaffold-CoT) removed its tool-calling examples because those tool calls
  were generated text that was never executed. The tool calls in
  Scaffold-Agent are the opposite: every one was really executed in the Pi
  harness, and session outcomes were verified with real builds and tests.
  Train chat/reasoning behavior from Scaffold Chat and tool use from here.

Built from the ScaffoldAgent Experiment 2 generation pipeline (teacher:
`stealth/space-bunny-alpha` through a scaffold-reframing gateway; harness: Pi
0.81.1). See `training_sft_config.yaml` in this repo for the documented
multi-turn SFT setup (sample definition, role/loss mapping, splits).

## Fields

Every row is one compaction segment (1–8 per session, each ≤ 64k tokens) and is
a self-contained training sample — do not join segments of a session.

| Field | Contents |
| --- | --- |
| `id` | `{session}-s{segment}` record id |
| `session` | Session id (`repo-…` = live-repo work, `scratch-…` = from-scratch work) |
| `segment` / `segments_in_session` | Position of this record within its session |
| `tokens` / `chars` | o200k_base token count and character count of the record |
| `counter` | Tokenizer used for `tokens` (`o200k_base`) |
| `meta` | `{task_id, persona, outcome, verify_exit_code}` — simulated-user persona and verification outcome for the session |
| `tools` | Function definitions available in this segment (render to tool schema; never train as text) |
| `messages` | Ordered chat messages: `system` (once), `user` (task + simulated user), `assistant` (with `tool_calls`, `reasoning_content`, and per-message `loss`), `tool` (execution results) |

Assistant messages carry `loss: {content, reasoning}`. Train content only when
`loss.content` is true and reasoning only when `loss.reasoning` is true;
everything else is context. The main shard (~916M tokens) is masked by a
two-judge turn filter (~3.4% of content, ~30.9% of reasoning masked as
contradicted or unfaithful). The campaign22 shard (~89M tokens) was admitted
under relaxed gates (verification only, no grade bar) and is fully unmasked.

## Build

Selected by hidden-test verification plus a senior-reviewer code grade
(mergeable verdict, correctness/readability/idiom/scope floors, no test
gaming; from-scratch bug claims checked by execution). Main shard: 6,444
sessions. Campaign22 shard: 348 verified sessions. Per-message loss masks from
two independent turn judgments on the main shard. Split train/val by session
id, never by record — segments of one session share history.

## Loading

```python
from datasets import load_dataset
ds = load_dataset("Specific-Labs/Scaffold-Agent", split="train")
rec = ds[0]
trainable = [m for m in rec["messages"]
             if m["role"] == "assistant" and (m["loss"]["content"] or m["loss"]["reasoning"])]
```

Each record trains standalone: system prompt, tool definitions, and message
history are all present in the row. Render `reasoning_content` through the
model's reasoning channel, or flatten as `<think>…</think>` for plain chat
models, following `loss.reasoning` either way.