diff --git a/clients/typescript/src/schema.d.ts b/clients/typescript/src/schema.d.ts
index 63288c6dbc..238a3410c8 100644
--- a/clients/typescript/src/schema.d.ts
+++ b/clients/typescript/src/schema.d.ts
@@ -2311,6 +2311,8 @@ export interface components {
kind: "evaluate_sensor";
} | {
command: string[];
+ /** @description Plan again even when the location kept a plan for the same request. */
+ fresh: boolean;
/** @enum {string} */
kind: "plan";
selection: string[];
@@ -2812,6 +2814,8 @@ export interface components {
/** @description A person's build command to plan on the location; the server freezes it like an ad-hoc run. */
PlanRequest: {
command: string[];
+ /** @description Plan again instead of returning the plan the location kept for the same request. */
+ fresh: boolean;
/** Format: uuid */
request_id: string;
};
@@ -2846,6 +2850,11 @@ export interface components {
PlanTimings: {
/** @description `synced_state` for a preview over the synced warehouse state; `live` when it read the warehouse. */
planned_from: string;
+ /**
+ * Format: date-time
+ * @description When the plan the location kept, and answered with again, was made; `None` for a new plan.
+ */
+ reused_from?: string | null;
steps: components["schemas"]["PlanTimingStep"][];
/** Format: double */
total_seconds: number;
diff --git a/crates/sqlbuild-cli/src/native_commands/_helpers/location/mod.rs b/crates/sqlbuild-cli/src/native_commands/_helpers/location/mod.rs
index dc88ad9111..ad8a09edea 100644
--- a/crates/sqlbuild-cli/src/native_commands/_helpers/location/mod.rs
+++ b/crates/sqlbuild-cli/src/native_commands/_helpers/location/mod.rs
@@ -3,6 +3,7 @@ pub(crate) mod execution;
pub(crate) mod held_copy;
pub(crate) mod plan_document;
pub(crate) mod plan_request;
+pub(crate) mod plan_reuse;
pub(crate) mod sync_outcomes;
pub(crate) mod sync_report;
pub(crate) mod work;
diff --git a/crates/sqlbuild-cli/src/native_commands/_helpers/location/plan_reuse.rs b/crates/sqlbuild-cli/src/native_commands/_helpers/location/plan_reuse.rs
new file mode 100644
index 0000000000..50fe2ce4e7
--- /dev/null
+++ b/crates/sqlbuild-cli/src/native_commands/_helpers/location/plan_reuse.rs
@@ -0,0 +1,128 @@
+//! The location's last finished plans, in memory, returned again for an identical request.
+
+use std::collections::{BTreeMap, VecDeque};
+use std::sync::{Arc, Mutex, PoisonError};
+
+use chrono::{DateTime, SecondsFormat, Utc};
+use serde_json::{Value, json};
+use sqlbuild_orchestration::platform::models::PlanModelDiff;
+
+use crate::argv::models::Stream;
+use crate::native_commands::_helpers::command::terminal::write_output;
+use crate::native_commands::constants::{REUSED_PLAN_AGE, REUSED_PLAN_BYTES, REUSED_PLANS};
+use crate::native_commands::models::{PlanKey, PlanReuse, PlanToKeep, ReusedPlan};
+use crate::native_commands::types::LocationPlan;
+
+/// The location's kept plans; one location serves one target.
+pub(crate) static PLAN_REUSE: Mutex