{"id":35216082,"url":"https://github.com/codeamt/platform-capitalism","last_synced_at":"2026-05-17T12:40:14.233Z","repository":{"id":326415493,"uuid":"1101559151","full_name":"codeamt/platform-capitalism","owner":"codeamt","description":"A simulation app built with FastHTML + MonsterUI enabling researchers to experimentally investigate how reinforcement schedules and platform policies interact to shape creator mental health and behavioral patterns.","archived":false,"fork":false,"pushed_at":"2025-11-28T19:40:58.000Z","size":3563,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-30T08:56:09.599Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://platform-capitalism.vercel.app","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codeamt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-21T21:14:15.000Z","updated_at":"2025-11-28T19:40:42.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/codeamt/platform-capitalism","commit_stats":null,"previous_names":["codeamt/platform-capitalism"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/codeamt/platform-capitalism","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeamt%2Fplatform-capitalism","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeamt%2Fplatform-capitalism/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeamt%2Fplatform-capitalism/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeamt%2Fplatform-capitalism/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codeamt","download_url":"https://codeload.github.com/codeamt/platform-capitalism/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeamt%2Fplatform-capitalism/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33139081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T09:28:26.183Z","status":"ssl_error","status_checked_at":"2026-05-17T09:27:52.702Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-29T22:02:44.964Z","updated_at":"2026-05-17T12:40:14.226Z","avatar_url":"https://github.com/codeamt.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Platform Capitalism Simulation\n\n\u003c!-- Update YOUR_USERNAME with your GitHub username after first push --\u003e\n[![CI](https://github.com/codeamt/platform-capitalism/actions/workflows/ci.yml/badge.svg)](https://github.com/codeamt/platform-capitalism/actions/workflows/ci.yml)\n[![Documentation](https://img.shields.io/badge/docs-GitHub%20Pages-blue)](https://codeamt.github.io/platform-capitalism)\n[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)\n\n\u003e **A research-driven simulation exploring creator wellbeing under different platform governance models**\n\nThis simulation environment models creator labor within platform economies using a state-machine framework where agents transition between four archetypal creative states—Optimizer, Hustler, True Believer, and Burnout—based on differential and intermittent reinforcement schedules. Agents generate content dynamically (3-10 posts/day) with earnings calculated via realistic CPM-based economics ($2-$40 per 1,000 views), reflecting empirical data from content farm research. A policy engine implements variable reinforcement regimes that shape creator behavior through rewards for quality, consistency, diversity, and volume, while tracking both monetary earnings and psychological metrics (view counts, addiction, burnout, resilience). The research dashboard provides real-time visibility into algorithmic decision-making and creator wellbeing through interactive visualizations, decision tree transparency tools, scenario comparison, and policy impact previews. This system enables researchers to experimentally investigate how platform monetization models and reinforcement schedules interact to shape creator mental health, economic outcomes, and behavioral patterns, offering an accessible framework for studying the economic and psychological dynamics of platform labor.\n\n![Dashboard Overview](static/img/preview.png)\n\n---\n\n## 📊 Research Foundation\n\nBased on empirical research into creator economies, particularly:\n\n**Primary Research:**\n\n1. **Mears, A. (2025).** [*Learning to Like the Likes and the Hate: The Labor of Internet Fame in the New Attention Economy*](https://academic.oup.com/socpro/advance-article/doi/10.1093/socpro/spaf028/8165972). Social Problems.\n\n2. **Mears, A. (2023).** [*Bringing Bourdieu to a Content Farm: Social Media Production Fields and the Cultural Economy of Attention*](https://journals.sagepub.com/doi/abs/10.1177/20563051231193027). Social Media + Society, 9(3).\n\n\n### Platform Dynamics\n\n```mermaid\n%%{init: {'theme':'dark','themeVariables': {'darkMode':'true'}}}%%\ngraph TD\n    A[Creator Agent] --\u003e|Content Generation| B(Platform Algorithm)\n    B --\u003e C{Capital Conversion}\n    C --\u003e|Views x CPM| D[Financial Capital]\n    C --\u003e|Engagement Rate| E[Status Capital]\n    C --\u003e|Niche Authority| F[Cultural Capital]\n    \n    D --\u003e G{Reinforcement Strategy}\n    E --\u003e G\n    F --\u003e G\n    \n    G --\u003e|Differential| H[Predictable Rewards]\n    G --\u003e|Intermittent| I[Unpredictable Rewards]\n    G --\u003e|Hybrid| J[Mixed Rewards]\n    \n    H --\u003e K[Creator Wellbeing]\n    I --\u003e K\n    J --\u003e K\n    \n    K --\u003e|Burnout Level| L{State Transition}\n    K --\u003e|Addiction Level| L\n    K --\u003e|Resilience| L\n    \n    L --\u003e|Low Burnout| M[OPTIMIZER]\n    L --\u003e|Rising Burnout| N[HUSTLER]\n    L --\u003e|High Burnout| O[BURNED_OUT]\n    L --\u003e|Intrinsic| P[TRUE_BELIEVER]\n    \n    M --\u003e|Strategy Adjustment| A\n    N --\u003e|Strategy Adjustment| A\n    O --\u003e|Strategy Adjustment| A\n    P --\u003e|Strategy Adjustment| A\n    \n    K -.-\u003e|Feedback Loop| B\n    \n    style D fill:#90EE90\n    style E fill:#87CEEB\n    style F fill:#DDA0DD\n    style K fill:#FFB6C1\n    style O fill:#FF6B6B\n    style M fill:#4ECDC4\n```\n\n**Key Dynamics:**\n- Capital Conversion: Content → Views → CPM Earnings + Status + Cultural Authority\n- Reinforcement: Platform strategy (differential/intermittent/hybrid) shapes reward patterns\n- Wellbeing Impact: Rewards affect burnout, addiction, and resilience\n- State Transitions: Wellbeing determines creator state (OPTIMIZER → HUSTLER → BURNED_OUT)\n- Feedback Loop: Creator state influences future content generation strategy\n\n**Key Insights:**\n- CPM-based monetization ($2-$40 per 1,000 views)\n- Content farm economics (median $5K-$30K/month per page)\n- Platform reinforcement strategies (differential vs. intermittent)\n- Creator burnout and addiction patterns\n- Capital conversion dynamics (financial, status, cultural)\n\n---\n\n## 🎮 Simulation Dynamics\n\n### CPM-Based Economics\n\n**Formula:**\n```\nEarnings = (Posts × Views_per_Post / 1000) × CPM_Rate × Quality_Bonus × Engagement_Bonus\n```\n\n$$\nE = \\frac{P \\times V}{1000} \\times C \\times Q_b \\times E_b\n$$\n\nWhere:\n- $E$ = Earnings\n- $P$ = Posts per day\n- $V$ = Views per post\n- $C$ = CPM rate\n- $Q_b$ = Quality bonus\n- $E_b$ = Engagement bonus\n\n**Example (Optimal Scenario):**\n- Agent posts **5 posts/day**\n- Each post gets **5,000 views**\n- CPM = **$10**\n- Quality bonus = **1.4x**\n- Engagement bonus = **1.0x**\n\n**Daily Earnings:** `(5 × 5,000 / 1,000) × $10 × 1.4 × 1.0 = $350/day`\n**Monthly:** ~$10,500 (matches research: median $5K-$30K/mo)\n\n### Agent Behavior Model\n\n**Content Generation**\n\nAgents generate content based on:\n1. Strategy (rapid_posting, strategic_pause, consistent_quality)\n2. Previous Reward (positive/negative reinforcement)\n3. Quality Trait (base productivity)\n\n**Formula:**\n```python\nposts_per_day = quality × (base_frequency + feedback_modifier) × 10.0\n```\n\n$$\nP_{day} = Q \\times (f_{base} + f_{feedback}) \\times 10.0\n$$\n\nWhere:\n- $P_{day}$ = Posts per day\n- $Q$ = Quality trait (0-1)\n- $f_{base}$ = Base frequency from strategy\n- $f_{feedback}$ = Feedback modifier from previous reward\n\n**State Machine \u0026 Psychological Metrics**\n\n| Category | Item | Description |\n|----------|------|-------------|\n| **State** | OPTIMIZER | Balanced, sustainable |\n| **State** | HUSTLER | High output, rising burnout |\n| **State** | TRUE_BELIEVER | Intrinsically motivated |\n| **State** | BURNED_OUT | Exhausted, low output |\n| **Metric** | Burnout | Accumulates with high output, decreases with rest |\n| **Metric** | Addiction | Driven by intermittent reinforcement |\n| **Metric** | Resilience | Ability to recover from negative rewards |\n| **Metric** | Arousal/Anxiety | Engagement with platform |\n\n### Platform Governance Models\n\n| Model | CPM | Reinforcement | Views/Post | Result |\n|-------|-----|---------------|------------|--------|\n| **Exploitative** | $5 (low) | Intermittent (unpredictable) | 3,000 (harder to grow) | High burnout, low earnings, addiction |\n| **Optimal** | $10 (fair) | Differential (predictable) | 5,000 (moderate growth) | Sustainable, balanced earnings |\n| **Balanced** | $15 (good) | Hybrid (50/50 mix) | 7,000 (growing audience) | Moderate burnout, good earnings |\n| **Cooperative** | $20 (premium) | Differential + UBI | 10,000 (large audience) | Low burnout, high earnings, sustainable |\n\n### Metrics \u0026 Analytics\n\n| Level | Metric | Description |\n|-------|--------|-------------|\n| **Agent** | Earnings | Total CPM-based revenue |\n| **Agent** | Views | Total content views |\n| **Agent** | Posts | Total content generated |\n| **Agent** | Burnout | Exhaustion level (0-1) |\n| **Agent** | Addiction | Compulsive behavior (0-1) |\n| **Agent** | Resilience | Recovery ability (0-1) |\n| **Agent** | Quality/Diversity/Consistency | Content traits (0-1) |\n| **Platform** | Total Earnings | Aggregate creator revenue |\n| **Platform** | Average Burnout | Platform health indicator |\n| **Platform** | Burnout Rate | % of creators in BURNED_OUT state |\n| **Platform** | Addiction Rate | % of creators with high addiction |\n| **Platform** | Mode | Reinforcement strategy (differential/intermittent/hybrid) |\n\n---\n\n### User Interface\n\n#### Simulation Dashboard\n![Dashboard](static/img/dashboard.png)\n*Interactive dashboard showing creator states, system health, and real-time metrics*\n\n#### Agent Metrics \u0026 Decision Tree\n![Agent Info](static/img/agent_info.png)\n*Individual creator cards with decision tree visualization and wellbeing metrics*\n\n#### System Health Analytics\n![System Health 1](static/img/system_health_1.png)\n*System health gauge and agent trait distributions*\n\n![System Health 2](static/img/system_health_2.png)\n*Reward characteristics, state transitions, and metric correlations*\n\n#### Governance Lab\n![Governance Lab](static/img/gov_lab.png)\n*Policy configuration interface for experimenting with platform governance models*\n\n#### Mobile Responsive Design\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"static/img/mobile.png\" alt=\"Mobile View\" width=\"50%\"\u003e\n\u003c/p\u003e\n\n*Fully responsive interface optimized for mobile devices*\n\n---\n\n## 🚀 Quick Start\n\n### Local Development\n\n```bash\n# Clone the repository\ngit clone https://github.com/codeamt/platform-capitalism.git\ncd platform-capitalism\n\n# Install dependencies\nmake install\n\n# (Optional) Copy environment variables\ncp .env.example .env\n\n# Run development server\nmake dev\n```\n\nOpen `http://localhost:5001` in your browser.\n\n### Using the Simulation\n\n1. Select a scenario from the dropdown:\n   - Algorithmic Slot Machine (Exploitative)\n   - Engagement Maximizer (Balanced)\n   - Creator-First Platform (Optimal)\n   - Cooperative Commons (Cooperative)\n\n2. Click \"Run Tick\" to advance the simulation by one day\n\n3. Observe real-time metrics:\n   - Platform Earnings (CPM-based)\n   - Total Views across all creators\n   - Individual agent states and strategies\n   - Creator Burnout levels\n   - Addiction Drive\n   - Resilience scores\n\n4. Explore transparency tools:\n   - Decision trees showing agent reasoning\n   - Policy configuration details\n   - Historical trend charts\n\n### Deployment Options\n\n#### Quick Demo (Vercel)\n```bash\n# Deploy to Vercel for demo/sharing\nmake quick-vercel\n\n# Or with production flag\nvercel --prod\n```\n\n#### Research Deployment (AWS Lightsail)\n```bash\n# One-command deployment\nmake quick-research\n\n# Or step-by-step\nmake terraform-init\nmake terraform-plan\nmake terraform-apply\nmake terraform-output  # Get deployment URL\n```\n\n**Cost:** ~$20/month for research deployments\n\n#### Docker (Local Testing)\n```bash\n# Build and run locally\nmake quick-demo\n\n# Or manually\nmake docker-build\nmake docker-run\n```\n\nSee [`guides/DEPLOYMENT_GUIDE.md`](guides/DEPLOYMENT_GUIDE.md) for detailed deployment instructions.\n\n### Available Commands\n\nRun `make` or `make help` to see all available commands:\n\n```bash\n# Development\nmake dev                # Run development server\nmake test               # Run pytest test suite\nmake test-coverage      # Run tests with coverage\n\n# Docker\nmake docker-build       # Build Docker image\nmake docker-run         # Run Docker container\nmake docker-push        # Push to GitHub Container Registry\n\n# Deployment\nmake deploy-vercel      # Deploy to Vercel (preview)\nmake deploy-vercel-prod # Deploy to Vercel (production)\nmake terraform-apply    # Deploy to AWS Lightsail\nmake lightsail-logs     # View deployment logs\n\n# Documentation\nmake docs-serve         # Serve MkDocs locally\nmake docs-deploy        # Deploy docs to GitHub Pages\n\n# Utilities\nmake format             # Format code with ruff\nmake lint               # Lint code\nmake clean              # Clean temporary files\n```\n\n\n## 🧪 Testing\n\n```bash\n# Run validation tests\nuv run python tests/validate_simulation.py\n```\n\nTests verify:\n- Agent state transitions\n- Reward calculations\n- Content generation\n- CPM earnings accuracy\n- Burnout accumulation\n\n---\n\n## 🤝 Contributing\n\n### 📁 Project Structure\n\n```\nplatform-capitalism/\n├── main.py                 # FastHTML application entry point\n├── simulation/\n│   ├── agents/            # Agent behavior, state machine, strategies\n│   ├── policy_engine/     # Reward calculation, CPM economics\n│   ├── scenarios/         # Platform governance presets\n│   └── environment.py     # Simulation orchestration\n├── ui/\n│   ├── components/        # Agent cards, decision trees, charts\n│   └── pages/            # Dashboard, governance lab\n├── routes/               # API endpoints (tick, reset, policy updates)\n└── tests/               # Validation tests\n```\n\n### 🔬 Key Features\n\n#### ✅ Implemented\n\n- CPM-based earnings with realistic market rates ($2-$40/1K views)\n- Volume-based content generation (3-10 posts/day)\n- Decision tree visualization (agent decision-making transparency)\n- Multiple governance scenarios (exploitative → cooperative)\n- Real-time metrics (burnout, addiction, earnings, views)\n- State machine (4 creator states with probabilistic transitions)\n- Reward systems (differential, intermittent, hybrid)\n- Stochastic trait evolution with independent noise\n- State persistence bonus (hysteresis)\n- Viral mechanics and reward variance\n- Platform algorithm variability\n- Optional text content generation using Hugging Face models\n\n   **Hugging Face Integration Features:**\n   - Generate realistic social media posts based on agent traits\n   - Automatic fallback to template-based generation if API unavailable\n   - Content quality and diversity driven by agent personality\n   - Graceful degradation - simulation works without HF API key\n\n   **Setup (Optional):**\n\n   1. **Install dependencies:**\n      ```bash\n      uv sync  # Installs huggingface-hub automatically\n      ```\n\n   2. **Set API key (optional):**\n      ```bash\n      export HUGGINGFACE_API_KEY=\"your_key_here\"\n      ```\n      Get your key from: https://huggingface.co/settings/tokens\n\n   3. **Enable text generation:**\n      ```python\n      # In your code or API endpoint\n      GLOBAL_ENVIRONMENT.tick(generate_text_content=True)\n      ```\n\n   **Usage Example:**\n   ```python\n   from simulation.content_generator import generate_agent_content\n\n   # Generate content for a specific agent\n   agent = agents[0]\n   result = generate_agent_content(agent, temperature=0.7, max_tokens=100)\n\n   # Returns:\n   {\n      \"content\": \"Just posted new content! Check it out... 🚀\",\n      \"method\": \"huggingface\",  # or \"template_fallback\"\n      \"model\": \"gpt2\",\n      \"word_count\": 15,\n      \"quality_score\": 0.8,\n      \"agent_id\": \"agent_1\",\n      \"agent_state\": \"OPTIMIZER\",\n      \"agent_strategy\": \"consistent_quality\"\n   }\n   ```\n\n   **Implementation Details:**\n   - Content generator: `simulation/content_generator.py`\n   - Agent prompt generation: `simulation/agents/agent.py::generate_content_prompt_hf()`\n   - Integration point: `simulation/environment.py::tick(generate_text_content=True)`\n\n   **Note:** The simulation works perfectly without HF API key - it uses intelligent template-based fallback generation.\n\n**Other Features in Development:**\n- **Controversial/Cringe Content Modeling**: Strategy-based content quality dimensions (authenticity, controversy, clickbait) with engagement vs. wellbeing trade-offs - [Design Doc](guides/CONTROVERSIAL_CONTENT_FEATURE.md)\n- Markov chain fallback: Statistical content generation\n- Multi-platform support: TikTok, Instagram, YouTube\n- Advanced analytics: Correlation analysis, trend detection\n- API endpoints: REST API for external access\n- Mobile architecture: Responsive design for mobile clients\n\n\n### Priority Areas:\n1. Advanced analytics (correlation, clustering)\n2. Multi-platform support (TikTok, Instagram, YouTube)\n3. Mobile-responsive UI\n4. API endpoints for external access\n\n### Development Workflow\n\n```mermaid\ngraph LR\n    A[Issue/Feature] --\u003e B[Create Branch]\n    B --\u003e C[Local Development]\n    C --\u003e D[Run Tests]\n    D --\u003e E{Tests Pass?}\n    E --\u003e|No| C\n    E --\u003e|Yes| F[Commit \u0026 Push]\n    F --\u003e G[GitHub Actions CI]\n    G --\u003e H{CI Pass?}\n    H --\u003e|No| C\n    H --\u003e|Yes| I[Create PR]\n    I --\u003e J[Code Review]\n    J --\u003e K{Approved?}\n    K --\u003e|Changes Requested| C\n    K --\u003e|Approved| L[Merge to Main]\n    L --\u003e M[Auto Deploy]\n    M --\u003e N[Vercel/Lightsail]\n    \n    style A fill:#FFE5B4\n    style D fill:#87CEEB\n    style G fill:#90EE90\n    style L fill:#DDA0DD\n    style M fill:#FFB6C1\n```\n\n**Development Steps:**\n1. Issue/Feature: Create GitHub issue or identify feature\n2. Branch: `git checkout -b feature/your-feature`\n3. Develop: Make changes, run `make dev` to test locally\n4. Test: Run `make test` (17 pytest tests must pass)\n5. CI: GitHub Actions runs automatically on push\n6. Review: Team reviews PR, suggests changes\n7. Merge: Approved PRs merge to main\n8. Deploy: Auto-deploy to Vercel (demo) or Lightsail (research)\n\n---\n\n## 📄 License\n\nSee `LICENSE` file for details.\n\n\n## 🙏 Acknowledgments\n\n- Ashley Mears for foundational research on platform labor and creator economies\n- Claude Sonnet 3.5 and Gemini 3 for development assistance\n- FastHTML framework\n- MonsterUI component library\n- Hugging Face community\n\n---\n\n**Built with ❤️ to understand and improve creator wellbeing on digital platforms.**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeamt%2Fplatform-capitalism","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeamt%2Fplatform-capitalism","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeamt%2Fplatform-capitalism/lists"}