Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/default_config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"codex_model": "gpt-5.4",
"codex_model": "gpt-5.5",
"codex_effort": "high",
"bitlesson_model": "haiku",
"agent_teams": false,
Expand Down
1 change: 1 addition & 0 deletions docs/install-for-claude.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions docs/install-for-codex.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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`
Expand All @@ -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`
Expand All @@ -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
Expand Down
34 changes: 24 additions & 10 deletions docs/install-for-kimi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -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):
Expand All @@ -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/
Expand All @@ -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 '
Comment on lines 73 to 76
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The manual install instructions say this awk step “matches the behavior of scripts/install-skill.sh”, but it only strips user-invocable. The installer’s strip_claude_specific_frontmatter() also removes disable-model-invocation and hide-from-slash-command-tool, so manual installs will produce different SKILL.md frontmatter. Update this snippet to strip the same keys (or adjust the comment to reflect the actual behavior).

Copilot uses AI. Check for mistakes.
BEGIN { in_fm = 0; fm_done = 0 }
/^---[[:space:]]*$/ {
Expand Down Expand Up @@ -98,6 +100,7 @@ ls -la ~/.config/agents/skills/

# Should show:
# humanize/
# humanize-gen-idea/
# humanize-gen-plan/
# humanize-refine-plan/
# humanize-rlcr/
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 |
Expand All @@ -191,14 +204,15 @@ 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

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
Expand Down
10 changes: 5 additions & 5 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ OPTIONS:
--plan-file <path> Explicit plan file path (alternative to positional arg)
--max <N> Maximum iterations before auto-stop (default: 42)
--codex-model <MODEL:EFFORT>
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 <SECONDS>
Timeout for each Codex review in seconds (default: 5400)
--track-plan-file Indicate plan file should be tracked in git (must be clean)
Expand Down Expand Up @@ -240,7 +240,7 @@ translated plan and QA variants by inserting `_<code>` before the file extension

OPTIONS:
--codex-model <MODEL:EFFORT>
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 <SECONDS>
Timeout for the Codex query in seconds (default: 3600)
-h, --help Show help message
Expand All @@ -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` |
Expand All @@ -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`:
Expand All @@ -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.
Expand Down
10 changes: 6 additions & 4 deletions hooks/lib/loop-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down
14 changes: 12 additions & 2 deletions hooks/lib/methodology-analysis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand Down Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions hooks/loop-codex-stop-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ' "')
Expand Down Expand Up @@ -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
Expand All @@ -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" \
Expand All @@ -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
Expand All @@ -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" \
Expand Down
47 changes: 47 additions & 0 deletions prompt-template/codex/finalize-phase-prompt.md
Original file line number Diff line number Diff line change
@@ -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
Loading