πŸ“„ staging-env-spec.md 5,907 bytes Apr 30, 2026 πŸ“‹ Raw

Staging Environment Specification

Overview

Icarus Family Assistant supports dual environments (staging vs prod) with environment-variable-driven configuration. This enables safe testing of the Brain Query Interface and future features with dummy data (Miller family) before touching real family data (Hoffmann family).

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    ENV Variable                              β”‚
β”‚              staging (default) β”‚ prod                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ config_env.py                                                β”‚
β”‚   DB_PATH         ~/.icarus/staging/staging.db               β”‚
β”‚                  ~/.icarus/data/prod.db                       β”‚
β”‚   CHROMA_DB_PATH  ~/.icarus/staging/chroma_db                β”‚
β”‚                  ~/.icarus/data/chroma_db                     β”‚
β”‚   FAMILY_CONFIG   ~/.family_assistant/family_staging.yaml    β”‚
β”‚                  ~/.family_assistant/family.yaml              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
│ Safety: _ensure_safe_paths() prevents staging→prod overlap  │
β”‚ Safety: staging_data.py exits if ENV!=staging               β”‚
β”‚ Safety: startup_verify.py checks path isolation              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Environment Variables

Variable Staging Default Prod Default Description
ENV staging prod Environment mode
DB_PATH ~/.icarus/staging/staging.db ~/.icarus/data/prod.db SQLite database
CHROMA_DB_PATH ~/.icarus/staging/chroma_db ~/.icarus/data/chroma_db Vector store
FAMILY_CONFIG_PATH ~/.family_assistant/family_staging.yaml ~/.family_assistant/family.yaml Family YAML
GROCERY_LISTS_DIR ~/.icarus/staging/grocery_lists ~/.icarus/data/grocery_lists Grocery lists
RECIPES_DIR ~/.icarus/staging/recipes ~/.icarus/data/recipes Recipes
INGRESS_SPOOL_DIR ~/.icarus/staging/ingress_spool ~/.icarus/data/ingress_spool Ingress
VISION_CACHE_DIR ~/.icarus/staging/vision_cache ~/.icarus/data/vision_cache Vision
SEED_STAGING 0 N/A Set to 1 to auto-seed on startup

Safety Rules

  1. Default to staging β€” If ENV not set, defaults to staging
  2. Path isolation β€” _ensure_safe_paths() raises RuntimeError if staging paths overlap with prod
  3. No auto-seed in prod β€” staging_data.py exits immediately if ENV != staging
  4. Startup verification β€” startup_verify.py logs ENV and validates config before pipeline start
  5. Explicit opt-in β€” SEED_STAGING=1 required to auto-seed on startup

Quick Start

Staging

export ENV=staging
cd ~/hoffdesk-agents/services/family_assistant

# Seed with Miller family test data (first time only)
python -m family_assistant.staging_data

# Run queries
ENV=staging python -c "
from family_assistant.family_brain import answer
result = answer('Is Friday a half-day?')
print(result['answer'])
"

Production

export ENV=prod
cd ~/hoffdesk-agents/services/family_assistant

# Start pipeline (uses existing Hoffmann data)
python -m family_assistant.pipeline

Test Data (Miller Family)

Member Role Details
John Miller Father IT at local software company
Sarah Miller Mother 3rd grade teacher, Lincoln Elementary
Leo Miller Son Age 9, soccer + chess club
Mia Miller Daughter Age 6, ballet + swim lessons
Buster Dog Golden Retriever, 4 years

Test Queries

Query Expected Answer Source
"Is Friday a half-day?" "No β€” full day per March 14 newsletter" Newsletter
"When is spring break?" "March 24-28, 2026" Newsletter
"What time is Leo's soccer practice?" "Tuesdays and Thursdays at 4:30 PM" Soccer email
"When was Buster's last vet visit?" "February 20, 2026" Receipt #4582

Files Modified/Created

Created

  • config_env.py β€” Environment-aware config with path isolation
  • staging_data.py β€” Miller family seeder (staging-only)
  • startup_verify.py β€” Pre-flight safety checks
  • icarus.service β€” Systemd service template
  • tests/test_env.sh β€” Environment isolation test
  • STAGING_ENV.md β€” User-facing docs
  • ~/.family_assistant/family_staging.yaml β€” Miller family YAML
  • ~/.family_assistant/.env.staging β€” Staging env template
  • ~/.family_assistant/.env.prod β€” Production env template

Modified

  • config.py β€” Added ENV awareness to family config resolution
  • family_brain.py β€” ChromaDB path now comes from config_env.py

Verification Results

βœ“ ENV=staging β†’ staging paths
βœ“ ENV=prod β†’ prod paths
βœ“ Staging DB != Prod DB
βœ“ Staging ChromaDB != Prod ChromaDB
βœ“ Staging paths isolated from production
βœ“ Staging DB_PATH points to prod β†’ RuntimeError raised
βœ“ ENV=prod + staging_data β†’ exits with error
βœ“ Miller family config loads correctly
βœ“ ChromaDB seeded with 4 test documents
βœ“ Query "Is Friday a half-day?" β†’ top result: March Newsletter (0.612)
βœ“ Prod ChromaDB untouched (1.7MB, last modified Apr 28)