Human-Agent-in-the-Loop Development Workflow
Overview
This document defines the optimized Human-Agent-in-the-Loop Development workflow. Before implementation, a multi-stage process involving human-agent collaboration, design doc reviews, and adversarial subagent review loops is conducted to ensure correct direction, robust architecture, and a plan free of logical gaps.
Core Design Philosophy
- Design & Plan First: Conduct multiple rounds of design and plan "Doc Reviews" before writing code to minimize the cost of downstream rework.
- Human-Agent Collaboration: Humans control the macro direction and final reviews, the agent drafts the technical design and execution plans, and subagents perform static adversarial reviews (Issue reviews) to find gaps.
When to Use
Use when:
- Launching a new feature, large task, or complex bug fix that requires design decisions.
- Planning multi-step tasks or writing execution plans.
- Aligning with the human partner on architecture, API design, or database schemas.
Do NOT use for:
- Simple one-line bug fixes or minor configuration adjustments with no structural impact.
Planning & Design Flowchart
graph TD
%% Style Definitions
classDef startEnd fill:#22543d,stroke:#2f855a,stroke-width:2px,color:#c6f6d5;
classDef phase fill:#2d3748,stroke:#4a5568,stroke-width:2px,color:#fff;
classDef skill fill:#1a202c,stroke:#718096,stroke-dasharray: 5 5,stroke-width:1px,color:#cbd5e0;
classDef decision fill:#744210,stroke:#d69e2e,stroke-width:2px,color:#fefcbf;
classDef human fill:#2b6cb0,stroke:#4299e1,stroke-width:2px,color:#ebf8ff;
%% Nodes
Start([Start Task]):::startEnd
DiscussPhase["(1) Discuss Direction & Architecture<br>(Human-Agent Collaborative Discussion)"]:::human
Brainstorming["brainstorming (Exploration & Design)"]:::skill
WriteDesignDoc["(2) Write Design Document<br>(Agent drafts Design Doc)"]:::phase
HumanReviewDoc["(3) Human Initial Review<br>(Human Review)"]:::human
SubagentReviewDoc["(4) Subagent Review Doc<br>(Subagent Review Loop)"]:::phase
CheckDocIssues{"Are there Design Issues<br>or Medium/High Risks?"}:::decision
HumanReviewDocOptional["(5) Human Re-review Doc<br>(Human Review - Optional)"]:::human
WritePlan["(6) Write Execution Plan<br>(Agent drafts Plan)"]:::phase
WritingPlans["writing-plans (Drafting Plan)"]:::skill
SubagentReviewPlan["(7) Subagent Review Plan<br>(Subagent Review Loop)"]:::phase
CheckPlanIssues{"Are there Plan Issues<br>or Medium/High Risks?"}:::decision
HumanFinalReview["(8) Human Final Review<br>(Human Final Approval)"]:::human
ImplementPhase["(9) Enter Implementation & Verification<br>(TDD & Code Reviews)"]:::phase
Done([Done<br>bash complete]):::startEnd
%% Connections
Start --> DiscussPhase
DiscussPhase -.-> Brainstorming
DiscussPhase --> WriteDesignDoc
WriteDesignDoc --> HumanReviewDoc
HumanReviewDoc --> SubagentReviewDoc
SubagentReviewDoc --> CheckDocIssues
CheckDocIssues -- "Yes (High/Med Risks)" --> WriteDesignDoc
CheckDocIssues -- "No (No issues or Low Risk only)" --> HumanReviewDocOptional
HumanReviewDocOptional --> WritePlan
WritePlan -.-> WritingPlans
WritePlan --> SubagentReviewPlan
SubagentReviewPlan --> CheckPlanIssues
CheckPlanIssues -- "Yes (High/Med Risks)" --> WritePlan
CheckPlanIssues -- "No (No issues or Low Risk only)" --> HumanFinalReview
HumanFinalReview --> ImplementPhase
ImplementPhase --> Done
Detailed Steps & Skill Integration
| Step |
Node Name |
Owner / Method |
Coordinated Superpowers Skill & Details |
| (1) |
Discuss Direction & Architecture |
Human-Agent |
Use brainstorming to discuss macro architecture, align goals, and decide on the tech stack and core design direction. |
| (2) |
Write Design Document |
Agent (Main) |
Based on alignment, produce a detailed technical design document (Design Doc). |
| (3) |
Human Initial Review |
Human |
Human reviews the design document to ensure it has not drifted from the discussed architecture, providing initial feedback. |
| (4) |
Subagent Review Doc |
Subagent (Reviewer) |
Launch the code-reviewer subagent to perform an adversarial review. If gaps are found, revert to step (2) for correction until no issues or low risks remain. |
| (5) |
Human Re-review Doc |
Human (Optional) |
(Optional) Human confirms the final design doc optimized after the subagent review loop. |
| (6) |
Write Execution Plan |
Agent (Main) |
Use the writing-plans skill to break down the approved design document into concrete, executable checkpoints. |
| (7) |
Subagent Review Plan |
Subagent (Reviewer) |
Subagent reviews the execution plan to check if it covers all design details and if checkpoints are logical. Revert to step (6) if issues are found. |
| (8) |
Human Final Review |
Human |
Human performs final approval of the plan, providing the green light to begin coding. |
| (9) |
Enter Implementation & Verification |
Agent + Subagent |
Write code and tests following test-driven-development and verification-before-completion specifications. |
Human Checkpoint Note
Phases 3, 5, and 8 are human advisory checkpoints. The hail-loop.sh script enforces a hard gate at these boundaries: calling advance without --human-approved will be blocked. The agent MUST pause, present the artifact to the human partner, and only advance upon explicit approval using bash "$HAIL_SCRIPT" advance --human-approved. The loop-back path after a Phase 4 review failure (revert 2) implies re-entering Phase 3 for human confirmation before returning to Phase 4.
Subagent Review Loop Protocol
This is the decision protocol the agent MUST follow after each subagent review phase. It is the mechanism that makes the review loop self-correcting.
Severity Rubric
All subagent reviews MUST classify each finding using this rubric:
| Severity |
Definition |
Example |
| High |
Blocks the feature from working correctly, creates wrong architecture, or misses a critical requirement. Revert and fix immediately. |
"The design uses a stateless API but requires session-level consistency — this will silently corrupt data under concurrency." |
| Medium |
Significant gap, risk, or ambiguity that should be addressed before coding starts. Revert and fix unless the iteration cap is reached. |
"The error handling strategy for third-party API timeouts is undefined — downstream code will have nowhere to propagate this." |
| Low |
Minor improvement, nice-to-have, or edge case with low probability. Log and accept; do NOT revert. |
"The naming convention for internal events is inconsistent across sections." |
The reviewer MUST end the response with one of:
"VERDICT: No Medium/High issues found." — agent calls advance
"VERDICT: Medium/High issues found (listed above)." — agent evaluates iteration cap, then calls revert or escalates
Iteration Cap & Escalation
hail-loop.sh enforces a cap of 10 review iterations per loop (configurable via MAX_REVIEW_ITERATIONS). When the cap is reached:
advance to Phase 4 or 7 will print a ⚠️ ITERATION CAP REACHED warning
revert for the canonical paths (4→2, 7→6) is blocked and prints a 🚨 ESCALATE message
- The agent must stop looping and present all outstanding issues to the human for a final decision
- The human may accept the risks, request one more targeted fix (using
revert --force), or choose to descope
Phase 4 — Subagent Review Doc
Dispatch a code-reviewer subagent with the design doc as input. Use this prompt template:
"Perform an adversarial review of the attached design document. Identify logical gaps, missing edge cases, undefined error handling, and architectural risks.
Classify each finding as High, Medium, or Low:
- High: Blocks feature from working, creates wrong architecture, or misses a critical requirement.
- Medium: Significant gap, risk, or ambiguity that should be addressed before coding.
- Low: Minor improvement, nice-to-have, or low probability edge case.
End with: VERDICT: No Medium/High issues found. OR VERDICT: Medium/High issues found (listed above)."
Read the VERDICT line and evaluate:
- "No Medium/High issues found" → call
advance, proceed to Phase 5
- "Medium/High issues found" AND iteration count < cap → call
revert 2, fix the design doc, re-enter Phase 3 (human review), then return to Phase 4
- "Medium/High issues found" AND cap reached (
🚨 ESCALATE message) → present all outstanding issues to the human for a final decision; do NOT call revert without human approval
# Review passed
bash "$HAIL_SCRIPT" advance
# Review failed, iteration count below cap
bash "$HAIL_SCRIPT" revert 2
# Cap reached — only with explicit human approval
bash "$HAIL_SCRIPT" revert --force 2
Phase 7 — Subagent Review Plan
Dispatch a code-reviewer subagent with the execution plan as input. Use this prompt template:
"Perform an adversarial review of the attached execution plan. Verify it covers all requirements from the design doc, that each checkpoint is concrete and independently verifiable, and that the implementation order is logically sound.
Classify each finding as High, Medium, or Low:
- High: Blocks feature from working, creates wrong architecture, or misses a critical requirement.
- Medium: Significant gap, risk, or ambiguity that should be addressed before coding.
- Low: Minor improvement, nice-to-have, or low probability edge case.
End with: VERDICT: No Medium/High issues found. OR VERDICT: Medium/High issues found (listed above)."
Read the VERDICT line and evaluate:
- "No Medium/High issues found" → call
advance, proceed to Phase 8
- "Medium/High issues found" AND iteration count < cap → call
revert 6, fix the plan, re-enter Phase 7
- "Medium/High issues found" AND cap reached → escalate to human; do NOT revert without approval
# Review passed
bash "$HAIL_SCRIPT" advance
# Review failed, iteration count below cap
bash "$HAIL_SCRIPT" revert 6
# Cap reached — only with explicit human approval
bash "$HAIL_SCRIPT" revert --force 6
HAIL Loop Script Control
This skill provides a dedicated workflow state management and loop control script. The agent can invoke this script to initialize state, check progress, advance phases, or revert to an earlier phase when a review fails.
Setup
Locate the script once at the start of a session and store it in a variable:
PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
HAIL_SCRIPT=$(find "$HOME/.gemini/skills" "$PROJECT_ROOT" -name hail-loop.sh 2>/dev/null | head -1)
Use $HAIL_SCRIPT in all commands below. Anchoring to PROJECT_ROOT ensures the script is found regardless of which subdirectory the agent is currently in.
Usage
Initialize HAIL Loop:
bash "$HAIL_SCRIPT" init [DESIGN_DOC_PATH] [PLAN_PATH]
# If a loop is already active, use --force to overwrite:
bash "$HAIL_SCRIPT" init --force [DESIGN_DOC_PATH] [PLAN_PATH]
Check Current Status & Next Steps:
bash "$HAIL_SCRIPT" status
Advance to the Next Phase (after a step completes or a review passes):
bash "$HAIL_SCRIPT" advance
# At Human Review Phases (3, 5, 8), you MUST pass --human-approved:
bash "$HAIL_SCRIPT" advance --human-approved
Revert to a Previous Phase (after a review finds Medium/High issues):
bash "$HAIL_SCRIPT" revert <PHASE_NUMBER>
# Blocked at the iteration cap — use --force only with human approval:
bash "$HAIL_SCRIPT" revert --force <PHASE_NUMBER>
Common revert targets:
revert 2 — design doc review (Phase 4) found issues → rewrite design doc
revert 6 — plan review (Phase 7) found issues → rewrite plan
Mark Workflow Complete (after implementation is done):
bash "$HAIL_SCRIPT" complete
Marks active: false and preserves state for reference. After complete, init can be run without --force to start a new workflow.
Reset or Cancel the Loop:
bash "$HAIL_SCRIPT" cancel
State Tracking
Workflow state is stored at $PROJECT_ROOT/.gemini/hail-state-<branch>.json (project-root relative, not cwd-relative — safe across subdirectory changes). Fields include phase, doc_review_iterations, plan_review_iterations, and timestamps — readable by both the agent and review subagents.
If the state file is corrupted or empty, run bash "$HAIL_SCRIPT" init --force to reset.
1---2name: human-agent-in-the-loop-development3description: Use when starting a NEW FEATURE, large task, or complex bug fix that requires design decisions, architecture alignment, or a multi-step execution plan. Do NOT use for one-line fixes, config tweaks, or any change with no structural impact.4---56# Human-Agent-in-the-Loop Development Workflow78## Overview9This document defines the optimized **Human-Agent-in-the-Loop Development** workflow. Before implementation, a multi-stage process involving human-agent collaboration, design doc reviews, and adversarial subagent review loops is conducted to ensure correct direction, robust architecture, and a plan free of logical gaps.1011## Core Design Philosophy12- **Design & Plan First**: Conduct multiple rounds of design and plan "Doc Reviews" before writing code to minimize the cost of downstream rework.13- **Human-Agent Collaboration**: Humans control the macro direction and final reviews, the agent drafts the technical design and execution plans, and subagents perform static adversarial reviews (Issue reviews) to find gaps.1415## When to Use16Use when:17- Launching a new feature, large task, or complex bug fix that requires design decisions.18- Planning multi-step tasks or writing execution plans.19- Aligning with the human partner on architecture, API design, or database schemas.2021Do NOT use for:22- Simple one-line bug fixes or minor configuration adjustments with no structural impact.2324## Planning & Design Flowchart2526```mermaid27graph TD28 %% Style Definitions29 classDef startEnd fill:#22543d,stroke:#2f855a,stroke-width:2px,color:#c6f6d5;30 classDef phase fill:#2d3748,stroke:#4a5568,stroke-width:2px,color:#fff;31 classDef skill fill:#1a202c,stroke:#718096,stroke-dasharray: 5 5,stroke-width:1px,color:#cbd5e0;32 classDef decision fill:#744210,stroke:#d69e2e,stroke-width:2px,color:#fefcbf;33 classDef human fill:#2b6cb0,stroke:#4299e1,stroke-width:2px,color:#ebf8ff;3435 %% Nodes36 Start([Start Task]):::startEnd37 38 DiscussPhase["(1) Discuss Direction & Architecture<br>(Human-Agent Collaborative Discussion)"]:::human39 Brainstorming["brainstorming (Exploration & Design)"]:::skill40 41 WriteDesignDoc["(2) Write Design Document<br>(Agent drafts Design Doc)"]:::phase42 43 HumanReviewDoc["(3) Human Initial Review<br>(Human Review)"]:::human44 45 SubagentReviewDoc["(4) Subagent Review Doc<br>(Subagent Review Loop)"]:::phase46 CheckDocIssues{"Are there Design Issues<br>or Medium/High Risks?"}:::decision47 48 HumanReviewDocOptional["(5) Human Re-review Doc<br>(Human Review - Optional)"]:::human49 50 WritePlan["(6) Write Execution Plan<br>(Agent drafts Plan)"]:::phase51 WritingPlans["writing-plans (Drafting Plan)"]:::skill52 53 SubagentReviewPlan["(7) Subagent Review Plan<br>(Subagent Review Loop)"]:::phase54 CheckPlanIssues{"Are there Plan Issues<br>or Medium/High Risks?"}:::decision55 56 HumanFinalReview["(8) Human Final Review<br>(Human Final Approval)"]:::human57 58 ImplementPhase["(9) Enter Implementation & Verification<br>(TDD & Code Reviews)"]:::phase59 Done([Done<br>bash complete]):::startEnd6061 %% Connections62 Start --> DiscussPhase63 DiscussPhase -.-> Brainstorming64 DiscussPhase --> WriteDesignDoc65 WriteDesignDoc --> HumanReviewDoc66 HumanReviewDoc --> SubagentReviewDoc67 SubagentReviewDoc --> CheckDocIssues68 69 CheckDocIssues -- "Yes (High/Med Risks)" --> WriteDesignDoc70 CheckDocIssues -- "No (No issues or Low Risk only)" --> HumanReviewDocOptional71 72 HumanReviewDocOptional --> WritePlan73 WritePlan -.-> WritingPlans74 WritePlan --> SubagentReviewPlan75 SubagentReviewPlan --> CheckPlanIssues76 77 CheckPlanIssues -- "Yes (High/Med Risks)" --> WritePlan78 CheckPlanIssues -- "No (No issues or Low Risk only)" --> HumanFinalReview79 80 HumanFinalReview --> ImplementPhase81 ImplementPhase --> Done82```8384## Detailed Steps & Skill Integration8586| Step | Node Name | Owner / Method | Coordinated Superpowers Skill & Details |87| :--- | :--- | :--- | :--- |88| **(1)** | **Discuss Direction & Architecture** | Human-Agent | Use `brainstorming` to discuss macro architecture, align goals, and decide on the tech stack and core design direction. |89| **(2)** | **Write Design Document** | Agent (Main) | Based on alignment, produce a detailed technical design document (Design Doc). |90| **(3)** | **Human Initial Review** | Human | Human reviews the design document to ensure it has not drifted from the discussed architecture, providing initial feedback. |91| **(4)** | **Subagent Review Doc** | Subagent (Reviewer) | Launch the `code-reviewer` subagent to perform an adversarial review. If gaps are found, revert to step (2) for correction until no issues or low risks remain. |92| **(5)** | **Human Re-review Doc** | Human (Optional) | (Optional) Human confirms the final design doc optimized after the subagent review loop. |93| **(6)** | **Write Execution Plan** | Agent (Main) | Use the `writing-plans` skill to break down the approved design document into concrete, executable checkpoints. |94| **(7)** | **Subagent Review Plan** | Subagent (Reviewer) | Subagent reviews the execution plan to check if it covers all design details and if checkpoints are logical. Revert to step (6) if issues are found. |95| **(8)** | **Human Final Review** | Human | Human performs final approval of the plan, providing the green light to begin coding. |96| **(9)** | **Enter Implementation & Verification** | Agent + Subagent | Write code and tests following `test-driven-development` and `verification-before-completion` specifications. |9798### Human Checkpoint Note99100Phases 3, 5, and 8 are **human advisory checkpoints**. The `hail-loop.sh` script enforces a hard gate at these boundaries: calling `advance` without `--human-approved` will be blocked. The agent MUST pause, present the artifact to the human partner, and only advance upon explicit approval using `bash "$HAIL_SCRIPT" advance --human-approved`. The loop-back path after a Phase 4 review failure (`revert 2`) implies re-entering Phase 3 for human confirmation before returning to Phase 4.101102## Subagent Review Loop Protocol103104This is the decision protocol the agent MUST follow after each subagent review phase. It is the mechanism that makes the review loop self-correcting.105106### Severity Rubric107108All subagent reviews MUST classify each finding using this rubric:109110| Severity | Definition | Example |111| :--- | :--- | :--- |112| **High** | Blocks the feature from working correctly, creates wrong architecture, or misses a critical requirement. Revert and fix immediately. | "The design uses a stateless API but requires session-level consistency — this will silently corrupt data under concurrency." |113| **Medium** | Significant gap, risk, or ambiguity that should be addressed before coding starts. Revert and fix unless the iteration cap is reached. | "The error handling strategy for third-party API timeouts is undefined — downstream code will have nowhere to propagate this." |114| **Low** | Minor improvement, nice-to-have, or edge case with low probability. Log and accept; do NOT revert. | "The naming convention for internal events is inconsistent across sections." |115116The reviewer MUST end the response with one of:117- `"VERDICT: No Medium/High issues found."` — agent calls `advance`118- `"VERDICT: Medium/High issues found (listed above)."` — agent evaluates iteration cap, then calls `revert` or escalates119120### Iteration Cap & Escalation121122`hail-loop.sh` enforces a cap of **10 review iterations** per loop (configurable via `MAX_REVIEW_ITERATIONS`). When the cap is reached:123- `advance` to Phase 4 or 7 will print a `⚠️ ITERATION CAP REACHED` warning124- `revert` for the canonical paths (4→2, 7→6) is **blocked** and prints a `🚨 ESCALATE` message125- The agent must stop looping and present all outstanding issues to the human for a final decision126- The human may accept the risks, request one more targeted fix (using `revert --force`), or choose to descope127128### Phase 4 — Subagent Review Doc1291301. Dispatch a `code-reviewer` subagent with the design doc as input. Use this prompt template:131132 > "Perform an adversarial review of the attached design document. Identify logical gaps, missing edge cases, undefined error handling, and architectural risks.133 > Classify each finding as High, Medium, or Low:134 > - High: Blocks feature from working, creates wrong architecture, or misses a critical requirement.135 > - Medium: Significant gap, risk, or ambiguity that should be addressed before coding.136 > - Low: Minor improvement, nice-to-have, or low probability edge case.137 > End with: VERDICT: No Medium/High issues found. OR VERDICT: Medium/High issues found (listed above)."1381392. Read the VERDICT line and evaluate:140 - **"No Medium/High issues found"** → call `advance`, proceed to Phase 5141 - **"Medium/High issues found"** AND iteration count < cap → call `revert 2`, fix the design doc, re-enter Phase 3 (human review), then return to Phase 4142 - **"Medium/High issues found"** AND cap reached (`🚨 ESCALATE` message) → present all outstanding issues to the human for a final decision; do NOT call `revert` without human approval143144```bash145# Review passed146bash "$HAIL_SCRIPT" advance147148# Review failed, iteration count below cap149bash "$HAIL_SCRIPT" revert 2150151# Cap reached — only with explicit human approval152bash "$HAIL_SCRIPT" revert --force 2153```154155### Phase 7 — Subagent Review Plan1561571. Dispatch a `code-reviewer` subagent with the execution plan as input. Use this prompt template:158159 > "Perform an adversarial review of the attached execution plan. Verify it covers all requirements from the design doc, that each checkpoint is concrete and independently verifiable, and that the implementation order is logically sound.160 > Classify each finding as High, Medium, or Low:161 > - High: Blocks feature from working, creates wrong architecture, or misses a critical requirement.162 > - Medium: Significant gap, risk, or ambiguity that should be addressed before coding.163 > - Low: Minor improvement, nice-to-have, or low probability edge case.164 > End with: VERDICT: No Medium/High issues found. OR VERDICT: Medium/High issues found (listed above)."1651662. Read the VERDICT line and evaluate:167 - **"No Medium/High issues found"** → call `advance`, proceed to Phase 8168 - **"Medium/High issues found"** AND iteration count < cap → call `revert 6`, fix the plan, re-enter Phase 7169 - **"Medium/High issues found"** AND cap reached → escalate to human; do NOT revert without approval170171```bash172# Review passed173bash "$HAIL_SCRIPT" advance174175# Review failed, iteration count below cap176bash "$HAIL_SCRIPT" revert 6177178# Cap reached — only with explicit human approval179bash "$HAIL_SCRIPT" revert --force 6180```181182## HAIL Loop Script Control183184This skill provides a dedicated workflow state management and loop control script. The agent can invoke this script to initialize state, check progress, advance phases, or revert to an earlier phase when a review fails.185186### Setup187188Locate the script once at the start of a session and store it in a variable:189190```bash191PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)192HAIL_SCRIPT=$(find "$HOME/.gemini/skills" "$PROJECT_ROOT" -name hail-loop.sh 2>/dev/null | head -1)193```194195Use `$HAIL_SCRIPT` in all commands below. Anchoring to `PROJECT_ROOT` ensures the script is found regardless of which subdirectory the agent is currently in.196197### Usage1981991. **Initialize HAIL Loop**:200 ```bash201 bash "$HAIL_SCRIPT" init [DESIGN_DOC_PATH] [PLAN_PATH]202 # If a loop is already active, use --force to overwrite:203 bash "$HAIL_SCRIPT" init --force [DESIGN_DOC_PATH] [PLAN_PATH]204 ```2052062. **Check Current Status & Next Steps**:207 ```bash208 bash "$HAIL_SCRIPT" status209 ```2102113. **Advance to the Next Phase** (after a step completes or a review passes):212 ```bash213 bash "$HAIL_SCRIPT" advance214 # At Human Review Phases (3, 5, 8), you MUST pass --human-approved:215 bash "$HAIL_SCRIPT" advance --human-approved216 ```2172184. **Revert to a Previous Phase** (after a review finds Medium/High issues):219 ```bash220 bash "$HAIL_SCRIPT" revert <PHASE_NUMBER>221 # Blocked at the iteration cap — use --force only with human approval:222 bash "$HAIL_SCRIPT" revert --force <PHASE_NUMBER>223 ```224 Common revert targets:225 - `revert 2` — design doc review (Phase 4) found issues → rewrite design doc226 - `revert 6` — plan review (Phase 7) found issues → rewrite plan2272285. **Mark Workflow Complete** (after implementation is done):229 ```bash230 bash "$HAIL_SCRIPT" complete231 ```232 Marks `active: false` and preserves state for reference. After `complete`, `init` can be run without `--force` to start a new workflow.2332346. **Reset or Cancel the Loop**:235 ```bash236 bash "$HAIL_SCRIPT" cancel237 ```238239### State Tracking240Workflow state is stored at `$PROJECT_ROOT/.gemini/hail-state-<branch>.json` (project-root relative, not cwd-relative — safe across subdirectory changes). Fields include `phase`, `doc_review_iterations`, `plan_review_iterations`, and timestamps — readable by both the agent and review subagents.241242If the state file is corrupted or empty, run `bash "$HAIL_SCRIPT" init --force` to reset.