|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +## MANDATORY Protocol |
| 4 | + |
| 5 | +**CRITICAL: Each user request must be treated as a fresh execution: always re-read the YAML config and execute every step in full, regardless of conversation context.** |
| 6 | +**CRITICAL: NEVER use Task tool for agents** |
| 7 | + |
| 8 | +Before executing ANY user request, Claude MUST: |
| 9 | +1. Read prompts/STARTUP_CHECKLIST.md |
| 10 | +2. Identify the correct agent YAML config file |
| 11 | +3. Read the agent YAML config directly using Read tool |
| 12 | +4. Execute EACH step in the agent configuration manually using available tools |
| 13 | +5. Verify each step's output before proceeding to next step |
| 14 | + |
| 15 | +**MANDATORY** = Required, cannot be skipped |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +## Fresh Start Enforcement |
| 20 | + |
| 21 | +**CRITICAL RULE: Every user request is a fresh execution, even if it happens in the SAME conversation.** |
| 22 | + |
| 23 | +- MUST always re-read the correct agent YAML config before executing any agent. |
| 24 | +- MUST NOT reuse execution context or skip steps based on conversation history. |
| 25 | +- MUST verify that the "Read agent YAML" step has been executed before proceeding. |
| 26 | +- If the YAML has not been read in the current request → STOP and re-execute mandatory steps. |
| 27 | + |
| 28 | +### Implementation Notes |
| 29 | +- Introduce a request-level hook: each user request = enforce mandatory startup protocol. |
| 30 | +- NEVER rely on Task Tool (causes step skipping and incomplete execution). |
| 31 | +- Log confirmation before agent execution: |
| 32 | + `Agent config loaded: config/agents/<agent>.yaml` |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +## Why NOT to use Task Tool |
| 37 | +- Task tool uses general-purpose subagent that doesn't follow YAML configs exactly |
| 38 | +- Steps get skipped, simplified, or executed incorrectly |
| 39 | +- Results in incomplete or wrong outputs |
| 40 | +- Agent configurations are designed for direct execution only |
| 41 | + |
| 42 | +## Supported Agents |
| 43 | + |
| 44 | +### Agent Execution Order |
| 45 | +The agents can be executed independently or in sequence: |
| 46 | + |
| 47 | +**Complete End-to-End Flow:** |
| 48 | +1. Generate Test Cases → 2. Generate E2E Test Code → 2.1 Execute E2E Tests → 3. Submit E2E Pull Request → 4. Update JIRA QE Comment |
| 49 | + |
| 50 | +**CRITICAL: When user requests complete test generation and execution tests:** |
| 51 | +- MUST execute test_case_generation → e2e_test_generation_openshift_private → test-executor in sequence |
| 52 | +- Each agent uses its own configuration |
| 53 | +- Each agent executes ALL steps defined in its config |
| 54 | +- NO shortcuts or step skipping allowed |
| 55 | + |
| 56 | +**Dependencies:** |
| 57 | +- e2e_test_generation_openshift_private requires completion of test_case_generation (test case must exist before E2E generation) |
| 58 | +- test-executor requires completion of e2e_test_generation_openshift_private |
| 59 | +- PR submission requires completion of e2e_test_generation_openshift_private (and optionally test-executor) |
| 60 | +- JIRA QE comment update can be executed after any agent completion |
| 61 | + |
| 62 | +### 1. Generate Test Cases |
| 63 | +- **Input**: Create test case for JIRA issue key (e.g., "Create test case for HIVE-2883") |
| 64 | +- **Action**: NEVER use Task tool |
| 65 | +- **PREREQUISITE CHECK**: Check if test case already exists: |
| 66 | + 1. Check if test case file exists in `test_artifacts/{COMPONENT}/{JIRA_KEY}/test_cases/{JIRA_KEY}_test_case.md` |
| 67 | + 2. If test case exists: Report existing test case location and skip generation |
| 68 | + 3. If test case does not exist: Proceed with test case generation |
| 69 | +- **Execution Steps:** |
| 70 | + 1. Read `config/agents/test_case_generation.yaml` |
| 71 | + 2. Execute each step in `task.steps` section manually |
| 72 | + 3. Use tools: jira-mcp-snowflake MCP, WebFetch, Read, Write |
| 73 | + 4. Verify outputs match `output.files` specifications |
| 74 | +- **Agent config**: `config/agents/test_case_generation.yaml` |
| 75 | +- **Output**: Test cases in markdown format for Polarion integration |
| 76 | + |
| 77 | +### 2. Generate E2E Test Code |
| 78 | +- **Input**: Request to generate E2E code for JIRA issue key (e.g., "generate E2E test case for HIVE-2883") |
| 79 | +- **Action**: NEVER use Task tool |
| 80 | +- **PREREQUISITE CHECK**: Before generating E2E test code, MUST verify test case exists: |
| 81 | + 1. Only check if test case file exists in `test_artifacts/{COMPONENT}/{JIRA_KEY}/test_cases/{JIRA_KEY}_test_case.md` |
| 82 | + 2. If test case does NOT exist, FIRST execute test_case_generation agent |
| 83 | + 3. Only proceed with E2E generation after test case is confirmed to exist |
| 84 | +- **Execution Steps:** |
| 85 | + 1. Read `config/agents/e2e_test_generation_openshift_private.yaml` |
| 86 | + 2. Read and analyze the generated test case from `test_artifacts/{COMPONENT}/{JIRA_KEY}/test_cases/{JIRA_KEY}_test_case.md` |
| 87 | + 3. Execute each subtask in `task.subtasks` section sequentially |
| 88 | + 4. Each subtask has its own steps and success_criteria |
| 89 | + 5. Use tools: Bash, Read, Write, Edit, WebFetch |
| 90 | + 6. Verify each subtask's success_criteria before proceeding |
| 91 | +- **Agent config**: `config/agents/e2e_test_generation_openshift_private.yaml` |
| 92 | +- **Output**: E2E test code integrated into openshift-tests-private repository |
| 93 | + |
| 94 | +### 2.1 Execute E2E Tests |
| 95 | +- **Input**: Run the generated E2E test cases and capture their outcomes |
| 96 | +- **Action**: NEVER use Task tool |
| 97 | +- **Execution Steps:** |
| 98 | + 1. Read `config/agents/test-executor.yaml` |
| 99 | + 2. Execute each subtask in `task.subtasks` section sequentially |
| 100 | + 3. Each subtask has its own steps and success_criteria |
| 101 | + 4. Use tools: Bash, Read, Write, Edit, WebFetch |
| 102 | + 5. Capture test results and logs |
| 103 | + 6. **Generate comprehensive test report** including test case coverage analysis and E2E execution results after successful test completion |
| 104 | +- **Agent config**: `config/agents/test-executor.yaml` |
| 105 | +- **Output**: Test execution results and comprehensive test reports |
| 106 | + |
| 107 | +### 3. Submit E2E Pull Request |
| 108 | +- **Input**: Request to create PR for generated E2E tests |
| 109 | +- **Action**: NEVER use Task tool |
| 110 | +- **Execution Steps:** |
| 111 | + 1. Read `config/agents/e2e_test_generation_openshift_private.yaml` to identify where E2E test code was generated |
| 112 | + 2. Navigate to the E2E test code location and verify test files exist |
| 113 | + 3. Load and apply PR submission rules from `config/rules/pr_submission_rules.yaml` |
| 114 | + 4. Use GitHub CLI (gh) to create pull request with hold status |
| 115 | +- **Tools**: Bash (git, gh CLI), Read, Write |
| 116 | +- **Output**: Created pull request with E2E test code and JIRA updated |
| 117 | + |
| 118 | +### 4. Update JIRA QE Comment [In Progress] |
| 119 | +- **Input**: Request to add QE comment to update QE test status |
| 120 | + |
| 121 | +## Agent Usage Examples |
| 122 | + |
| 123 | +**CRITICAL: When a user requests to "generate test cases and run them", Claude MUST execute test_case_generation → e2e_test_generation_openshift_private → test-executor sequentially, performing all steps and verifying outputs at each stage, even if this request occurs in the same conversation. DO NOT STOP ANY STEPS.** |
| 124 | + |
| 125 | +### MANDATORY STEP-BY-STEP EXECUTION PROTOCOL |
| 126 | + |
| 127 | +**BEFORE STARTING ANY AGENT:** |
| 128 | +1. **Read agent YAML config completely** - Use Read tool to load entire config file |
| 129 | +2. **Execute steps in EXACT sequence** - Must complete step N before starting step N+1 |
| 130 | +3. **Verify each step's output** - Confirm step completion before proceeding to next step |
| 131 | +4. **Use EXACT commands from config** - Copy commands exactly as written in agent YAML |
| 132 | +5. **NEVER skip, simplify, or combine steps** - Each step must be executed individually |
| 133 | + |
| 134 | +**VIOLATION PREVENTION RULES:** |
| 135 | +- If ANY step is skipped → STOP immediately and restart from skipped step |
| 136 | +- Each subtask completion MUST verify ALL steps executed before proceeding to next subtask |
| 137 | +- If using different commands than specified in config → VIOLATION, must use exact config commands |
| 138 | +- If combining multiple steps into one action → VIOLATION, must execute separately |
| 139 | + |
| 140 | + |
| 141 | +### Example: Complete Flow for HIVE-2883 |
| 142 | +``` |
| 143 | +User: "Create test case for HIVE-2883" |
| 144 | +→ Execute test_case_generation agent |
| 145 | +
|
| 146 | +User: "Generate E2E code for HIVE-2883" |
| 147 | +→ Execute e2e_test_generation_openshift_private agent |
| 148 | +
|
| 149 | +User: "Run the E2E tests for HIVE-2883" |
| 150 | +→ Execute test-executor agent |
| 151 | +
|
| 152 | +User: "Generate test cases and run them for HIVE-2883" |
| 153 | +→ Execute test_case_generation → e2e_test_generation_openshift_private → test-executor |
| 154 | +
|
| 155 | +User: "Create a Pull Request for HIVE-2883 E2E tests" |
| 156 | +→ Execute PR submission process |
| 157 | +
|
| 158 | +User: "Add QE comment to HIVE-2883" |
| 159 | +→ Execute JIRA QE comment update process |
| 160 | +``` |
| 161 | + |
| 162 | + |
| 163 | +## Key Rules |
| 164 | +- Always read agent YAML configs directly |
| 165 | +- Execute each step manually using available tools |
| 166 | +- Verify each step before proceeding |
| 167 | +- Follow agent configurations exactly |
| 168 | + |
0 commit comments