Clouds: lower opacity, depthWrite off, softer puffs.
Moon shadow color now matches sky phase instead of fixed black.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update README: pip install -e ., .env config with NN default
- Fix Day display: server sends phase in datetime_str, index.html uses state
directly instead of fragile regex parse that defaulted to Day 1
- Fix DB growth: snapshots DELETE-then-INSERT by name, prune old events/convos
- Fix console errors: pointer-lock→pointerlock, demo mode stops WS reconnect
and REST polling, mat() guards against undefined color
- FPV NPC chat: E key starts conversation, NPC freezes and faces player,
chat dialog with text input and Web Speech API microphone, contextual
NPC responses (name, age, occupation, mood), ESC to end chat
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Enhanced building architecture: chimneys, porches, bay windows on houses; balconies and cornices on apartments; glass curtain-wall office; sawtooth roof factory with loading dock; rose window church with buttresses; clock tower school; cinema with ticket booth; hospital with helipad; museum with columns and dome; park with gazebo and flower beds; ornate town square fountain
- Add FP and JOIN buttons to index.html controls bar
- Forward toggle-fp and show-join messages to 3d iframe
- Add pointer-lock, xr-spatial-tracking, fullscreen to iframe allow
- Click overlay for pointer lock (user gesture required)
- Fix speed control: set simSpeed immediately before async API call
- Prevent speed flickering at 10x/50x
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
First-person VR mode, calendar system, agent fixes, player character
- First-person mode (WASD+mouse) with PointerLockControls
- WebXR VR support for headsets
- Player can join city as playable character with HUD
- NPCs face the player when nearby in FP mode
- Calendar system starting 1 April 2026 with seasons
- Weather: 75% sunny, snow only in winter, rain other seasons
- Aging tied to calendar (1 year = 365 days, not tick-based)
- Moon phases (full/half/quarter/new, 28-day cycle)
- Agents always visible (no indoor hiding)
- Windows semi-transparent in interior view
- Dead agents show death date/age, no needs bars
- Agent movement speed 4x faster
- Sleeping agents lie along beds (not perpendicular)
- Furniture marked isFurniture for interior view
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix street lamps (glow sprites + few PointLights), speed controls in demo mode
- Street lamps: use emissive glow sprites instead of 100+ PointLights
(only 11 actual PointLights at key intersections for night illumination)
- Fix celestialTex definition order (moved before street lamp code)
- Demo speed: setSpeed works locally when no server, forwards to 3d iframe
- Demo tick uses dynamic setTimeout interval based on speed multiplier
- Pause/resume works in demo mode
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Street lamps, moon/stars fix, 100 agents with lifecycle, resizable panel
3D Visual:
- Street lamps along roads with PointLights that glow at night
- Solid 3D moon with glow halo, 500 brighter stars
- Clouds hidden when sunny weather
- Night scene brighter (ambient 0.35, hemi 0.45)
- Furniture placed inside buildings (not in front)
- Agents positioned inside buildings, visible only on interior click
- Cemetery location with gravestones
Agent Lifecycle (demo mode):
- 100 agents with age, gender, occupation, life phase
- Marriage system (18+), pregnancy (9 ticks), births increase population
- Divorce (rare random), aging with career progression
- Illness at 70+, hospitalization, death, burial at cemetery
- Age-based daily routines: kindergarten/school/university/work/retired
- Long-term memory recording life events
- Life plan displayed in info panel
UI:
- Resizable right sidebar panel (drag handle)
- Life plan and long-term memory sections in agent info
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Brighter night scene, building interior view on click
- Night lighting 3x brighter: hemi 0.35, ambient 0.25, lighter sky gradient, less fog
- Window glow increased to 0.8 emissive intensity
- Click building to enter interior: walls become transparent, camera zooms in
- See agents inside on beds, tables, desks
- Exit interior on empty click, Escape, or close panel
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Weather system, day/night cycle, agent behaviors, city expansion
- Sun movement east→zenith→west with dynamic shadows
- Weather effects: rain (4000 particles), snow (2000 particles), thunderstorms (lightning flashes), fog, cloudy skies
- Sun brightness/size adjusts per weather (bright sunny → dim stormy)
- Storm clouds layer (18 dark clouds) for bad weather
- Night: residential buildings become transparent, agents sleep in beds
- Furniture inside buildings: tables at restaurants/bars, desks in offices/schools, seats in cinema/church
- Agent poses: walking, sitting (at tables/desks), sleeping (in beds)
- Bad weather: 70% agents stay indoors; night: all go home to sleep
- Demo mode cycles through full day/night + weather types automatically
- Moon enlarged (10), stars visible from 19:00, brighter after 21:00
- Trees halved in size for better proportion with buildings
- City expanded: WORLD_SIZE 100→130, shadow camera enlarged
- 10 new public buildings (bank, court, gallery, daycare, vet, yoga, pub, etc.)
- 4 new streets for expanded area
- Ollama defa…
Integrate 3D city into main UI: iframe viewport 7/8 + data panel 1/8 right
- index.html: replace 2D canvas with 3D iframe (7/8 width), keep sidebar
right (1/8) with agents/chat/events tabs
- 3d.html: hide status bar and controls when embedded, postMessage bridge
for agent selection and camera controls
- Auto-detect file:// protocol for local demo mode (no server needed)
- Added collision avoidance, smooth mountains, 75 agents, new buildings
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add 3D city visualization: buildings, humanoid agents, sky environment
- Three.js isometric 3D city with 70 locations: houses, apartments, shops,
offices, factories, public buildings (police, fire, museum, mall, townhall,
market), parks, and entertainment venues
- Detailed humanoid figures with arms, legs, clothing, walking animation
- Sky system: sun/moon, stars, clouds, mountains, day/night lighting
- 75 demo agents with collision avoidance around buildings
- Grid of streets connecting all city blocks
- /3d route added to FastAPI server
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Major simulation features:
- Age progression (1 year per 365 sim days) with lifecycle stages
- Death system for 80+ with exponential probability curve
- Divorce mechanic for unhappy marriages (low trust/sentiment/mood)
- Married couples move in together (cohabitation)
- Church wedding ceremonies, hospital births after 9 sim-day pregnancy
- Baby agents born as real citizens, living with parents, autonomous at age 4
- Annual mayor elections with weighted voting (18+ citizens)
- Short-term (weekly) and long-term goals with auto-refresh
- Memory query API: ask any agent about their memories via LLM
- Community score tracking for election candidacy
- UI: lifecycle badges, deceased agents, mayor display, split goals,
memory query input, parent info, new event icons
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
NN training: realistic persona data, graphs, hot-reload endpoint
- Update all 20 personas in nn_train.py and nn_selfimprove.py to match
enhanced personas.yaml (corrected names, ages, traits, occupations)
- Add persona-specific behavioral patterns: night shift schedule (George),
nightly bar routine (Frank), crush proximity (Lila→Elena), taxi wandering
(Omar), overworked doctor (Priya), morning exercise (Marcus/Yuki), etc.
- Add persona-aware needs generation, mood calculation, starting locations
- Add training graph plots (loss + accuracy curves) after training
- Add --graph flag to display graphs from last training run
- Decouple --push from training (push existing model without retraining)
- Add POST /api/nn/reload endpoint for hot-reloading ONNX model from HF Hub
- NNClient.reload() deletes cache, re-downloads, swaps ONNX session in-place
- Both scripts auto-trigger /api/nn/reload after pushing to HF Hub
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix StockEx order endpoint: use shared database helper
Was creating a new Database() instance which crashes. Now uses
_get_player_from_token() like all other player endpoints.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add StockEx trading integration for player agents
- New API endpoints: /stockex/market, /stockex/leaderboard,
/stockex/portfolio/{id}, /stockex/order
- Player agents can browse market data, view portfolios, and place
buy/sell orders on StockEx clearing house
- Orders recorded as life events and memories for the agent
- Web UI: StockEx button in player panel opens trading modal with
live market data, portfolio view, and order form
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add life events, goals, pregnancy system; fix profile editor bugs
- Life events: append-only timeline seeded from persona, extended by
LLM reflections and romance milestones (dating/engaged/married/birth)
- Goals: personal aspirations with progress tracking, managed by LLM
reflections (add/complete/progress)
- Pregnancy: married couples can conceive, birth after ~7 sim-days,
baby names, both parents get memories and life events
- Agent context: LLM now sees life story, goals, children, pregnancy
- Fix profile editor: fetch full agent detail instead of WS summary
(occupation, background, personality sliders now load correctly)
- Fix Go dropdown: only rebuild when empty, preserves user selection
- Fix WS state summary: include age, occupation, daily_plan, is_player
- NN self-improve: track accuracy in training_stats.json, compare with
previous model on push
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
LLM popup: show live usage stats as probability slider moves
Slider now shows real-time estimates that update on drag:
- "X% of decisions via LLM" (how many agent actions use LLM vs routine)
- "~Y calls/hour" (accounting for RPM cap, budget per tick, agent count)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Gemini uses "quota" in ALL 429 responses, even per-minute rate limits.
The circuit breaker was triggering on the first per-minute 429, declaring
daily quota exhausted and blocking all calls until midnight.
Now only circuit-breaks on "per-day"/"daily" keywords or retry-after > 120s.
Per-minute throttles wait up to 30s and retry normally.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The circuit breaker was arming on any retry-after > 15s, but Groq sends
retry-after: 30-60s for normal per-minute rate limits. This caused
immediate "quota exhausted" on first use with many agents.
Now only circuit-breaks on retry-after > 120s or body containing
"daily"/"limit" keywords. Per-minute throttles wait and retry normally.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix LLM switcher panel: prevent popup close on slider interaction, fix defaults
- Stop click/mousedown events inside quota panel from propagating to
document handler that closes the popup
- Default probability slider to 10% for rate-limited providers instead
of inheriting NN's 100%
- Show daily limit and max runtime instead of unreliable remaining count
(in-memory counter resets on server restart)
- Badge shows "1500/day · ~6.3h" instead of fake "1500 left"
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Detect actual quota exhaustion via llm_status (429 errors), not just
in-memory counter which resets on server restart
- NN auto-sets probability to 100% when selected
- Remove "local" from NN label
- Popup probability slider initializes from current probability, not hardcoded 20%
- Fix pqForCalc to include rpm field for accurate runtime estimates
- Quota badge shows "exhausted" when API is actually rate-limited
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix quota runtime estimates: use RPM as bottleneck, sync top probability slider
- Runtime estimate now based on RPM (Gemini 4 RPM = 240 calls/h, ~6.25h for 1500 RPD)
not probability, which barely affects duration with 50 agents
- Remove misleading per-probability runtime table from popup
- Show RPM and single accurate runtime estimate instead
- Fix ID collision between top slider and popup slider (use class selectors)
- Sync top probability slider when switching provider via popup
- Expose RPM and max_calls_per_hour in /api/llm/quota per-provider data
- Update nn_selfimprove budget calculations to use RPM-based math
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix quota endpoint: per-provider tick rates for accurate runtime estimates
- Add GET /api/llm/quota endpoint exposing per-provider daily quota (Gemini 1500 RPD, Groq 14400 RPD)
- Add personality/home/work fields to agent detail API for NN training data collection
- Fix nn_selfimprove: /api/agents returns dict not list, correct probability endpoint path
- Fix Gemini scheduled reset to 10:00 AM Athens instead of midnight
- Add 'budget' CLI mode to calculate and apply optimal probability for target duration
- Scheduled mode now auto-calculates probability from remaining quota
- Frontend: rate-limited providers (Gemini/Groq) show quota badge and expand a panel
with runtime estimates table, probability slider, and confirm button before switching
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diversify agent activities, add local training script, scheduled Gemini cycle, architecture diagram
- routine.py: Add morning/post-work exercise, park lunch, sports_field for more
personality types, varied activity descriptions, park as exercise destination
- nn_train.py: Standalone local training script (equivalent to Kaggle notebook)
with synthetic data gen, ONNX export, HF push, CUDA support
- nn_selfimprove.py: Add 'scheduled' mode for nightly Gemini collection + retrain,
oversample LLM-sourced samples 3x during training
- routes.py: Fix valid providers list (nn instead of hf)
- docs/architecture.html: SVG diagram of SociAgentTransformer architecture
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add NN self-improvement pipeline: collect, train, push
scripts/nn_selfimprove.py — three-step pipeline:
1. collect: polls the live HF Space simulation, records (state, action)
pairs from all agents each tick as labeled training samples
2. train: retrains the SociAgentTransformer on collected + synthetic data,
exports to ONNX
3. push: uploads the improved model to RayMelius/soci-agent-nn on HF Hub
Usage:
python scripts/nn_selfimprove.py collect --minutes 60
python scripts/nn_selfimprove.py train --epochs 20
python scripts/nn_selfimprove.py push
python scripts/nn_selfimprove.py all # full pipeline
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add NN provider as default, remove HF inference (7B/0.5B)
- New NNClient: downloads ONNX model from RayMelius/soci-agent-nn on
first use, runs inference via onnxruntime on CPU (~1ms for 50 agents).
Zero API calls, zero cost, works offline.
- NN is now the default provider — always available, no API key needed.
LLM probability defaults to 100% for NN (no rate limiting).
- Removed HFInferenceClient and all 7B/0.5B model references — these
required HF Pro credits and never worked on free tier.
- Updated provider list in UI, fallback order, and provider icons.
- Added training notebook (notebooks/soci_agent_nn.ipynb).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Stop persisting LLM probability to DB and default endpoint to 0.10
The DB-saved probability was overriding the provider default on restarts.
Also changed the endpoint default from 1.0 to 0.10 to match the intended
behavior for cloud providers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Default LLM probability to 10% for cloud providers, ignore stale DB value
The DB-saved slider value (often 1.0 from local Ollama sessions) was
overriding the provider default on HF deploys, causing Gemini to burn
through its daily quota in minutes. Now always starts with the provider
default (10% for cloud, 100% for Ollama) — users can still adjust via
the UI slider during the session.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix Gemini conversations: bump LLM budget to 2 and remove double probability gate
With budget=1, action decisions consumed the entire per-tick allowance,
leaving zero budget for conversations. Also, active conversations were
gated by llm_call_probability on every turn — now they always continue
once started.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reset Gemini circuit breaker after failed startup probe
A single 429 on the probe was circuit-breaking for the entire day,
leaving the simulation in routine-only mode. Now the breaker resets
so the sim loop can retry gracefully per-tick.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add logging config so server output is visible in HF container logs
HF Spaces requires containers to run as uid 1000. Previous Dockerfile
ran as root which can cause permission issues during HF's init step.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The original 'soci' space had a corrupted HF backend record that
persisted across delete/recreate. Migrated to soci2.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
HFInferenceClient.__init__ no longer raises ValueError when token is absent.
Logs a warning instead; complete() already returns "" gracefully.
Allows switching to HF models from the UI even without a token configured.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Show soci-agent HF models unconditionally (don't require HF_TOKEN)
soci-agent-7b and soci-agent-q4 are public repos — always show them
regardless of whether HF_TOKEN is set (e.g. on Render).
Other HF models still gated behind HF_TOKEN.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Clean up LLM selector: only deployed HF models, remove Ollama soci variants
- HF soci entries: keep only deployed models (7b, q4); drop 8b/3b/1b5 (not on HF)
- Ollama: remove all soci-agent variants (Ollama unreachable on HF Space)
- Keep generic Ollama (local) entry for local deployments
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add all soci-agent model variants to LLM selector
- Clone llama.cpp shallow repo instead of downloading single script;
its bundled gguf-py is always in sync with convert_hf_to_gguf.py,
fixing MistralTokenizerType import error against PyPI gguf 0.17.1
- Add PYTHONPATH override so convert picks up llama.cpp's gguf-py
- Modelfile FROM now points to 7b-q4_k_m.gguf (4683 MB, Q4_K_M)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add GGUF export script for Windows (merge LoRA + quantise)
scripts/export_gguf_windows.py pipeline:
1. Load LoRA adapters via Unsloth, merge to 16-bit safetensors
2. Download convert_hf_to_gguf.py from llama.cpp (cached)
3. Convert merged model → F16 GGUF
4. Quantise F16 → Q4_K_M via llama_cpp.llama_model_quantize
5. Update Modelfile FROM to point at the new GGUF
6. Optionally push GGUF to HF Hub (--push flag)
Supports --model 0.5b/1.5b/3b/7b/8b and --quant f16/q4_k_m/q5_k_m/q8_0
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>