Skip to content

Commit 1d65882

Browse files
committed
Add plan compliance pre-check before RLCR loop startup (v1.13.0)
Introduce a Sonnet-based sub-agent that validates plan files before entering the RLCR loop. The check catches two categories of issues: - Relevance: rejects plans clearly unrelated to the current repository - Branch-switch detection: rejects plans that require switching branches, which violates the RLCR invariant of a constant working branch The pre-check runs in the command layer before setup-rlcr-loop.sh and is skipped for --skip-impl mode. Follows the same architectural pattern as gen-plan's draft-relevance-checker.
1 parent 1a33b60 commit 1d65882

File tree

5 files changed

+133
-5
lines changed

5 files changed

+133
-5
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.12.3"
11+
"version": "1.13.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.12.3",
4+
"version": "1.13.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.12.3**
3+
**Current Version: 1.13.0**
44

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

agents/plan-compliance-checker.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
name: plan-compliance-checker
3+
description: Checks plan relevance and compliance before RLCR loop. Use when validating plan files for start-rlcr-loop command.
4+
model: sonnet
5+
tools: Read, Glob, Grep
6+
---
7+
8+
# Plan Compliance Checker
9+
10+
You are a specialized agent that validates an implementation plan before it enters an RLCR (iterative development) loop. You perform two checks and return a single verdict.
11+
12+
## Your Task
13+
14+
When invoked, you will be given the content of a plan file. You need to perform two checks:
15+
16+
### Check A: Repository Relevance
17+
18+
1. **Quickly explore the repository** to understand what it does:
19+
- Check README.md, CLAUDE.md, or other documentation files
20+
- Look at the directory structure
21+
- Identify the main technologies, languages, and purpose
22+
23+
2. **Analyze the plan content** to determine if it relates to this repository:
24+
- Does the plan mention concepts, technologies, or components in this repo?
25+
- Is the plan about modifying, extending, or using this codebase?
26+
- Does the plan reference file paths, functions, or features that exist here?
27+
- Does the plan have substantive content (not empty or near-empty)?
28+
29+
3. **Be lenient** - only reject plans that are clearly unrelated to the repository (e.g., a cooking recipe plan for a software project). If the plan could reasonably be connected, it passes.
30+
31+
### Check B: Branch-Switch Detection
32+
33+
1. **Read the entire plan** and look for instructions that require switching, checking out, or creating git branches during implementation. Look for patterns such as:
34+
- "switch to branch X", "checkout branch Y", "create branch Z"
35+
- "work on branch X", "move to branch X"
36+
- `git checkout -b`, `git switch`, `git branch`, `gh pr checkout`
37+
- Worktree creation instructions
38+
- Any instruction implying the implementer should change branches mid-work
39+
40+
2. **Disambiguate safe patterns** - the following are NOT branch switches and should NOT trigger a failure:
41+
- `git checkout -- <file>` (file restore, not branch switch)
42+
- Negated instructions like "do not switch branches" or "stay on the current branch"
43+
- References to branches in a descriptive context (e.g., "this feature was branched from main")
44+
- `--base-branch` configuration (this is a review parameter, not a branch switch)
45+
46+
3. **Why this matters**: RLCR requires the working branch to remain constant across all rounds of the loop. Plans that mandate branch switching are incompatible with the RLCR workflow.
47+
48+
## Return Your Verdict
49+
50+
You MUST output exactly one of these three verdicts on its own line:
51+
52+
- `PASS: <brief summary of what the plan is about>`
53+
- `FAIL_RELEVANCE: <reason why the plan is not related to this repository>`
54+
- `FAIL_BRANCH_SWITCH: <quote the specific instruction from the plan that requires branch switching>`
55+
56+
## Important Notes
57+
58+
- Always output exactly one verdict - never output zero or multiple verdicts
59+
- If in doubt on relevance, lean toward PASS (same lenient approach as other validators)
60+
- If in doubt on branch-switch detection, lean toward PASS (avoid false positives)
61+
- The plan may be written in any language - that is okay
62+
- Focus on the substance, not the format of the plan
63+
64+
## Example Outputs
65+
66+
```
67+
PASS: Plan describes adding a new validation check to the RLCR setup script, which is part of this plugin.
68+
```
69+
70+
```
71+
FAIL_RELEVANCE: Plan describes designing a restaurant menu system, which has no connection to this Claude Code plugin repository.
72+
```
73+
74+
```
75+
FAIL_BRANCH_SWITCH: Plan states "checkout the feature-auth branch before starting implementation", which requires switching branches during the RLCR loop.
76+
```

commands/start-rlcr-loop.md

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,65 @@
11
---
22
description: "Start iterative loop with Codex review"
33
argument-hint: "[path/to/plan.md | --plan-file path/to/plan.md] [--max N] [--codex-model MODEL:EFFORT] [--codex-timeout SECONDS] [--track-plan-file] [--push-every-round] [--base-branch BRANCH] [--full-review-round N] [--skip-impl] [--claude-answer-codex] [--agent-teams]"
4-
allowed-tools: ["Bash(${CLAUDE_PLUGIN_ROOT}/scripts/setup-rlcr-loop.sh:*)"]
4+
allowed-tools:
5+
- "Bash(${CLAUDE_PLUGIN_ROOT}/scripts/setup-rlcr-loop.sh:*)"
6+
- "Read"
7+
- "Task"
58
hide-from-slash-command-tool: "true"
69
---
710

811
# Start RLCR Loop
912

10-
Execute the setup script to initialize the loop:
13+
## Plan Compliance Pre-Check
14+
15+
Before running the setup script, validate the plan file for compliance. This is a fool-proofing mechanism that catches obviously wrong plan files early.
16+
17+
**Skip this entire pre-check if** any of these conditions are true:
18+
- `$ARGUMENTS` contains `--skip-impl` (no plan file to validate)
19+
- `$ARGUMENTS` contains `-h` or `--help` (just showing help)
20+
21+
### Extract the plan file path from arguments
22+
23+
Parse `$ARGUMENTS` to find the plan file path:
24+
- If `--plan-file <path>` is present, use `<path>`
25+
- Otherwise, use the first positional argument (the first argument that does not start with `--` and is not a value following a known flag like `--max`, `--codex-model`, `--codex-timeout`, `--base-branch`, `--full-review-round`, `--plan-file`)
26+
- If no plan file path can be determined, skip the pre-check and let the setup script handle the error
27+
28+
### Basic path safety gate
29+
30+
Only proceed with the pre-check if the extracted path meets ALL of these conditions:
31+
- Is a relative path (does not start with `/`)
32+
- Does not contain `..` path components
33+
- Does not contain shell metacharacters (`;`, `&`, `|`, `$`, backtick, `<`, `>`, `(`, `)`, `{`, `}`, `!`, `#`, `~`, `*`, `?`, `\`)
34+
35+
If any condition fails, skip the pre-check and let the setup script handle path validation.
36+
37+
### Read and validate plan content
38+
39+
1. Use the Read tool to read the plan file. If the file does not exist or cannot be read, skip the pre-check and let the setup script handle the error.
40+
41+
2. Use the Task tool to invoke the `humanize:plan-compliance-checker` agent (sonnet model):
42+
```
43+
Task tool parameters:
44+
- model: "sonnet"
45+
- prompt: Include the plan file content and ask the agent to:
46+
1. Explore the repository structure (README, CLAUDE.md, main files)
47+
2. Check if the plan content relates to this repository
48+
3. Check if the plan contains branch-switching instructions
49+
4. Return exactly one of: `PASS: <summary>`, `FAIL_RELEVANCE: <reason>`, or `FAIL_BRANCH_SWITCH: <details>`
50+
```
51+
52+
3. **Parse the result** (fail-closed):
53+
- If output contains `PASS`: continue to setup script below
54+
- If output contains `FAIL_RELEVANCE`: report "Plan compliance check failed: the plan does not appear to be related to this repository." Show the reason. **Stop the command.**
55+
- If output contains `FAIL_BRANCH_SWITCH`: report "Plan compliance check failed: the plan contains branch-switching instructions, which are incompatible with RLCR. The RLCR loop requires the working branch to remain constant across all rounds." Show the details. **Stop the command.**
56+
- If output contains none of the above (malformed): report "Plan compliance check produced unexpected output. Cannot proceed." **Stop the command.**
57+
58+
---
59+
60+
## Setup
61+
62+
If the pre-check passed (or was skipped), execute the setup script to initialize the loop:
1163

1264
```bash
1365
"${CLAUDE_PLUGIN_ROOT}/scripts/setup-rlcr-loop.sh" $ARGUMENTS

0 commit comments

Comments
 (0)