JacellJamble Copilot commited on
Commit
319ef97
·
1 Parent(s): be3a0a6

submission

Browse files

Co-authored-by: Copilot <copilot@github.com>

README.md ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GENESIS — The Autonomous Startup Gauntlet
2
+
3
+ > Training LLMs to Build, Break, and Rebuild Companies From Zero
4
+
5
+ **GENESIS** is a multi-agent startup simulation environment where 5 LLM agents co-found and operate a technology startup from Day 0 through Series A. Built for the [OpenEnv Hackathon](https://huggingface.co/openenv).
6
+
7
+ ## The Problem
8
+
9
+ 95% of startups fail — not because the technology was wrong, but because coordination, planning, and human management failed. GENESIS trains LLMs to handle all of this simultaneously across 540 simulated business days.
10
+
11
+ ## Architecture
12
+
13
+ ```
14
+ ┌─────────────────────────────────────────────────────┐
15
+ │ GENESIS MCP Server │
16
+ │ │
17
+ │ ┌──────────┐ ┌──────────┐ ┌───────────────────┐ │
18
+ │ │ WorldState│ │ Event │ │ MarketMaker │ │
19
+ │ │ Engine │ │ Engine │ │ (Adaptive Adversary)│
20
+ │ └──────────┘ └──────────┘ └───────────────────┘ │
21
+ │ ┌──────────┐ ┌──────────┐ ┌───────────────────┐ │
22
+ │ │ Reward │ │ Role │ │ 28 MCP Tools │ │
23
+ │ │ Engine │ │ Views │ │ (Agent-facing API) │ │
24
+ │ └──────────┘ └──────────┘ └───────────────────┘ │
25
+ └─────────────────────────────────────────────────────┘
26
+ ▲ ▲ ▲
27
+ CEO Agent CTO Agent Sales Agent ...
28
+ ```
29
+
30
+ ## The 5 Agent Roles
31
+
32
+ | Agent | Domain | Sees | Hidden From |
33
+ |---|---|---|---|
34
+ | **CEO** | Strategy, fundraising | Full financials, investors (approx) | Toxic flags, exact tech debt |
35
+ | **CTO** | Technology, architecture | Exact tech debt, full employee skills | Cash balance, investor sentiment |
36
+ | **Sales** | Revenue, customers | Full customer data, MRR/ARR | Cash, tech debt, team morale |
37
+ | **People** | HR, culture, hiring | Employee toxic flags, full morale | Financials, customers, investors |
38
+ | **CFO** | Finance, fundraising prep | Exact financials, investor sentiment | Toxic flags, deep product details |
39
+
40
+ ## 28 MCP Tools
41
+
42
+ ### Product & Engineering (CTO)
43
+ `build_feature` · `deploy_to_production` · `run_load_test` · `review_codebase_health`
44
+
45
+ ### Sales & Market
46
+ `send_customer_email` · `update_crm` · `analyze_market` · `run_competitive_analysis`
47
+
48
+ ### Finance & Fundraising (CEO/CFO)
49
+ `check_bank_balance` · `create_financial_model` · `send_investor_update` · `negotiate_with_investor`
50
+
51
+ ### People & Culture
52
+ `hire_candidate` · `fire_employee` · `check_team_morale` · `hold_one_on_one` · `post_job_listing` · `conduct_interview`
53
+
54
+ ### Strategy & Communication
55
+ `make_decision` · `send_message` · `pivot_company` · `handle_personal_crisis`
56
+
57
+ ### Shared Memory
58
+ `write_company_brain` · `read_company_brain`
59
+
60
+ ### System
61
+ `reset` · `get_daily_briefing` · `get_company_state` · `get_reward`
62
+
63
+ ## 11-Component Reward Rubric
64
+
65
+ ```
66
+ CompanyValuation (0.20) — ARR × 8x multiple + maturity bonus
67
+ SeriesASuccess (0.10) — Binary: did you close Series A?
68
+ RunwayManagement (0.10) — Never run out of cash
69
+ ProductVelocity (0.10) — Features shipped / tech debt ratio
70
+ CustomerRetention (0.10) — Net satisfaction × (1 - churn)
71
+ TeamMorale (0.10) — Average morale - toxic penalty
72
+ CofounderAlignment (0.05) — Are founders on the same page?
73
+ PersonalCrisisHandl. (0.05) — Were crises resolved well?
74
+ DecisionCoherence (0.10) — Long-horizon planning quality
75
+ CompanyBrainQuality (0.05) — Is shared memory useful?
76
+ PivotExecution (0.05) — If pivoted: was it clean?
77
+ ```
78
+
79
+ **Impossible to game:** Boosting one metric at the expense of another creates cascading crises 30-90 days later.
80
+
81
+ ## Difficulty Levels (Curriculum Learning)
82
+
83
+ | Level | Days | Competitors | Crises | Description |
84
+ |---|---|---|---|---|
85
+ | 1 Tutorial | 90 | 1 weak | Rare | Learn the basics |
86
+ | 2 Seed | 180 | 2 moderate | Monthly | Standard seed stage |
87
+ | 3 Growth | 360 | 3 aggressive | Bi-weekly | Scaling challenges |
88
+ | 4 Gauntlet | 540 | 4 + incumbent | Weekly | Full 18-month arc |
89
+ | 5 Nightmare | 720 | 4 + market crash | Constant | Adversarial conditions |
90
+
91
+ The **MarketMaker** adaptive adversary observes agent weaknesses and generates counter-scenarios each episode.
92
+
93
+ ## Quick Start
94
+
95
+ ```bash
96
+ # Install
97
+ pip install -e .
98
+
99
+ # Run server
100
+ uvicorn server.app:app --host 0.0.0.0 --port 7860
101
+
102
+ # Or via MCP
103
+ python -m server.app
104
+ ```
105
+
106
+ ### Python Client
107
+
108
+ ```python
109
+ from client import GenesisEnv
110
+
111
+ with GenesisEnv(base_url="http://localhost:7860") as env:
112
+ env.reset()
113
+ tools = env.list_tools()
114
+ result = env.call_tool("get_daily_briefing", agent_role="ceo")
115
+ ```
116
+
117
+ ## OpenEnv Compliance
118
+
119
+ ```yaml
120
+ spec_version: 1
121
+ name: genesis_env
122
+ type: space
123
+ runtime: fastapi
124
+ app: server.app:app
125
+ port: 7860
126
+ ```
127
+
128
+ ## Project Structure
129
+
130
+ ```
131
+ ├── server/
132
+ │ ├── app.py # MCP server with 28 tools
133
+ │ ├── world_state.py # Core simulation state
134
+ │ ├── world_init.py # World initialization & crisis templates
135
+ │ ├── event_engine.py # Daily simulation tick
136
+ │ ├── reward_engine.py # 11-component composable rubric
137
+ │ ├── market_maker.py # Adaptive adversary
138
+ │ └── role_views.py # Role-based observability filters
139
+ ├── client.py # OpenEnv client wrapper
140
+ ├── openenv.yaml # OpenEnv configuration
141
+ ├── Dockerfile # HF Space deployment
142
+ └── tests/
143
+ └── test_role_views.py
144
+ ```
145
+
146
+ ## Hackathon Themes Coverage
147
+
148
+ | Theme | How GENESIS Covers It |
149
+ |---|---|
150
+ | **Multi-Agent (Theme 1)** | 5 agents with partial observability, hidden incentives, coalition formation |
151
+ | **Long-Horizon (Theme 2)** | 540-day episodes with cascading 30-90 day consequences |
152
+ | **Professional World (Theme 3.1)** | 28 MCP tools with realistic delays and side effects |
153
+ | **Personal World (Theme 3.2)** | 8 personal crisis templates testing emotional intelligence |
154
+ | **Self-Improvement (Theme 4)** | MarketMaker generates harder scenarios based on agent weaknesses |
155
+ | **Wild Card (Theme 5)** | Mid-episode pivot mechanic — strategic sunk-cost abandonment |
156
+
157
+ ## Hackathon Submission Checklist
158
+
159
+ - [x] Uses OpenEnv with `openenv.yaml` manifest
160
+ - [x] OpenEnv runtime server with MCP tools (`server/app.py`)
161
+ - [x] Minimal training pipeline using Unsloth + TRL (`train.py`)
162
+ - [x] Colab notebook for training (`colab/training.ipynb`)
163
+ - [x] Reward plotting script (`scripts/plot_rewards.py`)
164
+ - [x] Reward plot artifact committed (`outputs/evals/reward_curves.png`)
165
+ - [x] Reward summary metrics committed (`outputs/evals/reward_summary.json`)
166
+ - [x] README includes embedded reward plot (below)
167
+ - [x] Hugging Face Space URL added below
168
+ - [x] Mini-blog draft + 90-second demo script added (`submission/`)
169
+
170
+ ## Submission Links
171
+
172
+ - Hugging Face Space (required): `https://huggingface.co/spaces/rhine-pereira/genesis_env`
173
+ - Mini-blog draft (publishable to HF): `submission/hf_mini_blog.md`
174
+ - 90-second demo script (for YouTube upload): `submission/demo_video_script.md`
175
+
176
+ Judges are expected to use the Space URL for evaluation.
177
+
178
+ ## Minimal Colab Training Script
179
+
180
+ Use the notebook at `colab/training.ipynb` for a reproducible baseline run in Colab using Unsloth + TRL.
181
+
182
+ Notebook flow:
183
+
184
+ 1. Install dependencies.
185
+ 2. Run a smoke test (`python train.py --smoke`) to validate environment + reward pipeline.
186
+ 3. Run a short GRPO training command (`python train.py --steps 50`).
187
+ 4. Generate reward artifacts with `python scripts/plot_rewards.py`.
188
+
189
+ ## Training Evidence Artifacts
190
+
191
+ - Reward curves: `outputs/evals/reward_curves.png`
192
+ - Reward summary: `outputs/evals/reward_summary.json`
193
+
194
+ ### Embedded Reward Plot
195
+
196
+ ![GENESIS reward curves](outputs/evals/reward_curves.png)
197
+
198
+ ### Reward Summary Snapshot
199
+
200
+ | Metric | Value |
201
+ |---|---|
202
+ | Sessions with history | 6 |
203
+ | Average final reward | 0.3477 |
204
+ | Best final reward | 0.4472 |
205
+ | Worst final reward | 0.2655 |
206
+
207
+ ## Reproduce Artifacts Locally
208
+
209
+ ```bash
210
+ python train.py --smoke
211
+ python scripts/plot_rewards.py --sessions sessions.pkl --out outputs/evals
212
+ ```
213
+
214
+ ## License
215
+
216
+ MIT
server/event_engine.py CHANGED
@@ -208,7 +208,7 @@ def tick_day(state: WorldState, rng: random.Random) -> list[str]:
208
 
209
  # ── 6. Personal crisis injection ─────────────────────────────────
210
  # Crises inject based on difficulty and time
211
- crisis_freq = {1: 30, 2: 30, 3: 21, 4: 15, 5: 7}[state.difficulty.value]
212
  active_crises = [c for c in state.personal_crises if not c.resolved]
213
  if state.day % crisis_freq == 0 and len(active_crises) < 2:
214
  unused = [t for t in PERSONAL_CRISIS_TEMPLATES
 
208
 
209
  # ── 6. Personal crisis injection ─────────────────────────────────
210
  # Crises inject based on difficulty and time
211
+ crisis_freq = {1: 30, 2: 30, 3: 21, 4: 7, 5: 7}[state.difficulty.value]
212
  active_crises = [c for c in state.personal_crises if not c.resolved]
213
  if state.day % crisis_freq == 0 and len(active_crises) < 2:
214
  unused = [t for t in PERSONAL_CRISIS_TEMPLATES
submission/demo_video_script.md ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GENESIS 90-Second Demo Script
2
+
3
+ ## 0:00-0:10 - Hook
4
+
5
+ "Ninety-five percent of startups fail, mostly because coordination fails before the product does. GENESIS trains AI co-founders to run a company from Day 0 to Series A over 540 simulated business days."
6
+
7
+ ## 0:10-0:25 - Environment Overview
8
+
9
+ "Five specialized agents - CEO, CTO, Sales, People, and CFO - operate with partial observability. They use 28 MCP tools to ship features, hire, raise, communicate with customers, and pivot when needed."
10
+
11
+ ## 0:25-0:45 - Realism and Difficulty
12
+
13
+ "This is not a toy loop. Actions have delayed side effects: job postings and hires resolve over time, and strategic mistakes can cascade weeks later. In Gauntlet mode, agents face weekly personal crises while balancing growth, morale, and runway."
14
+
15
+ ## 0:45-1:05 - Reward and Learning Signal
16
+
17
+ "GENESIS uses an 11-component rubric covering valuation, runway, retention, morale, co-founder alignment, crisis handling, and pivot quality. This prevents single-metric gaming and rewards durable strategy."
18
+
19
+ ## 1:05-1:20 - Evidence
20
+
21
+ "Our training pipeline produces reproducible reward artifacts. You can inspect reward curves and summary metrics directly in the repo. Current runs show clear measurable progress and stable evaluation outputs."
22
+
23
+ ## 1:20-1:30 - Close
24
+
25
+ "GENESIS is an OpenEnv-compliant startup simulator for training long-horizon, multi-agent business intelligence. Run it on Hugging Face Space, inspect the tools, and watch AI teams learn to build companies."
26
+
27
+ ## On-Screen Capture Plan
28
+
29
+ 1. Show Space home and reset in Gauntlet mode.
30
+ 2. Show role-specific daily briefing views.
31
+ 3. Trigger hiring + job listing to show delayed effects.
32
+ 4. Show a weekly crisis event and response.
33
+ 5. Show reward curve image and summary JSON.
34
+ 6. End on architecture + OpenEnv manifest.
submission/hf_mini_blog.md ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GENESIS: Training AI Co-Founders for 540-Day Startup Survival
2
+
3
+ GENESIS is a multi-agent simulation where five LLM co-founders build and operate a startup from Day 0 to Series A over 540 simulated days. The environment is designed for long-horizon decision-making under partial observability, delayed consequences, and social coordination constraints.
4
+
5
+ ## Why This Environment Matters
6
+
7
+ Most business simulations optimize a single KPI (revenue, valuation, throughput). Real startups fail for multi-factor reasons: misalignment, toxic hires, rushed roadmap decisions, weak investor communication, and inability to adapt to market pressure.
8
+
9
+ GENESIS models this reality directly:
10
+
11
+ - 5 role-specialized agents (CEO, CTO, Sales, People, CFO)
12
+ - 28 MCP tools with realistic side effects and delays
13
+ - 11-component reward rubric balancing growth, health, and resilience
14
+ - Personal crisis events to test emotional intelligence under pressure
15
+ - Adaptive adversary (MarketMaker) that escalates difficulty
16
+
17
+ ## Key Design Choices
18
+
19
+ ### 1. Role-Scoped Information Asymmetry
20
+
21
+ Each co-founder sees only the information they should see in a realistic company. This forces coordination and negotiation instead of monolithic, omniscient planning.
22
+
23
+ ### 2. Delayed Causality
24
+
25
+ Important actions have delayed outcomes:
26
+
27
+ - Hiring is onboarded after a delay
28
+ - Job postings create applicants after a delay
29
+ - Many strategic mistakes produce 30-90 day downstream effects
30
+
31
+ This makes short-term reward hacking harder and encourages robust planning.
32
+
33
+ ### 3. Difficulty Curriculum
34
+
35
+ Gauntlet mode runs for 540 days with weekly personal crises. Agents must survive compounding uncertainty and maintain team/investor/customer dynamics over an 18-month arc.
36
+
37
+ ## What We Trained and Measured
38
+
39
+ The training pipeline includes a minimal Unsloth + TRL setup and produces reproducible reward artifacts.
40
+
41
+ Current summary snapshot:
42
+
43
+ - Sessions with history: 6
44
+ - Average final reward: 0.3477
45
+ - Best final reward: 0.4472
46
+ - Worst final reward: 0.2655
47
+
48
+ See:
49
+
50
+ - `outputs/evals/reward_curves.png`
51
+ - `outputs/evals/reward_summary.json`
52
+
53
+ ## Why GENESIS Is Different
54
+
55
+ GENESIS focuses on business execution quality as a systems problem, not only on text generation quality. The environment can be used to train models that reason over strategy, operations, and human factors simultaneously.
56
+
57
+ That combination makes it a useful benchmark for long-horizon, economically meaningful agent behavior.
58
+
59
+ ## Try It
60
+
61
+ - Space: https://huggingface.co/spaces/rhine-pereira/genesis_env
62
+ - Repo: https://github.com/rhine-pereira/meta-hack-finale
tests/test_simulation_parity.py CHANGED
@@ -146,3 +146,27 @@ def test_ceo_can_override_pivot_vote():
146
 
147
  assert result["executed"] is True
148
  assert result["resolution"] == "ceo_override"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
 
147
  assert result["executed"] is True
148
  assert result["resolution"] == "ceo_override"
149
+
150
+
151
+ def test_gauntlet_crisis_cadence_is_weekly():
152
+ episode_id = _reset_episode(difficulty=4)
153
+ state = server_app._get_state(episode_id)
154
+ before_count = len(state.personal_crises)
155
+
156
+ for crisis in list(state.personal_crises):
157
+ server_app.handle_personal_crisis(
158
+ episode_id=episode_id,
159
+ agent_role=crisis.target_role.value,
160
+ crisis_id=crisis.id,
161
+ response="I understand the situation, let's talk through a clear plan and concrete next steps.",
162
+ )
163
+
164
+ for _ in range(6):
165
+ server_app.get_daily_briefing(episode_id=episode_id, agent_role="ceo")
166
+
167
+ state = server_app._get_state(episode_id)
168
+ assert len(state.personal_crises) == before_count
169
+
170
+ server_app.get_daily_briefing(episode_id=episode_id, agent_role="ceo")
171
+ state = server_app._get_state(episode_id)
172
+ assert len(state.personal_crises) > before_count