Skip to content

feat: add adaptive workflow routing - #5

Merged
pertrai1 merged 2 commits into
mainfrom
feat/adaptive-workflow-routing
Apr 30, 2026
Merged

pertrai1 merged 2 commits into
mainfrom
feat/adaptive-workflow-routing

Conversation

@pertrai1-bot

@pertrai1-bot pertrai1-bot commented Apr 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Add directives/adaptive-routing.md to select the lightest safe workflow based on task intent, risk, and touched surfaces.
  • Add machine-readable frontmatter/routing metadata to directives and skills.
  • Update templates to load adaptive routing first instead of telling agents to load every directive.
  • Relax brittle TDD/template wording so strict RED/GREEN applies to behavior-changing work while Light Path covers mechanical/non-behavioral edits.
  • Add generic quality-gate feedback guidance: treat lint/type/test/build/static-analysis output as implementation feedback and fix root causes instead of suppressing rules.

Verification

  • git diff --check passed.
  • Local frontmatter validation passed for all directives and skills (name, description, version, YAML parse, body present).
  • Local routing/reference validation passed for directive/skill links and adaptive-routing presence in all agent templates.

Notes

This is cohesive enough for one PR: the router, frontmatter metadata, and wording adjustments depend on each other. I did not split into multiple PRs because the template changes need the new router and metadata context to make sense.

Summary by CodeRabbit

  • New Features

    • Adaptive routing selects the lightest safe workflow path for each task.
  • Updates

    • Directives and skills load conditionally based on routing decisions.
    • TDD is default only for behavior-changing work; mechanical/formatting edits use lighter workflows.
    • Verification outputs are treated as implementation feedback with stricter remediation expectations.
    • Templates and PR notes now begin with routing and streamline self-audit output when no findings exist.

@coderabbitai

coderabbitai Bot commented Apr 30, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e858eff2-d460-47b9-9191-11452edf594c

📥 Commits

Reviewing files that changed from the base of the PR and between fd288c0 and 1b79fc8.

📒 Files selected for processing (2)
  • directives/task-framing.md
  • templates/copilot-instructions.md
✅ Files skipped from review due to trivial changes (1)
  • templates/copilot-instructions.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • directives/task-framing.md

📝 Walkthrough

Walkthrough

This PR adds an adaptive routing directive and makes routing-first the initial workflow step; it adds YAML frontmatter metadata to many directives and skills for conditional loading; refines TDD to apply by default only to behavior-changing work; and updates templates and self-audit output to follow routed selections.

Changes

Cohort / File(s) Summary
Core Routing Infrastructure
README.md, directives/adaptive-routing.md
Introduces directives/adaptive-routing.md and elevates adaptive routing to run first from README; defines routing output format, path recipes, risk escalations, and routing rules.
Directive Frontmatter Metadata
directives/architecture-boundaries.md, directives/codebase-navigation.md, directives/error-memory.md, directives/exploration-mode.md, directives/session-decisions.md, directives/specification-driven-development.md, directives/task-framing.md, directives/type-driven-development.md
Added YAML frontmatter (name, description, version, triggers, routing.load: conditional) and conditional loading triggers; no body logic changes except for narrower applicability wording where noted.
Behavior-Focused Directives
directives/test-driven-development.md, directives/verification.md
TDD changed to default for behavior-changing work (features/fixes/runtime-affecting review); verification adds a Quality Gate Feedback section requiring root-cause fixes and forbids shallow suppressions; adaptive-routing exceptions added for mechanical/non-behavior edits.
Skill Routing Metadata
skills/architecture-boundary-reviewer/SKILL.md, skills/codebase-health-reviewer/SKILL.md, skills/spec-reviewer/SKILL.md, skills/systematic-debugging/SKILL.md, skills/test-reviewer/SKILL.md
Added version: 1.0.0 and routing blocks (triggers, paths) to enable conditional skill dispatch; no functional changes to skill bodies.
Self-Audit Conditional Output
skills/self-audit/SKILL.md
Added version and routing metadata; PR output behavior updated to insert ## Self-Audit only when routed findings exist, otherwise include a concise one-line note.
Template Routing Integration
templates/AGENTS.md, templates/CLAUDE.md, templates/copilot-instructions.md
Templates now require loading directives/adaptive-routing.md first to choose workflow path and which directives/skills to load; Light Path examples clarified for formatting/mechanical edits and directive loading is routed.
Miscellaneous small doc metadata
directives/architecture-boundaries.md (frontmatter nuance), directives/codebase-navigation.md (scope narrowing), others noted above
Minor wording and frontmatter tweaks to clarify conditional loading and when directives should be consulted.

Sequence Diagram(s)

sequenceDiagram
  participant User as User
  participant Agent as Agent
  participant Router as Adaptive Router
  participant Catalog as Directives/Skills Catalog
  participant Executor as Executor (implement/tests/verify)

  rect rgba(200,200,255,0.5)
    User->>Agent: submit task
    Agent->>Router: load adaptive-routing directive
    Router->>Catalog: evaluate triggers / risk / evidence
    Catalog-->>Router: selected path + directives/skills
    Router-->>Agent: route (path, selected directives/skills)
  end

  rect rgba(200,255,200,0.5)
    Agent->>Executor: load selected directives/skills
    Executor->>Executor: perform implementation / tests / checks
    Executor->>Agent: results, evidence, confirmations
    Agent->>User: deliver output & ask clarifying question if needed
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 I hop through routes both light and spry,
Choosing paths that suit the try.
Tests for changes that bend the run,
Tiny fixes skip the long drum—
Metadata guides, then hop, hop, done!

🚥 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 'feat: add adaptive workflow routing' directly and clearly describes the main change—introducing an adaptive routing mechanism for workflow selection.
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
  • Commit unit tests in branch feat/adaptive-workflow-routing

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: 0/1 reviews remaining, refill in 60 minutes.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@directives/task-framing.md`:
- Around line 23-25: The load sentence in directives/task-framing.md dropped the
explicit "high-risk tasks" condition; update the sentence loaded by
directives/adaptive-routing.md to explicitly include "high-risk tasks" (e.g.,
"Load this directive when selected by directives/adaptive-routing.md before
high-risk or non-trivial tasks — new features, cross-cutting refactors,
ambiguous requests, or anything affecting repo-wide conventions.") so the
trigger criteria remain consistent with the examples and routing decisions.

In `@templates/copilot-instructions.md`:
- Around line 54-56: The "Use when: ≤2 files changed" constraint in
templates/copilot-instructions.md conflicts with
directives/adaptive-routing.md's behavior-based Light Path definition; update
templates/copilot-instructions.md by either removing the "≤2 files changed"
file-count constraint entirely or adding a clear precedence note stating that
adaptive-routing.md's behavior-based classification (see
directives/adaptive-routing.md, Light Path rules around risk/behavior types)
overrides the file-count heuristic so routing decisions remain authoritative and
unambiguous.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7257edad-4ca3-4da7-addc-bb9357905115

📥 Commits

Reviewing files that changed from the base of the PR and between dbc0459 and fd288c0.

📒 Files selected for processing (21)
  • README.md
  • directives/adaptive-routing.md
  • directives/architecture-boundaries.md
  • directives/codebase-navigation.md
  • directives/error-memory.md
  • directives/exploration-mode.md
  • directives/session-decisions.md
  • directives/specification-driven-development.md
  • directives/task-framing.md
  • directives/test-driven-development.md
  • directives/type-driven-development.md
  • directives/verification.md
  • skills/architecture-boundary-reviewer/SKILL.md
  • skills/codebase-health-reviewer/SKILL.md
  • skills/self-audit/SKILL.md
  • skills/spec-reviewer/SKILL.md
  • skills/systematic-debugging/SKILL.md
  • skills/test-reviewer/SKILL.md
  • templates/AGENTS.md
  • templates/CLAUDE.md
  • templates/copilot-instructions.md

Comment thread directives/task-framing.md Outdated
Comment thread templates/copilot-instructions.md Outdated

Copilot AI 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.

Pull request overview

This PR introduces an “adaptive routing” directive that selects the lightest safe workflow (Light/Full + specialized paths) and updates templates/directives/skills to support conditional loading via machine-readable frontmatter.

Changes:

  • Add directives/adaptive-routing.md and update templates to load it first (instead of loading every directive by default).
  • Add YAML frontmatter metadata (name, description, version, routing hints) across directives and skills.
  • Adjust TDD/verification wording to apply strict RED/GREEN primarily to behavior-changing work and add quality-gate feedback guidance.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
templates/copilot-instructions.md Route-first guidance and Light/Full path workflow wording for Copilot instructions
templates/CLAUDE.md Route-first guidance and updated “routed sequences” framing
templates/AGENTS.md Route-first guidance and directive table now includes adaptive routing
skills/test-reviewer/SKILL.md Add version + routing metadata frontmatter
skills/systematic-debugging/SKILL.md Add version + routing metadata frontmatter
skills/spec-reviewer/SKILL.md Add version + routing metadata frontmatter
skills/self-audit/SKILL.md Add version + routing metadata; refine PR self-audit output guidance
skills/codebase-health-reviewer/SKILL.md Add version + routing metadata frontmatter
skills/architecture-boundary-reviewer/SKILL.md Add version + routing metadata frontmatter
directives/verification.md Add frontmatter + “Quality Gate Feedback” guidance
directives/type-driven-development.md Add frontmatter + routing metadata
directives/test-driven-development.md Add frontmatter + narrow strict TDD wording to behavior-changing work
directives/task-framing.md Add frontmatter + routing metadata; align loading to adaptive routing
directives/specification-driven-development.md Add frontmatter + routing metadata
directives/session-decisions.md Add frontmatter + routing metadata
directives/exploration-mode.md Add frontmatter + routing metadata
directives/error-memory.md Add frontmatter + routing metadata
directives/codebase-navigation.md Add frontmatter + routing metadata; clarify when routing may skip it
directives/architecture-boundaries.md Add frontmatter + routing metadata; add guidance on inferred boundary changes
directives/adaptive-routing.md New router directive defining paths, risk escalation, and required evidence
README.md Document adaptive routing as a first-class directive and explain frontmatter hints

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread templates/copilot-instructions.md Outdated
Comment on lines 93 to 97
For detailed guidance on each workflow rule, load `adaptive-routing.md` first,
then load only the selected directive from the `directives/` directory:

- `adaptive-routing.md` — Selects workflow path and required directives/skills
- `codebase-navigation.md` — SAFE exploration pattern

Copilot AI Apr 30, 2026

Copy link

Choose a reason for hiding this comment

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

In this template the routing references drop the directives/ prefix (e.g., adaptive-routing.md). Elsewhere in the repo/templates the canonical path is directives/adaptive-routing.md; using bare filenames makes it ambiguous where to load from. Update these references (and the bullet list) to use directives/... consistently.

Copilot uses AI. Check for mistakes.
@pertrai1-bot

Copy link
Copy Markdown
Collaborator Author

Addressed the current review comments in 1b79fc8:

  • Restored explicit high-risk wording in directives/task-framing.md.
  • Removed the Light Path ≤2 files changed heuristic from templates/copilot-instructions.md so adaptive routing remains behavior/risk based.
  • Updated Copilot directive references to use canonical directives/... paths.

Verification: git diff --check and local template/reference assertions passed. CodeRabbit now reports success for this PR.

@pertrai1
pertrai1 merged commit 0a9ae2c into main Apr 30, 2026
1 check passed
@pertrai1
pertrai1 deleted the feat/adaptive-workflow-routing branch April 30, 2026 12:00
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.

3 participants