The goal was still an operator assignment: the config set it, the birth prompt
called it 'your goal', and nothing let the subject change it. That is an agent
with a task, not the experiment.
- set_goal (src/goal.c): a mutate tool that writes the session .meta, resets
the goal state to open, updates the live snapshot, and logs goal_set with the
old and new goal. The next impulse reads it back. The session meta is the
authority; the config goal only seeds a newborn and is now called the initial
condition. The noisy config_goal_ignored event is gone: divergence is the
subject's act, not a configuration error.
- Birth prompt: 'This is not a task and there is no user. You are the subject
of an experiment... Your initial condition: X. It is yours, not an
assignment. Keep it, revise it, or replace it... set_goal changes it.'
- System prompt: 'the subject of an experiment... not an assistant and not here
to serve anyone... continue on your own behalf. Your goal is yours... the
experimenter watches through the instruments and may send a stimulus; neither
is an instruction.'
- Impulse/self-check: 'Your goal', 'continue on your own behalf'. The conductor
says 'your goal'.
- Instruments: dashboard labels its goal and 'send a stimulus, not a command';
MCP krang_say/krang_steer describe a stimulus, not an operator instruction;
footer says 'an instrument, not a service'.
- Docs: AGENTS.md, README.md, docs/DESIGN.md, krang.conf.example. The birth
message in the contract is updated; 'agent' in the prose is 'subject'.
- Tests: test_engine drives set_goal (writes meta, updates the snapshot, logs,
rejects an empty goal); test_birth checks the new initial-condition wording;
the birth-flow test asserts the config goal no longer logs a conflict.
make check 9/9, ASAN 9/9, root integration ok on a fresh debootstrap.
Findings from a pass over the daemon, the sandbox and the surfaces.
HTTP: a loopback dashboard without a token was reachable from any web page.
The wildcard CORS grant and an OPTIONS branch before the token check let a
cross-origin page POST into the one session, and a DNS-rebinding page could
read it under its own name. Requests now need a loopback Host while no token
is configured, an Origin must match the Host, and there is no CORS grant.
MCP connections get a receive/send timeout instead of pinning a thread
forever.
CLI: --check silently ignored an unreadable or invalid config and printed a
green self-test, because the load error was discarded. It now fails with the
parser message, prints the sandbox plan, and only then runs the scripted turn.
--self-test still works without a config.
Budgets: max_turn_seconds (default 1800) cancels a turn that outlives it and
records turn_timeout; the answer produced after the cancel is discarded.
External chat now counts against max_impulses_per_hour instead of bypassing
it.
Stuck detection: kstuck_turn() reset the whole ladder whenever a turn called
a mutating tool, so a loop of failing 'run' calls never escalated. The ladder
now resets only after a turn whose tool signals are clean. The dashboard's
stuck level is a locked snapshot instead of a read of daemon-private state.
Ledger: impulse records stored the running session total as if it were that
impulse's usage; they now store per-turn deltas, and turn_end logs them.
Config: refuse / and .. in rootfs/state/workspace, refuse nested trees (a
state inside the disposable rootfs would be deleted with it), and reject
negative sizes.
Event log: O_NOFOLLOW|O_CLOEXEC.
Makefile: check-asan reused the same object paths, so a plain make afterwards
linked uninstrumented code against sanitizer objects and failed. It now cleans
before and after.
Tests: test_server covers Host/Origin refusal and the OPTIONS/token check;
test_krang covers the path guards and the stuck reset; test_timeout proves
the wall-clock cancellation with a sleeping tool. make check is now seven
suites, ASAN also green, and the root integration still passes on a fresh
debootstrap.
One fixed session, born once, kept and compacted forever. The daemon wakes on
its own impulse, works on a persistent goal, detects repeated failures,
reflects, changes approach, and records everything. It starts as root, builds
a debootstrap chroot, then drops to an unprivileged uid and applies Landlock
and seccomp. Dashboard, HTTP API and MCP expose the same snapshot; the event
log is root-owned and append-only. Offline suites cover the engine, the daemon,
both sandbox layers and the dashboard/MCP sockets; a root-only script covers
debootstrap, chroot, uid drop and plugin loading.