Files
yvgude--lean-ctx/docs/contracts/intent-route-v1.md
T
wehub-resource-sync 26382a7ac6
CI / Clippy (push) Failing after 15m13s
CI / Test (ubuntu-latest) (push) Failing after 16m1s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Build (no embeddings / no ORT) (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / Cookbook (Node) (push) Has been cancelled
CI / Pi Extension (Node) (push) Has been cancelled
CI / Rust SDK (lean-ctx-client) (push) Has been cancelled
CI / Embed SDK (lean-ctx-sdk) (push) Has been cancelled
CI / Python SDK (leanctx) (push) Has been cancelled
CI / Hermes Plugin (Python) (push) Has been cancelled
CI / SDK Conformance Matrix (push) Has been cancelled
CI / Coverage (push) Has been cancelled
CI / cargo-deny (push) Has been cancelled
CI / Adversarial Safety (push) Has been cancelled
CI / Benchmarks (push) Has been cancelled
CI / Output-Quality Gate (eval A/B) (push) Has been cancelled
CI / Documentation (push) Has been cancelled
CI / CI Green (push) Has been cancelled
JetBrains Plugin / Actionlint (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
CodeQL / Analyze (rust) (push) Has been cancelled
JetBrains Plugin / Validation (push) Has been cancelled
JetBrains Plugin / Build (push) Has been cancelled
JetBrains Plugin / Test (push) Has been cancelled
Security Check / Security Scan (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:35:30 +08:00

1.3 KiB

Intent Route v1 (IntentRouteV1)

GitLab: #2309

Intent Route v1 is the policy contract that maps:

  1. Intent (task type + confidence + What/How/Do dimension)
  2. Budgets (token + cost budget levels)
  3. Context pressure (ledger utilization + pressure action)

→ into deterministic, traceable recommendations:

  • Model tier (fast|standard|premium) with profile cap + budget-based degradation
  • Read mode recommendation with pressure-based degradation
  • Reason string (traceable, no secret inputs)

Stability & versioning

  • Payload includes schema_version (SSOT: rust/src/core/contracts.rs).
  • Router decisions must be deterministic: same inputs + policy → same output.

Security / privacy

  • Raw query is not stored; the contract includes:
    • query_md5
    • a redacted, bounded excerpt (query_redacted)
  • No secrets should appear in routing artifacts, logs, or exported proofs.

Profile overrides

Profiles can cap routing via routing.max_model_tier and control degradation behavior:

  • File: rust/src/core/profiles.rs
  • Config section: [routing]

Relevant code

  • Router contract + policy: rust/src/core/intent_router.rs
  • Legacy heuristic route (used as base signal): rust/src/core/intent_engine.rs (route_intent)