File size: 6,488 Bytes
69ac23d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: apache-2.0
pretty_name: KmPlot computer-use environment from a one-line request (REA)
tags:
- computer-use
- cua
- gui-agent
- rl-environment
- agentenv
- desktop
- linux
- rea
- math
- plotting
- education
- from-request
---

# KmPlot: a computer-use environment built from a one-line request

![An agent solving the task in KmPlot](media/hero.gif)

**The real KmPlot 23.08 function plotter running on an Ubuntu 24.04 desktop, as an [agentenv](https://pypi.org/project/agentenv-framework/) computer environment. An agent completes the task only through screenshots, mouse and keyboard, and a verifier grades the saved files with no model.**

Claude Code built this environment from a one-line request in about 21 minutes, with only REA's build skill and MCP tools; [How it was made](#how-it-was-made) has the request and the steps. KmPlot opens a small plot file, `Documents/lesson_plots.fkt`, at launch: three functions, f(x) = x^2 − 4, g(x) = 2sin(x) and h(x) = 0.5x + 1. The agent has to change h's formula to h(x) = 2x + 1 and save the plot file. It sees only the screen and acts only with the mouse and keyboard.

## Watch

- Agent runs (Claude Code with Claude Sonnet 5.5): [run 1](media/solve-1.mp4), [run 2](media/solve-2.mp4), [run 3](media/solve-3.mp4)
- Witness, which proves the task can be done through the computer: [witness.mp4](media/witness.mp4)

Each video is the computer's own screen recording at 10 frames per second.

## The task

> In KmPlot, change the formula of the function h in Documents/lesson_plots.fkt to h(x) = 2x + 1 and save the plot file.

`bundle/artifacts/change-h-formula-check/verify.py` reads the app's files through the computer's `data/get` view and passes only if every check holds:

| Check | Kind | File |
| --- | --- | --- |
| `h-new-formula` | `line_count` | `Documents/lesson_plots.fkt` |
| `h-old-formula-gone` | `line_count` | `Documents/lesson_plots.fkt` |
| `g-unchanged` | `line_count` | `Documents/lesson_plots.fkt` |
| `f-unchanged` | `line_count` | `Documents/lesson_plots.fkt` |
| `three-functions` | `line_count` | `Documents/lesson_plots.fkt` |

A `.fkt` file is XML, but it opens with `<!DOCTYPE kmpdoc>` and no XML declaration, and REA read it as text lines rather than XML. So the checks count lines: exactly one must contain `>h(x) = 2x + 1<` and none `>h(x) = 0.5x + 1<`, g's and f's equations must each still appear once, and the file must still hold three `<function ` lines. The f check reads only `>f(x) = x^2`, because KmPlot stores the minus in x^2 − 4 as U+2212, not a hyphen. REA's draft suggested checks on each function's whole line, whose attributes Qt writes in a different order in every process, and a guard that failed a correct edit in a fresh process for that reason; Claude Code narrowed two suggestions to the equation text, discarded the guard and wrote the rest.

## Results

3 of 3 runs passed, about $0.68 per run.

| Run | Outcome | Turns | Cost | Video |
| --- | --- | --- | --- | --- |
| 1 | passed | 11 | $1.02 | [video](media/solve-1.mp4) |
| 2 | passed | 14 | $0.55 | [video](media/solve-2.mp4) |
| 3 | passed | 10 | $0.47 | [video](media/solve-3.mp4) |

## Run it

You need Docker. `agentenv-framework` builds the computer: Ubuntu 24.04 with the app installed from Ubuntu's archive (`kmplot` 23.08.5).

```bash
pip install agentenv-framework==0.9.1431
hf download earakely-scale/KmPlotFromRequestComputerEnv-REA --repo-type dataset --local-dir kmplot-request
agent-env run kmplot-request/bundle --task change-h-formula --agent claude-code --model <model>
```

The agent needs a model provider configured for agentenv. `--task smoke` only boots the computer, with no agent. `bundle/README.md` describes the bundle in detail.

## How it was made

Claude Code built this environment from a one-line request, given only [REA](https://github.com/morluto/rea)'s build skill and REA's MCP tools:

> Build me a KmPlot environment where the agent changes the formula of one plotted function and saves the plot file.

It asked only the skill's upfront questions, wrote no app-specific scripts, and finished in about 21 minutes. The steps were REA's usual ones:

1. **Capture.** REA launched KmPlot on a Linux desktop and recorded its package, windows and opened files while the edit was made. It also recorded the app's state folders before and after.
2. **Export.** REA turned the capture into an agentenv `computer_app`. It installs the app, seeds the starting files, starts the app, and waits for its main window. It also serves typed views of the app's files for verifiers.
3. **Task.** The task's checks were validated against the capture: they fail on the starting state and pass on the captured end state.
4. **Witness.** In a fresh computer, the edit was made through computer actions alone, and the checks were read at four stages. They held on the first try:

| Stage | Checks |
| --- | --- |
| `seed` | fail, as expected: h is still 0.5x + 1; the kept checks pass |
| `after_edit` | pass |
| `near_miss` | fail, as expected: the formula was typed as h(x) = 2x + 2 |
| `after_reset` | fail, as expected: `data/reset` restored the seed |

The agent runs came after the build: Claude Code with Claude Sonnet 5.5 (`--model anthropic/claude-sonnet-5-5 --no-emulate`, on an amd64 host) solved the task 3 times, each run recorded.

## What's inside

```
bundle/      the agentenv bundle: envs/ (app module, seed files), tasks/, artifacts/ (verifier), evals/
media/       witness and agent-run recordings (MP4) with short GIF previews
results.json the runs above, with each check's result
```

## Limits

- Because REA read the file as text, the checks are line counts, not checks on the XML's function elements. They need the equation exactly as the prompt writes it, `h(x) = 2x + 1`; an equivalent formula written differently, such as `2*x + 1`, fails.
- KmPlot stores the minus sign as U+2212 (−), not a hyphen, so a check on f's whole equation would need that character; the f check reads only the part before it.
- The computer installs whatever `kmplot` Ubuntu 24.04's archive holds at build time (23.08.5 for these runs); it is not pinned.
- Three runs is a small sample: the solve rate shows the task is solvable, not how hard it is.

## Licences

The bundle code, the task and the synthetic seed files are Apache-2.0. KmPlot itself is not included: the computer installs it from Ubuntu's archive (`kmplot` 23.08.5) at build time, under its own licence (GPL-2.0-or-later).