router-first-architecture
Router-First Architecture establishes a two-layer system where domain-specific routers deterministically map user intents to CLI commands before individual tools execute. Use this pattern when building skill sets with multiple related operations to centralize command routing logic, prevent direct tool bypass, and ensure consistent intent-to-action mapping through router confidence scores and co-activation rules.
git clone --depth 1 https://github.com/parcadei/Continuous-Claude-v3 /tmp/router-first-architecture && cp -r /tmp/router-first-architecture/.claude/skills/archive/router-first-architecture ~/.claude/skills/router-first-architectureSKILL.md
# Router-First Architecture
Route through domain routers before using individual tools. Routers abstract tool selection.
## Pattern
Domain routers (like `math-router`) provide deterministic mapping from user intent to exact CLI commands. Always use the router first; only bypass for edge cases.
## DO
- Call `math-router route "<intent>"` before any math operation
- Let domain skills co-activate with their router (via `coActivate` in skill-rules.json)
- Trust the router's confidence score; only fall back if `command: null`
- Keep trigger keywords/patterns in skill-rules.json broader than routing patterns
## DON'T
- Call individual scripts directly when a router exists
- Duplicate routing logic in individual skills
- Let domain skills bypass their router
## Co-Activation Pattern
Domain skills should co-activate with their router:
```json
{
"math/abstract-algebra/groups": {
"coActivate": ["math-router"],
"coActivateMode": "always"
}
}
```
This ensures the router is always available when domain knowledge is activated.
## Two-Layer Architecture
1. **Skill-rules trigger layer**: Nudges Claude to use the router (keywords, intent patterns)
2. **Router routing layer**: Deterministic mapping to scripts via regex patterns
Keep the trigger layer broader than routing - the router should handle "not found" gracefully.
## Source Sessions
- 2bbc8d6e: "Trigger layer was narrower than routing layer" - expanded triggers
- This session: Wired 8 domain math skills to co-activate with math-routerSecurity vulnerability analysis and testing
Build Python agents using Agentica SDK - spawn agents, implement agentic functions, multi-agent orchestration
Unit and integration test execution and validation
Feature planning, design documentation, AND integration planning
End-to-end and acceptance test execution
Analyze Claude Code sessions using Braintrust logs
Session analysis, precedent lookup, and learning extraction
Query the artifact index for precedent and guidance