-
Notifications
You must be signed in to change notification settings - Fork 125
Add gen-idea skill to Codex installs #101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zhaoxueyan1
wants to merge
3
commits into
PolyArch:dev
Choose a base branch
from
zhaoxueyan1:codex/gen-idea-codex-skill
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.