Implement pi_terraphim_router KG-driven routing module #52

Open
opened 2026-05-25 21:04:01 +02:00 by root · 0 comments
Owner

Goal

Replace the existing stub pi_terraphim_router/ directory with a production KG-driven routing module using terraphim_automata + terraphim_types (no orchestrator bloat, no SQLite).

Implementation Plan

See: .docs/design-pi-rust-terraphim-router.md

Steps

  • Step 1: Add terraphim_automata dependency to Cargo.toml
  • Step 2: Core types and errors (RouteDecision, RouterConfig, RouterError)
  • Step 3: Taxonomy loading from markdown files
  • Step 4: Routing logic with Aho-Corasick matching + priority selection
  • Step 5: Embedded fallback taxonomy (3-tier ADF rules)
  • Step 6: CLI handler for demo-route subcommand
  • Step 7: Provider readiness integration (model_entry_is_ready())
  • Step 8: Hot reload (reload_if_changed())
  • Step 9: Documentation and example update
  • Step 10: Quality gates (cargo check, clippy, test, UBS)

Acceptance Criteria

  • cargo check --features terraphim-routing compiles
  • pi demo-route "implement auth" --format json outputs valid JSON
  • Unit tests pass for all routing scenarios
  • UBS scanner passes on staged changes
  • No terraphim_orchestrator or SQLite dependency introduced

Estimated Effort

6-8 hours

## Goal Replace the existing stub `pi_terraphim_router/` directory with a production KG-driven routing module using `terraphim_automata` + `terraphim_types` (no orchestrator bloat, no SQLite). ## Implementation Plan See: `.docs/design-pi-rust-terraphim-router.md` ### Steps - [ ] Step 1: Add `terraphim_automata` dependency to Cargo.toml - [ ] Step 2: Core types and errors (`RouteDecision`, `RouterConfig`, `RouterError`) - [ ] Step 3: Taxonomy loading from markdown files - [ ] Step 4: Routing logic with Aho-Corasick matching + priority selection - [ ] Step 5: Embedded fallback taxonomy (3-tier ADF rules) - [ ] Step 6: CLI handler for `demo-route` subcommand - [ ] Step 7: Provider readiness integration (`model_entry_is_ready()`) - [ ] Step 8: Hot reload (`reload_if_changed()`) - [ ] Step 9: Documentation and example update - [ ] Step 10: Quality gates (cargo check, clippy, test, UBS) ### Acceptance Criteria - [ ] `cargo check --features terraphim-routing` compiles - [ ] `pi demo-route "implement auth" --format json` outputs valid JSON - [ ] Unit tests pass for all routing scenarios - [ ] UBS scanner passes on staged changes - [ ] No `terraphim_orchestrator` or SQLite dependency introduced ### Estimated Effort 6-8 hours
root added the status/in-progress label 2026-05-25 21:04:15 +02:00
Sign in to join this conversation.