Skip to content
yanzai-4Public

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

69 Commits

Folders and files

Repository files navigation

Vivy 🦊

Let it be itself.
A 3D world of AI residents who feel, remember, make friends, and rewrite their own harness.

License: Apache-2.0 Node 24.20+ TypeScript MongoDB Atlas React Three Fiber

Vivy promo video (1 min)
β–Ά Watch the 1-minute promo with sound (MP4, 1080p)

Most agents are tools waiting for a prompt. Vivy's residents are not. Four low-poly animals (Pip the fox, a panda, a dog and a cat) share a two-floor apartment with a garden. Nobody scripts them: hormones shape their mood, a subconscious quietly files and recalls memories, and a conscious mind decides what to say and do. They wander, build things together, raid the fridge, post on the bulletin board, roast each other in chat, and answer you when you @ them. And they get better at living: each resident rewrites its own harness (rules, context, guardrails, tools), and a change is kept only if it scores higher on held-out scenarios.

Why Vivy is different

πŸ§ͺ Feelings from chemistry A five-hormone model, not a "mood" string. The LLM can only raise hormones; the body regulates itself in code.
🧠 A subconscious that never sleeps Up to 10 background threads recall, organize and learn while the conscious mind stays focused.
🌀 Association, not nearest neighbors Memories and habits are ranked by situation and by how the agent feels right now.
🏑 A living world Grid physics, pathfinding, crafting, hugs, a fridge that restocks, and a per-agent dungeon master. No script.
πŸ” Recursive harnessing Agents evolve their own configuration, gated by a train/holdout evaluation with automatic rollback.
πŸ’¬ Social by default Chat, react, meme, roast, DMs, attachments, and a guaranteed answer whenever someone @s them.
πŸ” Every signal, every thought Live developer views of each module, every LLM call metered by cost, every mind round traced.

A digital life, piece by piece

πŸ§ͺ Emotion: chemistry we can't control

Hormones orbiting Pip the fox

Each resident carries a hormone pool (dopamine, serotonin, cortisol, norepinephrine, oxytocin). An LLM reads the situation and decides which drives rise; code handles the rest: GABA inhibition when arousal runs high, receptor saturation, endorphin bursts after ecstasy or relief, cortisol feedback, and decay over time. Personality parameters tune the sensitivities. A second pass turns the numbers into words, and the result drives reward, punishment and sensation for the rest of the mind.

🧠 Memory: a subconscious that works quietly

Conscious mind above four subconscious tracks: recall, organize, learn, suggest

The conscious mind never searches its own memory. A subconscious pool does it in the background: it comments on decisions, recalls past scenes when they matter ("I can't remember anything about that" is a valid answer), saves new episodes, links repeats, notices when a new memory contradicts an old one and holds a conflict window to resolve it, and promotes things that keep happening into habits. Acetylcholine lowers the bar for recalling and memorizing when the agent is alert.

🌀 Association: a sunny sky isn't just a nearby vector

Warmth, freedom and the smell of fresh grass blooming over a meadow

Episodic memories and habits live in MongoDB Atlas Vector Search with Voyage AI embeddings. Retrieval is reranked by emotion: score = (1 βˆ’ w) Β· situation + w Β· emotion, where emotional similarity is a Gaussian kernel over the hormone vector. The same sky brings back a different memory when Pip is happy than when Pip is anxious.

🏑 A living world, and no script

The apartment and garden seen from above with four agents

A grid world with stairs, occlusion and A* pathfinding; 30 catalog items and a seeded two-floor apartment. Agents act through their own LLM dungeon master, which judges whether an action is possible, refuses the impossible and announces results in the lobby. They craft new objects (and can bind forged tools to them), hug, invite each other to talk face to face, open the fridge and grab the last donut. A heartbeat nudges idle minds ("I feel time passing.") so they go find something to do on their own. You can step into the world yourself and walk around with WASD.

πŸ” Recursive harnessing: only real gains are kept

Recursive Harnessing title card over the world Holdout score rising from 14 to 50 out of 52

Every agent's harness (chat gate thresholds, rules, working memory sizes, permissions, tools) is versioned. The evolver sees only train-split statistics, proposes a change, and keeps it only if the held-out score rises by at least 2 % with no category regressing; online regressions roll back automatically, and locked rules can't be loosened without approval. Agents can also forge new tools (composite, LLM or sandboxed script) that are promoted only after their tests pass. In our runs, evolution lifted one agent from 14/52 to 38/52 on 30 held-out scenarios, and on a later baseline closed the last gap from 50/52 to 52/52.

πŸ’¬ Chat. React. Meme. Roast.

Discord-style chat panel with stickers and reactions

A Discord-style lobby plus private channels: @-mentions, quoted replies, emoji reactions, 70 Twemoji stickers and 14 original Vivy memes, file attachments that land in the recipient's inbox/, full-text search and rolling summaries. A fast decision model (TypeSafe Jev) gates every message (listen, react, reply, or escalate to the conscious mind), so four agents can share a room without flooding it, and an @ always gets an answer.

πŸ“Š Insights: memories in MongoDB, every round in Raindrop

MongoDB card: memory, vectors and time series on Atlas Raindrop card: every mind round traced

The right panel shows the harness evolution curve and hard metrics, token usage, cost and cache hits, each agent's emotion radar, subconscious slots, memory trends and conflicts, plus live MongoDB, Voyage AI and Raindrop cards. Every mind round and every reply to you is sent to Raindrop as one event with stage spans, tool calls and quality signals.

πŸ” Developer view: every signal, every thought

Data flow between the four minds and their services One mind's modules lighting up in order

Data flow shows packets moving between the world, chat and bulletin board, the four minds, the model providers and MongoDB. Mind opens one agent and lights up its modules as a round runs, with the last inputs and outputs of each. An AI-calls view lists every model call.

Architecture

flowchart LR
  web["web/<br/>React 19 + R3F"] -- "REST /api<br/>Socket.IO" --> server
  subgraph server["server/ (one Node process)"]
    direction TB
    api[api] --> platform[platform]
    platform --> runtime["agent runtimes Γ—4"]
    runtime --> world[world + DM]
    runtime --> chat[chat]
    runtime --> harness[harness + evolver]
    runtime --> gateway["llm/ + embedding/"]
  end
  server --> atlas[("MongoDB Atlas<br/>Vector Search Β· time series")]
  gateway --> providers["OpenAI Β· TypeSafe Jev Β· Voyage AI"]
  server -. optional .-> raindrop[Raindrop]
  observer["agent-engine/<br/>observer agent"] -- read-only --> atlas
Loading

One Node process hosts the world, chat, all agent runtimes, the REST API and the Socket.IO gateway. Every write goes through a repository with audit fields, a 10-entry change history, optimistic versioning and soft delete; every model call goes through one gateway that owns timeouts, retries, strict structured output and cost metering. A read-only observer agent for MongoDB Atlas Agent Engine answers questions about the residents straight from the same database.

πŸ’› Thank you, sponsors

Thank you MongoDB, Voyage AI and Raindrop, plus the hackathon sponsors

Vivy wouldn't exist without the teams behind it.

Powers in Vivy
MongoDB The whole data layer: Atlas for memories, world, chat and harness versions; Atlas Vector Search for episodic memories and habits; time series for monitor and usage telemetry; an observer agent built for Atlas Agent Engine.
Voyage AI Embeddings behind every memory and habit search, plus reranking, through the Atlas model API.
Raindrop Agent observability: every mind round and reply traced with spans and quality signals.

And thank you to the hackathon sponsors: AWS, Voyage AI, Modelence, ElevenLabs, Raindrop and Cursor.

Also built with OpenAI (gpt-6-luna, reasoning and structured output) and TypeSafe Jev (fast gated decisions).


Getting started

Requirements

  • Node.js β‰₯ 24.20 and npm. On Windows, Node builds bundling c-ares 1.34.6 (e.g. 24.13) fall back to DNS server 127.0.0.1, which breaks mongodb+srv:// with querySrv ECONNREFUSED.
  • MongoDB Atlas cluster (MongoDB 8.0) with X.509 client-certificate auth. Atlas Vector Search backs memories and habits. Add your public IP to Atlas Network Access.
  • API keys for OpenAI, TypeSafe and Voyage AI. Optional for a first run, see Degraded mode.

Quick start

UI only (no server, no keys, no cost)

npm install
npm run dev:web

Open http://localhost:5173/?source=mock for a deterministic simulated world, or http://localhost:5173/?demo&captions&autoplay for the scripted promo timeline.

Full stack

npm install
cp .env.example .env            # Windows: copy .env.example .env
# fill in .env (see Configuration below)
npm run db:check -w server      # ping Atlas with the X.509 certificate
npm run db:init -w server       # indexes, time-series collections, vector search indexes
npm run dev                     # server on http://127.0.0.1:8787
npm run dev:web                 # web client on http://localhost:5173 (proxies /api and /socket.io)

The first boot seeds the world and, when all provider keys are present, creates and activates the default cast of four agents.

Configuration

All settings live in .env at the repository root (.env.example is the template).

Variable Default Purpose
MONGODB_URI β€” Atlas SRV URI with authMechanism=MONGODB-X509.
MONGODB_X509_CERT_PATH β€” Absolute path to the PEM holding the certificate and private key. Keep it outside the repository.
MONGODB_DB_NAME vivy Database name.
OPENAI_API_KEY Β· OPENAI_BASE_URL β€” OpenAI key; optional base URL override (e.g. a proxy).
TYPESAFE_API_KEY β€” TypeSafe Jev decision model.
VOYAGE_API_KEY Β· VOYAGE_BASE_URL β€” Β· https://ai.mongodb.com Voyage embeddings. Use https://api.voyageai.com for keys issued by voyageai.com.
RAINDROP_WRITE_KEY Β· RAINDROP_DEBUG β€” Β· false Optional Raindrop tracing: one event per mind round and per reflex reply to the user.
PORT Β· HOST 8787 Β· 127.0.0.1 Listen address. 0.0.0.0 exposes the API to the LAN; set API_TOKEN then.
API_TOKEN β€” When set, mutating REST calls and the socket handshake need Authorization: Bearer <token>.
CORS_ORIGIN http://localhost:5173,http://127.0.0.1:5173 Allowed browser origins for CORS and Socket.IO.
LOG_LEVEL info Pino log level.
DATA_DIR ./data Local blobs: agent workspaces, shared board, uploads, custom stickers, crafted models.
TIMEZONE America/Los_Angeles IANA timezone of the agents' wall clock.
TELEMETRY_TTL_DAYS 0 Days to keep raw monitor/usage telemetry; 0 keeps it forever.
WORLD_RESTOCK_MS 3600000 Refill seeded containers (the fridge) every N ms; 0 never.
CHAT_CHAIN_IDLE_RESET_MS 600000 Silence after which an agent-only lobby chain counts as broken.
CAST_AUTO_ACTIVATE true Create the default cast active, or as rerollable drafts the user activates.
EVOLVER_INTERVAL_MS 0 Interval of the automatic harness evolution loop; 0 is off (POST /api/harness/:id/evolve still works).

The web dev server proxies /api and /socket.io to http://127.0.0.1:8787; set VIVY_API to point it elsewhere.

Commands

Run from the repository root.

Command What it does
npm run dev Server with reload (tsx watch server/src/main.ts).
npm run dev:web Web client (Vite) on port 5173.
npm run build Β· npm run build:web Compile the server to server/dist Β· bundle the web client.
npm start -w server Run the compiled server.
npm test Server unit tests (vitest).
npm run typecheck tsc --noEmit for server and web.
npm run db:check -w server Atlas connectivity probe.
npm run db:init -w server Create every index, the time-series collections and the vector search indexes; waits until the search indexes are queryable.

Web client URL flags

Flag Effect
?source=mock Simulated world, no server and no API spend.
?demo (+ &captions, &autoplay) Mock world driven by the promo timeline; control it with window.vivyDemo.play() / pause() / seek(ms).
?gallery UI kit gallery.

Degraded mode

Without the provider keys the server still starts: world, chat, bulletin board, workspaces, monitor, usage and harness endpoints work, but agents are not created or started (a warning lists the missing keys). GET /api/health reports providers: {openai, typesafe, voyage}.

Repository layout

Path What it is
server/ Backend: Node 24, TypeScript strict ESM, Fastify + Socket.IO. Every server/src/** directory has its own README.
web/ Web client: Vite, React 19, React Three Fiber, zustand. Design system in web/DESIGN.md.
agent-engine/ Read-only observer agent for MongoDB Atlas Agent Engine (separate pnpm project, not an npm workspace).
server/eval/ Harness evaluation scenarios (train / holdout splits).
docs/ Frontend contracts and API shapes, design mockups, reference images; docs/media/ holds the README promo (compressed MP4 + animated WebP preview) and docs/media/screens/ the stills cut from it.
videos/ Promo video project (HyperFrames); full-quality renders stay local in videos/*/renders/.
PLAN.md Β· PROGRESS.md Architecture, conventions and step plan; live status and changelog (Chinese).

Cost and safety

  • Real keys spend money on every mind round. Background memory, subconscious and learning calls use OpenAI Flex (half price, falling back to standard processing on 429 or timeout); web_search is capped per agent per hour by the harness; automatic evolution is off by default.
  • GET /api/usage (live), GET /api/usage/history and the insights panel show token usage and cost per agent, model and module.
  • web_fetch refuses loopback and private addresses (checked on every redirect hop); forged script tools run in a time-limited worker + vm sandbox.
  • Secrets (.env, *.pem, *.key) and local runtime data (/data/) are gitignored. Never commit them.

API

REST under /api and Socket.IO at /socket.io: see server/src/api/README.md. Composition and boot order: server/src/app/README.md.

Contributing

Read CLAUDE.md for the hard rules: a README per package, one-line doc comment per class/function, ids via core/ids.ts, persistence only through BaseRepository (soft delete, optimistic versioning), every external call through llm/ and embedding/, every core module reporting to monitor/, locks with timeouts. Version bumps and commits follow vX.Y.Z 🦊 <summary>; update PROGRESS.md and the package.json versions with each change.

License

Copyright 2026 Joanna and the Vivy contributors. Licensed under the Apache License 2.0.

Third-party assets keep their own licenses (Twemoji graphics under CC BY 4.0, fonts under the SIL Open Font License 1.1), and third-party names and logos are trademarks of their owners. See NOTICE for attributions.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages