Skip to content

As a friend, I can schedule routines #9

@steineggerroland

Description

@steineggerroland

Components implemented to date

📦 1. routine data model & templates

  • Structure for RoutineTemplate with setup, phases, steps, triggers, description, title, id
  • Steps are differentiated into ParameterRequestStep, ActionRoutineStep, MessageRoutineStep
  • timeOfDay is typed, supports absolute and relative times as well as parameter references
  • References to parameters are formally typed correctly (AfterDuration.reference, etc.)
  • Validation when creating templates is done explicitly via require(...) clauses
  • Triggers can react to events (e.g. PHASE_ENTERED, PHASE_LEFT, ROUTINE_STARTED)

👣 2. routine lifecycle

  • Setup via subtask:

  • SelectRoutineSubtaskHandler: Selection via LLM or by parameter (routineTemplateId)

  • SetupRoutineSubtaskHandler: sequential acquisition of parameters (with specific prompts), if successful: routine starts

  • Setup created:

  • RoutineInstance

  • Scheduler jobs for triggers and steps (Quartz)

  • EventLogs for relevant processes

  • On start:

  • RoutineStarted is published

  • RoutineLifecycleHandler reacts to events such as RoutineStepTriggered

�� 3. processing by LifecycleService

  • Processed:

  • RoutineStepTriggered → checks step type, sends message, expects confirmation if necessary

  • SetRoutineParameterRoutineStep → checks whether scheduler reschedule is necessary

  • TaskCompleted → checks reference to the routine and triggers follow-up action if necessary

  • TaskRemoved → complex decision logic via FriendStateAnalyzer, generates reminder if necessary, stops routine, restores task

💬 4. subtasks & intents

  • AnswerQuestionSubtaskHandler processes explicit queries from the assistant to the user
  • StopRoutineTodaySubtaskHandler planned but NOT IMPLEMENTED (only intent defined)
  • RoutineIntents defined correctly

📜 5. prompt processing

  • Prompt structure defined for parameter types
  • Reusable class: ExtractParamFromConversationService
  • Validate tests Extraction via FriendStateAnalyzerAIT

🧪 6. tests

  • Almost complete coverage:

  • Setup, step execution, trigger, reminder, task behavior

  • Mood/intent assessment, LLM evaluation, GoalContext processing

  • AI tests for LLM generation

  • Mock tests with clear expectations and verifications

🔎 Identified gaps & tasks

�� A. Processing of step confirmations

  • ActionRoutineStep is recognized and FULLY IMPLEMENTED

  • Confirmation mechanism for expectConfirmation = true is COMPLETE:

  • Creates tasks for confirmation-based steps

  • Task completion triggers ConfirmedActionStep event

  • RoutineTaskIntegrationService handles task completion and publishes ConfirmedActionStep

  • RoutineCompletionHandler processes ConfirmedActionStep and checks phase completion

  • NO ACTION NEEDED - This is fully working

�� B. Trigger types & processing

  • Triggers are scheduled (e.g. AFTER_PHASE_COMPLETIONS, AFTER_DURATION, AT_TIME_EXPRESSION)

  • FULLY IMPLEMENTED: Event-based trigger processing

  • RoutineAfterEventHandler handles AfterEvent triggers (PHASE_ENTERED, PHASE_LEFT)

  • RoutineTransitionHandler evaluates phase transitions after PhaseIterationCompleted

  • RoutineParameterSetHandler reschedules triggers when parameters change

  • RoutineTriggerService executes trigger effects (SendMessage, CreateTask)

  • NO ACTION NEEDED - This is fully working

�� C. Completion of a phase / routine

  • FULLY IMPLEMENTED: Phase completion and transition logic

  • RoutineCompletionHandler detects when all steps in a phase are completed

  • Publishes PhaseIterationCompleted event

  • RoutineTransitionHandler evaluates transition conditions and activates next phases

  • Supports AfterPhaseCompletions, AfterParameterSet, AfterEvent conditions

  • Phase deactivation cleanup is comprehensive (schedulers, tasks, conversations)

  • MISSING: RoutineCompleted event and end-of-routine handling

  • TODO: Define when a routine is considered complete (all phases done? time-based?)

  • TODO: Add RoutineCompleted event and handler

  • TODO: Consider routine renewal or completion reminders

🟡 D. Reminder function (for "later")

  • NOT IMPLEMENTED: No dedicated reminder system

  • Partial implementation: Task removal scenarios suggest continuing later

  • TODO: Introduce ReminderScheduler service

  • TODO: Calculate reminder times based on user preferences

  • TODO: Implement RoutineReminderCmd or generic reminder system

  • TODO: Decide if this should be part of lifecycle or separate service

🟡 E. Adaptive responses / escalations

  • Mood analysis integrated in task removal scenarios

  • MISSING: Personalized response tracking over longer periods

  • MISSING: Escalation strategy for repeated pauses or aborts

  • TODO: Implement pattern tracking (e.g., routine frequently stopped)

  • TODO: Add adaptive response logic based on user behavior patterns

  • TODO: Consider escalation strategies for consistent routine abandonment

🆕 Additional

  • Missing Components:

  • StopRoutineTodaySubtaskHandler (intent exists but no implementation)

  • Routine completion definition and handling

  • Reminder system for paused routines

  • Long-term adaptive response patterns

  • The routine feature is substantially more complete than the original issue description indicated. Most core functionality is working, with only a few specific gaps remaining.

Metadata

Metadata

Labels

enhancementNew feature or request
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions