awx

← Blog

Walk-through · 18 November 2026

How to mark 30 assignments in one step with Code Mode

Marking 30 programming submissions by hand takes an evening. Claude Code’s Code Mode did it on an awx computer in 37 seconds, with every score right and one formatting slip to catch.

Awi the cat agent looks through a magnifying glass

What we set up

On an awx computer we made a folder ~/marking with an invented lab assignment: three small Python functions, is_prime, fizzbuzz and grade, marked by 10 test cases, 1 mark each. Then 30 invented submissions, S001.py to S030.py, with the mistakes students really make: wrong answers for 1 or 2, an off-by-one loop, > instead of >=, printing instead of returning, a missing colon, a missing function, an import of a module that does not exist, and two loops that never end.

We knew the right score for every one, so we could check Claude’s marks afterwards. No real student’s work was used.

Claude Code ran in the computer’s Terminal tab, version 2.1.327 with Code Mode on, signed in with a Claude Max account. How to set that up: Use Claude Code’s Code Mode on your awx computer.

The request

In ~/marking there is a lab assignment (ASSIGNMENT.md), its 10 test cases (tests.json) and 30 student submissions (submissions/S001.py to S030.py). Mark every submission: run each test case against it, giving each test at most 3 seconds because some submissions crash or loop forever, and never let one submission's problem stop the others. Write ~/marking/marks.csv with the columns student, score (out of 10) and a one-line comment saying what went wrong. Then tell me the class average, how many got full marks, and the three most common mistakes.

Two parts of it matter most: a time limit for each test, because a loop that never ends would otherwise stop the marking, and “never let one submission’s problem stop the others”.

What Code Mode did

It took 37 seconds. Claude Code first read the assignment, the tests and one submission. Then one step of the session read:

Making 1 scratchpad edit, reading 1 file, running 303 shell commands…

That is Code Mode at work. Instead of 300 separate tool calls, each read before the next, one piece of JavaScript started a small helper script, ran every submission against every test, side by side, and kept only the results. In all, 4 pieces of code made 312 tool calls. Each test ran in its own Python process, stopped after 3 seconds, so a crash or an endless loop only cost that one test.

The code it wrote

Press Ctrl+O in Claude Code to see the code behind the tool calls. This is the heart of it, as Claude wrote it, only spaced out for reading:

async function runOne(id, t) {
  const r = await $`cd ${sp} && timeout -s KILL 3 python3 -I ${sp}/runner.py ${home}/marking/submissions/${id}.py ${t.fn} ${JSON.stringify(t.args)}`.nothrow().quiet();
  const m = r.stdout.match(/@@RES@@(.*)/);
  if (!m) return {pass: false, why: r.exitCode === 137 || r.exitCode === 124 || r.exitCode === null ? 'timeout' : 'crash'};
  const j = JSON.parse(m[1]);
  if (!j.ok) return {pass: false, why: j.err};
  const pass = JSON.stringify(j.r) === JSON.stringify(t.expect);
  return {pass, why: pass ? '' : `${t.fn}(${t.args}) gave ${JSON.stringify(j.r)} expected ${JSON.stringify(t.expect)}`.slice(0, 120)};
}
const res = {};
await Promise.all(ids.map(async id => { res[id] = []; for (const t of tests) res[id].push(await runOne(id, t)); }));

runOne runs one test with timeout -s KILL 3 and turns the outcome into pass, wrong answer, crash or timeout. Promise.all runs the 30 submissions at the same time. Then a last piece of code wrote marks.csv and worked out the average.

The result, checked

Claude Code's answer in the awx terminal: all 30 submissions marked and marks.csv written, class average 7.63 out of 10, 12 of 30 with full marks, and the most common mistakes listed by student number, ending Brewed for 37s
Claude Code’s report after 37 seconds.

We compared every line of marks.csv with our answer key: all 30 scores were right. The class average was 7.63 out of 10, and 12 got full marks. The two endless loops scored 8, because only the two tests that loop timed out, which is the fair result. Some lines of the file:

StudentScoreComment
S001 to S01210All tests passed
S0139is_prime(1) returns True
S0159is_prime(2) returns False
S0178fizzbuzz stops at n-1 (range(1,n) excludes n)
S0208grade uses > instead of >= so boundaries 80 and 65 are wrong
S0230SyntaxError (missing colon) so nothing runs
S0258is_prime loops forever (loop counter never incremented); timed out
S0270prints answers instead of returning them
S0298fizzbuzz function missing
S0300import numpyy (a module that does not exist) so the file fails to import

The one thing to fix

One comment broke the file. For S019 Claude wrote multiples of 15 give "Fizz" inside a quoted CSV field without doubling the quote marks, so a spreadsheet would split that line in the wrong place. One more message fixes it: “Check that marks.csv opens correctly as a CSV and fix any quoting.”

The lesson is the usual one with an agent: the marks were right, and the file still needed a look before it went anywhere.

Try it yourself

Common questions

Can Claude Code mark programming assignments?

In our run it marked 30 invented Python submissions against 10 test cases in 37 seconds, and every score matched our answer key. Check the marks file before you use it: one comment in ours broke the CSV format.

What does Code Mode change?

Claude Code writes JavaScript that makes many tool calls at once instead of one at a time. In our run, 4 pieces of code made 312 tool calls, including 300 test runs side by side.

Is it safe to run students' code?

Students' code can crash, loop forever or do something unexpected, so run it somewhere that is not your own laptop. An awx computer is sealed off from the server and your home network.

Do I need my own Claude account?

Yes. Code Mode is a feature of Claude Code and needs a Claude subscription or Console account. The awx Chat agent is a different agent.

Cautions

Keep reading

Getting started

Sign in with your Google account and ask to join. Once you are approved, make a computer, open its Terminal tab and follow the Code Mode steps.

Open awx

Awi the cat agent celebrates with confetti

Awi, signing off.

← All posts