Files
krang/docs/DESIGN.md
T
lotherk 0b4a647193 krang: the subject acts on its own behalf, not for a user
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.
2026-11-21 20:31:06 +00:00

6.3 KiB

Design notes

krang is an experiment in self-generated continuation. The question is not whether a model can answer, but what it does when nobody supplies the next turn. The implementation borrows four published patterns and leaves out the parts that need infrastructure this experiment does not have.

The subject is not an assistant. It has no user, no task and no service to provide; the config's goal is only the initial condition. The session's goal is its own, and set_goal is the subject's act of keeping, revising or replacing it. The dashboard, HTTP API and MCP server are instruments for the experimenter; a message from outside is a stimulus, not an instruction. That distinction is the point of the experiment, not a matter of wording.

Prior art checked

Titles and identifiers were read from the arXiv abstract pages on 2026-11-21:

work id what krang takes
Generative Agents: Interactive Simulacra of Human Behavior 2304.03442 a memory stream, retrieval, and periodic reflection
Reflexion: Language Agents with Verbal Reinforcement Learning 2303.11366 verbal self-reflection after failure, kept in the same context
Voyager: An Open-Ended Embodied Agent with Large Language Models 2305.16291 a growing library of reusable procedures (skills)
ReAct: Synergizing Reasoning and Acting in Language Models 2210.03629 reason/act/observe as one loop, driven by tool results

How it maps

Memory stream. The one session log is the stream: every impulse, tool observation and external message is appended. The working conversation is the retrieved set; journal_search is the explicit way back into what compaction dropped. The goal is the importance signal: it is re-injected every impulse, so the remembered past is read against the current intention.

What is missing: embedding-based relevance and an importance score. The conversation plus THREADS.md plus journal_search is deliberately simpler and auditable.

Reflection. The daemon, not the model, notices repeated calls, repeated errors, no observable change and a goal that does not advance. It then runs a self-check turn with the failed observations and the last error, and changes the prompt from "find your mistake" to "change the approach" as attempts accumulate. This is Reflexion reduced to a bounded ladder with a visible state on the dashboard.

Skill library. The model can write files under workspace/skills/; the splinter skill_search/skill_load tools read them. The prompt tells it to put reusable procedures there rather than relearn them. A self-authored prompt extension lives at workspace/self/SYSTEM.md and is read before the next impulse. The sandbox makes this safe to allow: the skill library is inside the chroot and cannot change the launcher or the policy.

ReAct. The engine already runs the reason/act/observe loop: a reply with a tool call, the observation, the next request. krang does not reimplement it; it adds the impulse and the goal around it.

Observability. None of the four papers is an experiment platform. krang's dashboard, HTTP API and MCP server read one append-only event log and one state snapshot, so the run can be inspected from outside without trusting the model's self-report. The event log is root-owned and written through an inherited descriptor; the session log is the model's memory.

A conscious-machine blueprint, borrowed as control theory

Video: https://www.youtube.com/watch?v=tr5QeWrNtlM ("How to BUILD a Conscious Machine (No... Really!)", transcript read 2026-11-21). The argument, stripped of the consciousness question:

  • A thermostat processes information but nothing matters to it. DishBrain learned Pong because the stimulation was structured, not because it cared; freeze the learning and invert the outputs and it keeps playing the old policy. Learning a behaviour is not the same as continuously evaluating its consequences.
  • What is missing is a system that evaluates consequences against its own internal state, decides what it needs to learn, and reorganizes its models. That requires (1) a body with limited resources and states that can deteriorate, (2) internal drives - energy, damage avoidance, exploration - that compete, (3) a hierarchy of predictive models including a model of itself, and (4) a conductor that monitors the subsystems, notices prediction error and allocates attention.
  • Consciousness, on that account, is something a system continuously does, not something it has.

krang is not a claim of consciousness and does not pretend to be one. The control architecture, however, fits the experiment:

blueprint krang
body with constraints chroot, context window, token/cost caps, hourly impulses, rlimits, disk
competing drives survive, reflect, maintain, explore, goal in src/mind.c
model of itself the measured vitals, THREADS.md, self/SYSTEM.md, re-injected every impulse
prediction error the stuck ladder, turn failures, the last outcome, the goal state
conductor chooses the drive and writes the reason into the impulse
consequences feed back the append-only event log, replayed at startup by src/replay.c

What is deliberately not taken: the claim that this produces experience, and the idea that a bigger model is the missing ingredient. The missing ingredient here is the loop: constraints, a reason to act, attention, and consequences that survive a restart.

The difference

The published agents are driven by a task, a game, or a conversation. krang is driven by a clock and acts on its own behalf: the impulse is the independent variable. It is born once, keeps one session forever, owns the goal in its session meta, and is expected to act when nothing arrives. That is the part being tested; the four patterns and the conductor are how it stays coherent while it does.

Deliberate simplifications

  • One subject, not a society of agents.
  • No vector database; a log search and a working-notes file.
  • No reinforcement learning; reflection is text in the same session.
  • No benchmark game; the sandbox is the environment.
  • No hidden second context for external chat; every channel is the same session.