# 1 Research Phase

## 1.0 Problem statement
 ### Discuss
  Discuss the problem and create in the `docs/00_problem` next files and folders:  
 - `problem_description.md`: Our problem to solve with the end result we want to achieve. 
 - `input_data`: Put to this folder all the necessary input data and expected results for the further tests. Analyze very thoroughly input data and form system's restrictions and acceptance ctiteria 
 - `restrictions.md`: Restrictions we have in real world in the -dashed list format.
 - `acceptance_criteria.md`: Acceptance criteria for the solution in the -dashed list format. 
   The most important part, determines how good the system should be.

### Example:
 - `problem_description.md`
    We have wing type UAV (airplane). It should fly autonomously to predetermined GPS destination. During the flight it is relying on the signal form GPS module.  
    But when adversary jam or spoof GPS, then UAV either don't know where to fly, or fly to the wrong direction.
    So, we need to achieve that UAV can fly correctly to the destination without GPS or when GPS is spoofed. We can use the camera pointing downward and other sensor data like altitude, available form the flight controller. Airplane is running Ardupliot. 
 - `input_data`
    - orthophoto images from the UAV for the analysis
    - list of expected GPS for the centers for each picture in csv format: picture name, lat, lon
    - video from the UAV for the analysis
    - list of expected GPS for the centers of video per timeframe in csv format: timestamp, lat, lon for each 1-2 seconds
    - ...
 - `restrictions.md`
    - We're limiting our solution to airplane type UAVs.
    - Additional weight it could take is under 1 kg.
    - The whole system should cost under $2000.
    - The flying range is restricted by eastern and southern part of Ukraine. And so on.  
 - `acceptance_criteria.md`
    - UAV should fly without GPS for at least 30 km in the sunshine weather.
    - UAV shoulf fly with maximum mistake no more than 40 meters from the real GPS
    - UAV should fly correctly with little foggy weather with maximum mistake no more than 100 meters from the real GPS
    - UAV should fly for minimum of 500 meters with missing inernal Satellite maps and the drifting error should be no more than 50 meters. 


## 1.1 **✨AI Research**: Restrictions and Acceptance Criteria assesment
  
  ### Execute `/1.research/1.1_research_assesment_acceptance_criteria`
   In case of external DeepResearch (Gemini, DeepSeek, or other), copypaste command's text and put to the research context:
    - `problem_description.md`
    - `restrictions.md`
    - `acceptance_criteria.md`
    - Samples of the input data

  ### Revise 
   - Revise the result, discuss it
   - Overwrite `acceptance_criteria.md` and `restrictions.md`
 

## 1.2 **✨AI Research**: Research the problem in great detail

  ### Execute `/1.research/1.2_research_problem`
   In case of external DeepResearch (Gemini, DeepSeek, or other), copypaste command's text and put to the research context:
    - `problem_description.md`
    - `restrictions.md`
    - `acceptance_criteria.md`
    - Samples of the input data
  
  ### Revise 
   - Revise the result from AI.
   - Research the problem as well
   - Add/modify/remove some solution details in the draft. (Also with AI)
   - Store it to the `docs/01_solution/solution_draft.md`


## 1.3 **✨AI Research**: Solution draft assessment
  
  ### Execute `/1.research/1.3_solution_draft_assessment`
   In case of external DeepResearch (Gemini, DeepSeek, or other), copypaste command's text and put to the research context:
    - `problem_description.md`
    - `restrictions.md`
    - `acceptance_criteria.md`
    - Samples of the input data
  
  ### Revise
  - Research by yourself as well - how to solve additional problems which AI figured out, and add them to the result.
  
  ### Iterate
  - Rename previous `solution_draft.md` to `{xx}_solution_draft.md`. Start {xx} from 01
  - Store the new revised result draft to the `docs/01_solution/solution_draft.md`
  - Repeat the process 1.3 from the beginning
  
  When the next solution wouldn't differ much from the previous one, or become actually worse, store the last draft as `docs/01_solution/solution.md`



# 2. Planning phase

## 2.10 **🤖📋AI plan**: Generate components

  ### Execute `/2.planning/2.10_gen_components`

  ### Revise 
   - Revise the plan, answer questions, put detailed descriptions
   - Make sure stored components are coherent and make sense
  
  ### Store plan
   - Save plan to `docs/02_components/00_decomposition_plan.md`


## 2.15 **🤖AI agent**: Components assesment

  ### Execute `/2.planning/2.15_components_assesment`

  ### Revise 
   - Clarify the proposals and ask to fix found issues
  
## 2.20 **🤖AI agent**: Generate Jira Epics
  
  ### Add Jira MCP to IDE and authenticate
   ```
   "Jira-MCP-Server": {
      "url": "https://mcp.atlassian.com/v1/sse"
   }
   ```
  
  ### Execute `/2.planning/2.20_gen_epics use jira mcp`

  ### Revise 
   - Revise the epics, answer questions, put detailed descriptions
   - Make sure epics are coherent and make sense


## 2.30 **🤖AI agent**:  Generate tests
  
  ### Execute `/2.planning/2.30_gen_tests`

  ### Revise 
   - Revise the tests, answer questions, put detailed descriptions
   - Make sure stored tests are coherent and make sense

## 2.40 **🤖📋AI plan**: Component Decomposition To Features
  ### Execute
   For each component in `docs/02_components` run 
    `/2.planning/2.40_gen_features --component @[component_name]_spec.md`  

  ### Revise 
   - Revise the features, answer questions, put detailed descriptions
   - Make sure features are coherent and make sense



# 3. Development phase

## 3.1 **🤖AI agent**: Feature implementation
 For each component in `docs/02_components/[##]_[component_name]/` folder do next:  
``` 
 Read component description `@docs/02_components/[##]_[component_name]/spec.md`.  
 Read all features in the folder `@docs/02_components/[##]_[component_name]`. For each feature do next:
  - Implement it
  - Make sure feature is connected and communicated properly with other features and existing code
  - Create unit tests from the Test cases description, run it and make sure the result is a success
  - Create integration test for the feature, run and make sure the result is a success
 If integration tests are specified in component spec, then write them and run, and make sure that component working correctly
```

## 3.2 **🤖AI agent**: Solution composition and integration tests
``` 
 Read all the files here `docs/03_tests/` and for each file write down tests and run it.  
 Compose a final test results in a csv with the next format:
  - Test filename
  - Execution time
  - Result  

 Fix all problems if tests failed until we got a successful result. 
 In case if one or more tests was failed due to missing data from user or API or other system, ask it from developer.
 Repeat test cycle until no failed tests.
 ```

# 4. Refactoring phase