BeCoin EcoSim is a self-contained simulation of an autonomous startup economy. It models treasury health, agent productivity, project pipelines, and the CEO discovery workflow that surfaces proposals and operational patterns. A FastAPI dashboard exposes the evolving state while the economy engine enforces BeCoin accounting rules and prevents catastrophic overspending.
becoin_economy provides a treasury-aware engine
that tracks transactions, agent output, project lifecycle, and impact records.โโโโโโโโโโโโโโโโโโ snapshot โโโโโโโโโโโโโโโโโโโโโโ JSON files
โ BecoinEconomy โโโโโโโโโโโโโโโโโถ โ Dashboard Exporter โ โโโโโโโโโโโโโโโโโโถ office-ui.html
โ (engine.py) โ โ (exporter.py) โ
โโโโโโโโฌโโโโโโโโโโโ โโโโโโโโโโฌโโโโโโโโโโโ
โ transactions & metrics โ REST + WS
โผ โผ
โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโ
โ Treasury / โ โ FastAPI Server โ
โ Agent Models โ โ (dashboard/server) โ
โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโ
BecoinEconomy coordinates treasury movements, agent activity,
and project status while guarding against overspending.build_dashboard_payload turns a snapshot into the five JSON files
the dashboard expects (treasury.json, agent-roster.json, projects.json,
impact-ledger.json, orchestrator-status.json).| Path | Purpose |
|---|---|
becoin_economy/models.py |
Dataclasses for treasury, agents, projects, transactions, and immutable snapshots. |
becoin_economy/engine.py |
Economy orchestration logic plus safeguards against overspending. |
becoin_economy/exporter.py |
Converts economy snapshots into dashboard JSON payloads. |
dashboard/server.py |
FastAPI app exposing CEO discovery endpoints and WebSocket broadcasts. |
dashboard/ceo_data_bridge.py |
Reads discovery session JSON from .claude-flow/discovery-sessions. |
dashboard/websocket_manager.py |
Manages WebSocket clients for live updates. |
dashboard/tests/ |
API, WebSocket, and data bridge tests. |
becoin_economy/tests/ |
Engine, exporter, and stress simulation tests. |
autonomous_agents/ |
Autonomous execution system with local LLMs and specialized agents. |
autonomous_agents/orchestrator.py |
Main orchestrator that executes implementation plans autonomously. |
autonomous_agents/personalities/ |
Loads 51 specialized agent personalities from Agency_of_Agents. |
docs/plans/ |
Implementation plans in markdown format for autonomous execution. |
Every critical handover is covered by automated tests:
test_engine_transactions.py validates project kick-off, completion, payroll, and
treasury reconciliation logic.test_exporter.py confirms JSON payloads remain dashboard-compatible and free of
non-serializable data.test_stress_simulation.py runs randomized start/complete/pay/advance cycles to
prove invariants (balance >= 0, chronological transactions, valid metrics).Run the full suite from the repository root:
pytest
Install dashboard dependencies:
cd dashboard
pip install -r requirements.txt
Start the FastAPI server:
uvicorn server:app --reload --port 3000
Serve the static dashboard (separate terminal):
python3 -m http.server 8080
Open http://localhost:9001/dashboard/office-ui.html and watch the BeCoin office
in action. The page polls the FastAPI endpoints and listens for WebSocket events.
The project includes an autonomous execution system that can implement entire feature plans independently using local LLMs and specialized agent personalities.
# One-click setup (installs Ollama, downloads Qwen2.5-Coder 7B, loads 51 agent personalities)
./autonomous_agents/setup_autonomous_agents.sh
# Execute a plan with dry-run (shows what would happen without executing)
python3 autonomous_agents/orchestrator.py docs/plans/example-plan.md --dry-run
# Execute a plan autonomously
python3 autonomous_agents/orchestrator.py docs/plans/example-plan.md
# Monitor progress in real-time (separate terminal)
python3 autonomous_agents/monitor.py -f
docs/plans/See autonomous_agents/README.md for complete documentation.
The dashboard expects five JSON files located under dashboard/becoin-economy/
(or any directory served alongside the HTML). Use the exporter to generate them from
any economy instance:
import json
from becoin_economy import BecoinEconomy, Agent, Project, Treasury, build_dashboard_payload
treasury = Treasury(start_capital=10000, balance=10000)
agents = [...] # list of Agent objects
projects = [...] # list of Project objects
economy = BecoinEconomy(treasury=treasury, agents=agents, projects=projects)
payload = build_dashboard_payload(economy)
for name, data in payload.items():
with open(f"dashboard/becoin-economy/{name}", "w") as fh:
json.dump(data, fh, indent=2)
The FastAPI layer surfaces discovery insights stored as JSON in
.claude-flow/discovery-sessions/. Endpoints include:
GET /api/ceo/status โ latest session overviewGET /api/ceo/proposals โ ROI-filtered proposalsGET /api/ceo/patterns โ operational patterns by typeGET /api/ceo/pain-points โ aggregated issuesGET /api/ceo/history โ session summariesWS /ws/ceo โ live push notifications for proposals, patterns, and status changesbecoin_economy/engine.py.build_dashboard_payload if structure changes.pytest to verify economy invariants and API contracts before committing.BeCoin EcoSim is released under the MIT License. See LICENSE for details.