diff --git a/config/default_config.json b/config/default_config.json index 6238dce2..af41af12 100644 --- a/config/default_config.json +++ b/config/default_config.json @@ -1,5 +1,5 @@ { - "codex_model": "gpt-5.4", + "codex_model": "gpt-5.5", "codex_effort": "high", "bitlesson_model": "haiku", "agent_teams": false, diff --git a/docs/install-for-claude.md b/docs/install-for-claude.md index 06b6991e..f6ddfbc1 100644 --- a/docs/install-for-claude.md +++ b/docs/install-for-claude.md @@ -50,6 +50,7 @@ After installing, you should see Humanize commands available: ``` /humanize:start-rlcr-loop +/humanize:gen-idea /humanize:gen-plan /humanize:refine-plan /humanize:ask-codex diff --git a/docs/install-for-codex.md b/docs/install-for-codex.md index 5d34b24c..7e6d3505 100644 --- a/docs/install-for-codex.md +++ b/docs/install-for-codex.md @@ -23,13 +23,13 @@ Or use the unified installer directly: ``` This will: -- Sync `humanize`, `humanize-gen-plan`, `humanize-refine-plan`, and `humanize-rlcr` into `${CODEX_HOME:-~/.codex}/skills` +- Sync `humanize`, `humanize-gen-idea`, `humanize-gen-plan`, `humanize-refine-plan`, and `humanize-rlcr` into `${CODEX_HOME:-~/.codex}/skills` - Copy runtime dependencies into `${CODEX_HOME:-~/.codex}/skills/humanize` - Install/update native Humanize Stop hooks in `${CODEX_HOME:-~/.codex}/hooks.json` - Enable the experimental `codex_hooks` feature in `${CODEX_HOME:-~/.codex}/config.toml` when `codex` is available - Seed `~/.config/humanize/config.json` with a Codex/OpenAI `bitlesson_model` when that key is not already set - Mark the install as `provider_mode: "codex-only"` when using `--target codex` -- Use RLCR defaults: `codex exec` with `gpt-5.4:high`, `codex review` with `gpt-5.4:high` +- Use RLCR defaults: `codex exec` with `gpt-5.5:high`, `codex review` with `gpt-5.5:high` Requires Codex CLI `0.114.0` or newer for native hooks. Older Codex builds are not supported by the Codex install path. @@ -41,6 +41,7 @@ ls -la "${CODEX_HOME:-$HOME/.codex}/skills" Expected directories: - `humanize` +- `humanize-gen-idea` - `humanize-gen-plan` - `humanize-refine-plan` - `humanize-rlcr` @@ -55,6 +56,7 @@ Runtime dependencies in `humanize/`: Installed files/directories: - `${CODEX_HOME:-~/.codex}/skills/humanize/SKILL.md` +- `${CODEX_HOME:-~/.codex}/skills/humanize-gen-idea/SKILL.md` - `${CODEX_HOME:-~/.codex}/skills/humanize-gen-plan/SKILL.md` - `${CODEX_HOME:-~/.codex}/skills/humanize-refine-plan/SKILL.md` - `${CODEX_HOME:-~/.codex}/skills/humanize-rlcr/SKILL.md` @@ -77,7 +79,7 @@ sed -n '1,220p' "${CODEX_HOME:-$HOME/.codex}/hooks.json" Expected: - `codex_hooks` is `true` - `hooks.json` contains `loop-codex-stop-hook.sh` -- `${XDG_CONFIG_HOME:-~/.config}/humanize/config.json` contains `bitlesson_model` set to a Codex/OpenAI model such as `gpt-5.4` +- `${XDG_CONFIG_HOME:-~/.config}/humanize/config.json` contains `bitlesson_model` set to a Codex/OpenAI model such as `gpt-5.5` - for `--target codex`, `${XDG_CONFIG_HOME:-~/.config}/humanize/config.json` also contains `provider_mode: "codex-only"` ## Optional: Install for Both Codex and Kimi diff --git a/docs/install-for-kimi.md b/docs/install-for-kimi.md index ee217d70..ddee5c31 100644 --- a/docs/install-for-kimi.md +++ b/docs/install-for-kimi.md @@ -4,11 +4,12 @@ This guide explains how to install the Humanize skills for [Kimi Code CLI](https ## Overview -Humanize provides four Agent Skills for kimi: +Humanize provides five Agent Skills for kimi: | Skill | Type | Purpose | |-------|------|---------| | `humanize` | Standard | General guidance for all workflows | +| `humanize-gen-idea` | Flow | Generate a repo-grounded idea draft from loose input | | `humanize-gen-plan` | Flow | Generate structured plan from draft | | `humanize-refine-plan` | Flow | Refine annotated plan with CMT blocks | | `humanize-rlcr` | Flow | Iterative development with Codex review | @@ -24,7 +25,7 @@ From the Humanize repo root, run: ``` This command will: -- Sync `humanize`, `humanize-gen-plan`, `humanize-refine-plan`, and `humanize-rlcr` into `~/.config/agents/skills` +- Sync `humanize`, `humanize-gen-idea`, `humanize-gen-plan`, `humanize-refine-plan`, and `humanize-rlcr` into `~/.config/agents/skills` - Copy runtime dependencies into `~/.config/agents/skills/humanize` Common installer script (all targets): @@ -47,8 +48,9 @@ cd /path/to/humanize # Create the skills directory if it doesn't exist mkdir -p ~/.config/agents/skills -# Copy all four skills +# Copy all five skills cp -r skills/humanize ~/.config/agents/skills/ +cp -r skills/humanize-gen-idea ~/.config/agents/skills/ cp -r skills/humanize-gen-plan ~/.config/agents/skills/ cp -r skills/humanize-refine-plan ~/.config/agents/skills/ cp -r skills/humanize-rlcr ~/.config/agents/skills/ @@ -63,14 +65,14 @@ cp -r config ~/.config/agents/skills/humanize/ cp -r agents ~/.config/agents/skills/humanize/ # Hydrate runtime root placeholders inside SKILL.md files -for skill in humanize humanize-gen-plan humanize-refine-plan humanize-rlcr; do +for skill in humanize humanize-gen-idea humanize-gen-plan humanize-refine-plan humanize-rlcr; do sed -i.bak "s|{{HUMANIZE_RUNTIME_ROOT}}|$HOME/.config/agents/skills/humanize|g" \ "$HOME/.config/agents/skills/$skill/SKILL.md" done # Strip user-invocable flag from SKILL.md files for runtime visibility # (This matches the behavior of scripts/install-skill.sh) -for skill in humanize humanize-gen-plan humanize-refine-plan humanize-rlcr; do +for skill in humanize humanize-gen-idea humanize-gen-plan humanize-refine-plan humanize-rlcr; do awk ' BEGIN { in_fm = 0; fm_done = 0 } /^---[[:space:]]*$/ { @@ -98,6 +100,7 @@ ls -la ~/.config/agents/skills/ # Should show: # humanize/ +# humanize-gen-idea/ # humanize-gen-plan/ # humanize-refine-plan/ # humanize-rlcr/ @@ -129,7 +132,17 @@ Look for the "Skills" section in the help output. ### Use the skills -#### 1. Generate plan from draft +#### 1. Generate an idea draft + +```bash +# Start the flow with inline text +/flow:humanize-gen-idea "add undo/redo to the editor" + +# Or load as standard skill +/skill:humanize-gen-idea +``` + +#### 2. Generate plan from draft ```bash # Start the flow (will ask for input/output paths) @@ -139,7 +152,7 @@ Look for the "Skills" section in the help output. /skill:humanize-gen-plan ``` -#### 2. Start RLCR development loop +#### 3. Start RLCR development loop ```bash # Start with plan file @@ -155,7 +168,7 @@ Look for the "Skills" section in the help output. /skill:humanize-rlcr ``` -#### 3. Get general guidance +#### 4. Get general guidance ```bash /skill:humanize @@ -169,7 +182,7 @@ Look for the "Skills" section in the help output. |--------|-------------|---------| | `path/to/plan.md` | Plan file path | Required (unless --skip-impl) | | `--max N` | Maximum iterations | 42 | -| `--codex-model MODEL:EFFORT` | Codex model | gpt-5.4:high | +| `--codex-model MODEL:EFFORT` | Codex model | gpt-5.5:high | | `--codex-timeout SECONDS` | Review timeout | 5400 | | `--base-branch BRANCH` | Base for code review | auto-detect | | `--full-review-round N` | Full alignment check interval | 5 | @@ -191,7 +204,7 @@ Ensure you have `codex` CLI installed: codex --version ``` -The skills will use `gpt-5.4` with `high` effort level by default. +The skills will use `gpt-5.5` with `high` effort level by default. ## Uninstall @@ -199,6 +212,7 @@ To remove the skills: ```bash rm -rf ~/.config/agents/skills/humanize +rm -rf ~/.config/agents/skills/humanize-gen-idea rm -rf ~/.config/agents/skills/humanize-gen-plan rm -rf ~/.config/agents/skills/humanize-refine-plan rm -rf ~/.config/agents/skills/humanize-rlcr diff --git a/docs/usage.md b/docs/usage.md index 4234b39d..313ae7ce 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -76,7 +76,7 @@ OPTIONS: --plan-file Explicit plan file path (alternative to positional arg) --max Maximum iterations before auto-stop (default: 42) --codex-model - Codex model and reasoning effort (default from config, fallback gpt-5.4:high) + Codex model and reasoning effort (default from config, fallback gpt-5.5:high) --codex-timeout Timeout for each Codex review in seconds (default: 5400) --track-plan-file Indicate plan file should be tracked in git (must be clean) @@ -240,7 +240,7 @@ translated plan and QA variants by inserting `_` before the file extension OPTIONS: --codex-model - Codex model and reasoning effort (default from config, fallback gpt-5.4:high) + Codex model and reasoning effort (default from config, fallback gpt-5.5:high) --codex-timeout Timeout for the Codex query in seconds (default: 3600) -h, --help Show help message @@ -265,7 +265,7 @@ Current built-in keys: | Key | Default | Description | |-----|---------|-------------| -| `codex_model` | `gpt-5.4` | Shared default model for Codex-backed review and analysis | +| `codex_model` | `gpt-5.5` | Shared default model for Codex-backed review and analysis | | `codex_effort` | `high` | Shared default reasoning effort (`xhigh`, `high`, `medium`, `low`) | | `bitlesson_model` | `haiku` | Model used by the BitLesson selector agent | | `provider_mode` | unset | Optional runtime mode hint such as `codex-only` | @@ -279,7 +279,7 @@ All Codex-using features (RLCR loop, ask-codex) share the same model configurati | Key | Default | Description | |-----|---------|-------------| -| `codex_model` | `gpt-5.4` | Model used for Codex operations (reviews, analysis, queries) | +| `codex_model` | `gpt-5.5` | Model used for Codex operations (reviews, analysis, queries) | | `codex_effort` | `high` | Reasoning effort (`xhigh`, `high`, `medium`, `low`) | To override, add to `.humanize/config.json`: @@ -300,7 +300,7 @@ Codex model is resolved with this precedence: 1. CLI `--codex-model` flag (highest priority) 2. Feature-specific defaults 3. Config-backed defaults from the 4-layer hierarchy above -4. Hardcoded fallback (`gpt-5.4:high`) +4. Hardcoded fallback (`gpt-5.5:high`) **Migration note**: If your `.humanize/config.json` contains the legacy keys `loop_reviewer_model` or `loop_reviewer_effort`, they are silently ignored. diff --git a/hooks/lib/loop-common.sh b/hooks/lib/loop-common.sh index 3e54e6ef..93352d41 100755 --- a/hooks/lib/loop-common.sh +++ b/hooks/lib/loop-common.sh @@ -54,7 +54,7 @@ readonly DRIFT_STATUS_REPLAN_REQUIRED="replan_required" # Default Codex configuration (single source of truth - all scripts reference this) # Scripts can pre-set DEFAULT_CODEX_MODEL/DEFAULT_CODEX_EFFORT before sourcing to override. # Config-backed defaults are loaded from the merge hierarchy after config-loader.sh is sourced. -# Precedence: pre-set value > config value > hardcoded fallback (gpt-5.4/high) +# Precedence: pre-set value > config value > hardcoded fallback (gpt-5.5/high) # # The actual assignment happens in the "Config-backed defaults" section below, # after config-loader.sh has been sourced and merged config is available. @@ -207,7 +207,7 @@ DEFAULT_BITLESSON_MODEL="${DEFAULT_BITLESSON_MODEL:-haiku}" # Load codex model/effort from merged config so .humanize/config.json can set persistent # defaults for all Codex-using features (RLCR, ask-codex). -# Precedence: pre-set by caller > config value > hardcoded fallback (gpt-5.4/high) +# Precedence: pre-set by caller > config value > hardcoded fallback (gpt-5.5/high) _cfg_codex_model="$(get_config_value "$_LOOP_COMMON_CONFIG" "codex_model" 2>/dev/null || true)" if [[ -n "$_cfg_codex_model" && ! "$_cfg_codex_model" =~ ^[a-zA-Z0-9._-]+$ ]]; then echo "Warning: Invalid codex_model in merged config: $_cfg_codex_model" >&2 @@ -219,7 +219,7 @@ elif [[ -n "$_cfg_codex_model" && ! "$_cfg_codex_model" =~ ^(gpt-|o[0-9]) ]]; th echo " Ignoring configured codex_model; using caller preset or fallback" >&2 _cfg_codex_model="" fi -DEFAULT_CODEX_MODEL="${DEFAULT_CODEX_MODEL:-${_cfg_codex_model:-gpt-5.4}}" +DEFAULT_CODEX_MODEL="${DEFAULT_CODEX_MODEL:-${_cfg_codex_model:-gpt-5.5}}" _cfg_codex_effort="$(get_config_value "$_LOOP_COMMON_CONFIG" "codex_effort" 2>/dev/null || true)" if [[ -n "$_cfg_codex_effort" && ! "$_cfg_codex_effort" =~ ^(xhigh|high|medium|low)$ ]]; then echo "Warning: Invalid codex_effort in merged config: $_cfg_codex_effort" >&2 @@ -233,7 +233,9 @@ DEFAULT_CODEX_EFFORT="${DEFAULT_CODEX_EFFORT:-${_cfg_codex_effort:-high}}" # Precedence: pre-set by caller (e.g. --agent-teams flag) > config value > hardcoded fallback (false) _cfg_agent_teams="$(get_config_value "$_LOOP_COMMON_CONFIG" "agent_teams" 2>/dev/null || true)" DEFAULT_AGENT_TEAMS="${DEFAULT_AGENT_TEAMS:-${_cfg_agent_teams:-false}}" -unset _cfg_codex_model _cfg_codex_effort _cfg_agent_teams +_cfg_provider_mode="$(get_config_value "$_LOOP_COMMON_CONFIG" "provider_mode" 2>/dev/null || true)" +DEFAULT_PROVIDER_MODE="${DEFAULT_PROVIDER_MODE:-$_cfg_provider_mode}" +unset _cfg_codex_model _cfg_codex_effort _cfg_agent_teams _cfg_provider_mode unset _LOOP_COMMON_PROJECT_ROOT _LOOP_COMMON_CONFIG diff --git a/hooks/lib/methodology-analysis.sh b/hooks/lib/methodology-analysis.sh index a95e81af..4073747a 100644 --- a/hooks/lib/methodology-analysis.sh +++ b/hooks/lib/methodology-analysis.sh @@ -78,8 +78,13 @@ Please analyze the development records in $LOOP_DIR and provide methodology impr Write your analysis to $LOOP_DIR/methodology-analysis-report.md. When done, write a completion note to $LOOP_DIR/methodology-analysis-done.md." + local methodology_template="claude/methodology-analysis-prompt.md" + if [[ "${PROVIDER_MODE:-}" == "codex-only" ]]; then + methodology_template="codex/methodology-analysis-prompt.md" + fi + local analysis_prompt - analysis_prompt=$(load_and_render_safe "$TEMPLATE_DIR" "claude/methodology-analysis-prompt.md" "$fallback" \ + analysis_prompt=$(load_and_render_safe "$TEMPLATE_DIR" "$methodology_template" "$fallback" \ "LOOP_DIR=$LOOP_DIR" \ "EXIT_REASON=$exit_reason" \ "EXIT_REASON_DESCRIPTION=$exit_reason_description" \ @@ -183,12 +188,17 @@ complete_methodology_analysis() { block_methodology_analysis_incomplete() { local done_file="$LOOP_DIR/methodology-analysis-done.md" + local action_item="Spawn an Opus agent to analyze the development records" + if [[ "${PROVIDER_MODE:-}" == "codex-only" ]]; then + action_item="Run a Codex 5.5 methodology analysis, using a sub-agent if the current runtime supports it" + fi + local reason="# Methodology Analysis Incomplete Please complete the methodology analysis before exiting. You need to: -1. Spawn an Opus agent to analyze the development records +1. $action_item 2. Review the analysis report 3. Optionally help the user file a GitHub issue 4. Write a completion note to: $done_file diff --git a/hooks/loop-codex-stop-hook.sh b/hooks/loop-codex-stop-hook.sh index 0c191d4c..b0fcd779 100755 --- a/hooks/loop-codex-stop-hook.sh +++ b/hooks/loop-codex-stop-hook.sh @@ -141,6 +141,7 @@ CODEX_TIMEOUT="${STATE_CODEX_TIMEOUT:-${CODEX_TIMEOUT:-$DEFAULT_CODEX_TIMEOUT}}" ASK_CODEX_QUESTION="${STATE_ASK_CODEX_QUESTION:-false}" AGENT_TEAMS="${STATE_AGENT_TEAMS:-false}" PRIVACY_MODE="${STATE_PRIVACY_MODE:-true}" +PROVIDER_MODE="${DEFAULT_PROVIDER_MODE:-}" BITLESSON_REQUIRED="false" if [[ -n "$RAW_BITLESSON_REQUIRED" ]]; then BITLESSON_REQUIRED=$(echo "$RAW_BITLESSON_REQUIRED" | sed 's/^bitlesson_required:[[:space:]]*//' | tr -d ' "') @@ -1342,7 +1343,7 @@ Since the code review was skipped, please manually verify your changes before fi 3. Check for common code quality issues ## Simplification (Optional) -If time permits, use the \`code-simplifier:code-simplifier\` agent via the Task tool to simplify and refactor your code. Focus more on changes between branch from {{BASE_BRANCH}} to {{START_BRANCH}}. +If time permits, use the Codex \`code-simplifier:code-simplifier\` agent if it is available in the current runtime. If that agent is not available, perform the same simplification pass directly. Focus more on changes between branch from {{BASE_BRANCH}} to {{START_BRANCH}}. ## Constraints - Must NOT change existing functionality @@ -1355,7 +1356,7 @@ If time permits, use the \`code-simplifier:code-simplifier\` agent via the Task 2. Commit your changes 3. Write your finalize summary to: {{FINALIZE_SUMMARY_FILE}}" - finalize_prompt=$(load_and_render_safe "$TEMPLATE_DIR" "claude/finalize-phase-skipped-prompt.md" "$fallback" \ + finalize_prompt=$(load_and_render_safe "$TEMPLATE_DIR" "codex/finalize-phase-skipped-prompt.md" "$fallback" \ "FINALIZE_SUMMARY_FILE=$finalize_summary_file" \ "PLAN_FILE=$PLAN_FILE" \ "GOAL_TRACKER_FILE=$GOAL_TRACKER_FILE" \ @@ -1367,7 +1368,7 @@ If time permits, use the \`code-simplifier:code-simplifier\` agent via the Task Codex review has passed. The implementation is complete. -You are now in the **Finalize Phase**. Use the \`code-simplifier:code-simplifier\` agent via the Task tool to simplify and refactor your code. +You are now in the **Finalize Phase**. Use the Codex \`code-simplifier:code-simplifier\` agent if it is available in the current runtime. If that agent is not available, perform the same simplification pass directly. ## Constraints - Must NOT change existing functionality @@ -1383,7 +1384,7 @@ Focus on the code changes made during this RLCR session. Focus more on changes b 2. Commit your changes 3. Write your finalize summary to: {{FINALIZE_SUMMARY_FILE}}" - finalize_prompt=$(load_and_render_safe "$TEMPLATE_DIR" "claude/finalize-phase-prompt.md" "$fallback" \ + finalize_prompt=$(load_and_render_safe "$TEMPLATE_DIR" "codex/finalize-phase-prompt.md" "$fallback" \ "FINALIZE_SUMMARY_FILE=$finalize_summary_file" \ "PLAN_FILE=$PLAN_FILE" \ "GOAL_TRACKER_FILE=$GOAL_TRACKER_FILE" \ diff --git a/prompt-template/codex/finalize-phase-prompt.md b/prompt-template/codex/finalize-phase-prompt.md new file mode 100644 index 00000000..c5d8f616 --- /dev/null +++ b/prompt-template/codex/finalize-phase-prompt.md @@ -0,0 +1,47 @@ +# Finalize Phase + +Codex review has passed. The implementation is complete and all acceptance criteria have been met. + +You are now in the **Finalize Phase**. This is the opportunity to simplify and refactor the code before final completion. + +## Your Task + +Use the Codex `code-simplifier:code-simplifier` agent if it is available in the current runtime. If that agent is not available, perform the same simplification pass directly in this session. + +## Constraints + +These constraints are **non-negotiable**: + +1. **Must NOT change existing functionality** - All features must work exactly as before +2. **Must NOT fail existing tests** - Run tests to verify nothing is broken +3. **Must NOT introduce new bugs** - Be careful with refactoring +4. **Only perform functionality-equivalent changes** - Simplification and cleanup only + +## Focus Areas + +Focus on: +- Code that was recently added or modified +- Changes between branch from `{{BASE_BRANCH}}` to `{{START_BRANCH}}` +- Removing unnecessary complexity +- Improving readability and maintainability +- Consolidating duplicate code +- Simplifying control flow where possible +- Removing dead code or unused variables + +## Reference Files + +- Original plan: @{{PLAN_FILE}} +- Goal tracker: @{{GOAL_TRACKER_FILE}} + +## Before Exiting + +1. Complete all `[mainline]` and `[blocking]` tasks +2. `[queued]` tasks may remain only if they are documented as non-blocking follow-up work +3. Commit your changes with a descriptive message +4. Write your finalize summary to: **{{FINALIZE_SUMMARY_FILE}}** + +Your summary should include: +- What simplifications were made +- Files modified during the Finalize Phase +- Confirmation that tests still pass +- Any notes about the refactoring decisions diff --git a/prompt-template/codex/finalize-phase-skipped-prompt.md b/prompt-template/codex/finalize-phase-skipped-prompt.md new file mode 100644 index 00000000..8f4c7e02 --- /dev/null +++ b/prompt-template/codex/finalize-phase-skipped-prompt.md @@ -0,0 +1,46 @@ +# Finalize Phase (Review Skipped) + +**Warning**: Code review was skipped due to: {{REVIEW_SKIP_REASON}} + +The implementation could not be fully validated. You are now in the **Finalize Phase**. + +## Important Notice + +Since the code review was skipped, manually verify your changes before finalizing: + +1. Review your code changes for any obvious issues +2. Run any available tests to verify correctness +3. Check for common code quality issues + +## Simplification (Optional) + +If time permits, use the Codex `code-simplifier:code-simplifier` agent if it is available in the current runtime. If that agent is not available, perform the same simplification pass directly in this session. + +Focus on changes between branch from `{{BASE_BRANCH}}` to `{{START_BRANCH}}`. + +## Constraints + +These constraints are **non-negotiable**: + +1. **Must NOT change existing functionality** - All features must work exactly as before +2. **Must NOT fail existing tests** - Run tests to verify nothing is broken +3. **Must NOT introduce new bugs** - Be careful with refactoring +4. **Only perform functionality-equivalent changes** - Simplification and cleanup only + +## Reference Files + +- Original plan: @{{PLAN_FILE}} +- Goal tracker: @{{GOAL_TRACKER_FILE}} + +## Before Exiting + +1. Complete all `[mainline]` and `[blocking]` tasks +2. `[queued]` tasks may remain only if they are documented as non-blocking follow-up work +3. Commit your changes with a descriptive message +4. Write your finalize summary to: **{{FINALIZE_SUMMARY_FILE}}** + +Your summary should include: +- What work was done +- Files modified +- Confirmation that tests still pass, if possible +- Any notes about manual verification performed diff --git a/prompt-template/codex/methodology-analysis-prompt.md b/prompt-template/codex/methodology-analysis-prompt.md new file mode 100644 index 00000000..67450db4 --- /dev/null +++ b/prompt-template/codex/methodology-analysis-prompt.md @@ -0,0 +1,73 @@ +# Methodology Analysis Phase + +The RLCR loop has reached its exit point. + +**Exit reason**: {{EXIT_REASON}} - {{EXIT_REASON_DESCRIPTION}} +**Rounds completed**: {{CURRENT_ROUND}} of {{MAX_ITERATIONS}} + +Before the loop fully exits, perform a methodology improvement analysis. This analysis helps improve the Humanize development methodology itself -- it is NOT about the project you just worked on. + +## Instructions + +### 1. Run a Sanitized Codex 5.5 Analysis + +Use a Codex analysis sub-agent running `gpt-5.5` when the current runtime supports explicit model selection. If explicit model selection or sub-agent execution is unavailable, perform the analysis directly in this Codex session and note that fallback in the report. + +Analysis task: Read the development records in `{{LOOP_DIR}}`: +- All files matching `round-*-summary.md` +- All files matching `round-*-review-result.md` + +Analyze these records from a **pure methodology perspective** and write your findings to `{{LOOP_DIR}}/methodology-analysis-report.md`. + +**CRITICAL SANITIZATION RULES** - The report MUST NOT contain: +- File paths, directory paths, or module paths +- Function names, variable names, class names, or method names +- Branch names, commit hashes, or git identifiers +- Business domain terms, product names, or feature names +- Code snippets or code fragments of any kind +- Raw error messages or stack traces +- Project-specific URLs or endpoints +- Any information that could identify the specific project + +**Focus areas for analysis**: +- Iteration efficiency: Were rounds productive or did they repeat similar work? +- Feedback loop quality: Did reviewer feedback lead to meaningful improvements? +- Stagnation patterns: Were there signs of going in circles? +- Review effectiveness: Did reviews catch real issues or create false positives? +- Plan-to-execution alignment: Did execution follow the plan or drift? +- Round count vs. progress ratio: Was the number of rounds proportional to progress? +- Communication clarity: Were summaries and reviews clear and actionable? + +**Output format**: Write a structured report with methodology improvement suggestions. Each suggestion should describe a general pattern observed and a concrete improvement to the RLCR methodology. If no improvements are found, write a brief note saying the methodology worked well for this session. + +### 2. Read the Analysis Report + +After the analysis completes, read `{{LOOP_DIR}}/methodology-analysis-report.md`. ALL subsequent user-facing content MUST be derived solely from this report -- do NOT reference raw development records directly. + +### 3. Handle Results + +**If no improvements found**: Briefly inform the user that the methodology analysis found no significant improvement suggestions. Then write a completion note to `{{LOOP_DIR}}/methodology-analysis-done.md` and exit. + +**If improvements found**: + +a) Report to the user: + - Brief summary of the exit reason ({{EXIT_REASON}}: {{EXIT_REASON_DESCRIPTION}}) + - Methodology improvement suggestions from the report + +b) Ask the user directly whether they would like to help improve Humanize by opening a GitHub issue with these suggestions. Emphasize: + - This is completely voluntary + - The content is fully sanitized with no project-specific information + - It helps improve the methodology for everyone + +c) **If user declines**: Write a completion marker to `{{LOOP_DIR}}/methodology-analysis-done.md` and exit. + +d) **If user agrees**: + - Draft a GitHub issue title and body from the analysis report + - Show the draft to the user for review and confirmation + - If confirmed: run `gh issue create --repo PolyArch/humanize --title "..." --body "..."` + - If `gh` is not available, provide the title and body so the user can create the issue manually + - Write a completion marker to `{{LOOP_DIR}}/methodology-analysis-done.md` and exit + +### 4. Completion Marker + +You MUST write meaningful content to `{{LOOP_DIR}}/methodology-analysis-done.md` before exiting. This file signals that the analysis phase is complete. A brief summary of what was done, such as "Analysis complete, no suggestions" or "Analysis complete, issue filed", is sufficient. diff --git a/scripts/ask-codex.sh b/scripts/ask-codex.sh index 47ffeab0..afed83fb 100755 --- a/scripts/ask-codex.sh +++ b/scripts/ask-codex.sh @@ -55,7 +55,7 @@ USAGE: OPTIONS: --codex-model - Codex model and reasoning effort (default from config, fallback gpt-5.4:high) + Codex model and reasoning effort (default from config, fallback gpt-5.5:high) --codex-timeout Timeout for the Codex query in seconds (default: 3600) -h, --help Show this help message @@ -68,7 +68,7 @@ DESCRIPTION: EXAMPLES: /humanize:ask-codex How should I structure the authentication module? - /humanize:ask-codex --codex-model gpt-5.4:high What are the performance bottlenecks? + /humanize:ask-codex --codex-model gpt-5.5:high What are the performance bottlenecks? /humanize:ask-codex --codex-timeout 300 Review the error handling in src/api/ ENVIRONMENT: @@ -247,6 +247,10 @@ if [[ -n "$CODEX_EFFORT" ]]; then CODEX_EXEC_ARGS+=("-c" "model_reasoning_effort=${CODEX_EFFORT}") fi +# Disable native Codex hooks for the nested one-shot invocation. Humanize's +# Codex install path requires Codex versions that support --disable. +CODEX_DISABLE_HOOKS_ARGS=(--disable codex_hooks) + # Determine automation flag based on environment variable CODEX_AUTO_FLAG="--full-auto" if [[ "${HUMANIZE_CODEX_BYPASS_SANDBOX:-}" == "true" ]] || [[ "${HUMANIZE_CODEX_BYPASS_SANDBOX:-}" == "1" ]]; then @@ -269,7 +273,7 @@ CODEX_STDERR_FILE="$CACHE_DIR/codex-run.log" echo "# Working directory: $PROJECT_ROOT" echo "# Timeout: $CODEX_TIMEOUT seconds" echo "" - echo "codex exec ${CODEX_EXEC_ARGS[*]} \"\"" + echo "codex exec ${CODEX_DISABLE_HOOKS_ARGS[*]} ${CODEX_EXEC_ARGS[*]} \"\"" echo "" echo "# Prompt content:" echo "$QUESTION" @@ -294,7 +298,7 @@ epoch_to_iso() { START_TIME=$(date +%s) CODEX_EXIT_CODE=0 -printf '%s' "$QUESTION" | run_with_timeout "$CODEX_TIMEOUT" codex exec "${CODEX_EXEC_ARGS[@]}" - \ +printf '%s' "$QUESTION" | run_with_timeout "$CODEX_TIMEOUT" codex exec "${CODEX_DISABLE_HOOKS_ARGS[@]}" "${CODEX_EXEC_ARGS[@]}" - \ > "$CODEX_STDOUT_FILE" 2> "$CODEX_STDERR_FILE" || CODEX_EXIT_CODE=$? END_TIME=$(date +%s) diff --git a/scripts/install-skill.sh b/scripts/install-skill.sh index fa546618..01db6602 100755 --- a/scripts/install-skill.sh +++ b/scripts/install-skill.sh @@ -3,7 +3,7 @@ # Install/upgrade Humanize skills for Kimi and/or Codex. # # What this does: -# 1) Sync skills/{humanize,humanize-gen-plan,humanize-rlcr} to target skills dir(s) +# 1) Sync Humanize entrypoint skills to target skills dir(s) # 2) Copy runtime dependencies into /humanize/{scripts,hooks,prompt-template} # 3) Hydrate SKILL.md command paths with concrete runtime root paths # @@ -38,6 +38,7 @@ DRY_RUN="false" SKILL_NAMES=( "humanize" + "humanize-gen-idea" "humanize-gen-plan" "humanize-refine-plan" "humanize-rlcr" @@ -103,11 +104,18 @@ resolve_source_layout() { # Installed runtime layout: # /humanize/scripts/install-skill.sh - # /humanize-gen-plan/SKILL.md - # /humanize-rlcr/SKILL.md + # //SKILL.md if [[ -d "$runtime_root/scripts" ]] && [[ -d "$runtime_root/hooks" ]] && [[ -d "$runtime_root/prompt-template" ]]; then skills_root="$(cd "$runtime_root/.." && pwd)" - if [[ -f "$skills_root/humanize/SKILL.md" ]] && [[ -f "$skills_root/humanize-gen-plan/SKILL.md" ]] && [[ -f "$skills_root/humanize-refine-plan/SKILL.md" ]] && [[ -f "$skills_root/humanize-rlcr/SKILL.md" ]]; then + local all_skills_present="true" + local skill + for skill in "${SKILL_NAMES[@]}"; do + if [[ ! -f "$skills_root/$skill/SKILL.md" ]]; then + all_skills_present="false" + break + fi + done + if [[ "$all_skills_present" == "true" ]]; then SKILLS_SOURCE_ROOT="$skills_root" RUNTIME_SOURCE_ROOT="$runtime_root" return 0 @@ -296,7 +304,7 @@ user_config = pathlib.Path(sys.argv[2]) install_target = sys.argv[3] defaults = json.loads(default_config.read_text(encoding="utf-8")) -default_codex_model = defaults.get("codex_model") or "gpt-5.4" +default_codex_model = defaults.get("codex_model") or "gpt-5.5" if user_config.exists(): try: diff --git a/skills/ask-codex/SKILL.md b/skills/ask-codex/SKILL.md index 486e8fcb..a09a6b0b 100644 --- a/skills/ask-codex/SKILL.md +++ b/skills/ask-codex/SKILL.md @@ -24,7 +24,7 @@ If the user supplied flags such as `--codex-model` or `--codex-timeout`, reconst Example: ```bash -"${CLAUDE_PLUGIN_ROOT}/scripts/ask-codex.sh" --codex-model gpt-5.4:high "Review the following round summary (M4)..." +"${CLAUDE_PLUGIN_ROOT}/scripts/ask-codex.sh" --codex-model gpt-5.5:high "Review the following round summary (M4)..." ``` Never run this unsafe form: @@ -53,4 +53,4 @@ because the shell will re-parse the question text and can fail before `ask-codex ## Notes - The response is saved to `.humanize/skill//output.md` for reference -- Default model is `gpt-5.4:high` with a 3600-second timeout +- Default model is `gpt-5.5:high` with a 3600-second timeout diff --git a/skills/humanize-gen-idea/SKILL.md b/skills/humanize-gen-idea/SKILL.md new file mode 100644 index 00000000..c22faa1c --- /dev/null +++ b/skills/humanize-gen-idea/SKILL.md @@ -0,0 +1,127 @@ +--- +name: humanize-gen-idea +description: Generate a repo-grounded idea draft from a loose prompt or notes file using directed exploration. +type: flow +user-invocable: false +disable-model-invocation: true +--- + +# Humanize Generate Idea + +Use this flow as the Codex/Kimi entrypoint for turning a loose idea into a draft document that can feed `humanize-gen-plan`. + +## Runtime Root + +The installer hydrates this skill with an absolute runtime root path: + +```bash +{{HUMANIZE_RUNTIME_ROOT}} +``` + +All commands below assume `{{HUMANIZE_RUNTIME_ROOT}}`. + +## Required Sequence + +### 1. Validate and Parse Input + +Run the validator first: + +```bash +"{{HUMANIZE_RUNTIME_ROOT}}/scripts/validate-gen-idea-io.sh" ... +``` + +Reconstruct argv safely: +- Keep `--n` and `--output` as separate shell arguments. +- Pass inline idea text as one quoted argument. +- Never rely on unsafe shell word-splitting for the free-form idea text. + +On success, parse these keys from stdout: +- `INPUT_MODE` +- `OUTPUT_FILE` +- `SLUG` +- `TEMPLATE_FILE` +- `N` +- `IDEA_BODY_FILE` when `INPUT_MODE=file` + +Preserve the idea body exactly: +- `inline`: extract the text between `=== IDEA_BODY_BEGIN ===` and `=== IDEA_BODY_END ===` +- `file`: read the entire contents of `IDEA_BODY_FILE` + +If validation exits non-zero, stop and report the corresponding error. + +### 2. Gather Repo Context + +Ground the draft in the current repository before ideating: +- Read the repo `README.md` +- Read `CLAUDE.md` if present +- Read `.claude/CLAUDE.md` if present +- Inspect the top-level directory listing + +### 3. Generate Orthogonal Directions + +Generate exactly `N` distinct directions for exploring the idea. + +Each direction must include: +- `name`: 2-5 words +- `rationale`: one sentence explaining why this angle is meaningfully different + +If two directions are near-duplicates, replace one with a genuinely different angle. + +### 4. Explore Each Direction + +For each direction, gather objective evidence from the repo. Prefer parallel read-only exploration when your runtime supports it; otherwise do the same work sequentially. + +Each proposal must contain exactly these fields: +- `APPROACH_SUMMARY` +- `OBJECTIVE_EVIDENCE` +- `KNOWN_RISKS` +- `CONFIDENCE` (`high`, `medium`, or `low`) + +`OBJECTIVE_EVIDENCE` must use concrete repo paths or precedents. If no concrete evidence exists, record the literal sentinel: + +```text +exploratory, no concrete precedent +``` + +### 5. Synthesize and Write the Draft + +Choose the primary direction by: +1. Evidence density +2. Fit with existing repo patterns +3. Smaller implementation surface when quality is otherwise similar +4. `CONFIDENCE` as a tiebreaker + +Write exactly one draft file to `OUTPUT_FILE`, using `TEMPLATE_FILE` as the structural contract. The draft should include: +- Title +- Original idea +- One primary direction +- Alternative directions considered +- Synthesis notes + +Do not modify source code or write any file other than the draft output. + +## Validation Exit Codes + +| Exit Code | Meaning | +|-----------|---------| +| 0 | Success - continue | +| 1 | Missing idea input or empty input file | +| 2 | Input looks like a file path but is missing, unreadable, or not `.md` | +| 3 | Output directory does not exist | +| 4 | Output file already exists | +| 5 | No write permission to output directory | +| 6 | Invalid arguments | +| 7 | Idea template file not found | + +## Usage + +```bash +# Start the flow with inline text +/flow:humanize-gen-idea "add undo/redo to the editor" + +# Or expand an existing notes file +/flow:humanize-gen-idea docs/idea.md --n 6 + +# Load as a standard skill only +/skill:humanize-gen-idea +``` diff --git a/skills/humanize-rlcr/SKILL.md b/skills/humanize-rlcr/SKILL.md index d9873b47..6166e1b7 100644 --- a/skills/humanize-rlcr/SKILL.md +++ b/skills/humanize-rlcr/SKILL.md @@ -83,7 +83,7 @@ Pass these through `setup-rlcr-loop.sh`: | `--plan-file ` | Explicit plan path | - | | `--track-plan-file` | Enforce tracked plan immutability | false | | `--max N` | Maximum iterations | 42 | -| `--codex-model MODEL:EFFORT` | Codex model and effort for `codex exec` | gpt-5.4:high | +| `--codex-model MODEL:EFFORT` | Codex model and effort for `codex exec` | gpt-5.5:high | | `--codex-timeout SECONDS` | Codex timeout | 5400 | | `--base-branch BRANCH` | Base for review phase | auto-detect | | `--full-review-round N` | Full alignment interval | 5 | @@ -94,7 +94,7 @@ Pass these through `setup-rlcr-loop.sh`: | `--yolo` | Skip quiz and enable --claude-answer-codex | false | | `--skip-quiz` | Skip Plan Understanding Quiz (implicit in skill mode) | false | -Review phase `codex review` runs with `gpt-5.4:high`. +Review phase `codex review` runs with `gpt-5.5:high`. ## Usage diff --git a/skills/humanize/SKILL.md b/skills/humanize/SKILL.md index 5b0a6af3..558e7e1d 100644 --- a/skills/humanize/SKILL.md +++ b/skills/humanize/SKILL.md @@ -72,8 +72,8 @@ After each round, write the required summary and stop/exit normally. Humanize's **Common Options:** - `--max N` - Maximum iterations before auto-stop (default: 42) -- `--codex-model MODEL:EFFORT` - Codex model and reasoning effort for `codex exec` (default: gpt-5.4:high) -- Review phase `codex review` uses `gpt-5.4:high` +- `--codex-model MODEL:EFFORT` - Codex model and reasoning effort for `codex exec` (default: gpt-5.5:high) +- Review phase `codex review` uses `gpt-5.5:high` - `--codex-timeout SECONDS` - Timeout for each Codex review (default: 5400) - `--base-branch BRANCH` - Base branch for code review (auto-detects if not specified) - `--full-review-round N` - Interval for full alignment checks (default: 5) diff --git a/tests/run-all-tests.sh b/tests/run-all-tests.sh index 00373b45..dca4d4de 100755 --- a/tests/run-all-tests.sh +++ b/tests/run-all-tests.sh @@ -80,6 +80,7 @@ TEST_SUITES=( "test-monitor-runtime.sh" "test-monitor-e2e-deletion.sh" "test-monitor-e2e-sigint.sh" + "test-gen-idea-wiring.sh" "test-gen-plan.sh" "test-refine-plan.sh" "test-task-tag-routing.sh" diff --git a/tests/test-ask-codex.sh b/tests/test-ask-codex.sh index 896f282a..e72b071c 100755 --- a/tests/test-ask-codex.sh +++ b/tests/test-ask-codex.sh @@ -7,6 +7,7 @@ # MOCK_CODEX_EXIT_CODE - exit code the mock returns (default: 0) # MOCK_CODEX_STDOUT - text the mock writes to stdout # MOCK_CODEX_STDERR - text the mock writes to stderr +# MOCK_CODEX_ARGS_FILE - file where the mock records non-help argv # set -euo pipefail @@ -40,6 +41,15 @@ cat > "$MOCK_BIN_DIR/codex" << 'MOCK_EOF' #!/usr/bin/env bash # Mock codex binary for testing ask-codex.sh # Controlled via environment variables. +if [[ "${1:-}" == "--help" ]]; then + if [[ -n "${MOCK_CODEX_HELP:-}" ]]; then + printf '%s\n' "$MOCK_CODEX_HELP" + fi + exit "${MOCK_CODEX_HELP_EXIT_CODE:-0}" +fi +if [[ -n "${MOCK_CODEX_ARGS_FILE:-}" ]]; then + printf '%s\n' "$*" > "$MOCK_CODEX_ARGS_FILE" +fi if [[ -n "${MOCK_CODEX_STDERR:-}" ]]; then echo "$MOCK_CODEX_STDERR" >&2 fi @@ -56,12 +66,14 @@ chmod +x "$MOCK_BIN_DIR/codex" export MOCK_CODEX_EXIT_CODE="" export MOCK_CODEX_STDOUT="" export MOCK_CODEX_STDERR="" +export MOCK_CODEX_ARGS_FILE="" # Reset mock state between tests reset_mock() { export MOCK_CODEX_EXIT_CODE="0" export MOCK_CODEX_STDOUT="" export MOCK_CODEX_STDERR="" + export MOCK_CODEX_ARGS_FILE="" } # Helper: run ask-codex with mock codex in PATH, inside mock project @@ -209,6 +221,18 @@ else fail "successful run exits 0" "exit 0" "exit=$EXIT_CODE" fi +# Test: codex hooks are always disabled for nested codex exec +reset_mock +export MOCK_CODEX_STDOUT="disable-hooks-test" +export MOCK_CODEX_ARGS_FILE="$TEST_DIR/codex-disable-hooks.args" +run_ask_codex "disable nested hooks test" > /dev/null 2>&1 +if grep -q -- 'exec --disable codex_hooks' "$MOCK_CODEX_ARGS_FILE"; then + pass "nested codex exec always disables codex_hooks" +else + fail "nested codex exec always disables codex_hooks" \ + "exec --disable codex_hooks" "$(cat "$MOCK_CODEX_ARGS_FILE" 2>/dev/null || echo missing)" +fi + # ======================================== # Error Handling Tests # ======================================== diff --git a/tests/test-codex-hook-install.sh b/tests/test-codex-hook-install.sh index 2d70bb2d..e9c8e9aa 100755 --- a/tests/test-codex-hook-install.sh +++ b/tests/test-codex-hook-install.sh @@ -127,6 +127,12 @@ else fail "Codex install keeps humanize-rlcr entrypoint skill" "skills/humanize-rlcr/SKILL.md exists" "missing" fi +if [[ -f "$CODEX_HOME_DIR/skills/humanize-gen-idea/SKILL.md" ]]; then + pass "Codex install keeps humanize-gen-idea entrypoint skill" +else + fail "Codex install keeps humanize-gen-idea entrypoint skill" "skills/humanize-gen-idea/SKILL.md exists" "missing" +fi + if [[ -f "$HOOKS_FILE" ]]; then pass "Codex install writes hooks.json" else @@ -151,11 +157,11 @@ else fail "Codex install writes a PATH-ready bitlesson-selector shim" "$COMMAND_BIN_DIR/bitlesson-selector exists" "missing" fi -if [[ "$(jq -r '.bitlesson_model // empty' "$HUMANIZE_USER_CONFIG")" == "gpt-5.4" ]]; then +if [[ "$(jq -r '.bitlesson_model // empty' "$HUMANIZE_USER_CONFIG")" == "gpt-5.5" ]]; then pass "Codex install seeds bitlesson_model with a Codex/OpenAI model" else fail "Codex install seeds bitlesson_model with a Codex/OpenAI model" \ - "gpt-5.4" "$(jq -c '.' "$HUMANIZE_USER_CONFIG" 2>/dev/null || echo MISSING)" + "gpt-5.5" "$(jq -c '.' "$HUMANIZE_USER_CONFIG" 2>/dev/null || echo MISSING)" fi if [[ "$(jq -r '.provider_mode // empty' "$HUMANIZE_USER_CONFIG")" == "codex-only" ]]; then diff --git a/tests/test-disable-nested-codex-hooks.sh b/tests/test-disable-nested-codex-hooks.sh index 7178052f..ba63b71d 100755 --- a/tests/test-disable-nested-codex-hooks.sh +++ b/tests/test-disable-nested-codex-hooks.sh @@ -130,7 +130,6 @@ start_branch: $current_branch base_branch: $current_branch base_commit: $base_commit push_every_round: false -codex_model: gpt-5.4 codex_effort: high codex_timeout: 120 review_started: $review_started @@ -206,6 +205,13 @@ else "review --disable codex_hooks" "$(cat "$TEST_DIR/review.args" 2>/dev/null || echo missing)" fi +if grep -q -- 'review_model=gpt-5.5' "$TEST_DIR/review.args"; then + pass "review-phase stop hook uses gpt-5.5 review model by default" +else + fail "review-phase stop hook uses gpt-5.5 review model by default" \ + "review_model=gpt-5.5" "$(cat "$TEST_DIR/review.args" 2>/dev/null || echo missing)" +fi + echo "" echo "========================================" echo "Disable Nested Codex Hooks Tests" diff --git a/tests/test-gen-idea-wiring.sh b/tests/test-gen-idea-wiring.sh new file mode 100755 index 00000000..9cdb3c54 --- /dev/null +++ b/tests/test-gen-idea-wiring.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash +# +# Tests for gen-idea skill wiring across skills, installers, and install docs. +# + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)" +PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" +source "$SCRIPT_DIR/test-helpers.sh" + +SKILL_FILE="$PROJECT_ROOT/skills/humanize-gen-idea/SKILL.md" +INSTALL_SCRIPT="$PROJECT_ROOT/scripts/install-skill.sh" +README_FILE="$PROJECT_ROOT/README.md" +CLAUDE_INSTALL_DOC="$PROJECT_ROOT/docs/install-for-claude.md" +CODEX_INSTALL_DOC="$PROJECT_ROOT/docs/install-for-codex.md" +KIMI_INSTALL_DOC="$PROJECT_ROOT/docs/install-for-kimi.md" + +frontmatter_value() { + local file="$1" + local key="$2" + sed -n "/^---$/,/^---$/{ /^${key}:[[:space:]]*/{ s/^${key}:[[:space:]]*//p; q; } }" "$file" +} + +assert_file_contains() { + local file="$1" + local needle="$2" + local description="$3" + + if grep -qF -- "$needle" "$file"; then + pass "$description" + else + fail "$description" "$needle" "missing" + fi +} + +echo "========================================" +echo "Gen-Idea Wiring Tests" +echo "========================================" +echo "" + +if [[ -f "$SKILL_FILE" ]]; then + pass "humanize-gen-idea skill file exists" + + if [[ "$(frontmatter_value "$SKILL_FILE" "name")" == "humanize-gen-idea" ]]; then + pass "humanize-gen-idea skill frontmatter sets the correct name" + else + fail "humanize-gen-idea skill frontmatter sets the correct name" \ + "humanize-gen-idea" "$(frontmatter_value "$SKILL_FILE" "name")" + fi + + if [[ "$(frontmatter_value "$SKILL_FILE" "user-invocable")" == "false" ]]; then + pass "humanize-gen-idea skill frontmatter sets user-invocable: false" + else + fail "humanize-gen-idea skill frontmatter sets user-invocable: false" \ + "false" "$(frontmatter_value "$SKILL_FILE" "user-invocable")" + fi +else + fail "humanize-gen-idea skill file exists" "$SKILL_FILE" "missing" +fi + +if sed -n '/^SKILL_NAMES=(/,/^)/p' "$INSTALL_SCRIPT" | grep -qF '"humanize-gen-idea"'; then + pass "install-skill.sh includes humanize-gen-idea in SKILL_NAMES" +else + fail "install-skill.sh includes humanize-gen-idea in SKILL_NAMES" \ + '"humanize-gen-idea"' "missing from SKILL_NAMES" +fi + +assert_file_contains "$README_FILE" "/humanize:gen-idea" "README.md mentions gen-idea quick start" +assert_file_contains "$CLAUDE_INSTALL_DOC" "/humanize:gen-idea" "install-for-claude.md mentions gen-idea command" +assert_file_contains "$CODEX_INSTALL_DOC" "humanize-gen-idea" "install-for-codex.md mentions humanize-gen-idea skill" +assert_file_contains "$KIMI_INSTALL_DOC" "humanize-gen-idea" "install-for-kimi.md mentions humanize-gen-idea skill" + +print_test_summary "Gen-Idea Wiring Tests" diff --git a/tests/test-template-references.sh b/tests/test-template-references.sh index 13d4c31b..6eb242b5 100755 --- a/tests/test-template-references.sh +++ b/tests/test-template-references.sh @@ -200,6 +200,54 @@ for script in "${CRITICAL_SCRIPTS[@]}"; do fi done +# ======================================== +# Section 5: Verify Codex Terminal Phase Templates +# ======================================== +section "Section 5: Verify Codex Terminal Phase Templates" + +STOP_HOOK="$PROJECT_ROOT/hooks/loop-codex-stop-hook.sh" +METHODOLOGY_LIB="$PROJECT_ROOT/hooks/lib/methodology-analysis.sh" + +if grep -q '"codex/finalize-phase-prompt.md"' "$STOP_HOOK" && + grep -q '"codex/finalize-phase-skipped-prompt.md"' "$STOP_HOOK"; then + pass "Finalize phase uses Codex-specific templates" +else + fail "Finalize phase uses Codex-specific templates" +fi + +if grep -q '"codex/methodology-analysis-prompt.md"' "$METHODOLOGY_LIB"; then + pass "Methodology analysis uses Codex-specific template" +else + fail "Methodology analysis uses Codex-specific template" +fi + +if grep -q '"claude/methodology-analysis-prompt.md"' "$METHODOLOGY_LIB" && + grep -q 'PROVIDER_MODE.*codex-only' "$METHODOLOGY_LIB"; then + pass "Methodology analysis gates Codex template behind codex-only provider mode" +else + fail "Methodology analysis gates Codex template behind codex-only provider mode" +fi + +CODEX_TERMINAL_TEMPLATES=( + "$TEMPLATE_DIR/codex/finalize-phase-prompt.md" + "$TEMPLATE_DIR/codex/finalize-phase-skipped-prompt.md" + "$TEMPLATE_DIR/codex/methodology-analysis-prompt.md" +) + +for template in "${CODEX_TERMINAL_TEMPLATES[@]}"; do + template_name="${template#$TEMPLATE_DIR/}" + if [[ ! -f "$template" ]]; then + fail "Codex terminal template exists: $template_name" + continue + fi + + if grep -qE 'Task tool|subagent_type|Agent tool|AskUserQuestion|model: "opus"|model: '\''opus'\''' "$template"; then + fail "Codex terminal template avoids Claude-only runtime syntax: $template_name" + else + pass "Codex terminal template avoids Claude-only runtime syntax: $template_name" + fi +done + # ======================================== # Summary # ======================================== diff --git a/tests/test-unified-codex-config.sh b/tests/test-unified-codex-config.sh index 5948193f..d40c20b7 100755 --- a/tests/test-unified-codex-config.sh +++ b/tests/test-unified-codex-config.sh @@ -65,8 +65,8 @@ DEFAULT_CONFIG="$PROJECT_ROOT/config/default_config.json" if ! command -v jq >/dev/null 2>&1; then skip "default config tests require jq" "jq not found" else - assert_eq "default_config.json: codex_model is gpt-5.4" \ - "gpt-5.4" "$(jq -r '.codex_model' "$DEFAULT_CONFIG")" + assert_eq "default_config.json: codex_model is gpt-5.5" \ + "gpt-5.5" "$(jq -r '.codex_model' "$DEFAULT_CONFIG")" assert_eq "default_config.json: codex_effort is high" \ "high" "$(jq -r '.codex_effort' "$DEFAULT_CONFIG")" @@ -100,8 +100,8 @@ else merged=$(XDG_CONFIG_HOME="$TEST_DIR/no-user-config" load_merged_config "$PROJECT_ROOT" "$PROJECT_DIR" 2>/dev/null) - assert_eq "default-only: codex_model defaults to gpt-5.4" \ - "gpt-5.4" "$(get_config_value "$merged" "codex_model")" + assert_eq "default-only: codex_model defaults to gpt-5.5" \ + "gpt-5.5" "$(get_config_value "$merged" "codex_model")" assert_eq "default-only: codex_effort defaults to high" \ "high" "$(get_config_value "$merged" "codex_effort")" @@ -119,6 +119,7 @@ else assert_eq "project override: codex_effort overrides default" \ "xhigh" "$(get_config_value "$merged" "codex_effort")" + fi echo "" @@ -141,7 +142,7 @@ else " 2>/dev/null || echo "ERROR") assert_eq "loop-common.sh: DEFAULT_CODEX_MODEL is set" \ - "gpt-5.4" "$(echo "$result" | cut -d'|' -f1)" + "gpt-5.5" "$(echo "$result" | cut -d'|' -f1)" assert_eq "loop-common.sh: DEFAULT_CODEX_EFFORT is set" \ "high" "$(echo "$result" | cut -d'|' -f2)" @@ -208,8 +209,8 @@ else result_line="$(printf '%s\n' "$result" | grep '^RESULT:' | tail -n 1)" - assert_eq "invalid config: codex_model falls back to gpt-5.4" \ - "gpt-5.4" "$(echo "$result_line" | cut -d':' -f2 | cut -d'|' -f1)" + assert_eq "invalid config: codex_model falls back to gpt-5.5" \ + "gpt-5.5" "$(echo "$result_line" | cut -d':' -f2 | cut -d'|' -f1)" assert_eq "invalid config: codex_effort falls back to high" \ "high" "$(echo "$result_line" | cut -d'|' -f2)" @@ -236,8 +237,8 @@ else result_line="$(printf '%s\n' "$result" | grep '^RESULT:' | tail -n 1)" - assert_eq "non-Codex config ($invalid_model): codex_model falls back to gpt-5.4" \ - "gpt-5.4" "$(echo "$result_line" | cut -d':' -f2 | cut -d'|' -f1)" + assert_eq "non-Codex config ($invalid_model): codex_model falls back to gpt-5.5" \ + "gpt-5.5" "$(echo "$result_line" | cut -d':' -f2 | cut -d'|' -f1)" assert_eq "non-Codex config ($invalid_model): codex_effort stays at high fallback" \ "high" "$(echo "$result_line" | cut -d'|' -f2)" @@ -324,8 +325,8 @@ BARE_EOF echo \"\$EXEC_MODEL|\$EXEC_EFFORT\" " 2>/dev/null || echo "ERROR") - assert_eq "bare state: falls back to DEFAULT_CODEX_MODEL (gpt-5.4)" \ - "gpt-5.4" "$(echo "$result" | cut -d'|' -f1)" + assert_eq "bare state: falls back to DEFAULT_CODEX_MODEL (gpt-5.5)" \ + "gpt-5.5" "$(echo "$result" | cut -d'|' -f1)" assert_eq "bare state: falls back to DEFAULT_CODEX_EFFORT (high)" \ "high" "$(echo "$result" | cut -d'|' -f2)"