tiny-civilization / README.md
nishtha711's picture
Update README.md
d02ce48 verified
|
Raw
History Blame Contribute Delete
5.96 kB
---
title: Tiny Civilization The Tinywick Hollow Gazette
emoji: 🦊
colorFrom: yellow
colorTo: red
sdk: gradio
sdk_version: "6.17.3"
app_file: app.py
pinned: true
license: mit
short_description: Persistent woodland civilisation sim. 1.5B model.
tags:
- build-small-hackathon
- thousand-token-wood
- tiny-titan
- off-the-grid
- off-brand
- best-agent
- best-demo
- field-notes
- sharing-is-caring
- simulation
- creative-writing
- gradio
- track:wood
- achievement:offgrid
- achievement:offbrand
- achievement:sharing
- achievement:fieldnotes
---
# 🦊 Tiny Civilization — The Tinywick Hollow Gazette
> *A persistent woodland simulation where four AI agents invent absurd civilisation events — and you read about them in the daily newspaper.*
**[Try it →](https://huggingface.co/spaces/build-small-hackathon/tiny-civilization)**
Built for the **Build Small Hackathon 2026 — Thousand Token Wood** track.
**Demo video:** https://drive.google.com/file/d/1umIJRb_OYZ2gxcbliFNa_YmhGK_y_0ik/view?usp=sharing
**Social post:** https://x.com/iagained/status/2066384319929778645?s=20
**Blog post:** https://huggingface.co/blog/build-small-hackathon/tiny-civilization
**Agent traces:** https://huggingface.co/datasets/build-small-hackathon/tiny-civilization-traces
---
## What is this?
Every time you click **Advance Day**, four woodland creatures run as independent AI agents:
| Agent | Personality |
|---|---|
| 🦊 **Reginald Fox** | Charming, dishonest, obsessed with certificates |
| 🦡 **Beatrice Badger** | Gruff rule-keeper, secretly a poet |
| 🐿️ **Cornelius Squirrel** | Anxious inventor, repeats himself! |
| 🐀 **Millicent Mole** | Philosophical, speaks in riddles |
Then a fifth **Narrator agent** writes a formal newspaper front page treating the whole affair with the utmost journalistic gravity.
---
## Features
| Feature | Detail |
|---|---|
| 🗞️ **Animated Newspaper** | Paper drops in, headline types itself, ink fades in |
| 🔊 **Read Aloud** | Browser TTS reads today's front page — no API needed |
| 🎵 **Sound Effects** | Paper/press sounds via Web Audio API (synthesised) |
| 🐿️ **Running Squirrel** | Occasionally sprints across the bottom of the screen |
| ⏳ **Loading Messages** | Rotating funny messages while the model runs |
| 📜 **Archive** | Browse every past front page |
| 🗣️ **Spread a Rumour** | Pick a creature + rumour type — affects the next day |
| 🎁 **Donate a Weird Object** | Items enter the creature economy |
| ⚖️ **Propose a Law** | Shift the legal framework of the Hollow |
| 🖼️ **Share as Image** | Download a PNG of today's front page |
| 🎮 **Konami Code** | `↑↑↓↓←→←→BA` — reveals all agent system prompts |
| 💾 **Persistent SQLite** | Civilisation remembers history across sessions |
---
## Model
- **Primary**: `Qwen/Qwen2.5-1.5B-Instruct`**1.5B parameters** ≤ 4B → 🐜 Tiny Titan
- **Fallback**: `Qwen/Qwen2.5-3B-Instruct` — 3B parameters, also ≤ 4B
- Runs **100% locally** via ZeroGPU — zero external AI APIs 🔌
- ~520 tokens per day across 4 inference calls (~15 seconds on T4)
---
## Badge Claims
| Badge | Qualification |
|---|---|
| 🐜 **Tiny Titan** | Qwen2.5-1.5B = 1.5B params, well under the 4B cap |
| 🔌 **Off the Grid** | No cloud AI APIs — model runs locally on ZeroGPU |
| 🎨 **Off-Brand** | Fully custom newspaper UI: UnifrakturMaguntia font, two-column CSS layout, CSS keyframe animations, Web Audio API sounds — zero default Gradio styling visible |
| 🤖 **Best Agent** | 5 independent agents: Fox, Badger, Squirrel, Mole (distinct system prompts + relationship scores), plus Narrator |
| 🎬 **Best Demo** | Demo video + social post + working Space |
| 📡 **Sharing is Caring** | Agent traces exported at [HF Dataset](https://huggingface.co/datasets/build-small-hackathon/tiny-civilization-traces) |
| 📓 **Field Notes** | Blog post at [HF Blog](https://huggingface.co/blog/build-small-hackathon/tiny-civilization) |
---
## Architecture
```
advance_day() ←── @spaces.GPU(duration=60)
├─ call_agent("fox", situation_prompt) → ~80 tokens
├─ call_agent("badger", situation_prompt) → ~80 tokens
├─ call_agent("squirrel", situation_prompt) → ~80 tokens
└─ generate_newspaper(events_summary) → ~280 tokens
└─ Structured output:
HEADLINE / article / WEATHER / FOX / BADGER / SQUIRREL / MOLE
```
Each agent has a 4-sentence system prompt defining their personality. The narrator uses a rigid output schema with a worked example (few-shot) so the 1.5B model follows the format ~90% of the time, with graceful fallbacks for the rest.
Creature relationships drift based on event type (+5 trade, +7 invention, −4 gossip, −10 feud) and feed back into future agent prompts — emergent character dynamics over time.
---
## Persistent History
Everything is stored in **SQLite**: days, events, creature relationships, inventory, nudges. The newspaper prompt includes the last two published headlines so the model writes *"In a development reminiscent of last Tuesday's acorn scandal..."* — history actually matters.
---
## Database Schema
```sql
CREATE TABLE days (day_number, headline, full_newspaper_text, timestamp);
CREATE TABLE events (id, day_number, actor, action, target, description);
CREATE TABLE creatures(name, relationship_scores JSON, inventory JSON);
CREATE TABLE nudges (id, day_number, nudge_type, nudge_value);
```
---
## Easter Egg
Type the **Konami Code** while the app is focused: `↑ ↑ ↓ ↓ ← → ← → B A`
A modal appears with all five raw system prompts — the behind-the-scenes look at what drives the simulation. Only the woodland elite know this.
---
*"All things are connected underground." — Millicent Mole, Day 1*