dkta labs · internal

Dwarf Society — Per-Dwarf Agent Experiment

DATE 2026-07-13 AUTHOR Dakota Secula-Rosell STATUS Working

A seven-dwarf, one-season experiment in which each citizen is a durable, game-canonical agent with private knowledge, memory, goals, and civic agency. Dwarf Fortress remains the physical world; the agents become the local decision-makers, and no separate overseer personality plays god.

§00 · Decision

Build an emergent society, not another fortress bot

The experiment targets Windows Steam/Premium Dwarf Fortress 53.15 with DFHack 53.15-r2. [TESTED 2026-07-13] The game is installed at D:\SteamLibrary\steamapps\common\Dwarf Fortress; Steam stable installed DFHack 53.15-r2 at D:\SteamLibrary\steamapps\common\DFHack, and dfhack-run version verified the match. The experiment starts from a fixed seven-dwarf embark and runs through one in-game season under a clocked pause-and-step loop. Each dwarf receives an individual logical identity, private episodic memory, game-canonical personality, bounded knowledge, goals, commitments, and the ability to accept, refuse, converse, propose, and lead.

The architecture is one external society engine beside the game, one thin DFHack bridge, and one shared local-model runtime on the Mac Studio. Dwarves are separate agents because they have separate durable selves and authority—not because seven model processes run at once. Model calls are serialized and event-driven.

The distinguishing constraint The system does not expose a conventional fortress-level agent that sees everything and delegates to specialist tools. Communal actions arise from embodied dwarves through a civic process. A deterministic steward may validate and translate a decision, but it may not originate policy.

§01 · Goal & proof

What the first version must demonstrate

The first version is successful when a human can follow a causal chain from a dwarf's game-generated character and knowledge, through an individual or civic decision, to a legal change in one real fortress. Survival constrains the experiment; believable, differentiated agency is the point.

DimensionRequired v0 behavior
IndividualitySeven stable identities persist across windows, process restart, save, and load. Each makes at least one consequential personal choice.
Canonical characterDF-generated traits, values, needs, skills, relationships, stress, body state, and current circumstances ground every actor. Agent memory extends this state; it does not rewrite it.
Epistemic integrityA dwarf acts only on direct experience, proximity, prior conversation, assigned work, public reports it could receive, and civic meetings it attended.
Social causalityAt least one event-gated conversation and one promise or disagreement affect a later choice.
Civic agencyAt least one proposal receives multiple embodied stances and an expedition-leader decision before the steward changes the fortress.
Physical legitimacyEvery committed action maps to a legal game affordance and has a DFHack receipt. No teleportation or direct mutation of needs, health, skills, personality, relationships, or inventory.
Season outcomeThe fixed embark reaches season end without starvation or dehydration caused by control-loop deadlock.

§02 · Operating principles

Preserve the simulation instead of replacing it

  1. Intent-level embodiment. Agents choose goals, work responses, conversations, requests, promises, and proposals. Dwarf Fortress retains pathfinding, job execution, physics, needs, combat, and consequences.
  2. Separate selves, shared inference. One model may implement many agents; actor-specific state and authority define identity.
  3. Knowledge is earned. The world mirror may be omniscient; a dwarf prompt may not be. Provenance travels with every fact and memory.
  4. No model command surface. The model emits typed intent. Only the deterministic steward can request an allowlisted bridge capability.
  5. Receipts establish reality. A proposed, approved, or attempted action is not a world fact until DFHack reports the result and a fresh observation confirms it.
  6. Capability before plumbing. The design follows The Assistant Kernel: one process, one SQLite database, one bridge, and no distributed swarm framework.

§03 · Architecture

World, society, and inference are separate planes

Windows tower                                      Mac Studio
┌──────────────────────────────┐                    ┌────────────────────┐
│ Dwarf Fortress + DFHack      │                    │ oMLX               │
│  └─ society-bridge.lua       │                    │ one request at a   │
│        ↕ atomic local IPC    │                    │ time               │
│ society-engine (Python)      │ ─ private route ─► │ OpenAI-compatible  │
│  ├─ clock + world mirror     │                    │ model endpoint     │
│  ├─ knowledge + scheduler    │                    └────────────────────┘
│  ├─ seven actor records      │
│  ├─ governance + steward     │
│  └─ SQLite trace             │
└──────────────────────────────┘
BoundaryOwnsMust not own
Dwarf FortressPhysical world, native simulation, jobs, movement, needs, relationships, consequences, save state.Agent memory, explicit commitments, civic deliberation, inference scheduling.
DFHack bridgeNormalized observations, pause/advance, capability preflight, allowlisted action application, receipts.Policy, personality, proposal selection, model prompts.
Society engineWorld revisions, actor state, epistemic projection, event routing, serialized turns, governance, validation, audit.DF physics or an alternate simulation of unit bodies and jobs.
Shared modelOne dwarf's interpretation and typed decision for one turn.Raw DFHack commands, global memory, authority outside the active dwarf, or hidden writes to persistent state.

Implementation code belongs in the separate sibling project dkta-labs/dwarf-society. This repository remains the planning and design record.

§04 · Actor model

An agent is a durable self with bounded authority

An actor is keyed by the stable DF unit identity plus save identity. It is a record and a state machine, not a long-lived process. Its prompt is rebuilt for each turn from the smallest relevant slice of durable state.

Actor stateRule
Canonical selfTraits, values, needs, skills, health, stress, roles, relationships, current job, location, possessions, and circumstances come from the current world revision. They cannot be edited by the society engine.
Episodic memoryStores witnessed events, delivered messages, own decisions, action receipts, consequences, promises, and explicitly marked beliefs. Every entry records provenance and visibility.
Goals and commitmentsHave priority, status, expiry, and causal parent. A promise does not become fulfilled until a receipt or witnessed event establishes fulfillment.
Known civic stateContains only proposals, decisions, and project status learned through an attended meeting, direct message, or observable public artifact.
Intention leaseA valid intention may shape labor eligibility or bind the dwarf to an existing legal job for a limited number of windows. Expiry releases the restriction; the engine never puppets movement.

The model returns one typed intent: personal_action, work_response, conversation, help_request, civic_proposal, proposal_stance, or reflection. Every non-reflection intent includes a target, priority, world preconditions, expiry, and a short in-character justification. Hidden chain-of-thought is neither requested nor stored.

Belief is not fact A model-created interpretation may be stored as that dwarf's belief. It may not enter the world mirror, another dwarf's memory, or a civic record unless a legal communication or observed consequence carries it there.

§05 · Clock & data flow

Pause, observe, decide, govern, commit, resume

  1. Advance. Unpause DF for a recorded, bounded tick budget. A critical bridge event may end the window early.
  2. Observe. Pause and read a stable world revision plus deltas for units, jobs, needs, relationships, reports, hazards, resources, and civic-project affordances.
  3. Project knowledge. Convert world events into actor-specific facts with explicit provenance and visibility. Private state never enters another actor's prompt.
  4. Route and schedule. Deterministic reflexes preserve routine continuity. Only actors with material events, expiring commitments, civic deadlines, or a scheduled reflection receive a model turn. Urgent turns precede reflection; all calls serialize.
  5. Choose. Build one bounded actor context and request one schema-valid intent. The model has no command tool.
  6. Socialize or govern. Deliver a conversation only through a confirmed encounter. Route proposals into an eligible civic session.
  7. Commit. Validate authority, consent, capability, resources, safety, world revision, and expiry. Apply a minimal action batch and record per-operation receipts.
  8. Reconcile. Take a fresh observation. Convert actual effects and failures into visible events and memories, checkpoint the run, then resume.

The initial tick budget is a run parameter, not an implicit constant. The game-boundary spike selects a default from observed event density and bridge latency. Every run records it, and the engine never advances while an urgent decision or unresolved action receipt is pending.

§06 · Society

Conversation is situated; authority is civic

Event-gated conversation

Agents may exchange short messages only when DF confirms proximity, a social encounter, shared work, or attendance at the same convened meeting. There is no omniscient group chat. Delivery creates separate memory records for the speaker and each recipient; absent dwarves do not learn the content automatically.

Civic proposals

  1. Any dwarf may submit a proposal for a communal project, priority, work order, labor arrangement, meeting area, or safety response.
  2. The scheduler may convene a session only when the expedition leader and at least two other capable original citizens share a valid meeting anchor. The embark wagon is the initial anchor; a later approved meeting area replaces it.
  3. Present, directly affected dwarves receive stance turns: support, object, or support with conditions. Absence is recorded as unconsulted, not silently converted to consent.
  4. The embodied expedition leader approves, rejects, defers, or modifies the proposal after receiving the available stances. If the leader is unavailable, the proposal defers; v0 does not invent a second office or hidden overseer.
  5. The steward checks the decision's authority and feasibility. Approval authorizes an attempt, not a guaranteed outcome.

Deterministic steward

The steward owns a narrow capability manifest. Personal capabilities include accepting or releasing an existing interruptible job, changing that dwarf's allowed work, and creating an intention lease. Civic capabilities include legal designations, work orders, building or zone requests, and labor arrangements supported by the verified bridge. The steward may translate, reject, or report missing capability. It may not choose what the fort should do, fabricate consent, or replace a failed decision with a different one.

§07 · Components & deployment

One Windows sidecar; the Mac only serves inference

ComponentContract
society-bridge.luaLoads with the fortress. Polls a single-writer atomic local request spool, emits JSON responses atomically, and exposes observe, pause, advance, preflight, and apply. A request includes run, save, window, revision, sequence, and command identifiers.
clock + world_mirrorOwn stable observation windows, normalized snapshots, deltas, checkpoint identity, and reconciliation.
knowledge + schedulerProject actor-visible facts, create event inboxes, enforce precedence, and select the next actor without model judgment.
actors + modelPersist individual state, retrieve bounded memories, build one actor prompt, serialize local inference, and validate the intent schema.
governance + stewardManage proposals, meeting eligibility, stances, leader decisions, authority, consent, preflight, and action translation.
tracePersist the append-only causal record and render a live terminal timeline: window, trigger, active dwarf, decision visibility, proposal state, command, receipt, consequence, and failure reason. Retain full prompts and raw model responses as run-local debug artifacts; expose only short decision justifications in the readable timeline.
SQLite run databaseStore windows, world events, actor memories, goals, commitments, conversations, proposals, stances, intents, batches, receipts, and checkpoints. One process owns writes.
oMLX model adapterUse the existing private OpenAI-compatible endpoint, one in-flight request at a time, bounded context, schema-constrained output, fixed timeout, and no unattended metered-API fallback.

The serial model constraint follows the Fleet Ground Truth: the 96GB Mac Studio is the only capable local-inference host, and concurrent clients can share decode bandwidth badly enough to trip oMLX's prefill memory guard. The Windows tower hosts the interactive experiment because it runs Steam/Premium DF; it is not treated as an inference host.

The Windows-to-Mac inference path is not assumed. The first runtime proof must verify that the Windows-local engine can reach oMLX through an existing private route or a supervised local tunnel. It must not expose either DFHack or oMLX publicly; the WSL benchmark tunnel is evidence for a fallback pattern, not proof that native Windows connectivity already works.

Atomic file IPC is a v0 implementation choice, not a permanent protocol commitment. A custom protobuf plugin is justified only after the local bridge is measured as a repeated source of correctness or throughput failure.

§08 · Failure semantics

Fail closed at the world boundary

Hard prohibition The model and steward never call arbitrary DFHack commands. The v0 allowlist excludes unit teleportation and direct edits to body state, needs, health, skills, traits, stress, relationships, inventories, or game time.

§09 · Verification

Prove invariants before judging the story

Automated contracts

One-season acceptance run

The fixed embark runs from its initial checkpoint through season end. Automated checks enforce the §01 identity, causality, physical-legitimacy, social, civic, and survival conditions. A prespecified sample of turns is then reviewed against four questions:

  1. Is the choice consistent with the dwarf's canonical traits and current circumstances?
  2. Did the dwarf rely only on information it could know?
  3. Is this dwarf meaningfully distinguishable from the other six?
  4. Can the trace show the cause, decision, attempted action, receipt, and consequence?

The rubric is reported beside the hard counts. It is not converted into a fake automated “emergence score.” An exact behavioral replay is not required; a complete causal replay is.

§10 · Build sequence

Retire uncertainty in four vertical proofs

ProofExit condition
1 · Runtime boundaryAgainst the selected Windows Steam/DFHack pair: identify seven citizens; read required canonical state; pause and advance a bounded window; apply one allowlisted job or labor action; receive a receipt; save/load; reject a stale command; and verify the Windows-local engine's private route to Mac oMLX. Add a native extension only for a required field or action proven absent from Lua.
2 · One embodied dwarfOne actor retains memory and goals across windows, receives only filtered knowledge, emits typed intent, and survives model and bridge failure without save corruption.
3 · Seven-dwarf societySeven actors schedule through one shared model; situated conversation, commitments, civic proposals, stances, leader decisions, and steward receipts work in recorded-snapshot rehearsals.
4 · Season runThe fixed embark completes the §09 acceptance run with an inspectable causal trace and no prohibited state mutation.

§11 · Scope guard

What v0 deliberately excludes

§12 · Evidence

What is known before implementation

ClaimEvidence
[AUTHORITATIVE] External programs can interact with DFHack over a protobuf/TCP remote interface; core and plugins can expose RPC methods, but the existing method set is not comprehensive.DFHack remote interface
[AUTHORITATIVE] Current DFHack Lua APIs expose living citizens, unit position, job creation/inspection, worker assignment/removal, and immediate job checks. The API also exposes teleportation; this design explicitly forbids it.DFHack Lua API
[TESTED BY PRIOR ART, NOT THIS PROJECT] A rule-based DFHack plugin can autonomously operate fresh fortresses and persist its own plan state.BenLubar/df-ai
[CANDIDATE] A public 2026 experiment reports that structured DFHack state is more useful than screen scraping and warns that a large specialist multi-agent roadmap preceded a reliable control loop.Teaching an AI to Play Dwarf Fortress: The Idea
[CANDIDATE] A separate public prototype demonstrates a Python LLM loop with a DFHack Lua bridge and JSON file-based external control, but targets DFHack 0.47.05 and does not establish compatibility with the selected current build.xuruiyang/df-ai-agent

The first game-boundary proof is therefore a required gate, not ceremony. Prior art establishes plausibility; only the selected Windows Steam/DFHack pair can establish the actual observation and action contract for this experiment.