---
name: feature-approval-workflow-setting
description: Add project-based setting for feature approval workflow (auto/manual)
status: done
parts:
- src/types/task.rs
- src/types/mod.rs
- src/storage.rs
- src/servers/task.rs
- CLAUDE.md
estimate:
  optimistic: 2 hours
  normal: 3 hours
  pessimistic: 5 hours
---

# Implementation Plan

## Summary

Add a project-level configuration file (`tasks/.config/config.toml`) that controls whether the coding agent can automatically continue to the next feature or must wait for manual approval. Default behavior is `manual` (wait for approval).

## Task Summary

| ID | Task | Files |
|----|------|-------|
| T1 | Add ProjectConfig type with TOML support | `src/types/task.rs`, `src/types/mod.rs` |
| T2 | Add config loading to StateManager | `src/storage.rs` |
| T3 | Add task-level override field | `src/types/task.rs` |
| T4 | Modify mark_feature_verified response | `src/servers/task.rs` |
| T5 | Add approval mode to list_project_tasks | `src/servers/task.rs` |
| T6 | Update documentation | `CLAUDE.md` |

## Tasks

- [ ] **T1**: Create `ProjectConfig` struct with `feature_approval_mode` field (enum: `auto`, `manual`). Add TOML deserialization using `toml` crate. Default to `manual`.

- [ ] **T2**: Add `load_project_config()` method to `StateManager` that reads `tasks/.config/config.toml`. Return default config if file doesn't exist.

- [ ] **T3**: Add optional `feature_approval_mode` field to `TaskState` for task-level override. Implement `get_effective_approval_mode()` helper that checks task > project > default.

- [ ] **T4**: Modify `mark_feature_verified` tool to check approval mode. In `manual` mode, return response with `"await_approval": true` and message instructing agent to pause and ask user before continuing. In `auto` mode, return current behavior.

- [ ] **T5**: Add `feature_approval_mode` field to `ListProjectTasksResponse`. Load project config and include the mode in the response.

- [ ] **T6**: Update CLAUDE.md with:
  - Config file location and format (`tasks/.config/config.toml`)
  - Available settings and their defaults
  - Workflow differences between modes
  - Example configuration

## Config File Location

```
project/
  tasks/
    .config/
      config.toml    # K4000 project configuration
    .state/
      ...            # Task state (existing)
    my-task/
      task.md
      ...
```

## Example Config

```toml
# K4000 Project Configuration

# Feature approval mode: "auto" or "manual"
# - auto: Agent proceeds to next feature automatically
# - manual: Agent pauses and asks for approval after each feature (default)
feature_approval_mode = "auto"
```

## Testing Considerations

- Test config parsing with valid TOML
- Test default values when config file is missing
- Test task-level override precedence
- Test mark_feature_verified response in both modes
- Test list_project_tasks includes approval mode

## Dependencies

Add to Cargo.toml:
```toml
toml = "0.8"
```

---

## Estimate

**Senior Developer Profile:** 5+ years experience, familiar with Rust and MCP servers.

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

### Assumptions
- Developer is familiar with the K4000 codebase structure
- TOML crate integration is straightforward
- No breaking changes to existing MCP tool interfaces
- Tests can be written alongside implementation
