Skip to content

feat: add CreateSubHabit AI action + refactor SystemPromptBuilder#9

Merged
thomasluizon merged 1 commit into
mainfrom
feature/create-sub-habit-action
Mar 21, 2026
Merged

feat: add CreateSubHabit AI action + refactor SystemPromptBuilder#9
thomasluizon merged 1 commit into
mainfrom
feature/create-sub-habit-action

Conversation

@thomasluizon

Copy link
Copy Markdown
Owner

Summary

  • Add CreateSubHabit action type so the AI chat can add sub-habits to existing parent habits (previously could only create new top-level habits with inline sub-habits)
  • Refactor SystemPromptBuilder: extract monolithic 560-line method into 9 section methods with a PromptContext record (no output change)
  • ExecuteCreateSubHabitAsync delegates to existing CreateSubHabitCommand via MediatR, reusing all validation (Pro check, parent ownership, depth limit, frequency inheritance)

Test plan

  • dotnet build succeeds (0 warnings, 0 errors)
  • All 282 unit tests pass
  • Manual test: ask AI chat to "add X under my Y habit" with an existing parent
  • Verify refactored prompt output is identical (minus new CreateSubHabit content)

🤖 Generated with Claude Code

Add CreateSubHabit action type enabling the AI chat to add sub-habits
to existing parent habits. Previously, the AI could only create new
top-level habits with inline sub-habits.

Backend changes:
- Add CreateSubHabit to AiActionType enum
- Add dispatch case + ExecuteCreateSubHabitAsync in ProcessUserChatCommand
  that delegates to existing CreateSubHabitCommand via MediatR
- Refactor SystemPromptBuilder: extract monolithic 560-line method into
  9 section methods with a PromptContext record
- Add CreateSubHabit capability, rule, example, and usage docs to AI prompt

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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