|
| 1 | +# ExecPlan Guide |
| 2 | + |
| 3 | +This document is adapted from [OpenAI's ExecPlan](https://developers.openai.com/cookbook/articles/codex_exec_plans) guidance and tailored to the needs of this repository. |
| 4 | + |
| 5 | +It defines how execution plans (ExecPlans) should be written and maintained in this codebase. |
| 6 | + |
| 7 | +ExecPlans are meant for tasks like these: |
| 8 | + |
| 9 | +- Tasks that cannot realistically be completed in one or two exchanges |
| 10 | +- Work that spans multiple steps, files, or experiments |
| 11 | +- Investigations that need recorded evidence, decisions, intermediate findings, and current status |
| 12 | +- Long efforts where context can easily drift if it is not written down |
| 13 | + |
| 14 | +If the task is just a very small change, a simple bug fix, or a single-file adjustment, a separate ExecPlan is usually unnecessary. |
| 15 | + |
| 16 | +## 1. What an ExecPlan Is |
| 17 | + |
| 18 | +An ExecPlan is not a casual TODO list and not a lightweight checklist. |
| 19 | + |
| 20 | +It is a living execution document that should answer questions like: |
| 21 | + |
| 22 | +- What problem is being solved? |
| 23 | +- Why is it worth doing? |
| 24 | +- What is already known? |
| 25 | +- What exactly happens next? |
| 26 | +- How do we know the result is correct? |
| 27 | +- What did we learn along the way? |
| 28 | +- Why did the plan change midway? |
| 29 | + |
| 30 | +A good ExecPlan should let someone who does not know the previous conversation pick up the task and continue with reasonable confidence. |
| 31 | + |
| 32 | +## 2. When to Use an ExecPlan |
| 33 | + |
| 34 | +Create or update an ExecPlan when one or more of the following is true: |
| 35 | + |
| 36 | +1. The task will likely take significant time or span multiple conversations |
| 37 | +2. The work combines at least two of: research, experimentation, debugging, implementation |
| 38 | +3. The task touches multiple modules, files, or evidence sources |
| 39 | +4. There is meaningful uncertainty and assumptions need to be validated first |
| 40 | +5. The task needs a record of why a decision was made, not just what changed |
| 41 | +6. The task may be paused and resumed later |
| 42 | + |
| 43 | +Typical examples: |
| 44 | + |
| 45 | +- Aligning gem5 behavior with RTL |
| 46 | +- Investigating frontend / BPU / FTQ / flush / redirect behavior |
| 47 | +- Analyzing a performance regression |
| 48 | +- Landing a larger refactor |
| 49 | +- Building a feature that must be implemented in phases |
| 50 | +- Prototyping before committing to a final design |
| 51 | + |
| 52 | +## 3. Writing Principles |
| 53 | + |
| 54 | +### 3.0 Language |
| 55 | + |
| 56 | +By default, ExecPlans may be written in Chinese for internal development efficiency. |
| 57 | + |
| 58 | +Use English when the expected audience includes external contributors, or when the plan is intended to be referenced from public-facing documentation, PR discussion, or broader cross-team communication. |
| 59 | + |
| 60 | +### 3.1 Self-Contained |
| 61 | + |
| 62 | +An ExecPlan should be as self-contained as possible. |
| 63 | + |
| 64 | +Do not assume the reader remembers earlier chat history, and do not write things like "same as discussed above". |
| 65 | + |
| 66 | +If background is necessary to move the task forward, write it into the current document. |
| 67 | + |
| 68 | +### 3.2 Outcome-Oriented |
| 69 | + |
| 70 | +Do not stop at "change function X" or "add field Y". |
| 71 | + |
| 72 | +Explain: |
| 73 | + |
| 74 | +- What effect you expect |
| 75 | +- What the user or developer should be able to observe afterward |
| 76 | +- How that outcome will be validated |
| 77 | + |
| 78 | +### 3.3 Evidence-Oriented |
| 79 | + |
| 80 | +Especially for analysis tasks, do not write guesses as if they were facts. |
| 81 | + |
| 82 | +Clearly separate: |
| 83 | + |
| 84 | +- confirmed facts |
| 85 | +- current hypotheses |
| 86 | +- open questions |
| 87 | +- the evidence supporting a conclusion |
| 88 | + |
| 89 | +### 3.4 Continuously Updated |
| 90 | + |
| 91 | +An ExecPlan is a living document, not a one-time writeup. |
| 92 | + |
| 93 | +As the work progresses, update: |
| 94 | + |
| 95 | +- current status |
| 96 | +- new findings |
| 97 | +- decision changes |
| 98 | +- next actions |
| 99 | + |
| 100 | +### 3.5 Explain Why First |
| 101 | + |
| 102 | +Implementation details can be expanded later, but important decisions must include their rationale. |
| 103 | + |
| 104 | +Someone picking up the task later should be able to understand why this approach was chosen instead of another one. |
| 105 | + |
| 106 | +## 4. Recommended Location |
| 107 | + |
| 108 | +Prefer one ExecPlan file per complex task rather than putting everything into one large document. |
| 109 | + |
| 110 | +By default, ExecPlan instances should be treated as local working documents instead of repository-tracked artifacts. They are useful as intermediate notes during long investigations, but they are often too noisy and task-specific to keep in git by default. |
| 111 | + |
| 112 | +Recommended local directory structure: |
| 113 | + |
| 114 | +```text |
| 115 | +docs/ |
| 116 | + exec-plans/ |
| 117 | + active/ |
| 118 | + completed/ |
| 119 | + blocked/ |
| 120 | +``` |
| 121 | + |
| 122 | +Meaning: |
| 123 | + |
| 124 | +- `active/`: tasks currently in progress |
| 125 | +- `completed/`: finished tasks kept locally for later reference |
| 126 | +- `blocked/`: tasks paused pending external conditions |
| 127 | + |
| 128 | +Use concise, descriptive file names, for example: |
| 129 | + |
| 130 | +- `docs/exec-plans/active/gem5-rtl-fetch-align.md` |
| 131 | +- `docs/exec-plans/active/bpu-override-investigation.md` |
| 132 | +- `docs/exec-plans/active/spec06-regression-debug.md` |
| 133 | + |
| 134 | +Only commit an ExecPlan when there is explicit value in sharing it through the repository, such as cross-person handoff, review, or preserving a decision record that should live with the codebase. |
| 135 | + |
| 136 | +## 5. Recommended Structure |
| 137 | + |
| 138 | +Each ExecPlan should usually contain at least the following sections. |
| 139 | + |
| 140 | +## Title |
| 141 | + |
| 142 | +Use a short sentence that describes the goal. |
| 143 | +The title should prefer "action + object" over vague naming. |
| 144 | + |
| 145 | +For example: |
| 146 | + |
| 147 | +- Align gem5 frontend flush behavior with RTL |
| 148 | +- Investigate the IPC regression of a SPEC06 benchmark |
| 149 | +- Add verifiable observability for BPU override |
| 150 | + |
| 151 | +--- |
| 152 | + |
| 153 | +## Background and Goal |
| 154 | + |
| 155 | +Use a few paragraphs to explain: |
| 156 | + |
| 157 | +- what the current problem is |
| 158 | +- why it matters |
| 159 | +- what result should be achieved |
| 160 | +- how that result will be observed |
| 161 | + |
| 162 | +Focus first on the value of the task and the end result, not on implementation details. |
| 163 | + |
| 164 | +--- |
| 165 | + |
| 166 | +## Current Known Information |
| 167 | + |
| 168 | +Record the facts, observations, and constraints already confirmed. |
| 169 | +This can include: |
| 170 | + |
| 171 | +- relevant modules, files, and paths |
| 172 | +- current behavior and how it differs from expectations |
| 173 | +- logs, counters, traces, waveforms, or test results already observed |
| 174 | +- environment constraints |
| 175 | + |
| 176 | +Do not write guesses as facts in this section. |
| 177 | + |
| 178 | +## Hypotheses and Open Questions |
| 179 | + |
| 180 | +If uncertainty remains, list it explicitly. For example: |
| 181 | + |
| 182 | +- We currently suspect the issue is the timing of override activation |
| 183 | +- We are not yet sure whether the second target comes from mainBTB |
| 184 | +- We need to verify whether a counter covers the split-request case |
| 185 | + |
| 186 | +The purpose of this section is to keep the analysis from becoming muddled over time. |
| 187 | + |
| 188 | +--- |
| 189 | + |
| 190 | +## Planned Steps |
| 191 | + |
| 192 | +List the next steps in order. |
| 193 | +Each step should ideally be written as "action + goal + expected output". |
| 194 | + |
| 195 | +For example: |
| 196 | + |
| 197 | +1. Read the frontend redirect path and confirm the actual control flow in gem5 |
| 198 | +2. Cross-check RTL documentation and implementation, then summarize the flush taxonomy |
| 199 | +3. Add the required logs or counters and construct a minimal reproduction |
| 200 | +4. Run the chosen workload and verify whether the behavior converges |
| 201 | +5. Decide whether to keep the current approach or revise it based on the results |
| 202 | + |
| 203 | +Avoid cryptic shorthand that only the original author can understand. |
| 204 | + |
| 205 | +--- |
| 206 | + |
| 207 | +## Validation |
| 208 | + |
| 209 | +Always specify how success will be judged. |
| 210 | + |
| 211 | +Validation may mean: |
| 212 | + |
| 213 | +- tests pass |
| 214 | +- logs match expectations |
| 215 | +- counters move in the expected direction |
| 216 | +- a workload now behaves like RTL |
| 217 | +- a performance regression is eliminated |
| 218 | +- a scenario is reproducible and then fixed |
| 219 | + |
| 220 | +Even for analysis-only tasks, define what "done" means. For example: |
| 221 | + |
| 222 | +- root cause confirmed |
| 223 | +- minimal reproduction identified |
| 224 | +- candidate causes ruled out |
| 225 | +- a concrete recommendation for the next phase is available |
| 226 | + |
| 227 | +## Progress |
| 228 | + |
| 229 | +Progress must be updated continuously. |
| 230 | +Use checkboxes with timestamps. |
| 231 | + |
| 232 | +Example: |
| 233 | + |
| 234 | +- [x] 2026-03-24 10:00 Read the main frontend redirect path and identify the primary entry points |
| 235 | +- [x] 2026-03-24 11:20 Cross-check RTL docs and discover that the flush taxonomy differs from the earlier assumption |
| 236 | +- [ ] Add counters for the split-request case and verify whether `inflightLoads` fully covers it |
| 237 | +- [ ] Construct a minimal workload to validate the second-target selection logic |
| 238 | + |
| 239 | +If a step is only partially complete, say what has been finished and what remains. |
| 240 | + |
| 241 | +--- |
| 242 | + |
| 243 | +## Findings and Surprises |
| 244 | + |
| 245 | +Record important new findings that appear during the work. |
| 246 | +Especially note things like: |
| 247 | + |
| 248 | +- an earlier understanding was wrong |
| 249 | +- docs and code disagree |
| 250 | +- a counter definition is unreliable |
| 251 | +- a path is more important than expected |
| 252 | +- an experiment disproved an earlier hypothesis |
| 253 | + |
| 254 | +This section matters because long tasks often fail when important intermediate learning is not written down. |
| 255 | + |
| 256 | +--- |
| 257 | + |
| 258 | +## Decision Log |
| 259 | + |
| 260 | +Whenever an important decision is made or the direction changes, record it. |
| 261 | + |
| 262 | +Recommended format: |
| 263 | + |
| 264 | +- Decision: ... |
| 265 | +- Reason: ... |
| 266 | +- Date: ... |
| 267 | + |
| 268 | +For example: |
| 269 | + |
| 270 | +- Decision: add observability before changing behavior |
| 271 | +- Reason: the root cause is not fully confirmed yet, so changing behavior immediately is too risky |
| 272 | +- Date: 2026-03-24 |
0 commit comments