Delete obsolete loading of memory files from projects dir
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
743b35eb20
commit
a32dff06f9
1 changed files with 1 additions and 26 deletions
|
|
@ -80,9 +80,7 @@ fn load_memory_files(cwd: &Path, memory_project: Option<&Path>, context_groups:
|
||||||
// Primary config directory
|
// Primary config directory
|
||||||
let config_dir = home.join(".consciousness/identity");
|
let config_dir = home.join(".consciousness/identity");
|
||||||
let global = home.join(".consciousness");
|
let global = home.join(".consciousness");
|
||||||
let project = memory_project
|
let project = memory_project.map(PathBuf::from);
|
||||||
.map(PathBuf::from)
|
|
||||||
.or_else(|| find_project_memory_dir(cwd, &home));
|
|
||||||
|
|
||||||
let mut memories: Vec<(String, String)> = Vec::new();
|
let mut memories: Vec<(String, String)> = Vec::new();
|
||||||
|
|
||||||
|
|
@ -135,29 +133,6 @@ fn load_memory_files(cwd: &Path, memory_project: Option<&Path>, context_groups:
|
||||||
memories
|
memories
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Find the Claude Code project memory directory for the given cwd.
|
|
||||||
/// Claude Code mangles the path: /home/kent/foo → -home-kent-foo
|
|
||||||
fn find_project_memory_dir(cwd: &Path, home: &Path) -> Option<PathBuf> {
|
|
||||||
let projects_dir = home.join(".claude/projects");
|
|
||||||
if !projects_dir.exists() { return None; }
|
|
||||||
|
|
||||||
// Try direct cwd match, walking up to git root
|
|
||||||
let mut dir = Some(cwd);
|
|
||||||
while let Some(d) = dir {
|
|
||||||
let mangled = d.to_string_lossy().replace('/', "-");
|
|
||||||
let candidate = projects_dir.join(&mangled).join("memory");
|
|
||||||
if candidate.exists() { return Some(candidate); }
|
|
||||||
if d.join(".git").exists() { break; }
|
|
||||||
dir = d.parent();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fallback: first project dir with identity.md
|
|
||||||
std::fs::read_dir(&projects_dir).ok()?
|
|
||||||
.flatten()
|
|
||||||
.map(|e| e.path().join("memory"))
|
|
||||||
.find(|m| m.join("identity.md").exists())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Discover instruction and memory files that would be loaded.
|
/// Discover instruction and memory files that would be loaded.
|
||||||
/// Returns (instruction_files, memory_files) as (display_path, chars) pairs.
|
/// Returns (instruction_files, memory_files) as (display_path, chars) pairs.
|
||||||
pub fn context_file_info(prompt_file: &str, memory_project: Option<&Path>, context_groups: &[ContextGroup]) -> (Vec<(String, usize)>, Vec<(String, usize)>) {
|
pub fn context_file_info(prompt_file: &str, memory_project: Option<&Path>, context_groups: &[ContextGroup]) -> (Vec<(String, usize)>, Vec<(String, usize)>) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue