# Tasks: Process Query Feature
**Input**: Design documents from `specs/003-process-query/`
**Prerequisites**: design.md (required), spec.md (required for user stories), research.md, data-model.md, contracts/
**Tests**: Unit tests included per ground-rules requirement (Principle II: Test-First Development)
**Organization**: Tasks are grouped by user story to enable independent implementation and testing of each story.
## Format: `[ID] [P?] [Story] Description`
- **[P]**: Can run in parallel (different files, no dependencies)
- **[Story]**: Which user story this task belongs to (e.g., US1, US2, US3)
- Include exact file paths in descriptions
## Architecture Alignment
- **ADR-006**: Parallel Module Design for Processes - Process module follows checklist module structure
- **ADR-007**: In-Memory Search with Relevance Ranking - No external search engine needed
---
## Phase 1: Setup (Shared Infrastructure)
**Purpose**: Configuration and directory setup for process module
- [ ] T001 Add PROCESS_DIR setting to src/sso_mcp_server/config/settings.py with default ./processes
- [ ] T002 [P] Create processes/ directory at repository root for default process files
- [ ] T003 [P] Create src/sso_mcp_server/processes/ module directory with __init__.py
---
## Phase 2: Foundational (Blocking Prerequisites)
**Purpose**: Core infrastructure that MUST be complete before ANY user story can be implemented
**⚠️ CRITICAL**: No user story work can begin until this phase is complete
- [ ] T004 Implement discover_processes function in src/sso_mcp_server/processes/discovery.py (glob pattern *.md)
- [ ] T005 Implement parse_process_file function in src/sso_mcp_server/processes/parser.py (YAML frontmatter extraction)
- [ ] T006 [P] Write unit tests for discovery in tests/unit/processes/test_discovery.py
- [ ] T007 [P] Write unit tests for parser in tests/unit/processes/test_parser.py
**Checkpoint**: Foundation ready - user story implementation can now begin in parallel
---
## Phase 3: User Story 1 - Query Development Processes (Priority: P1) 🎯 MVP
**Goal**: Enable developers to retrieve specific process documentation by name through the MCP server
**Independent Test**: Call get_process tool with process name "code-review" → returns complete process content
### Tests for User Story 1
> **NOTE: Write these tests FIRST, ensure they FAIL before implementation**
- [ ] T008 [P] [US1] Write unit tests for ProcessService.get_process in tests/unit/processes/test_service.py
- [ ] T009 [P] [US1] Write unit tests for get_process_impl in tests/unit/tools/test_get_process.py
### Implementation for User Story 1
- [ ] T010 [US1] Implement ProcessService class with get_process method in src/sso_mcp_server/processes/service.py
- [ ] T011 [US1] Implement get_available_names helper method in ProcessService for error messages
- [ ] T012 [US1] Implement get_process_impl function in src/sso_mcp_server/tools/get_process.py
- [ ] T013 [US1] Register get_process tool in src/sso_mcp_server/server.py with auth middleware
- [ ] T014 [US1] Create example process file processes/code-review.md with YAML frontmatter
**Checkpoint**: At this point, User Story 1 should be fully functional and testable independently
---
## Phase 4: User Story 2 - List Available Processes (Priority: P2)
**Goal**: Enable developers to discover all available processes with names and descriptions
**Independent Test**: Call list_processes tool → returns array of all process metadata (name + description)
### Tests for User Story 2
- [ ] T015 [P] [US2] Write unit tests for ProcessService.list_processes in tests/unit/processes/test_service.py (append to existing)
- [ ] T016 [P] [US2] Write unit tests for list_processes_impl in tests/unit/tools/test_list_processes.py
### Implementation for User Story 2
- [ ] T017 [US2] Add list_processes method to ProcessService in src/sso_mcp_server/processes/service.py
- [ ] T018 [US2] Implement list_processes_impl function in src/sso_mcp_server/tools/list_processes.py
- [ ] T019 [US2] Register list_processes tool in src/sso_mcp_server/server.py with auth middleware
- [ ] T020 [P] [US2] Create additional example process file processes/deployment.md with YAML frontmatter
**Checkpoint**: At this point, User Stories 1 AND 2 should both work independently
---
## Phase 5: User Story 3 - Search Processes by Keyword (Priority: P3)
**Goal**: Enable developers to search across all process documents by keyword with relevance ranking
**Independent Test**: Call search_processes with query "deploy" → returns matching processes ordered by relevance
### Tests for User Story 3
- [ ] T021 [P] [US3] Write unit tests for SearchEngine in tests/unit/processes/test_search.py
- [ ] T022 [P] [US3] Write unit tests for ProcessService.search_processes in tests/unit/processes/test_service.py (append to existing)
- [ ] T023 [P] [US3] Write unit tests for search_processes_impl in tests/unit/tools/test_search_processes.py
### Implementation for User Story 3
- [ ] T024 [US3] Implement SearchEngine class with relevance scoring in src/sso_mcp_server/processes/search.py
- [ ] T025 [US3] Implement calculate_relevance method (name: 100pts, description: 50pts, content: 10pts/match)
- [ ] T026 [US3] Implement extract_snippet method for search result context
- [ ] T027 [US3] Add search_processes method to ProcessService in src/sso_mcp_server/processes/service.py
- [ ] T028 [US3] Implement search_processes_impl function in src/sso_mcp_server/tools/search_processes.py
- [ ] T029 [US3] Register search_processes tool in src/sso_mcp_server/server.py with auth middleware
- [ ] T030 [P] [US3] Create additional example process file processes/incident-response.md with YAML frontmatter
**Checkpoint**: All user stories should now be independently functional
---
## Phase 6: Polish & Cross-Cutting Concerns
**Purpose**: Improvements that affect multiple user stories
- [ ] T031 [P] Update module exports in src/sso_mcp_server/processes/__init__.py
- [ ] T032 [P] Add integration tests for all process tools in tests/integration/test_process_tools.py
- [ ] T033 [P] Update README.md with process tools documentation
- [ ] T034 Run ruff check and ruff format on all new files
- [ ] T035 Run pytest to verify all tests pass
- [ ] T036 Run quickstart.md validation scenarios manually
---
## Dependencies & Execution Order
### Phase Dependencies
- **Setup (Phase 1)**: No dependencies - can start immediately
- **Foundational (Phase 2)**: Depends on Setup completion - BLOCKS all user stories
- **User Stories (Phase 3+)**: All depend on Foundational phase completion
- User stories can then proceed in parallel (if staffed)
- Or sequentially in priority order (P1 → P2 → P3)
- **Polish (Final Phase)**: Depends on all desired user stories being complete
### User Story Dependencies
- **User Story 1 (P1)**: Can start after Foundational (Phase 2) - No dependencies on other stories
- **User Story 2 (P2)**: Can start after Foundational (Phase 2) - Reuses ProcessService from US1
- **User Story 3 (P3)**: Can start after Foundational (Phase 2) - Reuses ProcessService, adds SearchEngine
### Within Each User Story
- Tests MUST be written and FAIL before implementation
- ProcessService methods before tool implementations
- Tool implementation before server registration
- Story complete before moving to next priority
### Parallel Opportunities
- T002, T003 can run in parallel (different directories)
- T006, T007 can run in parallel (different test files)
- T008, T009 can run in parallel (different test files)
- T015, T016 can run in parallel (different test files)
- T021, T022, T023 can run in parallel (different test files)
- T031, T032, T033 can run in parallel (different files)
- Once Foundational phase completes, all user stories can start in parallel (if team capacity allows)
---
## Parallel Example: User Story 3
```bash
# Launch all tests for User Story 3 together:
Task: "Write unit tests for SearchEngine in tests/unit/processes/test_search.py"
Task: "Write unit tests for ProcessService.search_processes in tests/unit/processes/test_service.py"
Task: "Write unit tests for search_processes_impl in tests/unit/tools/test_search_processes.py"
# After tests written, implement sequentially:
Task: "Implement SearchEngine class in src/sso_mcp_server/processes/search.py"
Task: "Add search_processes method to ProcessService"
Task: "Implement search_processes_impl function"
Task: "Register search_processes tool in server.py"
```
---
## Implementation Strategy
### MVP First (User Story 1 Only)
1. Complete Phase 1: Setup (T001-T003)
2. Complete Phase 2: Foundational (T004-T007)
3. Complete Phase 3: User Story 1 (T008-T014)
4. **STOP and VALIDATE**: Test get_process tool independently
5. Deploy/demo if ready
### Incremental Delivery
1. Complete Setup + Foundational → Foundation ready
2. Add User Story 1 (get_process) → Test independently → Deploy/Demo (MVP!)
3. Add User Story 2 (list_processes) → Test independently → Deploy/Demo
4. Add User Story 3 (search_processes) → Test independently → Deploy/Demo
5. Each story adds value without breaking previous stories
### Parallel Team Strategy
With multiple developers:
1. Team completes Setup + Foundational together
2. Once Foundational is done:
- Developer A: User Story 1 (get_process)
- Developer B: User Story 2 (list_processes)
- Developer C: User Story 3 (search_processes)
3. Stories complete and integrate independently
---
## Notes
- [P] tasks = different files, no dependencies
- [Story] label maps task to specific user story for traceability
- Each user story should be independently completable and testable
- Verify tests fail before implementing
- Commit after each task or logical group
- Stop at any checkpoint to validate story independently
- Follow existing checklist module patterns (ADR-006)
- Use in-memory search with relevance ranking (ADR-007)