Skip to content

Batch command: discover, look, and a help to work from - #264

Merged
SimonHeybrock merged 2 commits into
mainfrom
262-command-look
Nov 23, 2026
Merged

SimonHeybrock merged 2 commits into
mainfrom
262-command-look

Conversation

@SimonHeybrock

Copy link
Copy Markdown
Member

First part of #262: an agent, or a person, can operate batches through essapps-batch from its help and its messages, without reading code.

Measured. A fresh agent (Claude Sonnet) got the command, a LoKI folder and the names of the bindings and row sources, and was to reduce I(Q) for six runs, change the Q binning and reduce again. It was not allowed to read source or documentation.

before with this change
commands run 24 11
of these, to find out how the command works about 20 6
refused attempts many; ten batches left behind none

Commands to discover and to look:

B="essapps-batch -w FOLDER -b ess.instruments.loki.bindings:BINDINGS -s ess.instruments.loki.batch:SOURCES"
$B specs                          # the specs bound: name, version, title, outputs
$B template loki-iofq -o t.yaml   # a template to fill in: every parameter, with what it takes
$B sources                        # the row sources: what each fills, and how it pairs files
$B rows sample-runs               # by name, as reduce --source takes it (was: rows module:NAME)
$B batches                        # label, title, spec, rows, reduced, source, follows
$B show -l water                  # the batch table with the status of each row; reduces nothing
$B template -l water              # the settings of a batch, as a template
$B export -l water results        # the outputs of a batch, without a table file

-s moved before the command, and --json writes any table as a list of objects.

The template says what each parameter takes, from the spec alone: required or its default, the kind of value in the words a person writes, the description (where a spec says its unit), and for an output which bound specs give one of that type. Every parameter is commented out, so a batch made from it does not keep today's defaults as its settings.

A row source has a description, which sources prints. Both test agents doubted LoKI's pairing of two sample runs with one transmission run, and one changed the table by hand; nothing said the rule.

Fixes:

  • A reduce that makes a batch and is then refused leaves no batch. Before, the same command line then failed with "the batch exists".
  • A cell that must name an output and does not says the form that works in a cell (RECORD.OUTPUT); a template says the forms that work in a template.
  • A wrong MODULE:NAME, a module that raises on import, and a template or table file that does not exist are a message, not a traceback.
  • --help is written for someone who operates batches: a first session, one template, the status words, the exit statuses, and that one process works on a folder at a time.

Checked by a review that ran every form of reduce before and after side by side (same output, exit status and folder, apart from the changes above) and each sentence of the help against the code.

Not done here: taking rows, removing a batch, Follow and stop as commands (second part). The template reads the types of a spec beside the page's settings form; one shared reading is a follow-up in #262.

To check by hand:

  • essapps-batch --help reads as a page one could work from.
  • template loki-iofq could be filled in by someone who has not seen the spec.

🤖 Generated with Claude Code

SimonHeybrock and others added 2 commits November 23, 2026 08:22
…erators

An agent given only `essapps-batch --help` spent most of its commands on
finding out how the command works: the form of a template, what each
parameter takes, how to write a reference, the name of a row source. It
could not look at a batch without reducing it (#262).

- specs, sources, batches: list the specs bound, the row sources with the
  parameters each fills, and the batches with rows done, source and Follow.
- template SPEC writes a template to fill in: each parameter with whether it
  is required or its default, what it takes in words, its description, and
  for an output the bound specs that give one. The type is read with
  ess.spec.field_types, as the settings form reads it. Required parameters
  are commented out, so the template as written is refused naming each.
  template -l LABEL writes the settings of a batch, as the page does.
- show -l LABEL writes the table with status, record and failure, without
  reducing.
- -s/--sources is a global option; rows takes a name in it, as reduce
  --source does.
- --json writes a table as a list of objects, one per row.
- A reduce that makes a batch and is then refused removes it again, so the
  same command line works once the template is right.
- A value that must be a reference says how to write one.
- A wrong package.module:NAME is one line on stderr and exit status 2.
- The module docstring, which --help prints, is written for an operator.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The commands are a table from name to function (_COMMANDS in cli.py);
  adding a command is one function and one entry.
- template: every parameter is commented out, one with a default showing
  it; a file in a group is said in its JSON form, which the header lists.
- batches counts the rows whose newest result completed (reduced),
  without comparing requests; show gives the status.
- export -l LABEL DIRECTORY exports the rows of a batch as they stand.
- sources prints the new RowSource.description; LoKI's sample-runs says
  how it pairs a transmission run.
- Text that names no output is refused where the syntax is known: in a
  cell (RECORD.OUTPUT) and in a template; the message of ess.spec gives
  no syntax, but the file refusal names the JSON form.
- A missing file, a folder without files.csv, and a -b module that
  raises on import are messages with exit 2, not tracebacks.
- A refused creating reduce says the refusal even if removing the batch
  is itself refused, and removes only a label without records.
- --json writes an empty cell as null; a list of names is a list in
  JSON and the names separated by a space in a table file.
- Help: statuses, exit codes, chaining, and --with made true in every case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant