Skip to content

Commit f0808a9

Browse files
Merge pull request #125 from exaforge/codex/deep-design
Stabilize core pipeline and simulation throughput
2 parents e8b0a84 + 10577ea commit f0808a9

190 files changed

Lines changed: 33334 additions & 54473 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ Thumbs.db
5353

5454
austin/
5555
examples/
56+
# Keep ad-hoc analysis dumps out of git even if examples are partially unignored later.
57+
examples/**/analysis/
5658

5759
# Simulation artifacts
5860
*.sqlite

AGENTS.md

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ extropy query summary --json
1818
```
1919

2020
**Agent mode behavior:**
21+
2122
- All output is JSON (parseable, no ANSI formatting)
2223
- Exit codes indicate success/failure (0 = success, non-zero = error)
2324
- No interactive prompts — commands fail fast if missing required input
@@ -29,20 +30,22 @@ extropy query summary --json
2930
extropy spec → extropy scenario → extropy persona → extropy sample → extropy network → extropy simulate → extropy results
3031
```
3132

32-
| Command | Purpose |
33-
|---------|---------|
34-
| `spec` | Create population spec from description |
35-
| `scenario` | Create scenario with events and outcomes |
36-
| `persona` | Generate persona rendering config |
37-
| `sample` | Sample agents from merged spec |
38-
| `network` | Generate social network |
39-
| `simulate` | Run simulation |
40-
| `results` | View results (summary, timeline, segment, agent) |
41-
| `query` | Export raw data (agents, edges, states, SQL) |
42-
| `chat` | Chat with simulated agents |
43-
| `estimate` | Predict simulation cost |
44-
| `validate` | Validate spec files |
45-
| `config` | View/set configuration |
33+
34+
| Command | Purpose |
35+
| ---------- | ------------------------------------------------ |
36+
| `spec` | Create population spec from description |
37+
| `scenario` | Create scenario with events and outcomes |
38+
| `persona` | Generate persona rendering config |
39+
| `sample` | Sample agents from merged spec |
40+
| `network` | Generate social network |
41+
| `simulate` | Run simulation |
42+
| `results` | View results (summary, timeline, segment, agent) |
43+
| `query` | Export raw data (agents, edges, states, SQL) |
44+
| `chat` | Chat with simulated agents |
45+
| `estimate` | Predict simulation cost |
46+
| `validate` | Validate spec files |
47+
| `config` | View/set configuration |
48+
4649

4750
## Non-Interactive Usage
4851

@@ -71,17 +74,19 @@ extropy persona -s ai-adoption -y
7174

7275
## Exit Codes
7376

74-
| Code | Meaning |
75-
|------|---------|
76-
| 0 | Success |
77-
| 1 | General error / validation failure |
78-
| 2 | Clarification needed (agent mode) |
79-
| 3 | File not found |
80-
| 4 | Sampling error |
81-
| 5 | Network error |
82-
| 6 | Simulation error |
83-
| 7 | Scenario error |
84-
| 10 | User cancelled |
77+
78+
| Code | Meaning |
79+
| ---- | ---------------------------------- |
80+
| 0 | Success |
81+
| 1 | General error / validation failure |
82+
| 2 | Clarification needed (agent mode) |
83+
| 3 | File not found |
84+
| 4 | Sampling error |
85+
| 5 | Network error |
86+
| 6 | Simulation error |
87+
| 7 | Scenario error |
88+
| 10 | User cancelled |
89+
8590

8691
## Querying Data
8792

@@ -150,11 +155,13 @@ export AZURE_ENDPOINT=https://<resource>.services.ai.azure.com/
150155

151156
All commands accept:
152157

153-
| Flag | Purpose |
154-
|------|---------|
155-
| `--json` | JSON output (overrides cli.mode) |
156-
| `--cost` | Show cost summary after command |
157-
| `--study PATH` | Explicit study folder path |
158+
159+
| Flag | Purpose |
160+
| -------------- | -------------------------------- |
161+
| `--json` | JSON output (overrides cli.mode) |
162+
| `--cost` | Show cost summary after command |
163+
| `--study PATH` | Explicit study folder path |
164+
158165

159166
## Study Folder Structure
160167

@@ -197,3 +204,4 @@ extropy results --json
197204
extropy query agents --to agents.jsonl
198205
extropy query states --to states.jsonl
199206
```
207+

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Extropy creates synthetic populations grounded in real-world distributions, conn
3131
```bash
3232
pip install extropy-run
3333
export OPENAI_API_KEY=sk-...
34+
# or: ANTHROPIC_API_KEY=... / AZURE_OPENAI_API_KEY=...
3435
```
3536

3637
Requires Python 3.11+. [uv](https://github.com/astral-sh/uv) recommended.
@@ -61,7 +62,7 @@ extropy results segment income
6162
## How It Works
6263

6364
1. **Population** — LLM discovers attributes, researches real-world distributions, samples agents
64-
2. **Network**Connects agents by similarity; edge types affect information flow
65+
2. **Network**Builds structural + similarity edges; edge types affect information flow
6566
3. **Two-pass reasoning** — Agent role-plays reaction, then classifier extracts outcomes
6667
4. **Propagation** — Opinions spread through network; agents update after hearing from peers
6768

@@ -79,9 +80,9 @@ extropy results segment income
7980
| Similarity edges | Acquaintances and online contacts from attribute similarity |
8081
| Small-world | Calibrated clustering coefficient and path lengths |
8182
| **Simulation** | |
82-
| Two-pass reasoning | Role-play first, classify second — eliminates central tendency bias |
83+
| Two-pass reasoning | Role-play first, classify second — reduces schema anchoring in outcome extraction |
8384
| Conversations | Agents talk to each other; both update state independently |
84-
| Memory | Full reasoning history with emotional trajectory |
85+
| Memory | Persistent memory traces with fidelity-based prompt trimming |
8586
| Conviction | Affects sharing probability and flip resistance |
8687
| THINK vs SAY | Internal monologue separate from public statement |
8788
| Timeline events | New information injected at specified timesteps |

docs/architecture.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,28 @@ extropy spec → extropy scenario → extropy persona → extropy sample → ext
1010

1111
All commands operate within a **study folder** — a directory containing `study.db` and scenario subdirectories. Data is keyed by `scenario_id` rather than `population_id`.
1212

13+
## Reference Study Blueprints
14+
15+
These are the canonical study patterns consolidated from prior showcase and study docs.
16+
17+
| Study Type | Population | Scenario Mode | Horizon | Typical Scale |
18+
|------------|------------|---------------|---------|---------------|
19+
| ASI announcement + societal transition | National population | Evolving | Monthly, 6 steps | 5,000 agents |
20+
| Geopolitical shock (for example Iran strikes) | National population | Evolving | Weekly, 12 steps | 5,000 agents |
21+
| Asset/market mania shock (for example BTC extreme rally) | National population | Evolving | Weekly, 8-12 steps | 5,000 agents |
22+
| Election projection (house control / state race) | National or state electorate | Static or lightly evolving | Decision-focused | 1,000-5,000 agents |
23+
24+
## Operational Quality Gates
25+
26+
Before moving forward to the next stage, the architecture assumes these checks:
27+
28+
1. `spec` gate: distribution realism and dependency coherence.
29+
2. `scenario` gate: timeline/outcome consistency and no contradictory rules.
30+
3. `persona` gate: natural language quality and no contradictory rendering.
31+
4. `sample` gate: no impossible household or demographic combinations.
32+
5. `network` gate: topology pass with realistic structural edge mix.
33+
6. `simulate` gate: expected timestep dynamics, checkpoint integrity, and tracked outputs.
34+
1335
---
1436

1537
## Phase 1: Population Creation (`extropy/population/`)
@@ -52,7 +74,7 @@ When `household_mode: true`:
5274
- Generate correlated partners (shared attributes: location, income correlation)
5375
- Generate NPC dependents (children, elderly) based on household type
5476
- Household types: singles, couples, single parents, couples with kids, multi-generational
55-
- `agent_focus` controls who reasons: `primary`, `couples`, `families`, `all`
77+
- `agent_focus_mode` controls who reasons: `primary_only`, `couples`, `all`
5678

5779
### 7. Network Generation (`network/`)
5880

@@ -353,8 +375,8 @@ Resolution order: programmatic > env vars > config file > defaults
353375
|-------|---------|-------------|
354376
| `fast` | `= models.fast` | Fast model for Pass 2 |
355377
| `strong` | `= models.strong` | Strong model for Pass 1 |
356-
| `max_concurrent` | 50 | Max concurrent LLM calls |
357-
| `rate_tier` | 1 | Provider rate limit tier |
378+
| `max_concurrent` | `null` (auto from RPM) | Max concurrent LLM calls |
379+
| `rate_tier` | `null` | Provider rate limit tier |
358380

359381
### Providers
360382

0 commit comments

Comments
 (0)