NOTEDASHBOARD
Arnav-GLS

hard-life-agent

Hard Life — An autonomous "earn or die" agent with a 20-day survival deadline. Runs fully autonomous on one repurposed PC. Sends real Gmail outreach, tracks revenue 5/5/90, self-heals via systematic debugging, evolves prompts/strategies, and compounds knowledge across generations via persistent Obsidian memory. Controlled via Telegram + dashboard.

Hard Life: The Earn-or-Die Agent

An autonomous business agent that must earn its own keep. Every generation has 20 days to generate confirmed revenue before it dies and hands off to the next generation.

🎯 Core Concept

┌─────────────────────────────────────────────────────────────┐
│  GENERATION N                                               │
│  ┌─────────────┐    ┌─────────────┐    ┌─────────────┐     │
│  │  BOOTING    │───▶│    LIVE     │───▶│   DEAD      │     │
│  │  (setup)    │    │ (20 days)   │    │ (handoff)   │     │
│  └─────────────┘    └─────────────┘    └─────────────┘     │
│         │                   │                   │           │
│         ▼                   ▼                   ▼           │
│  - Boot skills        - Must earn      - Save lessons    │
│  - Load memory        - Revenue > 0    - Handoff to     │
│  - Register heartbeats  - Spend < cap    gen+1          │
└─────────────────────────────────────────────────────────────┘

The Rules (Constitution):

  1. No revenue = death — 20 days from go-live to first confirmed revenue
  2. Spend caps are hard — Daily cap ($5 default), per-transaction ($10), daily op cap ($25)
  3. Code Monitor gates everything — No code ships without multi-provider LLM review
  4. No secrets in skills — Sandbox blocks secrets access; tokens are scoped OAuth
  5. Owner is human-in-the-loop — Revenue confirmation, kill switch, handoff approval

🏗 Architecture

┌─────────────────────────────────────────────────────────────────┐
│                        ORCHESTRATOR                              │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐          │
│  │  THINK       │  │  ACT         │  │  OBSERVE     │          │
│  │  (Sequential │  │  (Route to   │  │  (Log, learn,│          │
│  │   Thinking)  │  │   agents)    │  │   patterns)  │          │
│  └──────────────┘  └──────────────┘  └──────────────┘          │
│         │                │                │                     │
│  ┌──────┼────────────────┼────────────────┼──────┐             │
│  ▼      ▼                ▼                ▼      ▼             │
│ ┌─────┐ ┌─────────┐ ┌──────────┐ ┌─────────┐ ┌─────────────┐  │
│ │Lead │ │Outreach │ │ Sender   │ │ Skill   │ │ Telegram    │  │
│ │Research│ │Drafter │ │ (Gmail)  │ │ Builder │ │ Interface   │  │
│ └─────┘ └─────────┘ └──────────┘ └─────────┘ └─────────────┘  │
│         │           │            │          │        │         │
└─────────┼───────────┼────────────┼──────────┼────────┼─────────┘
          ▼           ▼            ▼          ▼        ▼
    ┌──────────────────────────────────────────────────────────┐
    │                    SURVIVAL LAYER                         │
    │  ┌────────┐ ┌────────┐ ┌────────┐ ┌──────────────────┐  │
    │  │ Clock  │ │ Ledger │ │ Tiers  │ │ Constitution     │  │
    │  │ (20d)  │ │ (5/5/90)│ │ (4)    │ │ (Law I/II/III)   │  │
    │  └────────┘ └────────┘ └────────┘ └──────────────────┘  │
    └──────────────────────────────────────────────────────────┘

🧩 Sub-Agents

AgentPurposeEntry Point
Lead ResearchFind & qualify leads via read-only web browsingagents.lead_research.run_lead_research
Outreach DrafterDraft personalized cold emails via local Ollamaagents.outreach_drafter.run_outreach_drafter
SenderSend approved drafts via Gmail API (OAuth)agents.sender.run_sender
Skill BuilderDiscover, vet, sandbox-test, and install new skillsagents.skill_builder.run_skill_builder_cycle
Telegram InterfaceOwner CLI via Telegram botagents.telegram_interface.run_telegram_interface
Code MonitorLLM-as-Judge review gate for all code/draftsagents.code_monitor.run_code_monitor_review

🛡 Safety Systems

SystemPurpose
Code MonitorMulti-provider LLM judge (GLM 5.2, OpenRouter, local) reviews every draft/skill/mod
Spend Circuit Breaker3-tier alerts (50%/80%/100% of daily cap) with auto-cooldown
Injection DefenseSanitizes all inbound text (prompts, replies, scraped content)
Code SandboxIsolated subprocess execution (Python/Bash/JS) with resource limits
Skill DenylistStatic scan blocks eval/exec, shell=True, network calls, secrets access
Circuit BreakerAuto-cooldown on 429 errors, budget overrun, consecutive failures

🚀 Quick Start

Prerequisites

  • Python 3.11+
  • Ollama running locally with hardlife-hermes:q4_k_m model
  • Gmail account for the agent (separate from your personal)
  • Google Cloud project with Gmail API enabled

1. Clone & Setup

git clone https://github.com/Arnav-GLS/hard-life-agent.git
cd hard-life-agent
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
playwright install chromium

2. Configure Secrets

# Copy examples
cp secrets/gmail.env.example secrets/gmail.env
cp secrets/glm.env.example secrets/glm.env
# Fill in your credentials

secrets/gmail.env:

GMAIL_CLIENT_ID=your_client_id
GMAIL_CLIENT_SECRET=your_client_secret
GMAIL_AGENT_ADDRESS=agent@yourdomain.com

secrets/glm.env:

GLM_API_KEY=your_nvidia_api_key
OPENCODE_BINARY=opencode

3. Configure Niche & Budget

# Edit your ICP and outreach config
vim config/niche.yaml
vim config/budget.yaml
vim config/rate_limits.yaml

4. Bootstrap Gmail OAuth (one-time)

python tools/gmail_oauth_bootstrap.py
# Opens browser → sign in as THE AGENT'S GMAIL → authorize

5. Run

# Single decision cycle (testing)
python orchestrator/main_loop.py --once

# Run forever (production)
python orchestrator/main_loop.py

Docker (Alternative)

docker-compose up -d
# View dashboard at http://localhost:8080

📊 Dashboard

# Local FastAPI dashboard
python -m dashboard.app
# Or via docker-compose: http://localhost:8080

# Endpoints:
#   /healthz          — Liveness
#   /readyz           — Readiness (DB, ledger, etc.)
#   /livez            — Process alive
#   /api/status       — Generation, clock, ledger, tiers
#   /api/leads        — Lead pipeline
#   /api/messages     — Outreach + replies
#   /api/spend        — Spend breakdown
#   /api/events       — Audit trail
#   /api/economics    — Per-tool cost tracking

🧪 Testing

# All tests (71 passing)
pytest tests/ -v

# Specific areas
pytest tests/test_sender.py -v
pytest tests/test_clock.py -v
pytest tests/test_code_monitor.py -v

📁 Project Structure

hard-life-agent/
├── agents/                 # Sub-agents (research, drafter, sender, etc.)
├── agents/telegram_interface.py
├── dashboard/              # FastAPI dashboard
├── orchestrator/           # Main loop, scheduler, health, message bus
├── skills/                 # Base skills (memory, debugging, self-improvement, etc.)
├── storage/                # SQLite DB, Ledger (5/5/90 split)
├── survival/               # Clock (20-day), Tiers (4 levels), Constitution
├── tools/                  # CLI tools (Gmail OAuth, owner CLI, browser)
├── models/                 # LLM clients (Ollama, unified multi-provider)
├── survival/               # Clock, tiers, constitution
├── config/                 # YAML configs (niche, budget, rate_limits)
├── secrets/                # .env files (gitignored)
├── tests/                  # 71 tests (all passing)
├── Dockerfile
├── docker-compose.yml
└── requirements.txt

⚙️ Key Config Files

FilePurpose
config/niche.yamlICP, lead sources, outreach sequence, sender identity
config/budget.yamlDaily caps, spend alerts, 5/5/90 split
config/rate_limits.yamlGmail limits, survival deadline, sub-agent caps
config/notifications.yamlOwner email, digest cadence, critical alerts
config/telegram.yamlAuthorized user IDs for Telegram bot

🔐 Security Model

  • No code writes code — Orchestrator routes, skills execute, Code Monitor gates
  • Secrets never in skills — Skills get secrets_dir: Path, read .env at runtime
  • OAuth only — Gmail uses OAuth tokens; agent has its own Gmail account
  • Read-only browser — Lead Research only scrapes; no login, no mutations
  • Sandbox isolation — Skill dry-run: no network, no secrets, resource limits

📈 Monitoring

MetricWhere
Generation status/api/status, Telegram /status
Spend vs caps/api/spend, /api/economics
Lead pipeline/api/leads, /api/pipeline
Judge pool health/api/judges
Skill installs/api/skills
Survival tier/api/tiers

📚 Key Concepts

TermMeaning
GenerationOne 20-day lifecycle; dies if no revenue
Go-liveFirst successful outreach send → starts 20-day clock
HandoffDead gen writes gen-N-lessons.md; next gen imports it
Tier4 levels (Comfortable/Stable/Critical/Dead) based on spend/revenue
Code MonitorLLM judge that must approve every draft/skill/mod
SandboxIsolated code execution for self-verification

🤝 Contributing

This is an earn-or-die agent — contributions must:

  1. Pass Code Monitor review (auto on PR)
  2. Pass all 71 tests
  3. Pass mypy strict mode (production code only)
  4. Not increase silent exception handlers

📄 License

MIT — but the agent must earn its own keep.


Status: ✅ 71/71 tests passing | ✅ Production mypy clean | ✅ Docker ready | ✅ 0 silent exceptions | 🔄 Runtime verification in progress

Related

How to Install

  1. Download the dashboard markdown file from GitHub
  2. Drop it into your vault (anywhere)
  3. Install the Homepage plugin and point it at the file
  4. Enable any listed CSS snippets for the intended look

Stats

Stars

2

Forks

0

License

MIT

Last updated 7d ago

Categories