Skip to content

feat(commands): add /plan-orchestrate — generate /orchestrate prompts from plan docs#1603

Closed
d0m999 wants to merge 4 commits into
affaan-m:mainfrom
d0m999:feat/plan-orchestrate-command
Closed

feat(commands): add /plan-orchestrate — generate /orchestrate prompts from plan docs#1603
d0m999 wants to merge 4 commits into
affaan-m:mainfrom
d0m999:feat/plan-orchestrate-command

Conversation

@d0m999

@d0m999 d0m999 commented Apr 28, 2026

Copy link
Copy Markdown

Summary

Adds /plan-orchestrate, a command that reads a plan document, decomposes it into steps, picks a per-step agent chain from the existing ECC catalogue, and emits one ready-to-paste /orchestrate custom invocation per step.

The command is generative only — it never invokes /orchestrate itself. The user stays in the loop and decides when (and whether) to execute each step.

Why this is high-frequency for everyone

  • For newcomers: composing the right chain (which language reviewer, when to add security-reviewer, where database-reviewer belongs) is the actual hard part of /orchestrate. They tend to either skip /orchestrate or ask Claude to "just figure it out", which loses determinism. This command makes the chain choice explicit and pasteable.
  • For experienced users: chain selection is mechanical pattern-matching against step intent — exactly the kind of repeated thinking AI should absorb. On a 10-step plan it removes ~10 rounds of "which agents this time?" without giving up control of the actual run.

What "AI-native" means here

The plan → orchestration handoff already exists conceptually in this repo (commands/plan.md, commands/orchestrate.md, skills/dmux-workflows/). What's missing is the bridge that emits the literal command string a user pastes next. This PR closes that gap so the workflow stays in working memory end-to-end:

plan doc → /plan-orchestrate → N pasteable lines → /orchestrate custom per step

What it does

  • Detects ECC install form (plugin vs legacy bare) and applies a matching everything-claude-code: prefix to both the slash command and every agent name. The two must stay in sync; under plugin install, bare agent names force fuzzy matching, which fails intermittently under parallel calls.
  • Detects project language (pyproject.toml / package.json / go.mod / Cargo.toml / etc.) to pick the right <lang>-reviewer and <lang>-build-resolver.
  • Tags each plan step (design, impl, test, migration, db, security, ...) and composes a chain ≤ 4 agents long to keep token cost predictable.
  • Emits per-step intent / tags / chain rationale, plus a final "batch execution" block for one-shot copy.
  • Self-checks before output: every agent name is in the catalogue; prefix usage is consistent; no invented flags (--mode / --gate / --agents=...); task descriptions are single-line and properly escaped.

Type

  • Command

Testing

  • node tests/run-all.js — pass
  • npx markdownlint-cli commands/plan-orchestrate.md — pass
  • Output strings conform to the /orchestrate custom shape documented in commands/orchestrate.md and skills/dmux-workflows/SKILL.md

Checklist

  • Follows command format (description: frontmatter + sections)
  • No new dependencies
  • No changes to existing files
  • Tested with Claude Code

Summary by cubic

Adds plan-orchestrate (in skills/plan-orchestrate), a skill that reads a plan doc and emits ready-to-paste /orchestrate custom commands per step without executing them. It auto-detects ECC install (plugin vs legacy) and outputs a single consistent form for the slash command and agent names.

  • New Features
    • Detects ECC install mode and renders consistent prefixes for both /orchestrate and agent names; normalizes any pre-prefixed agents from the plan to avoid double-prefixing.
    • Decomposes the plan into steps, tags intent, and selects ≤4-agent chains with dedup; zero-tag default to code-reviewer; ensures impl/refactor/migration end with a reviewer-class agent (<lang>-reviewer, code-reviewer, security-reviewer, or database-reviewer), letting domain-specific reviewers close when applicable.
    • Supports --lang=<...|auto> with a 60% polyglot tie-break and lang=unknown fallback (incl. PyTorch build resolver), --scope=all|step:n|range:a-b, and --dry-run; emits an overview, per-step one-liners with rationale, optional batch block, overview-only mode for very large plans, and runs strict self-checks (no invented flags).

Written for commit af61c73. Summary will update on new commits. Review in cubic

Summary by CodeRabbit

  • New Features
    • Added "plan-orchestrate" skill that generates one ready-to-paste /orchestrate custom command per decomposed plan step.
    • Auto-detects language and stabilizes install mode for consistent outputs.
    • Decomposes plans, extracts per-step metadata, and applies case-insensitive tagging and chain-building rules.
    • Emits Markdown with a steps overview table, per-step bash blocks, and an optional batch execution block.
    • Includes a pre-output checklist, gating behaviors, examples, and documented edge cases.

Reads a plan document, decomposes it into steps, designs a per-step
agent chain, and emits ready-to-paste /orchestrate custom prompts.
The command is generative only — it never invokes /orchestrate
itself. Detects plugin vs legacy ECC install and emits matching
slash-command and agent-name prefixes.
@coderabbitai

coderabbitai Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 84d9ac82-de8b-49da-a258-8218c9658114

📥 Commits

Reviewing files that changed from the base of the PR and between f695de9 and af61c73.

📒 Files selected for processing (1)
  • skills/plan-orchestrate/SKILL.md
✅ Files skipped from review due to trivial changes (1)
  • skills/plan-orchestrate/SKILL.md

📝 Walkthrough

Walkthrough

Adds a new skill specification that converts a user plan into ready-to-paste /orchestrate custom commands—validates plan path and ECC install mode, auto-detects language, decomposes and tags steps, composes agent chains, and emits a Markdown output with per-step bash blocks and a self-check checklist.

Changes

Cohort / File(s) Summary
Plan Orchestrate Skill Specification
skills/plan-orchestrate/SKILL.md
New specification document describing a phased pipeline: Phase 0 (plan path validation, ECC install-mode freeze, --lang auto-detection, PyTorch build flag, agent name normalization), Phase 1 (step decomposition + metadata), Phase 2 (case-insensitive trigger tagging, multi-tag agent-chain composition with deduplication, reviewer/build gating, unknown resolution, chain-length limits), Phase 3 (single-line escaped task descriptions with acceptance criteria and conditional "Out of scope" inheritance), Phase 4 (Markdown output: overview table, per-step bash blocks in ECC form, optional batch execution), Phase 5 (pre-output checklist validating catalogue membership, namespace consistency, formatting and chain rules), plus edge cases and examples.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant User
  participant Skill as Plan-Orchestrate Skill
  participant ModeDetect as ECC Mode Detector
  participant LangDetect as Language Detector
  participant Decomposer
  participant Tagger
  participant Composer as Chain Composer
  participant Renderer as Markdown Renderer

  User->>Skill: submit plan path & options
  Skill->>ModeDetect: detect ECC install mode
  ModeDetect-->>Skill: mode (plugin|legacy) (frozen)
  Skill->>LangDetect: analyze files / detect --lang (polyglot tie-break)
  LangDetect-->>Skill: resolved language (or unknown)
  Skill->>Decomposer: decompose plan into ordered steps
  Decomposer-->>Skill: steps + metadata
  Skill->>Tagger: tag steps via trigger-word matching
  Tagger-->>Skill: tags per step
  Skill->>Composer: build agent chains (dedupe, multi-tag rules, gating)
  Composer-->>Skill: per-step chain definitions
  Skill->>Renderer: render Markdown + bash blocks + self-check
  Renderer-->>User: final output document (overview + per-step + batch)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • affaan-m

Poem

🐰 I hop through plans with careful pace,
I split each step and name its place,
I tag, compose, then freeze the mode,
I print the scripts in tidy code —
One-line commands to run the race.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main addition: a new /plan-orchestrate command that generates /orchestrate prompts from plan documents.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
commands/plan-orchestrate.md (1)

132-136: Minor: consider rewording repeated “If ...” phrasing for style tools.

Around line 134-135 there are multiple successive “If …” sentences. A style tool hint indicates this may trigger a “repeated sentence beginning” rule.

Not a functional blocker, but worth a quick polish if you care about style/lint noise.

Suggested fix (vary sentence beginnings)
- 4. If `--lang=auto` failed, `<lang>-reviewer` falls back to `code-reviewer`.
- 5. If `<lang>-build-resolver` does not exist, fall back to `build-error-resolver`.
+ 4. When `--lang=auto` fails, `<lang>-reviewer` falls back to `code-reviewer`.
+ 5. When `<lang>-build-resolver` does not exist, fall back to `build-error-resolver`.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@commands/plan-orchestrate.md` around lines 132 - 136, The list has repetitive
sentence starts using "If ..." in items 4 and 5; edit the wording in the plan
rules so sentence openings vary for style while preserving meaning — for example
rephrase item 4 to "When `--lang=auto` fails, `<lang>-reviewer` falls back to
`code-reviewer`" and item 5 to "When `<lang>-build-resolver` is missing, fall
back to `build-error-resolver`" (keep items 2–6 semantics intact, including
symbols `impl`, `db`, `tdd-guide,database-reviewer,<lang>-reviewer`, chain cap
of 4, dropping `lookup`/`docs` first, `planner`/`architect` pairing rule).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@commands/plan-orchestrate.md`:
- Around line 217-218: Clarify the contradictory statements about count by
deciding and documenting exactly which count `--scope` affects: either the count
of rows in the overview table or the count of emitted per-step detail blocks;
update the lines referencing “The overview table and per-step sections agree on
count.” and the `--scope` note to state explicitly that `--scope` controls the
number of per-step detail blocks emitted while the overview table always lists
the full plan (or vice versa, pick the intended behavior), and add a short
parenthetical defining “count” (e.g., “count of detail blocks” vs “overview
rows”) so validators and generators have a single unambiguous interpretation of
`--scope` behavior.
- Around line 118-128: The doc’s invariant "Any step that produces code must end
the chain with a reviewer." conflicts with the default chains for the `test` and
`build` steps (currently `tdd-guide,e2e-runner` and `<lang>-build-resolver`);
fix by either appending a reviewer to those chains (e.g., change `test` to
`tdd-guide,e2e-runner,<lang>-reviewer` and `build` to
`<lang>-build-resolver,<lang>-reviewer`) or explicitly redefine "reviewer" in
the doc to include `e2e-runner` and `<lang>-build-resolver` and update the
invariant wording to reference that expanded definition so the invariant and
defaults remain consistent.
- Around line 130-137: Clarify deterministic chain composition by specifying how
to pick the primary tag and a full, ordered priority for dropping tags when
length >4: update the "primary tag" selection rule to pick the tag with highest
priority from a new tag-priority list (e.g., impl > design > security > db >
docs > lookup > lang-specific > build > test; tie-break by lexical order) and
extend rule 3 to drop tags in this explicit weakest-to-strongest order (with
lookup and docs first), also add fallback tie-break behavior (alphabetical) and
note that the primary tag wins when present; apply these changes to the "primary
tag" wording in Phase 2 and to the chain-length/drop rules so chain construction
is fully deterministic (reference terms: "primary tag", "drop weakest", rule 3,
Phase 2).

---

Nitpick comments:
In `@commands/plan-orchestrate.md`:
- Around line 132-136: The list has repetitive sentence starts using "If ..." in
items 4 and 5; edit the wording in the plan rules so sentence openings vary for
style while preserving meaning — for example rephrase item 4 to "When
`--lang=auto` fails, `<lang>-reviewer` falls back to `code-reviewer`" and item 5
to "When `<lang>-build-resolver` is missing, fall back to
`build-error-resolver`" (keep items 2–6 semantics intact, including symbols
`impl`, `db`, `tdd-guide,database-reviewer,<lang>-reviewer`, chain cap of 4,
dropping `lookup`/`docs` first, `planner`/`architect` pairing rule).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f0917f91-8ba1-44d2-95f2-9a5fd127eb41

📥 Commits

Reviewing files that changed from the base of the PR and between 4e66b28 and 4a09d25.

📒 Files selected for processing (1)
  • commands/plan-orchestrate.md

Comment thread commands/plan-orchestrate.md Outdated
Comment on lines +118 to +128
| `impl` | implement, build, add, create, port / 实现、编码、落地、写 | `tdd-guide,<lang>-reviewer` |
| `test` | test, coverage, e2e, integration / 测试、覆盖率、单测、集成、E2E | `tdd-guide,e2e-runner` |
| `refactor` | refactor, cleanup, dedupe, split / 重构、清理、拆分、合并、去重 | `architect,refactor-cleaner,<lang>-reviewer` |
| `migration` | migrate, upgrade, rewrite, port / 迁移、重写、搬运、升级 | `architect,tdd-guide,<lang>-reviewer` |
| `db` | schema, migration, index, SQL, Postgres, alembic, sqlmodel | `database-reviewer,<lang>-reviewer` |
| `security` | encrypt, auth, secret, OWASP, PII / 安全、加密、密钥、认证、授权 | `security-reviewer,<lang>-reviewer` |
| `build` | build, compile, lint failure / 构建、编译、CI、打包错误 | `<lang>-build-resolver` (falls back to `build-error-resolver`) |
| `docs` | docs, readme, codemap, changelog / 文档、README | `doc-updater` |
| `lookup` | lookup, reference, API usage / 调研、文档查询 | `docs-lookup` |
| `review` | review, audit, verify / 评审、审查、check | `<lang>-reviewer,code-reviewer` |
| `loop` | loop, autonomous, watchdog / 长跑、循环、守护 | `loop-operator` |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Make “code-producing steps end with a reviewer” consistent with test and build default chains.

Your invariant at line 137 (“Any step that produces code must end the chain with a reviewer.”) is enforced again in Phase 5 at line 216, but the default chains at:

  • test: line 119 tdd-guide,e2e-runner (ends with e2e-runner, not a *-reviewer/code-reviewer/security-reviewer)
  • build: line 124 <lang>-build-resolver (ends with a build resolver, not a reviewer)

If the implementation literally treats “reviewer” as “<lang>-reviewer / code-reviewer / security-reviewer / etc.”, then the invariant is internally violated by the doc’s own default chain definitions.

Suggested fix (end chains with `-reviewer`)
| Tag | Trigger words (English + Chinese, since plans are often written in either language) | Default chain |
|---|---|---|
@@
-| `test` | test, coverage, e2e, integration / 测试、覆盖率、单测、集成、E2E | `tdd-guide,e2e-runner` |
+| `test` | test, coverage, e2e, integration / 测试、覆盖率、单测、集成、E2E | `tdd-guide,e2e-runner,<lang>-reviewer` |
@@
-| `build` | build, compile, lint failure / 构建、编译、CI、打包错误 | `<lang>-build-resolver` (falls back to `build-error-resolver`) |
+| `build` | build, compile, lint failure / 构建、编译、CI、打包错误 | `<lang>-build-resolver,<lang>-reviewer` (falls back to `build-error-resolver,<lang>-reviewer`) |

If you instead intended that e2e-runner and *-build-resolver count as “reviewers” for the invariant, then you should explicitly redefine what “reviewer” means in this doc (and update the self-check wording) to remove ambiguity.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@commands/plan-orchestrate.md` around lines 118 - 128, The doc’s invariant
"Any step that produces code must end the chain with a reviewer." conflicts with
the default chains for the `test` and `build` steps (currently
`tdd-guide,e2e-runner` and `<lang>-build-resolver`); fix by either appending a
reviewer to those chains (e.g., change `test` to
`tdd-guide,e2e-runner,<lang>-reviewer` and `build` to
`<lang>-build-resolver,<lang>-reviewer`) or explicitly redefine "reviewer" in
the doc to include `e2e-runner` and `<lang>-build-resolver` and update the
invariant wording to reference that expanded definition so the invariant and
defaults remain consistent.

Comment thread commands/plan-orchestrate.md Outdated
Comment on lines +130 to +137
Chain composition rules:
1. `impl` + `security` → `tdd-guide,<lang>-reviewer,security-reviewer`.
2. `impl` + `db` → `tdd-guide,database-reviewer,<lang>-reviewer`.
3. Chain length is capped at 4. If exceeded, drop the weakest tag (`lookup` and `docs` go first).
4. If `--lang=auto` failed, `<lang>-reviewer` falls back to `code-reviewer`.
5. If `<lang>-build-resolver` does not exist, fall back to `build-error-resolver`.
6. **Do not** put both `planner` and `architect` in an `impl` chain — that wastes tokens. Pair them only on `design` steps.
7. Any step that produces code must end the chain with a reviewer.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Clarify deterministic chain composition when multiple tags apply (primary tag + “drop weakest” beyond lookup/docs).

Phase 2 says a step “may carry multiple tags; the chain is built from the primary tag and stacked as needed” (line 112-113), but it never defines:

  • How to choose the primary tag when multiple tags match.
  • How to choose which tags are “weakest” if the chain is still too long after dropping lookup/docs (line 133 only specifies that those go first).

This can lead to non-deterministic output or inconsistent chains across runs/LLMs.

Suggested fix (define tag priority + tie-breaks)
- 3. If exceeded, drop the weakest tag (`lookup` and `docs` go first).
+ 3. If exceeded, drop the weakest tag by this priority (highest drops first): `lookup`, `docs`, `plan`, `loop`, `review`, `design`, `refactor`, `migration`, `build`, `test`, `impl`, `db`, `security`.
+    - After dropping, re-apply the “end with a reviewer” rule for code-producing steps.
+    - If ties remain, prefer dropping earlier (leftmost) in the composed chain.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Chain composition rules:
1. `impl` + `security``tdd-guide,<lang>-reviewer,security-reviewer`.
2. `impl` + `db``tdd-guide,database-reviewer,<lang>-reviewer`.
3. Chain length is capped at 4. If exceeded, drop the weakest tag (`lookup` and `docs` go first).
4. If `--lang=auto` failed, `<lang>-reviewer` falls back to `code-reviewer`.
5. If `<lang>-build-resolver` does not exist, fall back to `build-error-resolver`.
6. **Do not** put both `planner` and `architect` in an `impl` chain — that wastes tokens. Pair them only on `design` steps.
7. Any step that produces code must end the chain with a reviewer.
Chain composition rules:
1. `impl` + `security``tdd-guide,<lang>-reviewer,security-reviewer`.
2. `impl` + `db``tdd-guide,database-reviewer,<lang>-reviewer`.
3. Chain length is capped at 4. If exceeded, drop the weakest tag by this priority (highest drops first): `lookup`, `docs`, `plan`, `loop`, `review`, `design`, `refactor`, `migration`, `build`, `test`, `impl`, `db`, `security`.
- After dropping, re-apply the "end with a reviewer" rule for code-producing steps.
- If ties remain, prefer dropping earlier (leftmost) in the composed chain.
4. If `--lang=auto` failed, `<lang>-reviewer` falls back to `code-reviewer`.
5. If `<lang>-build-resolver` does not exist, fall back to `build-error-resolver`.
6. **Do not** put both `planner` and `architect` in an `impl` chain — that wastes tokens. Pair them only on `design` steps.
7. Any step that produces code must end the chain with a reviewer.
🧰 Tools
🪛 LanguageTool

[style] ~135-~135: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ewerfalls back tocode-reviewer. 5. If -build-resolver` does not exist,...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@commands/plan-orchestrate.md` around lines 130 - 137, Clarify deterministic
chain composition by specifying how to pick the primary tag and a full, ordered
priority for dropping tags when length >4: update the "primary tag" selection
rule to pick the tag with highest priority from a new tag-priority list (e.g.,
impl > design > security > db > docs > lookup > lang-specific > build > test;
tie-break by lexical order) and extend rule 3 to drop tags in this explicit
weakest-to-strongest order (with lookup and docs first), also add fallback
tie-break behavior (alphabetical) and note that the primary tag wins when
present; apply these changes to the "primary tag" wording in Phase 2 and to the
chain-length/drop rules so chain construction is fully deterministic (reference
terms: "primary tag", "drop weakest", rule 3, Phase 2).

Comment thread commands/plan-orchestrate.md Outdated
Comment on lines +217 to +218
- [ ] The overview table and per-step sections agree on count.
- [ ] `--scope` is honoured (e.g. `step:3` emits one detail block, but the overview table still lists the full plan).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Fix contradiction in --scope self-check vs overview behavior.

Line 217 says: “The overview table and per-step sections agree on count.”
But line 218 says: “--scope is honoured … but the overview table still lists the full plan.”

Those two statements can’t both be true at the same time unless you explicitly define what “count” refers to (e.g., count of emitted detail blocks vs count of rows in the overview table). This can cause the command generator (or a validator) to disagree with its own doc.

Suggested fix (clarify what’s counted)
- - [ ] The overview table and per-step sections agree on count.
+ - [ ] The overview table and per-step sections agree on which steps are covered by `--scope` (overview may list full plan; detail blocks must match emitted scope).
@@
- - [ ] `--scope` is honoured (e.g. `step:3` emits one detail block, but the overview table still lists the full plan).
+ - [ ] `--scope` is honoured (e.g. `step:3` emits one detail block; the overview table still lists the full plan).
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- [ ] The overview table and per-step sections agree on count.
- [ ] `--scope` is honoured (e.g. `step:3` emits one detail block, but the overview table still lists the full plan).
- [ ] The overview table and per-step sections agree on which steps are covered by `--scope` (overview may list full plan; detail blocks must match emitted scope).
- [ ] `--scope` is honoured (e.g. `step:3` emits one detail block; the overview table still lists the full plan).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@commands/plan-orchestrate.md` around lines 217 - 218, Clarify the
contradictory statements about count by deciding and documenting exactly which
count `--scope` affects: either the count of rows in the overview table or the
count of emitted per-step detail blocks; update the lines referencing “The
overview table and per-step sections agree on count.” and the `--scope` note to
state explicitly that `--scope` controls the number of per-step detail blocks
emitted while the overview table always lists the full plan (or vice versa, pick
the intended behavior), and add a short parenthetical defining “count” (e.g.,
“count of detail blocks” vs “overview rows”) so validators and generators have a
single unambiguous interpretation of `--scope` behavior.

@greptile-apps

greptile-apps Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds skills/plan-orchestrate/SKILL.md, a generative-only skill that reads a plan document, decomposes it into tagged steps, selects an agent chain per step from the ECC catalogue, and emits ready-to-paste /orchestrate custom invocations. The skill handles plugin vs. legacy prefix detection, polyglot language detection with a tie-break, and includes a Phase 5 self-check checklist before emitting output. Previous review threads (static plugin-form template, commands-vs-skills placement, first-match --lang=auto, Phase 5/rule-2 contradiction) are all addressed in this revision. Three remaining gaps warrant attention: the "both markers exist → plugin wins" clause in Phase 0 is unreachable given the stop-at-first-match algorithm; the 3-tag combination impl+security+db is underdefined in the composition rules despite appearing in Example 1; and the shared trigger word "build" in impl means CI steps phrased with that verb receive an impl chain instead of a build-resolver chain.

Confidence Score: 5/5

Safe to merge — all findings are P2 documentation/logic-clarity issues with no runtime breakage.

No P0 or P1 findings. The three issues (dead-code clause, underdefined 3-tag rule, shared 'build' trigger) affect output determinism and correctness in specific edge cases but do not crash or corrupt anything. The skill is generative-only, so worst-case a user pastes a slightly wrong chain and notices before running it.

skills/plan-orchestrate/SKILL.md — Phase 2 chain composition rules and Phase 0 detection algorithm

Important Files Changed

Filename Overview
skills/plan-orchestrate/SKILL.md New skill bridging plan docs to /orchestrate prompts; well-structured with 5 phases and self-checks, but has three logic gaps: step 2.4 is unreachable dead code in the detection algorithm, 3-tag composition (impl+security+db) is underdefined, and the shared "build" trigger word causes impl to shadow the build tag on CI steps.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User invokes plan-orchestrate] --> B[Phase 0: Detect ECC mode + language]
    B --> C{Plugin dir exists?}
    C -->|Yes| D[ECC_MODE=plugin]
    C -->|No| E{Legacy agents exist?}
    E -->|Yes| F[ECC_MODE=legacy]
    E -->|No| G[ECC_MODE=legacy + warning]
    D & F & G --> H[Resolve --lang / polyglot tie-break]
    H --> I[Phase 1: Decompose plan into steps]
    I --> J[Phase 2: Tag each step + compose chain]
    J --> K{Multi-tag?}
    K -->|impl+security| L[tdd-guide, lang-reviewer, security-reviewer]
    K -->|impl+db| M[tdd-guide, database-reviewer, lang-reviewer]
    K -->|impl+security+db| N[underdefined — see Example 1]
    K -->|Single tag| O[Default chain from table]
    L & M & N & O --> P[Dedup + enforce length ≤ 4]
    P --> Q[Phase 3: Compress task description]
    Q --> R[Phase 4: Render output with ECC_MODE prefix]
    R --> S[Phase 5: Self-check]
    S --> T[Emit Markdown + Batch block]
Loading

Reviews (4): Last reviewed commit: "fix(plan-orchestrate): broaden reviewer-..." | Re-trigger Greptile

Comment thread commands/plan-orchestrate.md Outdated
Comment thread commands/plan-orchestrate.md Outdated
Comment thread commands/plan-orchestrate.md Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

4 issues found across 1 file

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="commands/plan-orchestrate.md">

<violation number="1" location="commands/plan-orchestrate.md:80">
P2: ECC install detection hardcodes Unix-style `~/.claude/...` paths, so Windows users can be misdetected and receive invalid legacy-form output.</violation>

<violation number="2" location="commands/plan-orchestrate.md:119">
P2: Internal inconsistency: rule 7 states "Any step that produces code must end the chain with a reviewer" but the default chains for `test` (`tdd-guide,e2e-runner`) and `build` (`<lang>-build-resolver`) both end with non-reviewer agents. Either append `<lang>-reviewer` to these default chains, or narrow the invariant to clarify which step tags are considered "code-producing" (excluding `test` and `build` if intended).</violation>

<violation number="3" location="commands/plan-orchestrate.md:196">
P3: Nested fenced examples reuse the same triple-backtick fence length, so the outer markdown code block closes early and the examples render incorrectly.</violation>

<violation number="4" location="commands/plan-orchestrate.md:218">
P2: Self-check contradiction: the checklist simultaneously requires the overview table and per-step sections to "agree on count" (previous item) while also stating the overview table lists the full plan even when `--scope` limits emitted detail blocks. These can't both be true unless you clarify what "count" refers to (e.g., the overview may list the full plan, but the detail blocks must match the emitted scope).</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread commands/plan-orchestrate.md Outdated
Comment thread commands/plan-orchestrate.md Outdated
Comment thread commands/plan-orchestrate.md Outdated
Comment thread commands/plan-orchestrate.md Outdated
Address PR affaan-m#1603 review feedback:

- P2: Move from commands/ to skills/plan-orchestrate/SKILL.md per the
  Workflow Surface Policy in AGENTS.md (skills/ is the canonical
  workflow surface; commands/ is for legacy compatibility shims).
- P1: Phase 4 output template was hardcoded to plugin form (overview
  table, "# plugin form" comment, "strip the prefix" blockquote).
  Replaced with ECC_MODE-neutral {ORCH_CMD} / {AGENT(...)} placeholder
  notation; the runtime emits exactly one resolved form throughout
  the output, never both, never with viewer-facing instructions.
- Polyglot --lang=auto: when multiple language markers match, pick
  the dominant language by source file count; on tie or below 60%
  threshold, fall back to code-reviewer.
- Reformat as SKILL.md with required sections (When to Activate,
  How It Works, Examples).
@d0m999 d0m999 force-pushed the feat/plan-orchestrate-command branch from 0d1f94c to 4a09d25 Compare April 29, 2026 02:30

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 2 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="skills/plan-orchestrate/SKILL.md">

<violation number="1">
P2: `pytorch-build-resolver` is documented in the catalogue but cannot be reached by the documented `--lang`/`<lang>-build-resolver` selection logic.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
skills/plan-orchestrate/SKILL.md (1)

203-204: Minor style suggestions from static analysis.

Line 203: "Very large plan" could be simplified to "Large plan (>1500 lines)".
Line 204: "N.a / N.b" could use "N.a and N.b" for clarity.

Both are optional style improvements.

✨ Optional style improvements
-- **Very large plan (>1500 lines)**: emit the overview table first and ask the user to narrow with `--scope` before generating details.
+- **Large plan (>1500 lines)**: emit the overview table first and ask the user to narrow with `--scope` before generating details.
-- **Step too broad** (e.g. "complete all backend work"): do not force a single chain. Suggest splitting into N.a / N.b and propose a split.
+- **Step too broad** (e.g. "complete all backend work"): do not force a single chain. Suggest splitting into N.a and N.b and propose a split.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@skills/plan-orchestrate/SKILL.md` around lines 203 - 204, Update the two
bullet texts in SKILL.md: change "Very large plan (>1500 lines)" to "Large plan
(>1500 lines)" and change occurrences of "N.a / N.b" to "N.a and N.b" so the
guidance reads more concise and clearer; locate the bullets containing those
exact phrases and edit them in-place.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@skills/plan-orchestrate/SKILL.md`:
- Around line 203-204: Update the two bullet texts in SKILL.md: change "Very
large plan (>1500 lines)" to "Large plan (>1500 lines)" and change occurrences
of "N.a / N.b" to "N.a and N.b" so the guidance reads more concise and clearer;
locate the bullets containing those exact phrases and edit them in-place.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 368c37f4-3b29-4f79-b31f-97f2c8359fef

📥 Commits

Reviewing files that changed from the base of the PR and between 4a09d25 and 0d1f94c.

📒 Files selected for processing (1)
  • skills/plan-orchestrate/SKILL.md

ECC install detection
- Resolve ~/.claude paths via <claude-home> placeholder so detection
  works on Windows (%USERPROFILE%\.claude) (cubic P2)
- Spell out the detection algorithm with priority order, mixed-install
  precedence (plugin wins), and a default-to-legacy fallback warning

Language detection
- lang=unknown is a sentinel, not the agent name code-reviewer.
  Phase 2 rules 5-6 resolve unknown to code-reviewer / build-error-resolver
- Polyglot tie-break excludes vendor/test/dist/generated dirs
- Add PyTorch sub-profile so pytorch-build-resolver is reachable when
  torch is a dep (cubic P2)

Phase 2 chain composition
- Define primary tag selection by table-order priority
- Add deduplication rule (avoids code-reviewer,code-reviewer)
- Add zero-tag default chain (code-reviewer with explicit rationale)
- Narrow reviewer invariant to impl/refactor/migration (cubic P2)

Output and self-check
- Strip everything-claude-code: prefix from plan-declared agent names
  before catalogue validation (no double-prefix in plugin mode)
- Out of scope clause is optional (only when plan declares one)
- Overview-only mode (large plan) skips per-step blocks and Batch block
- Self-check covers dedup, normalization, zero-tag, overview-only mode

Other
- Simplify trigger word table to a single canonical language;
  document multilingual matching by stem
- Use 4-backtick outer fence for nested example (cubic P3)
- Apply CodeRabbit nitpicks (Large plan; N.a and N.b)
- Drop --mode future-extension hint that contradicted the no-invented-flag rule
Comment thread skills/plan-orchestrate/SKILL.md Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 1 file (changes from recent commits).

You’re at about 93% of the monthly review limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="skills/plan-orchestrate/SKILL.md">

<violation number="1" location="skills/plan-orchestrate/SKILL.md:146">
P2: Rule 2 (`impl + security`) produces a chain ending with `security-reviewer`, but Rule 10 requires impl/refactor/migration steps to end with `<lang>-reviewer` or `code-reviewer`. These rules are internally contradictory — chains produced by Rule 2 will fail the Rule 10 / Phase 5 self-check.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread skills/plan-orchestrate/SKILL.md Outdated
… conflict

cubic flagged: rule 2 (impl+security) ends with security-reviewer, but
rule 10 required impl/refactor/migration to end with <lang>-reviewer
or code-reviewer — Phase 5 self-check would fail.

Broaden rule 10 (and the matching self-check) so reviewer-class
includes <lang>-reviewer, code-reviewer, security-reviewer, and
database-reviewer. Domain-specific reviewers correctly win the tail
position (security-reviewer closes security-tagged work).
@d0m999

d0m999 commented Apr 30, 2026

Copy link
Copy Markdown
Author

Thanks for the bot reviews — pushed two follow-up commits addressing the findings:

  • f695de9 — main fix commit (cross-platform paths, lang detection, chain composition determinism, plan-declared agent normalization, etc.)
  • af61c73 — broaden reviewer-class to resolve a rule 2 vs rule 10 conflict cubic flagged on f695de9

Greptile (4a09d258)

  • P2 commands/ vs skills/ → fixed in 0d1f94c (moved to skills/plan-orchestrate/SKILL.md)
  • P2 hardcoded plugin form in Phase 4 template → fixed in 0d1f94c ({ORCH_CMD} / {AGENT(...)} placeholders resolved per ECC_MODE)
  • First-match --lang=auto → fixed in 0d1f94c (file-count tie-break, 60% threshold) and tightened in f695de9 (excludes vendor/test/dist/generated)
  • Underspecified multi-tag merge → fixed in f695de9 (primary tag by table-order priority + dedup rule + zero-tag default)
  • dart-build-resolver unreachable → there is no dart-build-resolver or flutter-build-resolver in the ECC agent catalogue; --lang=flutter correctly falls through rule 6 to build-error-resolver. Happy to add a flutter-specific resolver agent if maintainers want one — that's a separate agent contribution.

cubic (across 4a09d258, 0d1f94c9, f695de92)

  • P2 hardcoded ~/.claude/... → fixed in f695de9 (<claude-home> placeholder with explicit Windows mapping)
  • P2 invariant vs test/build defaults → fixed in f695de9 (narrowed invariant to impl/refactor/migration)
  • P3 nested fenced examples → fixed in f695de9 (4-backtick outer + 3-backtick inner)
  • P2 self-check --scope contradiction → fixed in f695de9 (overview always lists full plan; detail-block count tracks --scope)
  • P2 pytorch-build-resolver unreachable → fixed in f695de9 (PyTorch sub-profile detection on torch dependency)
  • P2 rule 2 vs rule 10 conflict → fixed in af61c73 (broadened reviewer-class to include security-reviewer and database-reviewer)

CodeRabbit (0d1f94c9)

  • "Very large plan" / "N.a / N.b" nitpicks → applied in f695de9
  • The "repeated If ... sentence beginnings" nitpick was on the older commands/ version; the rewritten Phase 2 rules in f695de9 no longer use that pattern.

Additional changes in f695de9 from a self-review pass

  • lang=unknown is now a sentinel rather than the literal code-reviewer (prevents code-reviewer-build-resolver substitution mishaps)
  • Plan-declared agents with everything-claude-code: prefix are stripped before catalogue validation (no double-prefix in plugin mode)
  • Zero-tag steps emit code-reviewer with explicit rationale
  • Out-of-scope clause is now optional (omitted when the plan doesn't declare one)

Happy to iterate further on anything that's still off.

@affaan-m

Copy link
Copy Markdown
Owner

Thanks for the PR. This has been idle for a while and is not merge-ready against the moving main branch, so I am closing it to keep the queue tractable. Reopen is welcome with a current rebase and focused scope; maintainers may also port the useful parts into a fresh PR where appropriate.

@affaan-m affaan-m closed this May 11, 2026
affaan-m added a commit that referenced this pull request May 12, 2026
- add plan-orchestrate skill from closed PR #1603

- add Longhand MCP config from closed PR #1503

- sync catalog counts to 54 agents, 207 skills, 70 commands
@affaan-m affaan-m mentioned this pull request May 12, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants