Skip to content

Commit 2cb2e92

Browse files
ZenusZhangzenusclaudeSihaoLiu
authored
Improve gen-plan convergence and task-tag routing (#35)
* feat: extract F2 gen-plan-convergence changes Cherry-picked from SHAs: c283a92 9c0eef7 5156a05 002308a 8ba3a57 437567b 3c8caf5 4a57429 821f225 Revert pair 5156a05+002308a included (net-zero; hooks/lib/loop-common.sh not in diff) Version files kept at origin/main values; version bump deferred per runbook 4.5 Fix: added missing append_task_tag_routing_note call in implementation-phase continuation * docs: add F2 gen-plan-convergence feature analysis * refactor(gen-plan): remove redundant sections, add discussion/direct mode Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: delete f2 analysis docs from branch Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * test(gen-plan): flip section assertions to absence checks, add mode flag tests - Flip Convergence Log and Codex Team Workflow presence→absence assertions - Add Convergence Status presence test - Add --discussion, --direct, and mutual-exclusion tests for validate script Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: initialize bitlesson.md for project knowledge base * fix(gen-plan): sync Plan Structure block with template, add AC-12 regression test - Fix Task Breakdown intro wording to match template exactly - Add Output File Convention section to gen-plan.md Plan Structure block - Add regression test verifying byte-for-byte sync between extracted block and template - Simplify awk pattern in test (idiomatic form, drop cat subprocess) * refactor: simplify code-simplifier improvements from finalize phase - tests/test-gen-plan.sh: remove redundant inner file guard, remove unused EXIT captures, add per-test comments for mode-flag tests - commands/gen-plan.md: clarify Phase 0 AUTO_START variable naming, move priority note to Phase 0.5 where resolution actually occurs * chore: revert version to 1.13.2, add gen-plan hard constraint and remove bitlesson.md Reverts version to 1.13.2 across plugin.json, marketplace.json, and README.md. Adds "Hard Constraint: No Coding During Plan Generation" section to gen-plan.md and clarifies auto-start fallback behavior. Removes bitlesson.md from repository. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: restore bitlesson.md (auto-initialized by rlcr setup) * fix(gen-plan): gate auto-start to discussion mode * Remove bitlesson and bump version to 1.14.1 * Skip stophook CI test on forks * Skip stophook test in GitHub Actions * Enable Claude review on fork PRs * Restore Claude review workflow from main * Fix silent drop of user questions on auto-start path (v1.14.2) Add Step 1.5 in Phase 6 to consolidate pending user decisions before the manual review gate takes effect. This step runs unconditionally and transfers Phase 3 QUESTIONS_FOR_USER and Phase 5 needs_user_decision items into the Pending User Decisions section, ensuring the auto-start gate in Phase 8 correctly blocks when unresolved questions exist. * Bump version to 1.15.0 --------- Co-authored-by: zenus <q18003877513@gmail.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Sihao Liu <sihao@cs.ucla.edu>
1 parent 8d8ab13 commit 2cb2e92

File tree

14 files changed

+828
-32
lines changed

14 files changed

+828
-32
lines changed

.claude-plugin/marketplace.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"name": "humanize",
99
"source": "./",
1010
"description": "Humanize - An iterative development plugin that uses Codex to review Claude's work. Creates a feedback loop where Claude implements plans and Codex independently reviews progress, ensuring quality through continuous refinement.",
11-
"version": "1.14.0"
11+
"version": "1.15.0"
1212
}
1313
]
1414
}

.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "humanize",
33
"description": "Humanize - An iterative development plugin that uses Codex to review Claude's work. Creates a feedback loop where Claude implements plans and Codex independently reviews progress, ensuring quality through continuous refinement.",
4-
"version": "1.14.0",
4+
"version": "1.15.0",
55
"author": {
66
"name": "humania-org"
77
},

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Humanize
22

3-
**Current Version: 1.14.0**
3+
**Current Version: 1.15.0**
44

55
> Derived from the [GAAC (GitHub-as-a-Context)](https://github.com/SihaoLiu/gaac) project.
66

commands/gen-plan.md

Lines changed: 300 additions & 16 deletions
Large diffs are not rendered by default.

commands/start-rlcr-loop.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ If the pre-check passed (or was skipped), execute the setup script to initialize
6767

6868
This command starts an iterative development loop where:
6969

70-
1. You work on the implementation plan provided
70+
1. You execute the implementation plan with task-tag routing
71+
- `coding` tasks: Claude executes directly
72+
- `analyze` tasks: execute via `/humanize:ask-codex`
7173
2. Write a summary of your work to the specified summary file
7274
3. When you try to exit, Codex reviews your summary
7375
4. If Codex finds issues, you receive feedback and continue
@@ -86,9 +88,11 @@ This loop uses a **Goal Tracker** to prevent goal drift across iterations:
8688

8789
### Key Features
8890
1. **Acceptance Criteria**: Each task maps to a specific AC - nothing can be "forgotten"
89-
2. **Plan Evolution Log**: If you discover the plan needs changes, document the change with justification
90-
3. **Explicit Deferrals**: Deferred tasks require strong justification and impact analysis
91-
4. **Full Alignment Checks**: At configurable intervals (default every 5 rounds: rounds 4, 9, 14, etc.), Codex conducts a comprehensive goal alignment audit. Use `--full-review-round N` to customize (min: 2)
91+
2. **Task Tag Routing**: Every task should carry `coding` or `analyze` tag from plan generation
92+
- `coding -> Claude`, `analyze -> Codex`
93+
3. **Plan Evolution Log**: If you discover the plan needs changes, document the change with justification
94+
4. **Explicit Deferrals**: Deferred tasks require strong justification and impact analysis
95+
5. **Full Alignment Checks**: At configurable intervals (default every 5 rounds: rounds 4, 9, 14, etc.), Codex conducts a comprehensive goal alignment audit. Use `--full-review-round N` to customize (min: 2)
9296

9397
### How to Use
9498
1. **Round 0**: Initialize the Goal Tracker with Ultimate Goal and Acceptance Criteria
@@ -113,7 +117,7 @@ This loop uses a **Goal Tracker** to prevent goal drift across iterations:
113117

114118
The RLCR loop has two phases within the active loop:
115119

116-
1. **Implementation Phase**: Work on the plan, Codex reviews your summary
120+
1. **Implementation Phase**: Work by task tags (`coding -> Claude`, `analyze -> /humanize:ask-codex`), then Codex reviews your summary
117121
2. **Review Phase**: After COMPLETE, `codex review` checks code quality with `[P0-9]` severity markers
118122

119123
The `--base-branch` option specifies the base branch for code review comparison. If not provided, it auto-detects from: remote default > local main > local master.

docs/usage.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,16 @@ OPTIONS:
5656
### gen-plan
5757

5858
```
59-
/humanize:gen-plan --input <path/to/draft.md> --output <path/to/plan.md>
59+
/humanize:gen-plan --input <path/to/draft.md> --output <path/to/plan.md> [OPTIONS]
6060
6161
OPTIONS:
6262
--input Path to the input draft file (required)
6363
--output Path to the output plan file (required)
64+
--auto-start-rlcr-if-converged
65+
Start the RLCR loop automatically when the plan is converged
66+
(discussion mode only; ignored in --direct)
67+
--discussion Use discussion mode (iterative Claude/Codex convergence rounds)
68+
--direct Use direct mode (skip convergence rounds, proceed immediately to plan)
6469
-h, --help Show help message
6570
6671
The gen-plan command transforms rough draft documents into structured implementation plans.
@@ -71,6 +76,7 @@ Workflow:
7176
3. Analyzes draft for clarity, consistency, completeness, and functionality
7277
4. Engages user to resolve any issues found
7378
5. Generates a structured plan.md with acceptance criteria
79+
6. Optionally starts `/humanize:start-rlcr-loop` if `--auto-start-rlcr-if-converged` conditions are met
7480
```
7581

7682
### start-pr-loop

hooks/loop-codex-stop-hook.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,22 @@ Focus on the code changes made during this RLCR session. Focus more on changes b
11631163
exit 0
11641164
}
11651165

1166+
# Append task tag routing reminder to follow-up prompts.
1167+
# Arguments: $1=prompt_file_path
1168+
append_task_tag_routing_note() {
1169+
local prompt_file="$1"
1170+
1171+
cat >> "$prompt_file" << 'ROUTING_EOF'
1172+
1173+
## Task Tag Routing Reminder
1174+
1175+
Follow the plan's per-task routing tags strictly:
1176+
- `coding` task -> Claude executes directly
1177+
- `analyze` task -> execute via `/humanize:ask-codex`, then integrate the result
1178+
- Keep Goal Tracker Active Tasks columns `Tag` and `Owner` aligned with execution
1179+
ROUTING_EOF
1180+
}
1181+
11661182
# Continue review loop when issues are found
11671183
# Arguments: $1=round_number, $2=review_content
11681184
continue_review_loop_with_issues() {
@@ -1198,6 +1214,7 @@ You are in the **Review Phase** of the RLCR loop. Codex has performed a code rev
11981214
load_and_render_safe "$TEMPLATE_DIR" "claude/review-phase-prompt.md" "$fallback" \
11991215
"REVIEW_CONTENT=$review_content" \
12001216
"SUMMARY_FILE=$next_summary_file" > "$next_prompt_file"
1217+
append_task_tag_routing_note "$next_prompt_file"
12011218

12021219
jq -n \
12031220
--arg reason "$(cat "$next_prompt_file")" \
@@ -1625,6 +1642,7 @@ FOOTER_FALLBACK="## Before Exiting
16251642
Commit your changes and write summary to {{NEXT_SUMMARY_FILE}}"
16261643
load_and_render_safe "$TEMPLATE_DIR" "claude/next-round-footer.md" "$FOOTER_FALLBACK" \
16271644
"NEXT_SUMMARY_FILE=$NEXT_SUMMARY_FILE" >> "$NEXT_PROMPT_FILE"
1645+
append_task_tag_routing_note "$NEXT_PROMPT_FILE"
16281646

16291647
# Add push instruction only if push_every_round is true
16301648
if [[ "$PUSH_EVERY_ROUND" == "true" ]]; then

prompt-template/plan/gen-plan-template.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,55 @@ Example: "The implementation includes core feature X with basic validation"
6666

6767
<Describe relative dependencies between components, not time estimates>
6868

69+
## Task Breakdown
70+
71+
Each task must include exactly one routing tag:
72+
- `coding`: implemented by Claude
73+
- `analyze`: executed via Codex (`/humanize:ask-codex`)
74+
75+
| Task ID | Description | Target AC | Tag (`coding`/`analyze`) | Depends On |
76+
|---------|-------------|-----------|----------------------------|------------|
77+
| task1 | <...> | AC-1 | coding | - |
78+
| task2 | <...> | AC-2 | analyze | task1 |
79+
80+
## Claude-Codex Deliberation
81+
82+
### Agreements
83+
- <Point both sides agree on>
84+
85+
### Resolved Disagreements
86+
- <Topic>: Claude vs Codex summary, chosen resolution, and rationale
87+
88+
### Convergence Status
89+
- Final Status: `converged` or `partially_converged`
90+
91+
## Pending User Decisions
92+
93+
- DEC-1: <Decision topic>
94+
- Claude Position: <...>
95+
- Codex Position: <...>
96+
- Tradeoff Summary: <...>
97+
- Decision Status: `PENDING` or `<User's final decision>`
98+
6999
## Implementation Notes
70100

71101
### Code Style Requirements
72102
- Implementation code and comments must NOT contain plan-specific terminology such as "AC-", "Milestone", "Step", "Phase", or similar workflow markers
73103
- These terms are for plan documentation only, not for the resulting codebase
74104
- Use descriptive, domain-appropriate naming in code instead
105+
106+
## Output File Convention
107+
108+
This template is used to produce the main output file (e.g., `plan.md`).
109+
110+
### Chinese Variant (`_zh` file)
111+
112+
When `chinese_plan=true` is set in `.humanize/config.json`, a `_zh` variant of the output file is also written after the main file. The `_zh` filename is constructed by inserting `_zh` immediately before the file extension:
113+
114+
- `plan.md` becomes `plan_zh.md`
115+
- `docs/my-plan.md` becomes `docs/my-plan_zh.md`
116+
- `output` (no extension) becomes `output_zh`
117+
118+
The `_zh` file contains a full Chinese translation of the English plan. All identifiers (`AC-*`, task IDs, file paths, API names, command flags) remain unchanged, as they are language-neutral.
119+
120+
When `chinese_plan=false` (the default), or when `.humanize/config.json` does not exist, or when the `chinese_plan` field is absent, the `_zh` file is NOT written. A missing config file is not an error.

scripts/setup-rlcr-loop.sh

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ DESCRIPTION:
9999
3. Has two phases: Implementation Phase and Review Phase
100100
101101
The flow:
102-
1. Claude works on the plan (Implementation Phase)
102+
1. Claude executes plan tasks with tag-based routing (Implementation Phase)
103+
- `coding` tasks: Claude implements directly
104+
- `analyze` tasks: Claude delegates execution via `/humanize:ask-codex`
103105
2. Claude writes a summary to round-N-summary.md
104106
3. On exit attempt, Codex reviews the summary
105107
4. If Codex finds issues, it blocks exit and sends feedback
@@ -929,10 +931,10 @@ cat >> "$GOAL_TRACKER_FILE" << 'GOAL_TRACKER_EOF'
929931
| 0 | Initial plan | - | - |
930932
931933
#### Active Tasks
932-
<!-- Map each task to its target Acceptance Criterion -->
933-
| Task | Target AC | Status | Notes |
934-
|------|-----------|--------|-------|
935-
| [To be populated by Claude based on plan] | - | pending | - |
934+
<!-- Map each task to its target Acceptance Criterion and routing tag -->
935+
| Task | Target AC | Status | Tag | Owner | Notes |
936+
|------|-----------|--------|-----|-------|-------|
937+
| [To be populated by Claude based on plan] | - | pending | coding or analyze | claude or codex | - |
936938
937939
### Completed and Verified
938940
<!-- Only move tasks here after Codex verification -->
@@ -1007,7 +1009,7 @@ Before starting implementation, you MUST initialize the Goal Tracker:
10071009
1. Read @$GOAL_TRACKER_FILE
10081010
2. If the "Ultimate Goal" section says "[To be extracted...]", extract a clear goal statement from the plan
10091011
3. If the "Acceptance Criteria" section says "[To be defined...]", define 3-7 specific, testable criteria
1010-
4. Populate the "Active Tasks" table with tasks from the plan, mapping each to an AC
1012+
4. Populate the "Active Tasks" table with tasks from the plan, mapping each to an AC and filling Tag/Owner
10111013
5. Write the updated goal-tracker.md
10121014
10131015
**IMPORTANT**: The IMMUTABLE SECTION can only be modified in Round 0. After this round, it becomes read-only.
@@ -1019,6 +1021,15 @@ Before starting implementation, you MUST initialize the Goal Tracker:
10191021
For all tasks that need to be completed, please use the Task system (TaskCreate, TaskUpdate, TaskList) to track each item in order of importance.
10201022
You are strictly prohibited from only addressing the most important issues - you MUST create Tasks for ALL discovered issues and attempt to resolve each one.
10211023
1024+
## Task Tag Routing (MUST FOLLOW)
1025+
1026+
Each task must have one routing tag from the plan: \`coding\` or \`analyze\`.
1027+
1028+
- Tag \`coding\`: Claude executes the task directly.
1029+
- Tag \`analyze\`: Claude must execute via \`/humanize:ask-codex\`, then integrate Codex output.
1030+
- Keep Goal Tracker "Active Tasks" columns **Tag** and **Owner** aligned with execution (\`coding -> claude\`, \`analyze -> codex\`).
1031+
- If a task is missing a valid tag, do not guess silently; document it in Plan Evolution Log and block completion until clarified.
1032+
10221033
EOF
10231034

10241035
# Append plan content directly (avoids command substitution size limits for large files)
@@ -1057,6 +1068,7 @@ cat >> "$LOOP_DIR/round-0-prompt.md" << EOF
10571068
Throughout your work, you MUST maintain the Goal Tracker:
10581069
10591070
1. **Before starting a task**: Mark it as "in_progress" in Active Tasks
1071+
- Confirm Tag/Owner routing is correct before execution
10601072
2. **After completing a task**: Move it to "Completed and Verified" with evidence (but mark as "pending verification")
10611073
3. **If you discover the plan has errors**:
10621074
- Do NOT silently change direction

scripts/validate-gen-plan-io.sh

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,23 @@
1414
set -e
1515

1616
usage() {
17-
echo "Usage: $0 --input <path/to/draft.md> --output <path/to/plan.md>"
17+
echo "Usage: $0 --input <path/to/draft.md> --output <path/to/plan.md> [--auto-start-rlcr-if-converged] [--discussion|--direct]"
1818
echo ""
1919
echo "Options:"
2020
echo " --input Path to the input draft file (required)"
2121
echo " --output Path to the output plan file (required)"
22+
echo " --auto-start-rlcr-if-converged Enable direct RLCR start after converged planning (discussion mode only)"
23+
echo " --discussion Use discussion mode (iterative Claude/Codex convergence rounds)"
24+
echo " --direct Use direct mode (skip convergence rounds, proceed immediately to plan)"
2225
echo " -h, --help Show this help message"
2326
exit 6
2427
}
2528

2629
INPUT_FILE=""
2730
OUTPUT_FILE=""
31+
AUTO_START_RLCR_IF_CONVERGED="false"
32+
GEN_PLAN_MODE_DISCUSSION="false"
33+
GEN_PLAN_MODE_DIRECT="false"
2834

2935
# Parse arguments
3036
while [[ $# -gt 0 ]]; do
@@ -45,6 +51,18 @@ while [[ $# -gt 0 ]]; do
4551
OUTPUT_FILE="$2"
4652
shift 2
4753
;;
54+
--auto-start-rlcr-if-converged)
55+
AUTO_START_RLCR_IF_CONVERGED="true"
56+
shift
57+
;;
58+
--discussion)
59+
GEN_PLAN_MODE_DISCUSSION="true"
60+
shift
61+
;;
62+
--direct)
63+
GEN_PLAN_MODE_DIRECT="true"
64+
shift
65+
;;
4866
-h|--help)
4967
usage
5068
;;
@@ -55,6 +73,12 @@ while [[ $# -gt 0 ]]; do
5573
esac
5674
done
5775

76+
# Validate mutually exclusive flags
77+
if [[ "$GEN_PLAN_MODE_DISCUSSION" == "true" && "$GEN_PLAN_MODE_DIRECT" == "true" ]]; then
78+
echo "Error: --discussion and --direct are mutually exclusive"
79+
exit 6
80+
fi
81+
5882
# Validate required arguments
5983
if [[ -z "$INPUT_FILE" ]]; then
6084
echo "ERROR: --input is required"
@@ -66,6 +90,11 @@ if [[ -z "$OUTPUT_FILE" ]]; then
6690
usage
6791
fi
6892

93+
# Note on auto-start behavior in direct mode
94+
if [[ "$GEN_PLAN_MODE_DIRECT" == "true" && "$AUTO_START_RLCR_IF_CONVERGED" == "true" ]]; then
95+
echo "NOTE: --auto-start-rlcr-if-converged only triggers in --discussion mode; in --direct mode the plan is not considered converged and auto-start will be skipped."
96+
fi
97+
6998
# Get absolute paths
7099
INPUT_FILE=$(realpath -m "$INPUT_FILE" 2>/dev/null || echo "$INPUT_FILE")
71100
OUTPUT_FILE=$(realpath -m "$OUTPUT_FILE" 2>/dev/null || echo "$OUTPUT_FILE")

0 commit comments

Comments
 (0)