Skip to main content

Crate g8_planner

Crate g8_planner 

Source
Expand description

g8-planner — composite-query orchestration and recommendation derivation.

This crate is a pure deterministic transformer over StoreConnection. It calls exactly one store method — StoreConnection::planner_intent_check — and post-processes the six JSON payloads it receives into a structured FitReport with a deterministic [Recommendation].

§Design constraints (from ARCHITECTURE.md §5 and §11)

  • No LLM calls. No async runtime. No HTTP. No direct file I/O.
  • One store call per plan_check invocation. The composite-query principle (SPEC §3 principle 2) forbids verb chains; all SQL work is done inside planner_intent_check on the store side.
  • Deterministic. Same PlanDraft + same store contents → same FitReport and Recommendation every time.

§ARCHITECTURE_GAP

ARCHITECTURE.md §3.4 specifies pub fn plan_check(store: &dyn StoreConnection, …). However, StoreConnection contains a generic method (watch<F>) which makes it object-unsafe (not dyn-compatible). The equivalent and idiomatic Rust fix is to accept store: &S where S: StoreConnection, which is what this crate implements. All call sites are unaffected.

§Example

use g8_planner::Planner;
use g8_core::{plan::PlanDraft, SpaceId};
use g8_store::RusqliteStore;

// In production the CLI opens a RusqliteStore and passes it here.
let mut store = RusqliteStore::open_in_memory().unwrap();
store.migrate().unwrap();

let draft = PlanDraft {
    title: "streaming-export".into(),
    description: None,
    substrate: Some("export-pipeline".into()),
    touched_capabilities: vec![],
    touched_paths: vec![],
    space_id: SpaceId::derive(&["docs", "space"]),
    project_id: None,
};
let report = Planner::plan_check(&store, &draft).unwrap();
assert_eq!(report.recommendation, g8_core::Recommendation::Proceed);

Structs§

Planner
Stateless planner that turns a PlanDraft into a FitReport.

Enums§

PlannerError
Errors produced by Planner::plan_check.