83 lines
2.3 KiB
Markdown
83 lines
2.3 KiB
Markdown
# 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.ts`
|
|
- `src/intents/index.ts`
|
|
- `src/intents/registry.test.ts`
|
|
- `src/gateway/handlers/intents.ts`
|
|
|
|
Modified:
|
|
- `src/config/schema.ts`
|
|
- `src/daemon/index.ts`
|
|
- `src/daemon/routing.ts`
|
|
- `src/gateway/handlers/index.ts`
|
|
|
|
## Implementation Steps
|
|
|
|
1. Add config schema section `intents`:
|
|
- `enabled` (bool, default false)
|
|
- `match_threshold` (0..1)
|
|
- `rules[]` with `name`, `patterns[]`, `target { type, name }`, `priority`, `enabled`
|
|
2. Implement `ComponentRegistry`:
|
|
- rule registration
|
|
- glob/literal match
|
|
- score + tie-break (`priority`, specificity)
|
|
3. Add tests for exact/glob matches and tie-breaking.
|
|
4. Instantiate registry in daemon startup and load rules from config.
|
|
5. In `createMessageRouter`, run intent match before agent resolution.
|
|
6. Add gateway handlers to inspect configured rules and test match behavior.
|
|
|
|
## Validation Commands
|
|
|
|
```bash
|
|
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`
|