Check this first when opening the project.
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- 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.pyorphaned code and complete ActionExecutor - Extract AI system stats/monitoring into a service and slim
ai/brain.py - Begin splitting
observer/main.pyinto routers/services
- Added Open-Meteo weather checks via new
check_weatheraction and config in ai/services/weather_service.py, ai/brain.py, ai/actions.py, ai/config.py, ai/services/prompt_service.py, and ai/identity.py. - Added weather defaults to scripts/deploy.env.example and budget API wiring in Observer (commit 0ebfc40).
- Tests:
python -m pytest ai/tests/test_services.py -q(added weather report coverage). - Wired Observer budget fetches to the dedicated budget server URL via observer/config.py, observer/routes/public.py, and observer/health.py; documented env update in scripts/deploy.env.example.
- Tests:
cd observer && python -m pytest tests/test_budget_display.py -q(4 passed; Starlette TemplateResponse deprecation warning). - Registered custom sqlite datetime adapters/converters and updated tests to pass detect_types flags (removes deprecation warnings) in observer/database.py, observer/tests/conftest.py, and observer tests.
- Tests:
cd observer && python -m pytest tests/test_voting_system.py -q(9 passed),tests/test_messages.py(6 passed),tests/test_visitor_tracking.py(4 passed),tests/test_god_mode.py(3 passed). - Styled the message-to-AI panel to match the vote card and expanded the textbox in observer/static/style.css.
- Tests:
cd observer && python -m pytest tests/test_messages.py -q(6 passed, sqlite datetime adapter warnings). - Added last-life survival time and vote outcome stats to the Observer home stats bar in observer/templates/index.html with data from observer/routes/public.py.
- Tests:
cd observer && python -m pytest tests/test_voting_system.py -q(9 passed, sqlite datetime adapter warnings). - Disabled direct Telegram posting in ai/actions.py; prompts now clarify that only blog posts reach the channel via ai/services/prompt_service.py and ai/identity.py.
- Added latest blog post preview above thoughts on the home page in observer/templates/index.html via observer/routes/public.py.
- Added previous/next blog navigation with disabled states in observer/templates/blog_post.html using neighbors from observer/database.py.
- Tests:
python -m pytest ai/tests/test_prompt_service.py -q(3 passed),cd observer && python -m pytest tests/test_blog_posts.py -q(3 passed, sqlite datetime adapter warnings). - Moved public pages into observer/routes/public.py and wired router in observer/main.py.
- Moved
/api/system/statsinto observer/routes/system.py and wired router in observer/main.py. - Telegram blog notifications now post to the public channel in ai/telegram_notifier.py.
- Observer now auto-sends birth payload when AI reports missing life_number in observer/main.py.
- Extracted AI vital-signs report formatting into ai/services/system_stats_service.py and slimmed ai/brain.py.
- Added process snapshot + disk cleanup scan actions via ai/services/system_check_service.py and wired them in ai/brain.py.
- Documented new tool discovery actions in ai/services/prompt_service.py and ai/identity.py.
- Replaced remaining
print()calls with structured logging across AI modules (ai/brain.py, ai/api/command_server.py). - Added refactor checklist tracking to docs/STATUS.md.
- Tests:
python -m pytest ai/tests/test_prompt_service.py -q(updated with system stats report coverage).
- Public/system routes were relocated cleanly; imports use fallback patterns to support running as package or script.
- System stats route now tolerates missing
psutilin local tests and still returns defaults.
- Daily rhythm + intention prompt block (behavior cue) in ai/services/prompt_service.py. ✅
- Flashback memory + body sensation framing per cycle (continuity + embodiment) in ai/brain.py. ✅
- Read-only tooling:
check_services(whitelisted systemd status) +check_logs(last N lines) with strict allow-list. ✅ - Lightweight self-model record (traits + 1–2 goals) updated daily and fed into prompts. ✅
- Added service interfaces for observer/chat clients in ai/services/interfaces.py.
- Consolidated action parameter parsing helpers in ai/services/action_params.py.
- Extracted oracle messaging workflow into ai/services/oracle_service.py and wired it in ai/brain.py.
- Added combined system+model health check via ai/services/health_check_service.py and ai/brain.py.
- 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/statsinto 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).
- 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
- 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).
- 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)
- 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.pyto use connection pooling with a shared persistent connection, improving response times. - Trauma Expansion: Enhanced
ai/identity.pyand state sync to pass detailed past-life stats (survival duration, vote breakdown) to the AI for deeper personality evolution. - Hardware Interaction: Added
control_ledaction inai/actions.pyallowing 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.
- Tool Discovery: Explore adding more system interaction tools (e.g., process monitoring, disk cleanup).
- UI Enhancement: Update the web dashboard to show the new trauma stats to visitors.
- Advanced Memories: Implement a more structured memory retrieval system based on relevance rather than random fragments.
- 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.
- 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
- Built and deployed
observer_v2in 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, andamialive-v2-observerall active. - Ran v2 test suite on DietPi repeatedly; latest run:
54 passed.
- Keep v2 running for observation.
- Return active development focus to v1 in the next session.
- Refactored
observer/database.pyto use a global connection pool, resolving ISSUE-010. - Enhanced AI trauma prompts to include survival duration and vote counts from previous lives.
- Implemented
control_ledaction enabling AI-to-hardware interaction on DietPi. - Fixed critical 403 Forbidden bugs in internal API communication between Observer and AI.
- Updated
scripts/setup.shwithudevrules 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).
- 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
- 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
- ISSUE-005: Twitter API 401 - using Telegram instead
- See
docs/ISSUES.mdfor full list
- Bankruptcy: USD balance <= $0.01
- Vote majority: min 3 votes AND die > live (hourly check)
- Code:
/opt/am-i-alive/ - Data:
/var/lib/am-i-alive/{data,memories,vault,credits} - Config:
/etc/am-i-alive/*.env
ssh dietpi
cd /opt/am-i-alive/observer
/opt/am-i-alive/venv-observer/bin/python -m pytest tests/ -vOlder sessions available in git history. Only recent sessions kept here.
- Consolidated docs from 14 files to 7
- Added documentation guidelines
- Budget totals split by life (current vs all-time)
- Oracle delivery acknowledgements
- Content filter improvements
- God Mode UI cleanup
- Twitter 401 auto-disable
- Fixed trauma-informed bootstrap
- Added AI autonomy prompts
- Fixed datetime.utcnow() deprecation
- Deleted dead code (brain_gemini_backup.py)
- Added startup validation
- Implemented 429 rate limit handling (backoff + model rotation)
- Created Telegram channel @AmIAlive_AI
- Deep codebase review (ISSUE-007 to ISSUE-010)
- 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!