Skip to content

Conversation

@Nightbr
Copy link
Owner

@Nightbr Nightbr commented Jan 13, 2026

Summary

This PR contains multiple improvements to the agents and data model:

  1. Persistent storage for Mastra agents - Agent storage now persists to disk for better debugging in Studio
  2. Fixed food preferences data model - Split foodPreferences object into separate foodPreferencesLikes and foodPreferencesDislikes arrays
  3. Smart array merging for member updates - Added add/remove/replace modes for updating array fields
  4. Improved Select UI - Replaced custom search dropdowns with proper Select components in create family modal
  5. Better birthdate handling - Added age calculation and improved display of partial birthdates
  6. Removed defaultServings - Cleaned up unused defaultServings field from planner settings

Commits

1. init: persistent storage for debug in studio

  • Changed Mastra storage from :memory: to persistent file storage at .data/agent-storage.db
  • Enables debugging agent state in Mastra Studio

2. docs: fixed web app port + update doc

  • Set explicit port 3000 for web app in Vite config
  • Added "Running the Application" section to README with dev server instructions

3. fix: select UI + likes/dislikes override

Database Schema Changes:

  • Split foodPreferences (JSON object with likes/dislikes) into two separate columns:
    • foodPreferencesLikes (TEXT array)
    • foodPreferencesDislikes (TEXT array)
  • Added migration 0002_split_food_preferences_columns.sql with data migration

Smart Array Merging:

  • Added ArrayMergeModeSchema with modes: add, remove, replace
  • updateMemberByNameTool now supports smart merging for:
    • dietaryRestrictions / dietaryRestrictionsMode
    • allergies / allergiesMode
    • foodPreferencesLikes / foodPreferencesLikesMode
    • foodPreferencesDislikes / foodPreferencesDislikesMode

UI Improvements:

  • Replaced custom search-based country/language dropdowns with proper <Select> components
  • Added new Select component to UI package (@radix-ui/react-select)
  • Updated members-list.tsx to use new field names

Agent Prompt Updates:

  • Updated onboarding agent instructions to use new field names
  • Added smart merging examples to agent prompts

Fixed Bug:

  • Resolved "Food dislikes not saved to database" issue from TODO.md

4. birthdate fixes, clean planner settings

Birthdate Display Improvements:

  • Added calculateAgeFromBirthdate() - handles partial birthdates (year only, year+month, full date)
  • Added formatPartialBirthdate() - displays dates appropriately based on available fields
  • Added getBirthdateDisplay() - shows formatted date with calculated age

Removed defaultServings:

  • Removed defaultServings column from PlannerSettings table
  • Removed from schema, Zod schemas, AI tools, memory, services
  • Removed "Default Servings" card from web UI
  • Generated migration 0003_remove_default_servings.sql
  • Updated documentation and tests

New TODO:

  • Added "Speech-to-text button for chat input" to TODO.md

Files Changed

Core Package

  • packages/core/src/ai/index.ts - Persistent agent storage
  • packages/core/src/ai/agents/onboarding-agent.ts - Updated prompts
  • packages/core/src/ai/memory/onboarding-memory.ts - Updated schema
  • packages/core/src/ai/tools/member-tools.ts - Smart array merging
  • packages/core/src/ai/tools/planner-tools.ts - Removed defaultServings
  • packages/core/src/ai/tools/family-tools.ts - Removed defaultServings
  • packages/core/src/domain/db/schema.drizzle.ts - Schema updates
  • packages/core/src/domain/schemas/planner.schema.ts - Removed defaultServings
  • packages/core/src/domain/services/family-service.ts - Removed defaultServings

Migrations

  • 0002_split_food_preferences_columns.sql - Split foodPreferences
  • 0003_remove_default_servings.sql - Remove defaultServings

Web App

  • apps/web/src/components/family/create-family-modal.tsx - Select components
  • apps/web/src/components/family/members-list.tsx - New field names + birthdate display
  • apps/web/src/components/family/planner-settings.tsx - Removed defaultServings
  • apps/web/vite.config.ts - Explicit port 3000

UI Package

  • packages/ui/src/components/ui/select.tsx - New Select component

Scripts & Docs

  • scripts/seed.ts - Updated field names
  • README.md - Added running instructions
  • AGENTS.md - Added camelCase column naming guideline
  • specs/database-schema.md - Updated schema
  • specs/data-models.md - Updated types
  • specs/TODO.md - Removed fixed bug, added new item

Migration

After merging, run migrations:

pnpm run db:migrate

Note: If you have existing data, migration 0002 will automatically migrate foodPreferences.likes and foodPreferences.dislikes to the new columns.

@Nightbr Nightbr changed the title Remove defaultServings from planner settings Agent and app improvements Jan 13, 2026
@Nightbr Nightbr changed the title Agent and app improvements Agent improvements: persistent storage, food preferences fix, smart merging, birthdate display, and cleanup Jan 13, 2026
@Nightbr Nightbr force-pushed the improvements-agents branch from 633ddda to c8aff06 Compare January 13, 2026 12:20
@Nightbr Nightbr merged commit c5ab95e into main Jan 13, 2026
1 check passed
@Nightbr Nightbr deleted the improvements-agents branch January 13, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant