move working_stack code to correct file

This commit is contained in:
Kent Overstreet 2026-04-04 17:00:01 -04:00
parent e9d803c4ea
commit 375a8d9738
5 changed files with 24 additions and 30 deletions

View file

@ -10,6 +10,7 @@ use crate::agent::api::types::*;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use tiktoken_rs::CoreBPE;
use crate::agent::tools::working_stack;
/// A section of the context window, possibly with children.
#[derive(Debug, Clone)]
@ -231,15 +232,6 @@ pub struct ContextState {
pub entries: Vec<ConversationEntry>,
}
// TODO: these should not be hardcoded absolute paths
pub fn working_stack_instructions_path() -> std::path::PathBuf {
dirs::home_dir().unwrap_or_default().join(".consciousness/config/working-stack.md")
}
pub fn working_stack_file_path() -> std::path::PathBuf {
dirs::home_dir().unwrap_or_default().join(".consciousness/working-stack.json")
}
impl ContextState {
/// Compute the context budget from typed sources.
pub fn budget(&self, count_str: &dyn Fn(&str) -> usize,
@ -267,7 +259,7 @@ impl ContextState {
let mut parts: Vec<String> = self.personality.iter()
.map(|(name, content)| format!("## {}\n\n{}", name, content))
.collect();
let instructions = std::fs::read_to_string(working_stack_instructions_path()).unwrap_or_default();
let instructions = std::fs::read_to_string(working_stack::instructions_path()).unwrap_or_default();
let mut stack_section = instructions;
if self.working_stack.is_empty() {
stack_section.push_str("\n## Current stack\n\n(empty)\n");