Runnable Examples

Every example runs on MockProvider at $0. Copy the command, run it, see the output.

Prerequisites

From the runtime repo:

git clone https://github.com/M4G3LL4N0/grokbot-society.gitcd grokbot-society && pnpm installpnpm typecheck && pnpm test

Then run any example:

pnpm tsx examples/create-person.tspnpm tsx examples/group-scene.ts
zero-costpersonidentity

Create a Person

Zero inference — pure structured state in SQLite

Create a durable Person with biography, personality, interests, and current state. Assign roles at zero cost.

create-person.ts
pnpm tsx examples/create-person.ts
zero-costrolescomposition

Assign Roles

Composable behavior at zero cost

Assign multiple roles to a person. At scene time, only context-relevant roles compose into the Actor.

assign-roles.ts
pnpm tsx examples/assign-roles.ts
zero-costcirclesrelationships

Create a Circle

Named communities with ordered membership

Create a named community, add members, assign relevant roles, and establish relationships between members.

create-circle.ts
pnpm tsx examples/create-circle.ts
inferencescenemock-provider

Run a Group Scene

One inference, multiple speakers, bounded context

Run a group scene with the Inner Circle. One inference returns multiple speakers. Zero cost on MockProvider.

group-scene.ts
pnpm tsx examples/group-scene.ts
relationshipsinertiaevolution

Relationship Evolution

Watch relationships evolve with inertia over multiple interactions

Simulate multiple interactions and watch relationship dimensions (familiarity, trust, affection) evolve with 15% inertia per scene.

relationship-evolution.ts
pnpm tsx examples/relationship-evolution.ts
costpopulationsimulation

Zero-Cost Population

Dormant population = $0 inference cost

Create 1,000 people with only 5 active. Run cost simulator showing dormant population = $0 across all scenarios.

zero-cost-population.ts
pnpm tsx examples/zero-cost-population.ts
sessionsrolling-windowcontext

Long Session

Rolling-window context for road trips, evenings, ambient

Start a road-trip session, append messages, compile bounded context (rolling window + participant cards), end session.

session.ts
pnpm tsx examples/session.ts

Run All Examples

Run the full example suite sequentially. Each demonstrates a different facet of the runtime at $0 cost.

for f in examples/*.ts; do echo "=== Running $f ===" pnpm tsx "$f" echo "" done