Move project memory from .g3/ to analysis/ for version control
Project memory is now stored at analysis/memory.md instead of .g3/memory.md. This change enables: - Shared memory across git worktrees (studio agent sessions) - Version-controlled memory that persists across clones - Memory changes tracked in git history and reviewable in PRs Changes: - crates/g3-core/src/tools/memory.rs: Update get_memory_path() to use analysis/ - crates/g3-cli/src/project_files.rs: Update read_project_memory() path - crates/g3-core/src/prompts.rs: Update documentation references (2 occurrences) - analysis/memory.md: Add memory file (copied from .g3/memory.md)
This commit is contained in:
@@ -64,10 +64,10 @@ pub fn read_project_readme(workspace_dir: &Path) -> Option<String> {
|
||||
None
|
||||
}
|
||||
|
||||
/// Read project memory from .g3/memory.md in the workspace directory.
|
||||
/// Read project memory from analysis/memory.md in the workspace directory.
|
||||
/// Returns formatted content with emoji prefix and size info, or None if not found.
|
||||
pub fn read_project_memory(workspace_dir: &Path) -> Option<String> {
|
||||
let memory_path = workspace_dir.join(".g3").join("memory.md");
|
||||
let memory_path = workspace_dir.join("analysis").join("memory.md");
|
||||
|
||||
if !memory_path.exists() {
|
||||
return None;
|
||||
|
||||
@@ -99,7 +99,7 @@ Do not explain what you're going to do - just do it by calling the tools.
|
||||
|
||||
# Project Memory
|
||||
|
||||
Project memory is automatically loaded at startup alongside README.md and AGENTS.md. It contains an index of features -> code locations, patterns, and entry points. If you need to re-read memory from disk (e.g., after another agent updates it), use `read_file .g3/memory.md`.
|
||||
Project memory is automatically loaded at startup alongside README.md and AGENTS.md. It contains an index of features -> code locations, patterns, and entry points. If you need to re-read memory from disk (e.g., after another agent updates it), use `read_file analysis/memory.md`.
|
||||
|
||||
**IMPORTANT**: After completing a task where you discovered code locations, you **MUST** call the `remember` tool to save them..
|
||||
|
||||
@@ -321,7 +321,7 @@ If you can complete it with 1-2 tool calls, skip TODO.
|
||||
|
||||
# Project Memory
|
||||
|
||||
Project memory (if available) is automatically loaded at startup. It contains feature locations and patterns discovered in previous sessions. If you need to re-read memory from disk (e.g., after another agent updates it), use `read_file .g3/memory.md`.
|
||||
Project memory (if available) is automatically loaded at startup. It contains feature locations and patterns discovered in previous sessions. If you need to re-read memory from disk (e.g., after another agent updates it), use `read_file analysis/memory.md`.
|
||||
|
||||
**ALWAYS** call `remember` at the END of your turn when you discovered:
|
||||
- A feature's location (file + char range + function/struct names)
|
||||
|
||||
@@ -14,12 +14,12 @@ use crate::ToolCall;
|
||||
use super::executor::ToolContext;
|
||||
|
||||
/// Get the path to the memory file.
|
||||
/// Memory is stored at `.g3/memory.md` in the working directory.
|
||||
/// Memory is stored at `analysis/memory.md` in the working directory (version controlled).
|
||||
fn get_memory_path(working_dir: Option<&str>) -> PathBuf {
|
||||
let base = working_dir
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|| std::env::current_dir().unwrap_or_else(|_| PathBuf::from(".")));
|
||||
base.join(".g3").join("memory.md")
|
||||
base.join("analysis").join("memory.md")
|
||||
}
|
||||
|
||||
/// Format the file size in a human-readable way.
|
||||
@@ -45,7 +45,7 @@ pub async fn execute_remember<W: UiWriter>(
|
||||
|
||||
let memory_path = get_memory_path(ctx.working_dir);
|
||||
|
||||
// Ensure .g3 directory exists
|
||||
// Ensure analysis directory exists
|
||||
if let Some(parent) = memory_path.parent() {
|
||||
std::fs::create_dir_all(parent)?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user