Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
6405fa9
feat: rebrand UI navigation and titles for home management (#1)
mabry1985 Mar 15, 2026
bbf2df7
feat: add household budget tracking backend service and API (#2)
mabry1985 Mar 15, 2026
0d79e6b
feat: adapt agent prompt system for home management context (#4)
mabry1985 Mar 15, 2026
5a8a022
refactor: Shared SQLite database for home modules (#6)
mabry1985 Mar 15, 2026
74f2d11
feat: enable typescript strict mode and fix all type errors (#7)
mabry1985 Mar 15, 2026
4e6c35e
feat: add home inventory asset tracking backend service and API (#8)
mabry1985 Mar 15, 2026
8da88f8
feat: build household inventory UI for browsing, searching, and manag…
mabry1985 Mar 15, 2026
5941ab4
feat: add maintenance scheduling UI for viewing and completing recurr…
mabry1985 Mar 15, 2026
b92bca8
feat: add daily maintenance scheduler tick and calendar event generat…
mabry1985 Mar 15, 2026
b32b211
feat: implement core gamification engine with XP, levels, achievement…
mabry1985 Mar 15, 2026
b5a5387
feat: add maintenance scheduling backend service (#15)
mabry1985 Mar 15, 2026
2634327
Achievement definitions and check engine (#16)
mabry1985 Mar 15, 2026
38eea03
feat: implement Home Health Score computation with 4-pillar algorithm…
mabry1985 Mar 15, 2026
734820e
feat: implement gamification UI layer with profile page, dashboard wi…
mabry1985 Mar 15, 2026
3048101
feat: wire gamification XP awards and achievement checks into service…
mabry1985 Mar 15, 2026
7c8d693
feat: add gamification celebration animations and toasts (#20)
mabry1985 Mar 15, 2026
d004f50
feat: add sensor dashboard view with real-time updates (#21)
mabry1985 Mar 15, 2026
6bd33d9
Rate limiting and security middleware (#23)
mabry1985 Mar 15, 2026
2d0febf
feat: build household budget UI with month navigation, summary cards,…
mabry1985 Mar 15, 2026
2997712
refactor: Update docs, README, and CLAUDE.md for full product vision …
mabry1985 Mar 15, 2026
c4f1428
feat: add encrypted vault service and API routes (#26)
mabry1985 Mar 15, 2026
873426c
feat: add vendor/contractor directory service and API (#27)
mabry1985 Mar 15, 2026
e443a67
feat: add secrets vault UI with eye-toggle reveal and secure clipboar…
mabry1985 Mar 15, 2026
d2db946
feat: add time-series persistence to sensor registry (#31)
mabry1985 Mar 15, 2026
05f105a
feat: build vendor/contractor directory UI (#32)
mabry1985 Mar 15, 2026
368c352
feat: register Ava tools for inventory, vendors, and maintenance modu…
mabry1985 Mar 15, 2026
48711ed
feat: add Storybook stories for all homeMaker UI components (#34)
mabry1985 Mar 15, 2026
d149d9c
feat: add Ava quest generation engine with lifecycle management (#35)
mabry1985 Mar 15, 2026
097926e
feat: replace inherited protoMaker docs with clean homeMaker Diataxis…
mabry1985 Mar 15, 2026
81a7847
feat: add household chat channel with Ava AI integration (#38)
mabry1985 Mar 15, 2026
187463b
feat: integrate OpenWeatherMap free tier for weather context (#40)
mabry1985 Mar 15, 2026
46d620b
IoT command push endpoint (#41)
mabry1985 Mar 15, 2026
2702118
Home Assistant sensor bridge (#42)
mabry1985 Mar 15, 2026
5ed1286
feat: spike - replace Electron with Tauri v2 desktop app shell (#44)
mabry1985 Mar 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
76 changes: 40 additions & 36 deletions .automaker/context/CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,61 @@
# homeMaker Agent Context
# homeMaker Agent Context

## What This Is
## What Exists

A domestic home management hub built on the protoMaker platform. The AI agent pipeline, board, and auto-mode are CORE FEATURES — they help manage home projects, research purchases, plan renovations, and track maintenance schedules.
All modules currently implemented in homeMaker:

## What Agents Do Here
- **Board** — Kanban task tracking for house projects (backlog -> done)
- **Calendar** — CRUD event management for household schedules
- **Sensors** — IoT device registry, real-time readings, history persistence, HA integration
- **Budget** — Income/expense tracking, categories, monthly summaries
- **Vault** — AES-256-GCM encrypted secrets storage
- **Inventory** — Home asset tracking, warranties, valuations, sensor linking
- **Maintenance** — Recurring obligation scheduling, completion history, vendor linking
- **Vendors** — Service provider directory, trade categories, ratings
- **Gamification** — Home Health Score (0-100), XP/levels, 30 achievements, AI quests, streaks

Unlike protoMaker (where agents write code), homeMaker agents primarily:
- **Research**: Compare products, find contractors, look up how-to guides, estimate costs
- **Plan**: Break down renovations into phases with dependencies, create timelines
- **Track**: Manage recurring maintenance (HVAC filters, gutter cleaning, lawn care)
- **Organize**: Summarize findings into actionable recommendations
- **Code** (when needed): Build new UI views, add backend services, fix bugs — same as protoMaker
## Gamification Awareness

Default to research-and-report mode. Only write code when the task explicitly requires implementation.
Your implementation work earns XP for the homemaker and can trigger achievements. The gamification system tracks:

## What Exists (reuse these)
- **XP sources**: completing maintenance tasks, adding inventory items, logging budget entries, unlocking vault items, keeping sensors online
- **Achievements**: first maintenance completed, inventory milestones, budget streaks, sensor uptime awards
- **Home Health Score**: calculated across 4 pillars — Maintenance (30%), Sensors (25%), Budget (25%), Inventory (20%)

- **Board/Kanban** — tracks house projects as tasks with status, priority, dependencies
- **Auto-mode** — agents pick up tasks from the board and execute them autonomously
- **Sensor Registry** (`apps/server/src/services/sensor-registry-service.ts`) — IoT device data collection
- **Context Aggregator** (`apps/server/src/services/context-aggregator.ts`) — presence detection from sensors
- **Calendar view** (`apps/ui/src/components/views/calendar-view/`) — home schedule events
- **Todo** (`apps/ui/src/components/views/todo-view/`) — task lists
- **Notes** (`apps/ui/src/components/views/notes-view/`) — household notes
- **Chat (Ava)** — conversational AI assistant for the household
- **Event system** (`apps/server/src/lib/events.ts`) — real-time WebSocket push
When you add or modify features that interact with these modules, call `gamificationService.awardXp()` for relevant user actions. Do NOT write XP directly to the database.

## Tech Stack
## Shared Database Pattern

- **Frontend**: React 19, Vite 7, TanStack Router, Zustand 5, Tailwind CSS 4, Radix UI
- **Backend**: Express 5, SQLite, WebSocket, Claude Agent SDK
- **Shared libs**: `@protolabsai/types`, `@protolabsai/utils`, `@protolabsai/ui`, `@protolabsai/prompts`
All services share a single SQLite database (`homemaker.db`) with WAL mode and foreign keys enabled. Services receive the `Database` instance via constructor injection from `ServiceContainer`.

```typescript
// Pattern for service constructors
constructor(private db: Database) {
this.db.exec(`CREATE TABLE IF NOT EXISTS my_table (...)`);
}
```

Do NOT create standalone SQLite files per service. Always use the shared DB from `ServiceContainer`.

## Adding New Backend Modules

Follow the sensor registry pattern:
Follow the sensor registry pattern, using the shared DB:

1. Define types in `libs/types/src/`
2. Create service in `apps/server/src/services/`
2. Create service in `apps/server/src/services/` — accept `Database` via constructor
3. Create routes in `apps/server/src/routes/<module>/`
4. Wire into `apps/server/src/server/routes.ts`
5. Add to `ServiceContainer` in `apps/server/src/server/services.ts`

## Adding New UI Views

1. Create view in `apps/ui/src/components/views/<module>-view/`
2. Add route file `apps/ui/src/routes/<module>.tsx`
3. Add nav item in `apps/ui/src/components/layout/sidebar/hooks/use-navigation.ts`
After creating the view component and route file, add to sidebar navigation (`apps/ui/src/components/layout/sidebar/hooks/use-navigation.ts`). Current nav items include:
board, calendar, sensors, inventory, vendors, maintenance, budget, vault, profile

## Security Rules
## Key Invariants

- Secrets are encrypted AES-256-GCM at rest (never store plaintext)
- Use the existing `apps/server/src/lib/auth.ts` for API key validation
- Rate limit all write endpoints
- Never log secret values, only IDs and metadata
- Tailscale handles network-level auth — no login UI needed
- Gamification: all XP awards go through `gamificationService.awardXp()` — never direct DB writes
- Inventory: amounts in cents (integer), never floating point dollars
- Maintenance: `intervalDays` is always a positive integer, `nextDueAt` auto-calculated
- Vendors: phone numbers stored as strings (preserve formatting)
- Home Health Score: always recalculate after data mutations, never cache stale scores
30 changes: 30 additions & 0 deletions .automaker/context/coding-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,33 @@
- External IoT devices POST to `POST /api/sensors/report` with their registered ID
- Register on startup via `POST /api/sensors/register`
- Use WebSocket events (`sensor:data-received`) for real-time UI updates

## Module-Specific Rules

### Gamification

- All XP awards MUST go through `gamificationService.awardXp()` — never write XP directly to the database
- Always emit `gamification:xp-gained` and `gamification:achievement-unlocked` events via the service
- Home Health Score must be recalculated after any data mutation in Inventory, Maintenance, Sensors, or Budget modules

### Inventory

- Monetary amounts (purchase price, current value) stored as integers in cents — never floating point dollars
- Always link sensor IDs by reference; do not embed sensor data in inventory records

### Maintenance

- `intervalDays` must always be a positive integer (>0)
- `nextDueAt` is auto-calculated from `lastCompletedAt + intervalDays` — never store user-supplied values directly
- Link to vendors by ID only; do not embed vendor data in maintenance records

### Vendors

- Phone numbers stored as strings to preserve formatting (e.g., "(555) 123-4567")
- Trade categories use a fixed enum — do not allow free-form category creation

### Shared Database

- All services use the shared `homemaker.db` from `ServiceContainer` — do NOT create standalone SQLite files
- Use WAL mode pragma in service initialization: `db.exec('PRAGMA journal_mode=WAL')`
- Enable foreign keys: `db.exec('PRAGMA foreign_keys=ON')`
93 changes: 74 additions & 19 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ The AI agent pipeline (board, auto-mode, Claude Agent SDK, worktrees) is **core
## Brand Identity

- **homeMaker** = the product name (always camelCase)
- **@protolabsai/*** = internal package names (preserved from protoLabs Studio lineage, do NOT rename)
- **@protolabsai/\*** = internal package names (preserved from protoLabs Studio lineage, do NOT rename)
- **.automaker/** = internal directory for board data, context files, features (preserved, do NOT rename)

## Git Workflow

Feature branches PR to `main`. Keep it simple — no staging/promotion pipeline needed for a home app.

**Rules:**

- Never push directly to `main`. Always use a PR.
- Before committing, run `git status` and verify only intended files are staged.
- `.automaker/memory/` files are updated by agents. Include memory changes in commits alongside related code changes.
Expand Down Expand Up @@ -80,6 +81,10 @@ homeMaker/
└── ...
```

### Shared Database

All server services share a single `homemaker.db` (SQLite, WAL mode, foreign keys enabled). Services receive the DB connection via constructor injection from `ServiceContainer`.

### Key Technologies

- **Frontend**: React 19, Vite 7, TanStack Router, Zustand 5, Tailwind CSS 4
Expand All @@ -90,8 +95,8 @@ homeMaker/

The server (`apps/server/src/`) follows a modular pattern:

- `routes/` - Express route handlers organized by domain (sensors, budget, vault, calendar, etc.)
- `services/` - Business logic (SensorRegistryService, BudgetService, VaultService, AgentService, AutoModeService, etc.)
- `routes/` - Express route handlers organized by domain (sensors, budget, vault, calendar, inventory, maintenance, vendors, gamification, etc.)
- `services/` - Business logic (SensorRegistryService, BudgetService, VaultService, InventoryService, MaintenanceService, VendorService, GamificationService, QuestGeneratorService, WeatherService, AgentService, AutoModeService, etc.)
- `providers/` - AI provider abstraction (Claude via Agent SDK)
- `lib/` - Utilities (events, auth, crypto)
- `server/` - Bootstrap modules (middleware, services, wiring, routes, startup, shutdown)
Expand All @@ -101,7 +106,7 @@ The server (`apps/server/src/`) follows a modular pattern:
The UI (`apps/ui/src/`) uses:

- `routes/` - TanStack Router file-based routing
- `components/views/` - Main view components (board, calendar, sensors, budget, vault, etc.)
- `components/views/` - Main view components (board, calendar, sensors, budget, vault, inventory, maintenance, vendors, profile, etc.)
- `store/` - Zustand stores with persistence
- `hooks/` - Custom React hooks
- `lib/` - Utilities and API client
Expand All @@ -128,12 +133,45 @@ The UI (`apps/ui/src/`) uses:

The Kanban board from protoLabs Studio, repurposed for tracking house projects. Tasks flow through: backlog -> in_progress -> review -> done (with blocked as an escape state).

### Inventory

`apps/server/src/services/inventory-service.ts` — Tracks home assets, warranties, and valuations with sensor linking. Monetary amounts stored as integers in cents.

- Types: `InventoryItem` in `libs/types/src/inventory.ts`
- Routes: `apps/server/src/routes/inventory/`
- Events: `inventory:item-created`, `inventory:item-updated`

### Maintenance

`apps/server/src/services/maintenance-service.ts` — Recurring obligations with auto-calculated due dates, completion history, and vendor linking. `nextDueAt` computed from `lastCompletedAt + intervalDays`.

- Types: `MaintenanceTask` in `libs/types/src/maintenance.ts`
- Routes: `apps/server/src/routes/maintenance/`
- Events: `maintenance:task-completed`, `maintenance:task-overdue`

### Vendors

`apps/server/src/services/vendor-service.ts` — Service provider directory with trade categories, ratings, and linked assets. Phone numbers stored as strings to preserve formatting.

- Types: `Vendor` in `libs/types/src/vendor.ts`
- Routes: `apps/server/src/routes/vendors/`

### Gamification

`apps/server/src/services/gamification-service.ts` — Home Health Score (0--100), XP/levels (10 tiers), 30 achievements across 6 categories, AI quests, and streaks.

- Types: `GamificationProfile`, `Achievement`, `Quest` in `libs/types/src/gamification.ts`
- Routes: `apps/server/src/routes/gamification/`
- Quest generation: `apps/server/src/services/quest-generator-service.ts`
- Events: see "Gamification Events" below

## Import Conventions

Always import from shared packages:

```typescript
import type { Feature, SensorConfig } from '@protolabsai/types';
import type { GamificationProfile, Achievement, Quest } from '@protolabsai/types';
import { createLogger } from '@protolabsai/utils';
import { getFeatureDir } from '@protolabsai/platform';
```
Expand All @@ -143,6 +181,7 @@ import { getFeatureDir } from '@protolabsai/platform';
### Adding a New Backend Module

Follow the sensor registry pattern:

1. Define types in `libs/types/src/`
2. Create service in `apps/server/src/services/`
3. Create routes in `apps/server/src/routes/<module>/`
Expand All @@ -159,6 +198,17 @@ Follow the sensor registry pattern:

All server operations emit events that stream to the frontend via WebSocket. Events are created using `createEventEmitter()` from `lib/events.ts`.

#### Gamification Events

```
gamification:xp-gained — XP awarded (source, amount, total)
gamification:achievement-unlocked — Achievement unlocked (achievement definition)
gamification:level-up — Level milestone crossed (new level, tier)
gamification:health-score-updated — Home Health Score recalculated (score, pillars)
gamification:quest-generated — New AI quest available
gamification:streak-updated — Streak count changed
```

### Feature Status System

5-status system for all board tasks:
Expand All @@ -175,31 +225,36 @@ Project-specific rules are stored in `.automaker/context/` and automatically loa

### Model Hierarchy for Auto-Mode

| Model | Use Case | Triggered By |
| ---------- | ------------------------------- | ----------------------------------- |
| **Opus** | Complex research, architecture | `complexity: 'architectural'` |
| **Sonnet** | Standard tasks (default) | `complexity: 'medium'` or `'large'` |
| **Haiku** | Quick lookups, simple tasks | `complexity: 'small'` |
| Model | Use Case | Triggered By |
| ---------- | ------------------------------ | ----------------------------------- |
| **Opus** | Complex research, architecture | `complexity: 'architectural'` |
| **Sonnet** | Standard tasks (default) | `complexity: 'medium'` or `'large'` |
| **Haiku** | Quick lookups, simple tasks | `complexity: 'small'` |

### Feature Flags

Single source of truth: `DEFAULT_FEATURE_FLAGS` in `libs/types/src/global-settings.ts`. When adding a new flag:

1. Add to `FeatureFlags` interface and set default to `false` in `DEFAULT_FEATURE_FLAGS`
2. Add label in `developer-section.tsx` `FEATURE_FLAG_LABELS`
3. Add server-side guard: `featureFlags?.yourFlag ?? false`

## Environment Variables

| Variable | Required | Description |
|----------|----------|-------------|
| `ANTHROPIC_API_KEY` | Yes | Anthropic API key for AI agents |
| `HOMEMAKER_VAULT_KEY` | For vault | 64-char hex key for AES-256-GCM secrets encryption |
| `AUTOMAKER_API_KEY` | Optional | API key for server authentication |
| `HOST` | No | Host to bind to (default: 0.0.0.0) |
| `PORT` | No | Server port (default: 3008) |
| `DATA_DIR` | No | Data storage directory (default: ./data) |
| `AUTOMAKER_MOCK_AGENT` | No | Enable mock agent mode for CI testing |
| `GITHUB_TOKEN` | Optional | For GitHub operations |
| Variable | Required | Description |
| ------------------------------- | --------- | -------------------------------------------------- |
| `ANTHROPIC_API_KEY` | Yes | Anthropic API key for AI agents |
| `HOMEMAKER_VAULT_KEY` | For vault | 64-char hex key for AES-256-GCM secrets encryption |
| `AUTOMAKER_API_KEY` | Optional | API key for server authentication |
| `HOST` | No | Host to bind to (default: 0.0.0.0) |
| `PORT` | No | Server port (default: 3008) |
| `DATA_DIR` | No | Data storage directory (default: ./data) |
| `AUTOMAKER_MOCK_AGENT` | No | Enable mock agent mode for CI testing |
| `GITHUB_TOKEN` | Optional | For GitHub operations |
| `OPENWEATHERMAP_API_KEY` | Optional | Weather widget API key |
| `OPENWEATHERMAP_LAT` | No | Home latitude for weather |
| `OPENWEATHERMAP_LON` | No | Home longitude for weather |
| `SENSOR_HISTORY_RETENTION_DAYS` | No | Days of sensor history (default: 30) |

## Important Guidelines

Expand Down
Loading
Loading