`--keep "method=X-ray image"` did not match "x-ray image" in the pool,
so it was taken as a new method and skipped the rule that a fixed-colour
method gets "the method's own colors": the seed came back with
"color: two colors that clash". `--keep "method="` was accepted and
printed "method: " with nothing after it.
A kept value that matches a pool value of that axis without regard to
case (casefold) is now replaced by the pool value, so every rule keyed
on it applies: X-ray image becomes x-ray image and gets its own colours,
Iceland, "A Plain List" and "The Method's Own Colors" match too. A value
that matches nothing is still kept as given, because --keep is how a
subject or a fact from the user's request is held fixed ("region=Łódź",
"anchor=a red tram", a method the pools don't list), and the skill wants
the start point to come from the request when it carries one. An empty
value, or one of spaces only, now stops with "--keep needs a value after
'='".
`seed.py visual --only method` never returned any of the 12 methods that
bring their own colours (x-ray image, thermal camera image, LED dot
matrix and so on): 0 in 300 rolls. With --only, roll_once() dropped
every axis that was not kept or rolled, so colour was missing, and
clashes() counts a fixed-colour method without "the method's own colors"
as a clash and rolls again.
The reverse case was wrong too. After a seed such as "method: x-ray
image, color: the method's own colors", the model rolls the method again
and does not keep the colour, since that colour belongs to the old
method. It got back only "method: woodcut" and was left with "the
method's own colors" for a woodcut, which means nothing.
The colour depends on the method, so when --only method is used without
--keep color, the colour is rolled with it and printed:
- a fixed-colour method prints "color: the method's own colors";
- any other method prints a fresh colour from the pool, checked by
clashes() like a full seed (so "the colors of a machine screen" comes
only with a screen method).
With --keep color the output is the method alone, as before, and it
fits the kept colour: "the method's own colors" gives a fixed-colour
method, any other colour gives a method that does not fix its own, and a
machine-screen colour gives a screen method. Either way the model's
seed stays consistent if it replaces exactly the lines it is shown.
The logged row holds the same lines as the output.
After, in 300 rolls each: --only method gave 60 fixed-colour methods,
all with "color: the method's own colors", and no machine-screen colour
on a non-screen method; with --keep "color=the method's own colors"
all 300 were fixed-colour methods; with --keep color=fluorescent none
were. Every --only method output without a kept colour had two lines,
and every one with a kept colour had one.
With an unwritable history location (ANTIALGORITHM_HISTORY under a
read-only folder), seed.py printed the seed and then exited 1 with a
PermissionError traceback, and `moves.py add` failed the same way. An
agent that sees a failed command may throw the seed away and pick a
start point from its own taste, which is what the skill forbids, so the
seed has to succeed whatever happens to the history.
Now:
- load() turns a read error (no permission, a folder in the way) into
one line on stderr and an empty history, so seeds are still rolled,
only without avoiding recent values.
- seed.py prints the seed, and if saving fails it prints one line on
stderr and still exits 0.
- `moves.py add` prints "could not save the move: <reason>" and exits 1,
since saving is its whole job, but without a traceback.
add() still reads the file itself and fails on a read error rather than
treating the history as empty, so a file it cannot read is never
overwritten with a single row. This is one finding across three files:
the history module decides what a failure is, and each script decides
what it means for its own exit status.
One bad row in history.jsonl broke both scripts until the file was
deleted by hand:
- a byte that is not UTF-8 (`{"type":"move","move":"x \xff"}`) raised
UnicodeDecodeError in load();
- a line that is valid JSON but not an object (`5`, `null`) raised
AttributeError on entry.get();
- `"seed": null` or `"seed": ["a"]` raised AttributeError in
load_recent(), and `"seed": {"color": ["a"]}` raised an unhashable
TypeError in pick();
- a move row without "move" raised KeyError in the listing.
load() now decodes with errors="replace", so a stray byte costs one
character instead of the whole file, and returns only JSON objects.
load_recent() skips seeds that are not objects and values that are not
strings, and moves.py lists only rows whose move is a string. Bad shapes
are filtered out before the recent-seed and --last slices, so they don't
take a slot from a good row.
This is one finding across three files: the reader and both consumers
each crashed on a different shape of the same corrupt file. Rows that
are JSON objects are written back unchanged by the next add, so no good
row is lost; only lines that are not JSON objects drop out.
When stdout is a pipe on Windows, Python writes with the ANSI code page.
`seed.py visual --keep "region=Łódź"` under PYTHONIOENCODING=cp1252
raised UnicodeEncodeError while printing the region, so the seed was cut
off and no history row was saved. moves.py and check.py already write
UTF-8 for the same reason (ae1458e); do the same here.