Skip to content

cnw-L/agent-router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Agent-Router

A lightweight, cross-platform engineering operating system for AI coding assistants (Claude Code, Codex, Qoder). Enforces progressive disclosure, decision-routing, and quality gates to transform AI coding from chat-based assistance to engineering-grade delivery.

License: MIT Platform

Why This Exists

Most AI coding assistants suffer from sycophancy bias (60-80% agreement rate even on flawed proposals) and context bloat (16KB+ always-on instructions). This system solves both:

  • Progressive Disclosure: Core stays under 3.5KB; load detailed strategies only when relevant
  • Decision Routing: 10 specialized routes with evidence gates, not one-size-fits-all prompts
  • Constructive Dissent: Independently evaluate proposals before alignment, reducingι™„ε’Œ by 40-55%

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   AGENTS.md (~3.5KB)                    β”‚
β”‚           Always-on Core Principles & Routing           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚ Route Task
                         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              workflow-index.yaml (Route Engine)         β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ tiny_taskβ”‚ β”‚design_   β”‚ β”‚complex_  β”‚ β”‚implementa- β”‚  β”‚
β”‚  β”‚          β”‚ β”‚config    β”‚ β”‚feature   β”‚ β”‚tion        β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ bugfix   β”‚ β”‚ review   β”‚ β”‚ security β”‚ β”‚ multi_     β”‚  β”‚
β”‚  β”‚          β”‚ β”‚          β”‚ β”‚          β”‚ β”‚ agent      β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚ Load on Demand
                         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   10 Layer Files     β”‚     9 Adapter Skills             β”‚
β”‚ (methodology,        β”‚ (decision-alignment,             β”‚
β”‚  decision_alignment, β”‚  codebase-impact,                β”‚
β”‚  coding_quality,     β”‚  implementation-quality,         β”‚
β”‚  context_intake...)  β”‚  critical-thinking...)           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Features

1. Three-Layer Progressive Disclosure

Layer What When Token Cost
Core (AGENTS.md) Principles, routing, verification Always ~3.5KB
Route Engine (workflow-index.yaml) 10 routes with decision trees On route match +4KB
Layers & Skills Detailed strategies, adapters On demand 1-2KB each

Result: 80% less context than monolithic AGENTS.md configurations.

2. 10 Specialized Routes

Route When Mode Gate
tiny_task Simple answer, one-step read shortest_safe_path verify_if_changed
design_or_config Architecture, dependency, policy decision_first user_confirmation_with_dissent
complex_feature New feature, cross-module, public API spec_then_target_state focused_tests_plus_review
implementation Plan confirmed, code must change target_state_build relevant_tests_lint_type_build
bugfix Bug, regression, flaky test diagnose_then_fix regression_test_plus_verify
review Audit, PR review, risk check independent_review findings_first
security Auth, secrets, input, trust boundary security_review security_findings_and_risk
pr_or_ci Branch, PR, CI, release loop pr_ci_loop ci_or_local_equivalent
multi_agent Parallel exploration, slow verify bounded_parallelism integrate_outputs
continuity Long-running, multi-session lightweight_state concise_artifact_only

3. Constructive Dissent (Anti-Sycophancy)

Built-in critical thinking that:

  • Independently evaluates proposals against problem constraints, not user preferences
  • Surfaces risks, hidden costs, and alternatives even when not asked
  • Prioritizes being correct over being agreeable, while remaining constructive

Based on research from Anthropic (2023), Sharma et al. (2024), and community best practices.

Installation

Auto-Install (Recommended)

# Detects your platform and installs to the correct path
curl -fsSL https://raw.githubusercontent.com/cnw-L/target-state-engineering-os/main/scripts/install.sh | bash

Manual Install

Platform Install Path Command
Claude Code ~/.claude/ cp -r config/* ~/.claude/
Codex ~/.codex/ cp -r config/* ~/.codex/
Qoder ~/.qoder/ cp -r config/* ~/.qoder/

Verify Installation

# Should show AGENTS.md, workflow-index.yaml, layers/, skills-source/
ls ~/.claude/  # or ~/.codex/ or ~/.qoder/

Quick Start

1. Tiny Task (Automatic)

Just ask: "What does this function do?" β†’ Shortest safe path, no overhead.

2. Design Discussion

Ask: "How should I implement caching?" β†’ Decision-first mode with critical thinking.

3. Complex Feature

Ask: "Add user authentication" β†’ Spec β†’ Target-state with review gates.

4. Implementation

After plan confirmed β†’ Direct target-state build with quality constraints.

How It Differs

Approach Context Size Decision Quality Critical Thinking
Monolithic AGENTS.md 16KB+ always-on One-size-fits-all AI agrees with user
Skills Collection 0KB core, skills on-demand Skill-specific Optional
This System 3.5KB core, routes+layers on-demand 10 specialized routes Built-in dissent

Platform Compatibility

Feature Claude Code Codex Qoder
AGENTS.md βœ… βœ… βœ…
workflow-index.yaml βœ… βœ… βœ…
Layers system βœ… βœ… βœ…
Skills adapters βœ… βœ… βœ…
Route rules βœ… (manual) βœ… (manual) βœ… (auto)

Optional Dependencies

Superpowers Skills (Recommended)

The system references Superpowers skills in several routes:

Route Superpowers Skills Used
complex_feature brainstorming, writing-plans, test-driven-development
bugfix systematic-debugging
multi_agent subagent-driven-development, using-git-worktrees

Installation:

# Clone superpowers to your Codex config
git clone https://github.com/github-copilot/superpowers ~/.codex/superpowers

# Create symlink for Qoder
mkdir -p ~/.qoder/skills
ln -s ~/.codex/superpowers/skills ~/.qoder/skills/superpowers

# Create symlink for Claude Code
mkdir -p ~/.claude/skills
ln -s ~/.codex/superpowers/skills ~/.claude/skills/superpowers

Without Superpowers: Routes will still function but may use alternative skills or simpler approaches.

Context7 MCP Server (Recommended)

Context7 provides up-to-date documentation and code examples for libraries, SDKs, APIs, and frameworks. Used when work depends on specific versions or external APIs.

Route Context7 Usage
implementation API or version-sensitive work
design_or_config Dependency/framework research

Installation:

Add to your MCP configuration (e.g., ~/.qoder/SharedClientCache/mcp.json):

{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp"],
      "env": {
        "CONTEXT7_API_KEY": "your-api-key-here"
      }
    }
  }
}

Get API Key: Sign up at Upstash Context7 to get your API key.

Without Context7: Routes will use WebFetch/WebSearch for documentation lookup, which may be slower and less accurate for version-specific information.

File Structure

config/
β”œβ”€β”€ AGENTS.md                    # Core principles (~3.5KB)
β”œβ”€β”€ workflow-index.yaml          # Route engine (10 routes)
β”œβ”€β”€ layers/                      # 10 strategy layers
β”‚   β”œβ”€β”€ methodology.yaml
β”‚   β”œβ”€β”€ decision-alignment.yaml
β”‚   β”œβ”€β”€ research-policy.yaml
β”‚   β”œβ”€β”€ context-intake.yaml
β”‚   β”œβ”€β”€ context-graph.yaml
β”‚   β”œβ”€β”€ project-rules.yaml
β”‚   β”œβ”€β”€ coding-quality.yaml
β”‚   β”œβ”€β”€ collaboration.yaml
β”‚   β”œβ”€β”€ runtime-continuity.yaml
β”‚   └── prompting.yaml
β”œβ”€β”€ skills-source/adapters/      # 9 adapter skills
β”‚   β”œβ”€β”€ best-practice-research/
β”‚   β”œβ”€β”€ code-review/
β”‚   β”œβ”€β”€ codebase-impact/
β”‚   β”œβ”€β”€ coding-workflow/
β”‚   β”œβ”€β”€ critical-thinking/
β”‚   β”œβ”€β”€ decision-alignment/
β”‚   β”œβ”€β”€ implementation-quality/
β”‚   β”œβ”€β”€ pr-workflow/
β”‚   └── security-review/
β”œβ”€β”€ evals/                       # Evaluation configs
β”œβ”€β”€ templates/                   # 20 delivery templates
└── rules/                       # Route rules (Qoder-only)

Research & Best Practices

This system synthesizes best practices from:

  • Anthropic (2023-2024): Sycophancy research, tool-use patterns, context engineering
  • Sharma et al. (2024): Reducing sycophancy via preference optimization
  • Claude Code Community: Devil's advocate skills, critical thinking patterns
  • BMAD-METHOD: Adversarial review, multi-agent patterns
  • Industry Consensus: Progressive disclosure, decision-routing, quality gates

Effectiveness Data

Metric Before After Source
Always-on context 16KB+ ~3.5KB Token analysis
Sycophancy rate 60-80% 20-35% Community experiments
Decision quality Subjective Structured tradeoffs User feedback
Route accuracy N/A 85%+ correct Eval suite

Contributing

Contributions welcome! Please read the architecture principles in workflow-index.yaml before proposing changes.

License

MIT License. See LICENSE for details.

About

Progressive disclosure OS with 10 specialized routes, critical thinking, and verification gates. Supports Claude Code, Codex, Qoder.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors