2.3 KiB
2.3 KiB
Phase 2 PR #1 Checklist: Component Registry Routing
Created: 2026-02-12 Owner: Flynn core Status: ready to implement
Goal
Add a component registry for intent routing so message patterns can map to target agents/skills before full orchestration.
Scope
In scope:
- intent rule schema in config
- registry with match + priority resolution
- router integration in
daemon/routing.ts - gateway inspection handler (
intents.list,intents.match)
Out of scope:
- confidence-based fast-path decisions (PR #2)
- history/context boosts (PR #3)
Files
New:
src/intents/registry.tssrc/intents/index.tssrc/intents/registry.test.tssrc/gateway/handlers/intents.ts
Modified:
src/config/schema.tssrc/daemon/index.tssrc/daemon/routing.tssrc/gateway/handlers/index.ts
Implementation Steps
- Add config schema section
intents:enabled(bool, default false)match_threshold(0..1)rules[]withname,patterns[],target { type, name },priority,enabled
- Implement
ComponentRegistry:- rule registration
- glob/literal match
- score + tie-break (
priority, specificity)
- Add tests for exact/glob matches and tie-breaking.
- Instantiate registry in daemon startup and load rules from config.
- In
createMessageRouter, run intent match before agent resolution. - Add gateway handlers to inspect configured rules and test match behavior.
Validation Commands
pnpm typecheck
pnpm test:run src/intents/registry.test.ts
pnpm test:run src/daemon/routing.test.ts
pnpm test:run src/gateway/handlers/handlers.test.ts
pnpm test:run
pnpm lint
pnpm build
Acceptance Criteria
- Registry resolves matches deterministically.
- Intent routing is opt-in and disabled by default.
- Messages with matching rules can override default agent target.
- Messages without a match keep existing route behavior.
- Gateway inspection handlers return correct match/rule info.
- No regressions in existing routing tests.
Risks
- False-positive matches route to wrong agent.
- Mitigation: conservative threshold + debug logging.
- Rule explosion impacts performance.
- Mitigation: precompile/cached patterns and O(n) bounded scan.
Commit Message
feat(routing): add component registry for intent-based target resolution