Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
docs(agent): say what constancy above the cache line actually means
thinhlpg0040f4d5b880
diff --git a/src-tauri/src/core/agent/loop.rs b/src-tauri/src/core/agent/loop.rsindex 3b9979d10..9aff03236 100644--- a/src-tauri/src/core/agent/loop.rs+++ b/src-tauri/src/core/agent/loop.rs@@ -2109,9 +2109,11 @@ fn build_run_system_prompt(/// with this project's resolved sandbox/scratch and `[prompt]` policy). Used by/// the CLI `/context` view to size the system segments: routing it through the/// same builder is what keeps the reported breakdown from drifting away from-/// what is actually sent. Excludes the per-turn additions a run makes on top ---/// the date, git state, query-dependent memory recall, and plan/todo state ---/// which are not knowable while idle. `None` when no prompt would be built, or+/// what is actually sent. What it sizes is the stable prompt a run caches, so+/// the per-turn additions a run composes on top are excluded: the date, git+/// state, query-dependent memory recall, and plan/todo state all land in the+/// volatile block below the cache line rather than in the prefix this reports.+/// `None` when no prompt would be built, or/// when the project's `[prompt]` policy cannot be honored (the run itself/// reports that failure with the same message).#[cfg(feature = "cli")]diff --git a/src-tauri/src/core/agent/prompt.rs b/src-tauri/src/core/agent/prompt.rsindex d2958e6e1..f4a6e9d9e 100644--- a/src-tauri/src/core/agent/prompt.rs+++ b/src-tauri/src/core/agent/prompt.rs@@ -195,13 +195,17 @@ impl Composer {}}- /// Whether this composer's content is constant for a session.+ /// Whether this composer's content is constant across the turns of one+ /// run.///- /// A composer that reads the clock, the branch, the query, or the todo list- /// is not, and cannot sit above the cache line: it would break the prefix- /// on the turn its value changed. Composition happens once per run, so a- /// composer that reads the project directory is constant *within a run* --- /// which is what "for a session" means here.+ /// That is what the cache line asks for: composition happens once per run+ /// and every turn of it reuses the same message 0, so a composer whose+ /// bytes can only change when a new run composes the prompt may sit above+ /// the cache line. A composer that reads the clock, the branch, the query,+ /// or the todo list cannot: it would break the prefix on the turn its value+ /// changed. A composer that reads the project directory (project context,+ /// skills, memory) qualifies -- an edit to those files lands on the next+ /// run, which is a new prompt on purpose.pub(crate) fn constant(self) -> bool {match self {Composer::AssistantInstructions@@ -318,7 +322,8 @@ impl PromptPolicy {if !composer.constant() {if composer.declared() == Some(Placement::Prefix) {return Err(format!(- "`{}` is declared above the cache line but its content is not constant for a session. \+ "`{}` is declared above the cache line but its content is not constant across \+ the turns of one run. \A composer that varies would break the cached prefix on the turn its value changed: \declare it in the tail (see Composer::declared), or make it constant.",composer.id()