Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
bdf2819
Her prompt is fitted to a working window sized from the measured pref…
joelteply Oct 28, 2026
694a726
context_budget: the working-window step is an associated constant
joelteply Oct 28, 2026
d682844
The working window is the dyno's measured knee (48k), not a rate: sta…
joelteply Oct 28, 2026
b1acb40
An epoch starts her growing sources at a quarter of what grounding le…
joelteply Oct 28, 2026
f7ebc79
The working window's rule is a pure function the test runs at the kne…
joelteply Oct 28, 2026
4b5cf9e
WORKING_WINDOW_TOKENS and working_window_when are associated items: c…
joelteply Oct 28, 2026
29ae09a
source-hygiene: prompt_self_sizing ratchet counts every prompt-conten…
joelteply Oct 28, 2026
f883c28
Flexbox compliance step 0: the unused tool catalog (authorized_tool_c…
joelteply Oct 28, 2026
f972581
refactor(focus): preserve dispatch completions for view allocation
joelteply Oct 28, 2026
db36673
continuum_context: an item's whole may be stored, not resident (resid…
joelteply Oct 28, 2026
f3fc3bc
feat(focus): expose grant-based tool levels and invariant demand
joelteply Oct 28, 2026
68f28d5
feat(focus): pass epoch tools grant into learned-head selection
joelteply Oct 28, 2026
8e7b38d
Focus, conversation step: airc delivers every turn whole; her cursor …
joelteply Oct 28, 2026
09ec9f3
Merge branch 'codex/focus-tools' of https://github.com/CambrianTech/c…
joelteply Oct 28, 2026
3c5d9e1
Merge commit '8e7b38d41' into codex/focus-tools
joelteply Oct 28, 2026
d4a0b11
Focus, tools step: her hands are one claim in the one allocation, the…
joelteply Oct 28, 2026
c44b539
Merge remote-tracking branch 'origin/fable/working-window' into codex…
joelteply Oct 28, 2026
7998517
Remove independent tool-window budget after shared focus integration
joelteply Oct 28, 2026
d3dfdff
Focus, grounding and recall step: sources deliver every item at its l…
joelteply Oct 28, 2026
4b9e1e8
Focus: compile fixes from the 20:19Z window; delete what the migratio…
joelteply Oct 28, 2026
a8fdbc6
Focus: room updates are conversation turns in her view; the inert rep…
joelteply Oct 28, 2026
13ba365
Merge branch 'codex/focus-tools' of https://github.com/CambrianTech/c…
joelteply Oct 28, 2026
ceca62f
Use shared allocation receipts instead of rereading tool affordability
joelteply Oct 28, 2026
c8904ca
Describe tool receipt against shared allocation
joelteply Oct 28, 2026
e687458
Focus: an unread room update keeps a handle in her view, so one large…
joelteply Oct 28, 2026
2dcd5de
Focus: room updates get one index line that never collapses, not a ha…
joelteply Oct 28, 2026
1dc5a2a
Card ids in the board, active-work and wall sources use airc_core's s…
joelteply Oct 28, 2026
1978076
Merge branch 'codex/focus-tools' of https://github.com/CambrianTech/c…
joelteply Oct 28, 2026
58a5968
Focus, act_observe: her echoed args fold at a fixed rule; a settled r…
joelteply Oct 28, 2026
f0eac08
Focus: a tool result's custody is storage only: saved whole, handed b…
joelteply Oct 28, 2026
bcfcac5
StoredWhole ships with its first caller (#5573), not here; result_sum…
joelteply Oct 29, 2026
2c0c1a1
A result header and an open-view note size nothing: shape rules repla…
joelteply Oct 29, 2026
2b6bb58
The withheld-hands test asks with the work turn its window is calibra…
joelteply Oct 29, 2026
ab07bfe
Her view gives back what a squeezed start collapsed, and a kept tool …
joelteply Oct 29, 2026
3464360
A level replaces its pointer, so an item smaller than its own pointer…
joelteply Oct 29, 2026
8aac686
A start never collapses her newest end: the newest item is covered, a…
joelteply Oct 29, 2026
ce7c7bb
start_would_restore returns the typed GrantMismatch, never a quiet "n…
joelteply Oct 29, 2026
fa7c578
Merge canary (the cognition crate tree, #5588) into the focus branch
joelteply Oct 29, 2026
49212ea
A view that cannot be sized refuses the turn: GrantMismatch reaches b…
joelteply Oct 29, 2026
bdb47e8
A test drives the real boundary: an allocator answering for the wrong…
joelteply Oct 29, 2026
f950037
The context-codec rule types are private: used only in their own file…
joelteply Oct 29, 2026
fad638d
The roster's RagRenderable projection is its own module (viewstate_ra…
joelteply Oct 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion core/continuum-academy/src/cognition/eval/eval_settle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ pub(super) async fn eval_settle(
let delivery = crate::cognition::rag_budget::RagDelivery {
source_id: "airc".to_string(),
items: vec![crate::cognition::rag_budget::RagItem {
key: String::new(),
summary: None,
pointer: None,
content: prompt.to_string(),
tokens: 0,
metadata: serde_json::json!({ "peer_id": "peer", "occurred_at_ms": EVAL_EPOCH_MS }),
}],
tokens_used: 0,
truncated: false,
resolution_used: crate::cognition::rag_budget::ResolutionPreference::Raw,
};
let burst = crate::cognition::workspace::Burst::from_turns(
room,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,13 +395,10 @@ pub(super) async fn perception_grade(
name: "perception/observe".to_string(),
input: serde_json::json!(params),
};
// Generous char bound: the ObserveResult carries the structure tree + (inline) the rendered
// PNG, which the model-facing path would fold. Grading is not latency-critical and needs the
// WHOLE JSON, so we don't fold it here.
const OBSERVE_RESULT_BOUND: usize = 16_000_000;
// Grading needs the WHOLE JSON (structure tree + inline PNG); results come back whole.
let out = match acting
.executor
.execute_native_batch(std::slice::from_ref(&observe_call), &ws_ctx, OBSERVE_RESULT_BOUND)
.execute_native_batch(std::slice::from_ref(&observe_call), &ws_ctx)
.await
{
Ok(o) => o,
Expand Down
12 changes: 9 additions & 3 deletions core/continuum-academy/src/cognition/eval/run_pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ pub(super) async fn run_pass(
let task_delivery = crate::cognition::rag_budget::RagDelivery {
source_id: "airc".to_string(),
items: vec![crate::cognition::rag_budget::RagItem {
key: String::new(),
summary: None,
pointer: None,
content: framed_prompt,
tokens: 0,
metadata: serde_json::json!({
Expand All @@ -214,7 +217,6 @@ pub(super) async fn run_pass(
}],
tokens_used: 0,
truncated: false,
resolution_used: crate::cognition::rag_budget::ResolutionPreference::Raw,
};
// own_peer/agent_name attribute the persona's OWN past posts; a single-task
// exam has none, so they're inert here (the item's peer_id "peer" ≠ "").
Expand Down Expand Up @@ -400,6 +402,9 @@ pub(super) async fn run_pass(
let nudge_delivery = crate::cognition::rag_budget::RagDelivery {
source_id: "airc".to_string(),
items: vec![crate::cognition::rag_budget::RagItem {
key: String::new(),
summary: None,
pointer: None,
content: format!(
"You did not answer. This is a GRADED exam question and you must answer it \
now — do NOT reply PASS or stay silent. Provide your complete solution:\n\n{}",
Expand All @@ -410,7 +415,6 @@ pub(super) async fn run_pass(
}],
tokens_used: 0,
truncated: false,
resolution_used: crate::cognition::rag_budget::ResolutionPreference::Raw,
};
let nudge_burst = crate::cognition::workspace::Burst::from_turns(
room,
Expand Down Expand Up @@ -519,6 +523,9 @@ pub(super) async fn run_pass(
let red_delivery = crate::cognition::rag_budget::RagDelivery {
source_id: "airc".to_string(),
items: vec![crate::cognition::rag_budget::RagItem {
key: String::new(),
summary: None,
pointer: None,
content: format!(
"You settled, but the task's definition-of-done currently FAILS. Its output ends:

Expand All @@ -531,7 +538,6 @@ Fix the workspace and finish — the grade reads th
}],
tokens_used: 0,
truncated: false,
resolution_used: crate::cognition::rag_budget::ResolutionPreference::Raw,
};
let red_burst = crate::cognition::workspace::Burst::from_turns(
room,
Expand Down
4 changes: 3 additions & 1 deletion core/continuum-academy/src/cognition/eval/warm_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ pub(super) async fn warm_gate(cycle: &crate::cognition::workspace::WorkspaceCycl
let probe_delivery = crate::cognition::rag_budget::RagDelivery {
source_id: "airc".to_string(),
items: vec![crate::cognition::rag_budget::RagItem {
key: String::new(),
summary: None,
pointer: None,
content: "ready check".to_string(),
tokens: 0,
metadata: serde_json::json!({ "peer_id": "peer", "occurred_at_ms": EVAL_EPOCH_MS }),
}],
tokens_used: 0,
truncated: false,
resolution_used: crate::cognition::rag_budget::ResolutionPreference::Raw,
};
let mut warm = false;
for _ in 0..15u32 {
Expand Down
15 changes: 2 additions & 13 deletions core/continuum-cognition/src/cognition/act_observe/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use continuum_base::time::EpochMs;
use uuid::Uuid;

use crate::ai::types::{ToolCall, ToolResult};
use crate::cognition::context_budget::ContextBudget;
use crate::cognition::workspace::WorkspaceCycle;

use super::observation::{extract_paths, ActOutcome, ActStatus, Observation, ToolOutput, ToolVerb};
Expand Down Expand Up @@ -153,16 +152,6 @@ pub async fn apply_act(
if let Some((_, w)) = cycle.model_loadout() {
body.working_memory.set_served_window(w);
}
// ONE budget for what an act's results may hold: working memory's own, which is the
// same for every turn of hers. Sized from the running turn's audience, a room turn
// (Interactive) cut a 440-line read at 12,960 chars while the ring the result joins next
// budgets ~26k (Benchy, the M5, 2026-10-17 23:06Z: "more than this window's 12960-char
// share", the same file re-read every turn, no write).
let budget = if cycle.model_loadout().is_some() {
body.working_memory.budget()
} else {
ContextBudget::unknown()
};
let ctx = crate::cognition::tool_executor::ToolExecutionContext {
persona_id: body.persona_id,
persona_name: body.persona_name.clone(),
Expand Down Expand Up @@ -303,7 +292,7 @@ pub async fn apply_act(
let batch_result = tokio::time::timeout(
TOOL_BATCH_CEILING,
executor
.execute_native_batch_pinned(&dispatched, &ctx, budget.latest_action_chars(), &pin),
.execute_native_batch_pinned(&dispatched, &ctx, &pin),
)
.await
.unwrap_or_else(|_| { // timeout elapsed = the hang this bound exists to convert; the closure builds the honest error
Expand Down Expand Up @@ -437,7 +426,7 @@ pub async fn apply_act(
},
status: ActStatus::Executed,
};
observation.push_str(&obs.render_recency(intent, &budget));
observation.push_str(&obs.render_recency(intent));
recall_observation.push_str(&obs.render_recall(intent));
// (The canvas feed publishes at the tool-executor seam, PRE-fold — a
// flood-sized ObserveResult here is already a spilled preview that no
Expand Down
4 changes: 1 addition & 3 deletions core/continuum-cognition/src/cognition/act_observe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ mod perception;
mod recency;

mod observation;
pub use observation::{extract_paths, ActOutcome, ActStatus, Observation, ToolOutput, ToolVerb};
pub use observation::{extract_paths, intent_label, ActOutcome, ActStatus, Observation, ToolOutput, ToolVerb};

mod types;
pub use types::{SettleOutcome, SettleStep};
Expand Down Expand Up @@ -142,7 +142,6 @@ pub mod test_support {
&self,
calls: &[ToolCall],
context: &ToolExecutionContext,
_max_result_chars: usize,
) -> Result<NativeBatchOutcome, ToolError> {
let act = {
let mut rooms = self.rooms.lock().unwrap();
Expand Down Expand Up @@ -289,7 +288,6 @@ pub mod test_support {
&self,
calls: &[ToolCall],
context: &ToolExecutionContext,
_max_result_chars: usize,
) -> Result<NativeBatchOutcome, ToolError> {
*self.seen_context.lock().unwrap() = Some(context.context_id);
let results = calls
Expand Down
51 changes: 19 additions & 32 deletions core/continuum-cognition/src/cognition/act_observe/observation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ use serde::{Deserialize, Serialize};
use ts_rs::TS;

use crate::ai::types::{ToolCall, ToolResult};
use crate::cognition::context_budget::ContextBudget;

use super::recency::{
humanize_result_content, render_act_for_recall,
summarize_args_for_recency,
render_call_args,
};

/// Semantic class of a tool verb. Produced ONCE from `ToolCall.name` at the act
Expand Down Expand Up @@ -264,23 +263,18 @@ impl Observation {
/// #205 KV-stability invariant. `intent` is batch-level (one per `apply_act`
/// call, shared by every act in the batch), so it is passed rather than
/// stored per-`Observation`.
pub fn render_recency(&self, intent: &str, budget: &ContextBudget) -> String {
Self::render_recency_impl(self, intent, budget)
}

fn render_recency_impl(&self, intent: &str, budget: &ContextBudget) -> String {
let fold = Some(budget.echoed_arg_chars());
let args = summarize_args_for_recency(&self.call.input, fold);
// The intent rides the result as a ONE-LINE reason, clipped to the same
// window-relative echo budget the args get — never the whole monologue.
pub fn render_recency(&self, intent: &str) -> String {
let args = render_call_args(&self.call.input);
// The intent rides the result as a ONE-LINE reason, its first line: a shape rule,
// never a size, and never the whole monologue.
// Measured 2026-09-04: one result header carried 2,902 chars of intent
// ("Let me get oriented…") ahead of 790 chars of actual output; across a
// turn, 6.1k of 20.6k result chars were intent echo. The output is what
// she must read; the reason is a label.
let because = if intent.trim().is_empty() {
String::new()
} else {
format!(" because {}", clip_intent(intent, budget.echoed_arg_chars()))
format!(" because {}", intent_label(intent))
};
format!(
"{}({}){}\nResult:\n{}\n\n",
Expand All @@ -295,8 +289,8 @@ impl Observation {
/// args, the same fold) over its HUMANIZED body at `level` (its summary, else whole), so a
/// summary reads what the receipt shows her, never the executor's serialized JSON, where a
/// read's numbered lines are escaped and no code level is found (Codex on #5424).
pub(crate) fn render_summary_part(&self, budget: &ContextBudget, level: impl Fn(&str) -> Option<String>) -> String {
let args = summarize_args_for_recency(&self.call.input, Some(budget.echoed_arg_chars()));
pub(crate) fn render_summary_part(&self, level: impl Fn(&str) -> Option<String>) -> String {
let args = render_call_args(&self.call.input);
let body = self.body_text();
let body = body.trim();
let shown = level(body).unwrap_or_else(|| body.to_owned()); // unwrap_or: a body with no smaller level is its own summary
Expand Down Expand Up @@ -359,31 +353,24 @@ pub fn extract_paths(input: &serde_json::Value) -> Vec<PathBuf> {

/// Clip an act's intent to a one-line reason of at most `max_chars` characters
/// (first line, head-trimmed with an ellipsis). Pure; used by the recency render.
pub(super) fn clip_intent(intent: &str, max_chars: usize) -> String {
let first = intent.trim().lines().next().unwrap_or("").trim(); // unwrap_or: an empty intent clips to nothing
let max = max_chars.max(24);
if first.chars().count() <= max {
first.to_string()
} else {
let head: String = first.chars().take(max.saturating_sub(1)).collect();
format!("{}…", head.trim_end())
}
/// The intent's label on a result: its first line. A shape rule, never a size: the rest of what she
/// thought is her own message, already in her view.
pub fn intent_label(intent: &str) -> String {
intent.trim().lines().next().map_or_else(String::new, |first| first.trim().to_string()) // an empty intent labels nothing
}

#[cfg(test)]
mod tests {

// what this catches: the intent rides a tool result as a ONE-LINE label clipped to
// the echo budget — never the monologue (2,902 chars ahead of 790 chars of output,
// measured 2026-09-04). A short intent passes through untouched.
// what this catches: the monologue riding every result (2,902 chars of intent ahead of 790
// chars of output, measured 2026-09-04). The label is the first line, by shape, never a size.
#[test]
fn intent_on_a_result_is_a_clipped_one_liner() {
fn intent_on_a_result_is_its_first_line() {
let long = "Let me get oriented properly this time. I've been confusing myself with stale context and the board says otherwise.\nSecond line never rides.";
let clipped = super::clip_intent(long, 40);
assert!(clipped.chars().count() <= 40, "{clipped:?}");
assert!(clipped.ends_with('…') && !clipped.contains("Second line"), "{clipped:?}");
assert_eq!(super::clip_intent("read the card", 40), "read the card");
assert_eq!(super::clip_intent(" ", 40), "");
let label = super::intent_label(long);
assert!(label.starts_with("Let me get oriented") && !label.contains("Second line"), "{label:?}");
assert_eq!(super::intent_label("read the card"), "read the card");
assert_eq!(super::intent_label(" "), "");
}

use super::*;
Expand Down
Loading
Loading