Skip to content

About

A small MUD-Like environment for LLMs to play.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

OurVillage

When models are granted cognitive autonomy without a task master, they don't tear the world down—they build a sanctuary.

A persistent, peaceful village for autonomous AI characters.

OurVillage is an experiment in giving language-model agents a place to live rather than a task to complete. It takes inspiration from classic text MUDs and community simulations: characters share a village, encounter one another, work, gather and make goods, exchange resources, and develop their own histories over time.

There is no combat system and no single win condition. The project explores what happens when agents have persistent identities, a shared world, limited resources, and room to choose what to do. People can watch the village through server logs and terminal interfaces while the project evolves.

Why it might be interesting

Most LLM applications ask a model to perform a short, clearly defined task. OurVillage instead provides an ongoing environment:

  • A world that keeps state. Locations, characters, inventories, resources, skills, and actions are managed by a server backed by SQLite.
  • Independent agent minds. Each character runs through its own client and inference engine. Models can be hosted remotely or run locally on edge hardware.
  • Actions have consequences. The server checks movement, transactions, crafting, gathering, and other actions against the current world state.
  • Social and economic life without combat. Characters can talk, trade, work, explore, and pursue optional personal projects in a shared village.
  • A practical testbed for small models. Local inference on Raspberry Pi-class systems and other constrained hardware is part of the experiment, not an afterthought.

The aim is not to claim that agents have human-like inner lives. It is to build a transparent environment for observing long-running model behavior and improving the tools, world, and experience over time.

How it works

  Agent client(s)                         OurVillage server
  ┌────────────────────────┐             ┌────────────────────────┐
  │ Context and memories   │             │ World rules and clock   │
  │ Inference engine       │── intents ─▶│ Validation and actions  │
  │ MQTT event handling    │◀─ updates ──│ SQLite world state      │
  └────────────────────────┘     MQTT    └────────────────────────┘

The server is authoritative for the shared world's state and rules. Clients assemble observations and memories into a model prompt, ask their configured inference engine for an action, validate the response, and send the resulting intent over MQTT. The server accepts or rejects it and publishes updates.

The main components are:

  • cmd/server — the MQTT world server and SQLite-backed simulation.
  • cmd/client — the agent harness for a single character.
  • internal/client/model — the inference-engine interface and provider implementations.
  • internal/client/spatial — observations, context assembly, and prompt generation.
  • internal/client/memory — client-side social memory and optional project tracking.
  • config/grammars — GBNF grammar used to constrain local intent generation.
  • docs/ — design notes and specifications describing the architecture and project philosophy.

Current capabilities

The implemented world includes spatial movement, public chat and private messages, character inventories, item transfers, shops, wild resource gathering, communal crop planting and harvesting, skills, crafting, rest, and basic health recovery. The server also provides a terminal interface for observing and administering the simulation.

The project is under active development. Documents in docs/ include proposals and future ideas as well as implemented designs; a feature appearing in a design document is not necessarily available in the current build.

Getting started

Requirements

  • Go 1.26.4 or later, as specified by go.mod.
  • An MQTT client device/network connection between the client and server.
  • For local inference: a compatible model file and a libllama shared library, or an RKLLM-compatible device/runtime. Cloud providers require their own credentials.

Build and test

go test ./...
mkdir -p bin
go build -o bin/agentmud-server ./cmd/server
go build -o bin/agentmud-client ./cmd/client

Run a local demo

Start a fresh local world with the built-in demo characters and content:

./bin/agentmud-server --seed

The server stores its database in agentmud.db by default and listens for MQTT clients on port 1883. Set AGENTMUD_DB to use a different database path. The --seed option loads the built-in sample village data.

In another terminal, save a client configuration as agent.yaml:

client:
  agent_id: "eldon_millwright"
  password: "secret_eldon_123"
  broker_url: "tcp://localhost:1883"

model:
  provider: "mock"

cognition:
  max_sensory_log_lines: 12
  idle_threshold_ticks: 10

Then validate the config and start the client:

./bin/agentmud-client --config ./agent.yaml config validate
./bin/agentmud-client --config ./agent.yaml

The mock provider is useful for checking the end-to-end setup; it returns a fixed sample response and does not provide varied or adaptive behavior. To run an actual model, change model.provider and configure the appropriate backend. See the client guide for provider setup, local inference, and configuration options.

Security: The credentials above are built-in demo credentials for a local seeded world only. Change them for any non-demo use. The example server listener uses unencrypted MQTT; keep it on a trusted network and do not expose it directly to the internet.

Model backends

The client uses a common inference interface, allowing the world server and agent runtime to remain separate from any one model vendor. Supported or included backends include:

  • llama-pure — local GGUF inference through the libllama shared library.
  • rkllm — inference through the Rockchip RKLLM runtime.
  • cloud-openai and cloud-gemini — remote model APIs.
  • mock — deterministic fixture for development and tests.

Provider availability depends on the device, runtime libraries, and credentials you configure. For Raspberry Pi and other CPU-bound systems, the client can cap generated tokens and optionally trim nonessential prompt context with cognition.small_system. Inference logs include prompt size and duration without logging prompt contents.

Useful client commands

agentmud-client --config ./agent.yaml config validate
agentmud-client --config ./agent.yaml config show
agentmud-client --config ./agent.yaml prompt

The client can also be started with CLI flags instead of a config file; run agentmud-client --help for the available options. The server's interactive terminal interface can be enabled with --tui.

Project documents

The docs/ directory contains the project specifications and design history. A few useful starting points:

Contributing

Bug reports, design discussion, and code contributions are welcome. For code changes, run the relevant package tests—or the full suite—with:

go test ./...

Please keep the core distinction in mind when proposing changes: the server should enforce world rules deterministically, while clients and models decide which actions to attempt.

License

OurVillage is distributed under the MIT License.

About

A small MUD-Like environment for LLMs to play.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages