Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
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
4 changes: 3 additions & 1 deletion docs/install-for-codex.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ 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
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 Down
30 changes: 22 additions & 8 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 thread
zevorn marked this conversation as resolved.
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 Down Expand Up @@ -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
Expand Down
16 changes: 12 additions & 4 deletions scripts/install-skill.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <skills-dir>/humanize/{scripts,hooks,prompt-template}
# 3) Hydrate SKILL.md command paths with concrete runtime root paths
#
Expand Down Expand Up @@ -38,6 +38,7 @@ DRY_RUN="false"

SKILL_NAMES=(
"humanize"
"humanize-gen-idea"
"humanize-gen-plan"
"humanize-refine-plan"
"humanize-rlcr"
Expand Down Expand Up @@ -103,11 +104,18 @@ resolve_source_layout() {

# Installed runtime layout:
# <skills-dir>/humanize/scripts/install-skill.sh
# <skills-dir>/humanize-gen-plan/SKILL.md
# <skills-dir>/humanize-rlcr/SKILL.md
# <skills-dir>/<skill>/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"
Comment thread
zevorn marked this conversation as resolved.
break
fi
done
if [[ "$all_skills_present" == "true" ]]; then
SKILLS_SOURCE_ROOT="$skills_root"
RUNTIME_SOURCE_ROOT="$runtime_root"
return 0
Expand Down
127 changes: 127 additions & 0 deletions skills/humanize-gen-idea/SKILL.md
Original file line number Diff line number Diff line change
@@ -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
```
1 change: 1 addition & 0 deletions tests/run-all-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions tests/test-codex-hook-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
74 changes: 74 additions & 0 deletions tests/test-gen-idea-wiring.sh
Original file line number Diff line number Diff line change
@@ -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"
Loading