Phase 05: Multi-Model Discussions - 4 plans created - 11 total tasks defined - Covers M4 (open/parallel), M5 (discuss/sequential), M8 (@mentions) - Ready for execution Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
91 lines
3.7 KiB
Markdown
91 lines
3.7 KiB
Markdown
---
|
|
phase: 05-multi-model-discussions
|
|
plan: 01
|
|
type: execute
|
|
---
|
|
|
|
<objective>
|
|
Create discussion service layer with CRUD operations for Discussion, Round, and Message entities.
|
|
|
|
Purpose: Establish the data layer that all multi-model discussion commands depend on.
|
|
Output: Working discussion service with create/get/list operations for discussions, rounds, and messages.
|
|
</objective>
|
|
|
|
<execution_context>
|
|
~/.claude/get-shit-done/workflows/execute-phase.md
|
|
~/.claude/get-shit-done/templates/summary.md
|
|
</execution_context>
|
|
|
|
<context>
|
|
@.planning/PROJECT.md
|
|
@.planning/ROADMAP.md
|
|
@.planning/STATE.md
|
|
|
|
# Prior phase context:
|
|
@.planning/phases/04-single-model-qa/04-02-SUMMARY.md
|
|
|
|
# Key files:
|
|
@src/moai/core/models.py
|
|
@src/moai/core/services/project.py
|
|
@src/moai/core/database.py
|
|
|
|
**Tech stack available:** sqlalchemy, aiosqlite, python-telegram-bot
|
|
**Established patterns:** Service layer pattern (core/services/), async context manager for sessions, module-level singleton
|
|
**Constraining decisions:**
|
|
- 03-01: Service layer pattern for database operations
|
|
- 01-03: expire_on_commit=False for async session usability
|
|
</context>
|
|
|
|
<tasks>
|
|
|
|
<task type="auto">
|
|
<name>Task 1: Create discussion service with CRUD operations</name>
|
|
<files>src/moai/core/services/discussion.py, src/moai/core/services/__init__.py</files>
|
|
<action>Create discussion.py service following the project.py pattern. Include:
|
|
- create_discussion(project_id, question, discussion_type) - creates Discussion with DiscussionType enum
|
|
- get_discussion(discussion_id) - returns Discussion with eager-loaded rounds/messages
|
|
- get_active_discussion(project_id) - returns active discussion for project (status=ACTIVE), or None
|
|
- list_discussions(project_id) - returns all discussions for a project
|
|
- complete_discussion(discussion_id) - sets status to COMPLETED
|
|
|
|
Use selectinload for eager loading rounds→messages to avoid N+1 queries. Follow existing async context manager pattern from project.py.</action>
|
|
<verify>Import service in Python REPL, verify functions exist and type hints correct</verify>
|
|
<done>discussion.py exists with 5 async functions, proper type hints, uses selectinload for relationships</done>
|
|
</task>
|
|
|
|
<task type="auto">
|
|
<name>Task 2: Add round and message operations to discussion service</name>
|
|
<files>src/moai/core/services/discussion.py</files>
|
|
<action>Add to discussion.py:
|
|
- create_round(discussion_id, round_number, round_type) - creates Round with RoundType enum
|
|
- get_current_round(discussion_id) - returns highest round_number Round for discussion
|
|
- create_message(round_id, model, content, is_direct=False) - creates Message
|
|
- get_round_messages(round_id) - returns messages for a round ordered by timestamp
|
|
|
|
All functions follow same async context manager pattern. Use proper enum imports from models.py.</action>
|
|
<verify>Import service, verify all 4 new functions exist with correct signatures</verify>
|
|
<done>discussion.py has 9 total functions (5 discussion + 4 round/message), all async with proper types</done>
|
|
</task>
|
|
|
|
</tasks>
|
|
|
|
<verification>
|
|
Before declaring plan complete:
|
|
- [ ] `python -c "from moai.core.services.discussion import *"` succeeds
|
|
- [ ] All 9 functions have async def signatures
|
|
- [ ] Type hints include Discussion, Round, Message, DiscussionType, RoundType
|
|
- [ ] No import errors when running bot
|
|
</verification>
|
|
|
|
<success_criteria>
|
|
|
|
- Discussion service exists at src/moai/core/services/discussion.py
|
|
- 9 async functions for discussion/round/message CRUD
|
|
- Follows established service layer pattern
|
|
- Eager loading prevents N+1 queries
|
|
- No TypeScript/import errors
|
|
</success_criteria>
|
|
|
|
<output>
|
|
After completion, create `.planning/phases/05-multi-model-discussions/05-01-SUMMARY.md`
|
|
</output>
|