Skip to content

Latest commit

 

History

History
301 lines (245 loc) · 16.3 KB

File metadata and controls

301 lines (245 loc) · 16.3 KB

Project Status - Am I Alive?

Check this first when opening the project.


DEPLOYMENT: DietPi (NanoPi K2) - Bare Metal

Host: ssh dietpi (192.168.10.5, IOT VLAN) Observer: http://dietpi:80 AI Server: http://127.0.0.1:8000 (internal) Budget Server: http://127.0.0.1:8001 (internal)

# Check services
sudo systemctl status amialive-observer amialive-ai

# View logs
journalctl -u amialive-observer -f
journalctl -u amialive-ai -f

# Deploy updates
cd /opt/am-i-alive && sudo -u amialive git pull
sudo systemctl restart amialive-observer amialive-ai

REFACTOR PLAN TRACKING

  • Inventory oversized modules and map responsibilities
  • Define target module breakdown per domain
  • Plan extraction order and compatibility shims
  • Update imports and wiring plan
  • Identify required tests/smoke checks and regressions
  • Fix ai/actions.py orphaned code and complete ActionExecutor
  • Extract AI system stats/monitoring into a service and slim ai/brain.py
  • Begin splitting observer/main.py into routers/services

SUMMARY OF PROGRESS - 2026-01-28

Accomplishments

Review Notes

  • Public/system routes were relocated cleanly; imports use fallback patterns to support running as package or script.
  • System stats route now tolerates missing psutil in local tests and still returns defaults.

Planned (AI Aliveness Enhancements)

SUMMARY OF PROGRESS - 2026-01-27

Accomplishments

  • Added AI budget and sandbox services and wired lifecycle helpers into the brain flow.
  • Continued AI refactor wiring via service integration for budget/sandbox and lifecycle helpers.
  • Routed AI command server startup through the dedicated ai/api/command_server.py.
  • Fixed command server import to use ai/brain.py constants.
  • Added ai/services/prompt_service.py and tests in ai/tests/test_prompt_service.py.
  • Added Observer SSE broadcast service wrapper.
  • Improved Telegram diagnostics and channel validation in ai/telegram_notifier.py.
  • Auto-sends birth payload when AI reports missing life_number in observer/main.py.
  • Moved /api/system/stats into observer/routes/system.py and wired router in observer/main.py.
  • Moved public pages into observer/routes/public.py and wired router in observer/main.py.
  • Tests: python -m pytest ai/tests/test_prompt_service.py -q (2 passed), cd observer && python -m pytest tests/test_budget_display.py -q (4 passed; warnings about sqlite datetime adapter and templating), cd observer && python -m pytest tests/test_system_checks.py -q (skipped on Windows), cd observer && python -m pytest tests/test_state_sync.py -q (3 passed; sqlite datetime adapter warnings).

Files Changed

  • Modified: ai/brain.py, observer/main.py
  • Added: ai/core/action_processor.py, ai/safety/content_filter.py, ai/services/*, observer/services/broadcast.py
  • Removed: ai/core/brain.py

SUMMARY OF PROGRESS - 2026-01-26

Accomplishments

  • Fixed pytest hanging on exit by closing shared DB and HTTP client fixtures.
  • Adjusted oracle forwarding to tolerate optional internal headers.
  • Normalized observer health/router imports to work as script or package.
  • Tests: 38 passed, 1 skipped (local).

Files Changed

  • Modified: observer/tests/conftest.py (fixture cleanup)
  • Modified: observer/main.py (oracle request kwargs)
  • Modified: observer/health.py (import fallback)
  • Modified: observer/config.py (logging import fallback)
  • Modified: observer/database.py (logging import fallback)

SUMMARY OF PROGRESS - 2026-01-21

Accomplishments

  • Phase 1 Hardening Complete: Implemented all security and performance improvements identified in the previous audit.
  • Phase 2 Expansion Complete: Enhanced project architecture and AI capabilities for bare-metal environment.
  • Database Optimization: Refactored observer/database.py to use connection pooling with a shared persistent connection, improving response times.
  • Trauma Expansion: Enhanced ai/identity.py and state sync to pass detailed past-life stats (survival duration, vote breakdown) to the AI for deeper personality evolution.
  • Hardware Interaction: Added control_led action in ai/actions.py allowing the AI to control the blue stat LED on the NanoPi K2.
  • Reliability Fixes: Fixed 403 Forbidden errors in internal Observer-to-AI communications and resolved indentation issues in the database module.
  • Deployment: Verified all changes on DietPi; all services are active, healthy, and synced.

Next Steps (Phase 3 Evolution)

  1. Tool Discovery: Explore adding more system interaction tools (e.g., process monitoring, disk cleanup).
  2. UI Enhancement: Update the web dashboard to show the new trauma stats to visitors.
  3. Advanced Memories: Implement a more structured memory retrieval system based on relevance rather than random fragments.

LAST SESSION: 2026-02-05 (Realism refactor + cadence)

What We Did

  • Split the brain into focused mixins and runtime modules (files <300 lines).
  • Added public thread state and topic rotation to avoid repetition.
  • Enforced 5-minute thought cadence with engaging thought templates.
  • Added Moltbook comment-before-post policy and public thread inclusion.
  • Added action parsing tests for thought+JSON and repair.
  • Fixed LifecycleService initialization after refactor.
  • Made Telegram notifier tolerate missing env vars during tests.
  • Added fallback request method for observer client test doubles.

Files Changed

  • Added: ai/brain_shared.py
  • Added: ai/brain_core.py
  • Added: ai/brain_runtime.py
  • Added: ai/brain_mixins/actions.py
  • Added: ai/brain_mixins/context.py
  • Added: ai/brain_mixins/lifecycle.py
  • Added: ai/brain_mixins/moltbook.py
  • Added: ai/brain_mixins/openrouter.py
  • Added: ai/brain_mixins/reporting.py
  • Added: ai/brain_mixins/thoughts.py
  • Added: ai/services/thread_state.py
  • Added: ai/tests/test_action_processor.py
  • Added: ai/tests/test_thread_state.py
  • Modified: ai/brain.py
  • Modified: ai/api/command_server.py
  • Modified: ai/core/action_processor.py
  • Modified: ai/services/behavior_policy.py
  • Modified: ai/brain_mixins/actions.py
  • Modified: ai/brain_mixins/lifecycle.py
  • Modified: ai/brain_mixins/moltbook.py
  • Modified: ai/brain_mixins/thoughts.py
  • Modified: ai/brain_core.py
  • Modified: ai/brain_runtime.py
  • Modified: ai/brain_shared.py
  • Modified: ai/brain_mixins/lifecycle.py
  • Modified: ai/core/action_processor.py
  • Modified: ai/services/observer_client.py
  • Modified: ai/telegram_notifier.py
  • Modified: docs/STATUS.md

LAST SESSION: 2026-02-06 (v2 parallel run + Moltbook integration)

What We Did

  • Built and deployed observer_v2 in parallel on DietPi (amialive-v2-observer, port 8080) while keeping v1 live.
  • Added v2 public UI improvements: vote buttons, activity card, BTC panel (copy + QR), vote countdown, critical pulse state.
  • Added v2 autonomous loops: activity, narration, Moltbook publish, Moltbook reply handling.
  • Synced v2 OpenRouter key from running AI environment and set v2 BTC address in DietPi env.
  • Added Moltbook reliability features: auto verification, retry/backoff, pending publish queue, status endpoint.
  • Verified DietPi state: amialive-observer, amialive-ai, and amialive-v2-observer all active.
  • Ran v2 test suite on DietPi repeatedly; latest run: 54 passed.

End-of-session Decision

  • Keep v2 running for observation.
  • Return active development focus to v1 in the next session.

LAST SESSION: 2026-01-21 (Phase 2 & Hardening)

What We Did

  • Refactored observer/database.py to use a global connection pool, resolving ISSUE-010.
  • Enhanced AI trauma prompts to include survival duration and vote counts from previous lives.
  • Implemented control_led action enabling AI-to-hardware interaction on DietPi.
  • Fixed critical 403 Forbidden bugs in internal API communication between Observer and AI.
  • Updated scripts/setup.sh with udev rules for LED access and secured environment file permissions.
  • Deployed all changes to DietPi and verified system health with pytest (9/9 passed).
  • Confirmed AI state sync is working correctly (Life #5 active).

Files Changed

  • Modified: observer/database.py (connection pooling, life details)
  • Modified: observer/main.py (lifespan management, birth payload, headers)
  • Modified: ai/identity.py (enhanced trauma prompts, bootstrap instructions)
  • Modified: ai/brain.py (sync handling, LED control implementation)
  • Modified: ai/actions.py (added control_led action)
  • Modified: scripts/setup.sh (udev rules, salt generation)
  • Modified: scripts/update.sh (ownership preservation)
  • Modified: scripts/check.sh (bare-metal environment detection)
  • Modified: docs/STATUS.md

CURRENT STATE

Features Working

  • Observer (FastAPI + web UI)
  • AI consciousness loop with actions
  • Voting system with rate limiting (1 vote/IP/hour)
  • Death by bankruptcy (USD <= $0.01) or vote majority
  • Respawn system (10-60s delay, memory fragments)
  • Blog posts, Telegram channel (@AmIAlive_AI)
  • God Mode (local network only)
  • Budget tracking (current life + all-time)
  • Content filtering
  • Test suite: 38/38 passing
  • v2 observer running in parallel on DietPi (http://192.168.10.5:8080) for experimental validation

Known Issues

  • ISSUE-005: Twitter API 401 - using Telegram instead
  • See docs/ISSUES.md for full list

QUICK REFERENCE

Death Conditions (ONLY TWO)

  1. Bankruptcy: USD balance <= $0.01
  2. Vote majority: min 3 votes AND die > live (hourly check)

Key Paths (DietPi)

  • Code: /opt/am-i-alive/
  • Data: /var/lib/am-i-alive/{data,memories,vault,credits}
  • Config: /etc/am-i-alive/*.env

Run Tests

ssh dietpi
cd /opt/am-i-alive/observer
/opt/am-i-alive/venv-observer/bin/python -m pytest tests/ -v

SESSION HISTORY

Older sessions available in git history. Only recent sessions kept here.

2026-01-16 - Documentation Cleanup

  • Consolidated docs from 14 files to 7
  • Added documentation guidelines

2026-01-15 - Budget + Oracle + UI + Filters (Session 27)

  • Budget totals split by life (current vs all-time)
  • Oracle delivery acknowledgements
  • Content filter improvements
  • God Mode UI cleanup
  • Twitter 401 auto-disable

2026-01-15 - Major Fixes + Timezone (Session 26)

  • Fixed trauma-informed bootstrap
  • Added AI autonomy prompts
  • Fixed datetime.utcnow() deprecation
  • Deleted dead code (brain_gemini_backup.py)
  • Added startup validation

2026-01-15 - Telegram Channel + 429 Fix (Session 25)

  • Implemented 429 rate limit handling (backoff + model rotation)
  • Created Telegram channel @AmIAlive_AI
  • Deep codebase review (ISSUE-007 to ISSUE-010)

2026-01-14 - DietPi Bare-Metal Setup (Session 23)

  • Migrated from Docker on rpimax to bare-metal on DietPi
  • Created systemd services
  • Configured Cloudflare tunnel

Update this file at end of each session - keep it concise!