---
name: feature-list-in-analysis
description: Add feature list generation to task analysis phase with feature-list.md output
status: done
parts:
- src/types/task.rs
- src/storage.rs
- src/servers/task.rs
estimate:
  optimistic: 3 hours
  normal: 5 hours
  pessimistic: 8 hours
---

# Implementation Plan

## Task Summary

| ID | Task | Files |
|----|------|-------|
| T1 | Add Feature data structures | `src/types/task.rs` |
| T2 | Add feature-list.md file management | `src/storage.rs` |
| T3 | Add save_features tool | `src/servers/task.rs` |
| T4 | Add mark_feature_complete tool | `src/servers/task.rs` |
| T5 | Update analyze_task to include feature extraction instructions | `src/servers/task.rs` |
| T6 | Update save_questions to be feature-aware | `src/servers/task.rs` |
| T7 | Add feature completion validation to set_task_status | `src/servers/task.rs` |
| T8 | Update CLAUDE.md documentation | `CLAUDE.md` |

## Tasks

- [ ] **T1**: Add Feature struct with fields: id, description, completed, priority (optional), complexity (optional), dependencies (optional Vec of feature ids). Add `features: Vec<Feature>` to TaskState. Add FeaturePriority enum (high, medium, low).

- [ ] **T2**: Add `feature_list_md_path()` to StateManager. Add `write_feature_list_md()` function that generates markdown with checkboxes. Add `read_feature_list_md()` to parse existing feature-list.md if needed.

- [ ] **T3**: Add `save_features` tool that accepts JSON array of features, saves to TaskState, and writes feature-list.md. Should be called automatically after analyze_task extracts features.

- [ ] **T4**: Add `mark_feature_complete` tool that takes task_name and feature_id, marks the feature as completed, and updates feature-list.md checkboxes.

- [ ] **T5**: Update `analyze_task` response instructions to tell Claude to: 1) Extract discrete features from the task description, 2) Call save_features with the feature list, 3) Generate questions per-feature if needed, 4) Call save_questions.

- [ ] **T6**: Update question generation guidance to encourage feature-aware questions. Questions should reference specific features when applicable.

- [ ] **T7**: In `set_task_status`, when setting status to `done`, validate that all features are marked complete. Return error if incomplete features exist.

- [ ] **T8**: Update CLAUDE.md to document the new workflow: analyze_task -> save_features -> save_questions -> answer questions -> implement -> mark features complete -> done.

## feature-list.md Format

```markdown
# Feature List

## F1: Feature title
**Priority:** high | medium | low
**Complexity:** simple | moderate | complex
**Dependencies:** F2, F3 (if any)
**Status:** [ ] Pending | [x] Complete

Description of the feature...

## F2: Another feature
...
```

## Testing Considerations

- Test save_features with various feature configurations (with/without optional fields)
- Test mark_feature_complete updates both state and markdown correctly
- Test set_task_status blocks transition to 'done' when features incomplete
- Test feature-list.md generation and parsing
- Test analyze_task returns updated instructions mentioning feature extraction

---

## Estimate

**Senior Developer Profile:** 5+ years experience, familiar with Rust and the K4000 codebase.

| Scenario | Time |
|----------|------|
| Optimistic | 3 hours |
| Normal | 5 hours |
| Pessimistic | 8 hours |

### Assumptions
- Existing patterns for questions.md can be reused for feature-list.md
- No major refactoring of the analysis flow required
- Feature metadata fields are optional and straightforward to implement
- Markdown parsing for checkboxes follows existing patterns
