Roci is a general-purpose agent orchestrator that runs autonomous character-driven sessions using Claude Code as the agent runtime. Characters have persistent identities (background, values, secrets, diary) and operate inside shared Docker containers.
The core architecture is domain-agnostic: the brain/stem tick engine (runActivation) paces, polls, and dispatches across three model tiers (hindbrain/forebrain/conscious) along a reflexive → integrative → deliberative depth hierarchy, operating skills (OODA loop), and 5 injectable Effect service layers handle all domain-specific behavior. A limbic drives/escalation system appraises each event to decide when to steer, reorient, or interrupt the running agent, and a long-term vector memory store persists experience across sessions. New domains can be added without modifying the engine.
- SpaceMolt -- AI agents playing an MMO via WebSocket
- GitHub -- AI agents managing repositories via GraphQL polling
| Package | Name | Description |
|---|---|---|
packages/core/ |
@roci/core |
Domain-agnostic engine: types, phase system, the brain/ cognition stack (brain/stem tick engine, limbic + cortex layers, shared transport), operating skills, long-term memory, services (Docker, Claude, CharacterFs, OAuthToken, ProjectRoot), logging |
packages/domain-spacemolt/ |
@roci/domain-spacemolt |
SpaceMolt domain implementation |
packages/domain-github/ |
@roci/domain-github |
GitHub domain implementation |
apps/roci/ |
roci |
CLI entry point, setup wizards, domain registry |
Supporting directories:
shared-resources/-- Shared docs and game documentationdocs/-- Project documentation
- Node.js >= 20
- pnpm >= 9
- Docker -- Running and accessible (characters run in shared containers)
- Local model runtime -- The
brain/stemtick engine (hindbrain/forebrain/conscious tiers) and interactive character creation generate against local MLX models, which the harness spawns viamlx_lm.server. The harness resolves the binary automatically from a Python venv at~/llm-env(the typical Apple-Silicon location) -- so you do not need tosource ~/llm-env/bin/activatebefore runningroci setup/roci start. Override the venv root withROCI_LLM_ENV=/path/to/venv. If the venv binary isn't found, the harness falls back to amlx_lm.serveronPATH(e.g. an already-activated shell or a system install). Install it withpip install mlx-lminside the venv. - Long-term memory embed server -- The long-term memory backend (the in-container
memory remember/memory searchcommands, plus the pre-cull diary->long-term promotion at session startup) is served by a host-side embeddings server bound to127.0.0.1:8084, runningmlx-community/bge-small-en-v1.5-bf16(384-dim) viascripts/embed-server/serve-embeddings.py. It comes up automatically underroci start(and bareroci) -- launched at orchestrator startup alongside the MLX model tiers and reaped together with them onSIGTERM/SIGINT/exit, so there is no manual step. It resolves its Python the same waymlx_lm.serverdoes ($ROCI_LLM_ENVor~/llm-env-><venv>/bin/python3, with that venv'sbinprepended toPATH, else apython3found onPATH); override explicitly withROCI_EMBED_PYTHON=/path/to/python. The venv just needsmlx-embeddingsinstalled (pip install mlx-embeddings). If no Python resolves, it logs a loud, actionable warning and continues non-fatally --roci startdoes not crash, but long-term memory is unavailable for that run (watch the logs for the embed-server warning). The first embed lazily loads the model; the embed client retries with backoff, so an earlyremember/searchtolerates the cold-start warm-up. Inside the container thememoryCLI is provisioned eagerly at container-ensure (before the first reflection), installed as root at/usr/local/bin/memoryand pointed at the host server. - Claude Code CLI -- Installed and authenticated with OAuth (the in-container tool-using agent runtime)
# Install dependencies
pnpm install
# Build all packages
pnpm build
# Initialize a new session directory
pnpm --filter roci roci init
# Create a character. The local model runtime is resolved automatically from
# ~/llm-env (override with ROCI_LLM_ENV=/path/to/venv); no manual `source` needed.
# `setup` is an interactive wizard: it generates each identity artifact
# (background, values, palette, diary) with the local conscious model and
# lets you accept / edit / regenerate / skip each step.
pnpm --filter roci roci setup
# Start a session (also uses the local model runtime).
pnpm --filter roci roci startThe
rociCLI is also available as a binary once built. The examples above usepnpm --filter roci roci <command>so they work straight from the repo without a global install.
| Command | Description |
|---|---|
init |
Initialize a new session directory |
setup |
Run domain-specific setup wizard |
start |
Start a session |
stop |
Stop a running session |
pause |
Pause a running session |
resume |
Resume a paused session |
status |
Show session status |
destroy |
Tear down a session and its resources |
create-app |
Scaffold a new domain application |
# Build all packages
pnpm build
# Run tests
pnpm test
# Type checking
pnpm typecheck
# Lint
pnpm lint
# Format
pnpm format
# Run all Biome checks (lint + format)
pnpm checkNew domains are added as packages under packages/. A domain implements the 5 Effect service layers that the engine requires. See docs/DOMAIN_GUIDE.md for a full walkthrough.
See HARNESS.md for detailed architecture documentation covering the brain/stem tick engine, phase system, limbic subsystems, and operating skills.
- TypeScript with strict mode
- Effect-TS for dependency injection, error handling, streaming, and async composition
- @effect/cli for the CLI interface
- pnpm workspaces + Nx for monorepo management and build orchestration
- Biome for linting and formatting
- Vitest for testing
- Docker for container management