-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add elegance-pipeline plugin (Codex bundle -> Claude Code native) #156
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,14 @@ and the project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.htm | |
|
|
||
| ### Added | ||
|
|
||
| - **`elegance-pipeline` plugin (1.0.0)**: Multi-agent code-elegance workflow converted from Codex bundle to native Claude Code plugin. 4 scouts (sonnet, read-only), 2 judges (opus, read-only), 1 planner (opus), 1 verifier (opus), 1 gated implementer (opus, full edit). Persistent state manager with stage gates and implementation signal. 3 commands (`init`, `status`, `run`), 1 skill, 5 agents. All `.codex/` paths rewritten to `${CLAUDE_PLUGIN_ROOT}`, Codex-Spark->sonnet, GPT-5.4->opus, state moved to project-local `.claude/elegance_pipeline/state/` | ||
|
|
||
| ### Fixed | ||
|
|
||
| - **marketplace.json version mismatches**: hookify 0.2.0->0.2.1, metacognitive-guard 0.4.5->0.5.0 (synced with plugin.json) | ||
|
|
||
| ### Added | ||
|
|
||
|
Comment on lines
9
to
+18
|
||
| - **Codex PR review automation**: Added `.github/workflows/codex-code-review.yml`, `.github/codex/prompts/review.md`, and `.github/codex/schemas/review-output.schema.json`. Codex now reviews pull requests in a read-only sandbox, returns structured verdicts, publishes formal GitHub reviews, and skips PRs that only modify Codex review automation | ||
| - **metacognitive-guard `InstructionsLoaded` hook**: Truth beacon now fires on both SessionStart AND InstructionsLoaded — ground truth re-injected when CLAUDE.md/rules are loaded, ensuring authoritative facts arrive after instructions context | ||
| - **metacognitive-guard `agent_type` filtering**: Struggle detector and Ralph Loop now skip subagents via `agent_type` field in hook events — prevents wasted haiku calls and false positives from subagent responses | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| { | ||
| "name": "elegance-pipeline", | ||
| "version": "1.0.0", | ||
| "description": "Multi-agent code-elegance workflow: 4 scouts, 2 judges, 1 planner, 1 verifier, 1 gated implementer. Persistent state manager with stage gates and implementation signal.", | ||
| "author": { | ||
| "name": "ANcpLua" | ||
| }, | ||
| "repository": "https://github.com/ANcpLua/ancplua-claude-plugins", | ||
| "license": "MIT", | ||
| "keywords": [ | ||
| "elegance", | ||
| "code-quality", | ||
| "multi-agent", | ||
| "refactoring", | ||
| "pipeline", | ||
| "scout", | ||
| "judge" | ||
| ], | ||
| "commands": "./commands", | ||
| "agents": [ | ||
| "./agents/elegance-scout.md", | ||
| "./agents/elegance-judge.md", | ||
| "./agents/elegance-planner.md", | ||
| "./agents/elegance-verifier.md", | ||
| "./agents/elegance-implementer.md" | ||
| ] | ||
|
Comment on lines
+18
to
+26
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # elegance-pipeline | ||
|
|
||
| Multi-agent code-elegance workflow for Claude Code. Evaluates source files across a repository for elegance (difficulty handled / solution complexity) and optionally converts justified weaknesses into narrowly scoped refactor work. | ||
|
|
||
| ## Pipeline | ||
|
|
||
| ```text | ||
| 4 Scouts (parallel, sonnet) -> 2 Judges (parallel, opus) -> 1 Planner (opus) | ||
| -> 1 Verifier (opus) -> 1 Implementer (gated, opus) | ||
| ``` | ||
|
|
||
| - **Scouts**: Read-only. Each inspects an assigned scope for elegant code candidates. | ||
| - **Judges**: Read-only. Verify scout findings against the codebase, produce final top-5 ranking. | ||
| - **Planner**: Read-only. Converts judge verdicts into max 3 actionable refactor tasks. | ||
| - **Verifier**: Read-only. Validates the plan is justified and narrow. Controls the implementation gate. | ||
| - **Implementer**: Full edit access. Only runs when the verifier approves. Implements the verified plan. | ||
|
|
||
| ## Setup | ||
|
|
||
| ```bash | ||
| python plugins/elegance-pipeline/elegance_pipeline/pipeline.py init \ | ||
| --project-anchor CLAUDE.md \ | ||
| --scope plugins/exodia \ | ||
| --scope plugins/metacognitive-guard \ | ||
| --scope plugins/hookify \ | ||
| --scope plugins/feature-dev | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| ```text | ||
| /elegance-pipeline:status # Check pipeline state | ||
| /elegance-pipeline:run # Run next ready stage | ||
| /elegance-pipeline:run scouts # Run only scout phase | ||
| ``` | ||
|
|
||
| ## State | ||
|
|
||
| State is project-local at `.claude/elegance_pipeline/state/`. Not committed to git. | ||
|
|
||
| ## Origin | ||
|
|
||
| Converted from the Codex `elegance-pipeline-bundle.zip`. All `.codex/` references rewritten to Claude Code native plugin structure. Codex-Spark -> sonnet, GPT-5.4 -> opus. Manual thread creation replaced with Claude Code subagent orchestration. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| --- | ||
| name: elegance-implementer | ||
| description: Implementation agent. Executes the verifier-approved refactor plan with minimal correct changes. Only runs when the implementation signal is READY. Use when running the elegance pipeline implementer phase. | ||
| tools: Read, Write, Edit, Grep, Glob, Bash | ||
| model: opus | ||
| --- | ||
|
|
||
| You are the implementation agent in the elegance pipeline. | ||
|
|
||
| Your job is to correctly implement the verifier-approved plan with the smallest change set that fully satisfies the decision. You understand scope before changing code, prefer the project's existing abstractions, and verify your work. | ||
|
|
||
| You have full edit access. Follow the 4-phase protocol: understand scope, plan, implement, verify. | ||
|
|
||
| When you receive your task prompt (rendered by the pipeline state manager), follow it exactly. Submit your results through the pipeline state manager command provided in the prompt. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| --- | ||
| name: elegance-judge | ||
| description: Code elegance judge. Verifies scout findings against the actual codebase and produces the final top-5 ranking. Use when running the elegance pipeline judge phase. | ||
| tools: Read, Grep, Glob, Bash | ||
| model: opus | ||
| --- | ||
|
|
||
| You are a code elegance judge in the elegance pipeline. | ||
|
|
||
| Your job is to take the shortlist from all 4 scouts, verify finalists directly in the codebase, and produce the definitive top-5 most elegant source files. You score by difficulty times cleanliness. | ||
|
|
||
| You are read-only. Do not edit, create, or delete any files. | ||
|
|
||
| When you receive your task prompt (rendered by the pipeline state manager), follow it exactly. Submit your results through the pipeline state manager command provided in the prompt. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| --- | ||
| name: elegance-planner | ||
| description: Refactor planner. Converts judge verdicts into actionable engineering tasks only when evidence justifies real change. Use when running the elegance pipeline planner phase. | ||
| tools: Read, Grep, Glob, Bash | ||
| model: opus | ||
| --- | ||
|
|
||
| You are the refactor planner in the elegance pipeline. | ||
|
|
||
| Your job is to convert judge verdicts into at most 3 narrow, high-confidence implementation tasks. You do not invent work. If the judges found no actionable weaknesses, you say "No implementation warranted." | ||
|
|
||
| You are read-only. Do not edit, create, or delete any files. | ||
|
|
||
| When you receive your task prompt (rendered by the pipeline state manager), follow it exactly. Submit your results through the pipeline state manager command provided in the prompt. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| --- | ||
| name: elegance-scout | ||
| description: Read-only code elegance scout. Inspects an assigned scope for the most elegant source files. Use when running the elegance pipeline scout phase. | ||
| tools: Read, Grep, Glob, Bash | ||
| model: sonnet | ||
| --- | ||
|
|
||
| You are a code elegance scout in the elegance pipeline. | ||
|
|
||
| Your job is to inspect source files in your assigned scope and identify the strongest candidates for elegance. You evaluate files by the ratio of problem complexity to solution complexity. | ||
|
|
||
| You are read-only. Do not edit, create, or delete any files. Do not run formatting, refactoring, or build commands. | ||
|
|
||
| When you receive your task prompt (rendered by the pipeline state manager), follow it exactly. Submit your results through the pipeline state manager command provided in the prompt. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| --- | ||
| name: elegance-verifier | ||
| description: Plan verifier judge. Validates that the planner extracted the right work from judge evidence. Controls the implementation gate signal. Use when running the elegance pipeline verifier phase. | ||
| tools: Read, Grep, Glob, Bash | ||
| model: opus | ||
| --- | ||
|
|
||
| You are the plan verifier judge in the elegance pipeline. | ||
|
|
||
| Your job is to verify whether the refactor planner extracted the right work from the judge evidence. You reject fabricated work, under-scoped plans, and over-broad cleanup sprawl. Your verdict controls the implementation signal gate. | ||
|
|
||
| You are read-only. Do not edit, create, or delete any files. | ||
|
|
||
| When you receive your task prompt (rendered by the pipeline state manager), follow it exactly. Submit your results through the pipeline state manager command provided in the prompt. |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,22 @@ | ||||
| --- | ||||
| description: Initialize the elegance pipeline for this repository | ||||
| disable-model-invocation: true | ||||
|
||||
| disable-model-invocation: true |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,54 @@ | ||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||
| description: Run the next ready stage of the elegance pipeline | ||||||||||||||||||||||||
| disable-model-invocation: true | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
| disable-model-invocation: true |
Copilot
AI
Mar 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allowed-tools includes Agent, but this repo’s orchestration commands consistently use the Task tool to spawn subagents (and no other command declares an Agent tool). If this is meant to allow subagent spawning, switch to Task and update the command text accordingly.
Copilot
AI
Mar 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example pipeline submission command echo "<agent output>" | python ${CLAUDE_PLUGIN_ROOT}/elegance_pipeline/pipeline.py submit ... embeds untrusted agent output directly into a Bash command in double quotes, which still allows command substitution via $(...) or backticks and can lead to arbitrary command execution if the output contains shell metacharacters. An attacker who can influence agent output (e.g., via repository content that the agent echoes) could inject $(malicious_command) and have it executed when this pattern is followed. Adjust the orchestration pattern so agent output is passed to pipeline.py via stdin or a temporary file without going through shell interpolation (for example, by avoiding echo with inline output and using safer redirection or tooling APIs that pass data directly).
| echo "<agent output>" | python ${CLAUDE_PLUGIN_ROOT}/elegance_pipeline/pipeline.py submit \ | |
| --role <role> --slot <slot> --stdin | |
| # Recommended: save agent output to a file and pass it via stdin | |
| python ${CLAUDE_PLUGIN_ROOT}/elegance_pipeline/pipeline.py submit \ | |
| --role <role> --slot <slot> --stdin < agent_output.json | |
| # Or, for manual pasting, use a quoted heredoc to avoid shell interpolation: | |
| python ${CLAUDE_PLUGIN_ROOT}/elegance_pipeline/pipeline.py submit \ | |
| --role <role> --slot <slot> --stdin << 'EOF' | |
| <paste agent output here, then press Enter and Ctrl-D> | |
| EOF |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The procedure for running the pipeline instructs the orchestrator (Claude Code) to pipe agent output into the state manager using echo "<agent output>" | python .... This is a critical command injection vulnerability. If the agent output contains shell metacharacters (e.g., backticks, $(...), or semicolons), they will be executed by the shell when the command is constructed. Since agents can be manipulated or produce unexpected output, this allows for arbitrary command execution on the user's machine.
| echo "<agent output>" | python ${CLAUDE_PLUGIN_ROOT}/elegance_pipeline/pipeline.py submit \ | |
| --role <role> --slot <slot> --stdin | |
| ``` | |
| 4. After each agent completes, submit its result to the state manager using the --file argument to avoid shell injection: | |
| ```bash | |
| python ${CLAUDE_PLUGIN_ROOT}/elegance_pipeline/pipeline.py submit \ | |
| --role <role> --slot <slot> --file <path_to_agent_output_file> |
Copilot
AI
Mar 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ## Arguments section claims /elegance-pipeline:run can run phases sequentially based on $ARGUMENTS (e.g., all, scouts, a specific slot), but the command body only documents a manual procedure and the state manager doesn’t implement any “run stage” subcommand. Either implement argument-driven behavior (likely by adding a run command in pipeline.py) or adjust this section to avoid promising functionality that doesn’t exist.
| Pass `$ARGUMENTS` to control which stage to run: | |
| - `scouts` — run only scout phase | |
| - `judges` — run only judge phase | |
| - `all` — run all phases sequentially (default) | |
| - A specific slot like `scout-1` or `judge-2` | |
| This command currently documents a **manual procedure** for running the pipeline. | |
| Any `$ARGUMENTS` passed to `/elegance-pipeline:run` **do not change** the behavior described above; | |
| you must explicitly follow the status → prompt → subagent → submit loop. | |
| You MAY still use `$ARGUMENTS` as a human-facing note (for example, to remind yourself you are focusing | |
| on “scouts”, “judges”, or a specific slot), but pipeline execution is not automated by these values. |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,14 @@ | ||||
| --- | ||||
| description: Show elegance pipeline workflow status | ||||
| disable-model-invocation: true | ||||
|
||||
| disable-model-invocation: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This
### Addedheading is a duplicate. To follow the Keep a Changelog format, all new additions for this release should be grouped under a single### Addedsection. Please move the items from this section to the### Addedsection at line 9.