Rename Project Memory to Workspace Memory
Rename all references from "Project Memory" to "Workspace Memory" to avoid future conflation if a "project" concept is introduced later. Changes: - Rename read_project_memory() -> read_workspace_memory() - Update all prompts, tool descriptions, and comments - Update header parsing in memory.rs to use "# Workspace Memory" - Update display detection for "=== Workspace Memory ===" - Update documentation and analysis/memory.md 11 files changed, ~36 occurrences updated.
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
# Project Memory
|
||||
# Workspace Memory
|
||||
> Updated: 2026-01-20T10:16:13Z | Size: 18.3k chars
|
||||
|
||||
### Remember Tool Wiring
|
||||
- `crates/g3-core/src/tools/memory.rs` [0..5000] - `execute_remember()`, `get_memory_path()`, `merge_memory()`
|
||||
- `crates/g3-core/src/tool_definitions.rs` [11000..12000] - remember tool definition in `create_core_tools()`
|
||||
- `crates/g3-core/src/tool_dispatch.rs` [48] - dispatch case for "remember"
|
||||
- `crates/g3-core/src/prompts.rs` [4200..6500] - Project Memory section in native prompt
|
||||
- `crates/g3-cli/src/lib.rs` [1472..1495] - `read_project_memory()` loads memory at startup
|
||||
- `crates/g3-core/src/prompts.rs` [4200..6500] - Workspace Memory section in native prompt
|
||||
- `crates/g3-cli/src/lib.rs` [1472..1495] - `read_workspace_memory()` loads memory at startup
|
||||
|
||||
### Context Window & Compaction
|
||||
- `crates/g3-core/src/context_window.rs` [0..815] - `ContextWindow`, `reset_with_summary()`, `should_compact()`, `thin_context()`
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
### CLI Module Extractions
|
||||
- `crates/g3-cli/src/metrics.rs` [0..5416] - `TurnMetrics`, `format_elapsed_time()`, `generate_turn_histogram()`
|
||||
- `crates/g3-cli/src/project_files.rs` [0..5577] - `read_agents_config()`, `read_project_readme()`, `read_project_memory()`, `extract_readme_heading()`
|
||||
- `crates/g3-cli/src/project_files.rs` [0..5577] - `read_agents_config()`, `read_project_readme()`, `read_workspace_memory()`, `extract_readme_heading()`
|
||||
- `crates/g3-cli/src/coach_feedback.rs` [0..4025] - `extract_from_logs()` for coach-player loop feedback extraction
|
||||
|
||||
### Context Compaction
|
||||
@@ -170,10 +170,10 @@ if s.chars().count() <= max_len { ... }
|
||||
```
|
||||
|
||||
|
||||
### Project Memory Location
|
||||
### Workspace Memory Location
|
||||
- Memory is now stored at `analysis/memory.md` (version controlled, shared across worktrees)
|
||||
- `crates/g3-core/src/tools/memory.rs` - `get_memory_path()` returns `analysis/memory.md`
|
||||
- `crates/g3-cli/src/project_files.rs` - `read_project_memory()` reads from `analysis/memory.md`
|
||||
- `crates/g3-cli/src/project_files.rs` - `read_workspace_memory()` reads from `analysis/memory.md`
|
||||
|
||||
### Compact Tool Output
|
||||
- `crates/g3-cli/src/ui_writer_impl.rs` - `print_tool_compact()` handles compact display for file ops and other tools
|
||||
|
||||
@@ -7,7 +7,7 @@ use tracing::debug;
|
||||
use g3_core::ui_writer::UiWriter;
|
||||
use g3_core::Agent;
|
||||
|
||||
use crate::project_files::{combine_project_content, read_agents_config, read_include_prompt, read_project_memory, read_project_readme};
|
||||
use crate::project_files::{combine_project_content, read_agents_config, read_include_prompt, read_workspace_memory, read_project_readme};
|
||||
use crate::display::{LoadedContent, print_loaded_status, print_workspace_path};
|
||||
use crate::language_prompts::{get_language_prompts_for_workspace, get_agent_language_prompts_for_workspace_with_langs};
|
||||
use crate::simple_output::SimpleOutput;
|
||||
@@ -130,7 +130,7 @@ pub async fn run_agent_mode(
|
||||
// Load AGENTS.md, README, and memory - same as normal mode
|
||||
let agents_content_opt = read_agents_config(&workspace_dir);
|
||||
let readme_content_opt = read_project_readme(&workspace_dir);
|
||||
let memory_content_opt = read_project_memory(&workspace_dir);
|
||||
let memory_content_opt = read_workspace_memory(&workspace_dir);
|
||||
|
||||
// Read include prompt early so we can show it in the status line
|
||||
let include_prompt = read_include_prompt(include_prompt_path.as_deref());
|
||||
@@ -194,7 +194,7 @@ pub async fn run_agent_mode(
|
||||
agent.set_agent_mode(agent_name);
|
||||
|
||||
// Auto-memory is enabled by default in agent mode (unless --no-auto-memory is set)
|
||||
// This prompts the LLM to save discoveries to project memory after each turn
|
||||
// This prompts the LLM to save discoveries to workspace memory after each turn
|
||||
agent.set_auto_memory(!no_auto_memory);
|
||||
|
||||
// Enable ACD (Aggressive Context Dehydration) if requested
|
||||
|
||||
@@ -54,7 +54,7 @@ impl LoadedContent {
|
||||
Self {
|
||||
has_readme: content.contains("Project README"),
|
||||
has_agents: content.contains("Agent Configuration"),
|
||||
has_memory: content.contains("=== Project Memory"),
|
||||
has_memory: content.contains("=== Workspace Memory"),
|
||||
include_prompt_filename: if content.contains("Included Prompt") {
|
||||
Some("prompt".to_string()) // Default name when we can't determine the actual filename
|
||||
} else {
|
||||
@@ -155,7 +155,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_loaded_content_from_combined() {
|
||||
let content = "Project README\nAgent Configuration\n=== Project Memory";
|
||||
let content = "Project README\nAgent Configuration\n=== Workspace Memory";
|
||||
let loaded = LoadedContent::from_combined_content(content);
|
||||
assert!(loaded.has_readme);
|
||||
assert!(loaded.has_agents);
|
||||
|
||||
@@ -38,7 +38,7 @@ use accumulative::run_accumulative_mode;
|
||||
use agent_mode::run_agent_mode;
|
||||
use autonomous::run_autonomous;
|
||||
use interactive::run_interactive;
|
||||
use project_files::{combine_project_content, read_agents_config, read_include_prompt, read_project_memory, read_project_readme};
|
||||
use project_files::{combine_project_content, read_agents_config, read_include_prompt, read_workspace_memory, read_project_readme};
|
||||
use simple_output::SimpleOutput;
|
||||
use ui_writer_impl::ConsoleUiWriter;
|
||||
use utils::{initialize_logging, load_config_with_cli_overrides, setup_workspace_directory};
|
||||
@@ -108,7 +108,7 @@ pub async fn run() -> Result<()> {
|
||||
// Load project context files
|
||||
let agents_content = read_agents_config(&workspace_dir);
|
||||
let readme_content = read_project_readme(&workspace_dir);
|
||||
let memory_content = read_project_memory(&workspace_dir);
|
||||
let memory_content = read_workspace_memory(&workspace_dir);
|
||||
let language_content = language_prompts::get_language_prompts_for_workspace(&workspace_dir);
|
||||
let include_prompt = read_include_prompt(cli.include_prompt.as_deref());
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Project file reading utilities.
|
||||
//!
|
||||
//! Reads AGENTS.md, README.md, and project memory files from the workspace.
|
||||
//! Reads AGENTS.md, README.md, and workspace memory files from the workspace.
|
||||
|
||||
use std::path::Path;
|
||||
use tracing::error;
|
||||
@@ -66,9 +66,9 @@ pub fn read_project_readme(workspace_dir: &Path) -> Option<String> {
|
||||
None
|
||||
}
|
||||
|
||||
/// Read project memory from analysis/memory.md in the workspace directory.
|
||||
/// Read workspace 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> {
|
||||
pub fn read_workspace_memory(workspace_dir: &Path) -> Option<String> {
|
||||
let memory_path = workspace_dir.join("analysis").join("memory.md");
|
||||
|
||||
if !memory_path.exists() {
|
||||
@@ -79,7 +79,7 @@ pub fn read_project_memory(workspace_dir: &Path) -> Option<String> {
|
||||
Ok(content) => {
|
||||
let size = format_size(content.len());
|
||||
Some(format!(
|
||||
"=== Project Memory (read from analysis/memory.md, {}) ===\n{}\n=== End Project Memory ===",
|
||||
"=== Workspace Memory (read from analysis/memory.md, {}) ===\n{}\n=== End Workspace Memory ===",
|
||||
size,
|
||||
content
|
||||
))
|
||||
|
||||
@@ -97,9 +97,9 @@ IMPORTANT: If the user asks you to just respond with text (like \"just say hello
|
||||
|
||||
Do not explain what you're going to do - just do it by calling the tools.
|
||||
|
||||
# Project Memory
|
||||
# Workspace 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 analysis/memory.md`.
|
||||
Workspace 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..
|
||||
|
||||
@@ -133,7 +133,7 @@ When to use this pattern and why.
|
||||
|
||||
This applies whenever you use search tools like `code_search`, `rg`, `grep`, `find`, or `read_file` to locate code.
|
||||
|
||||
Do NOT save duplicates - check the Project Memory section (loaded at startup) to see what's already known.
|
||||
Do NOT save duplicates - check the Workspace Memory section (loaded at startup) to see what's already known.
|
||||
|
||||
## Example
|
||||
|
||||
@@ -228,7 +228,7 @@ Short description for providers without native calling specs:
|
||||
- Example: {\"tool\": \"research\", \"args\": {\"query\": \"Best Rust HTTP client libraries for async/await\"}}
|
||||
- Use for researching APIs, SDKs, libraries, approaches, bugs, or any topic requiring web research
|
||||
|
||||
- **remember**: Save discovered code locations to project memory
|
||||
- **remember**: Save discovered code locations to workspace memory
|
||||
- Format: {\"tool\": \"remember\", \"args\": {\"notes\": \"markdown notes\"}}
|
||||
- Example: {\"tool\": \"remember\", \"args\": {\"notes\": \"### Feature Name\\n- `file.rs` [0..100] - `function_name()`\"}}
|
||||
- Use at the END of your turn after discovering code locations via search tools
|
||||
@@ -332,9 +332,9 @@ Skip TODO tools for simple single-step tasks:
|
||||
|
||||
If you can complete it with 1-2 tool calls, skip TODO.
|
||||
|
||||
# Project Memory
|
||||
# Workspace 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 analysis/memory.md`.
|
||||
Workspace 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)
|
||||
@@ -343,7 +343,7 @@ Project memory (if available) is automatically loaded at startup. It contains fe
|
||||
|
||||
This applies whenever you use search tools like `code_search`, `rg`, `grep`, `find`, or `read_file` to locate code.
|
||||
|
||||
Do NOT save duplicates - check the Project Memory section (loaded at startup) to see what's already known.
|
||||
Do NOT save duplicates - check the Workspace Memory section (loaded at startup) to see what's already known.
|
||||
|
||||
# Response Guidelines
|
||||
|
||||
|
||||
@@ -272,10 +272,10 @@ fn create_core_tools(exclude_research: bool) -> Vec<Tool> {
|
||||
});
|
||||
}
|
||||
|
||||
// Project memory tool (memory is auto-loaded at startup, only remember is needed)
|
||||
// Workspace memory tool (memory is auto-loaded at startup, only remember is needed)
|
||||
tools.push(Tool {
|
||||
name: "remember".to_string(),
|
||||
description: "Update the project memory with new discoveries. Call this at the END of your turn (before your summary) if you discovered something worth noting. Provide your notes in markdown format - they will be merged with existing memory.".to_string(),
|
||||
description: "Update the workspace memory with new discoveries. Call this at the END of your turn (before your summary) if you discovered something worth noting. Provide your notes in markdown format - they will be merged with existing memory.".to_string(),
|
||||
input_schema: json!({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -44,7 +44,7 @@ pub async fn dispatch_tool<W: UiWriter>(
|
||||
// Research tool
|
||||
"research" => research::execute_research(tool_call, ctx).await,
|
||||
|
||||
// Project memory tools
|
||||
// Workspace memory tools
|
||||
"remember" => memory::execute_remember(tool_call, ctx).await,
|
||||
|
||||
// ACD (Aggressive Context Dehydration) tools
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! Project memory tool: remember.
|
||||
//! Workspace memory tool: remember.
|
||||
//!
|
||||
//! These tools provide a persistent "working memory" for the project,
|
||||
//! storing feature locations, patterns, and entry points discovered
|
||||
@@ -91,12 +91,12 @@ fn merge_memory(existing: &str, new_notes: &str) -> String {
|
||||
format!("{}\n\n{}", existing_body.trim(), new_trimmed)
|
||||
}
|
||||
|
||||
/// Remove the header line (# Project Memory and > Updated: ...) from content.
|
||||
/// Remove the header line (# Workspace Memory and > Updated: ...) from content.
|
||||
fn remove_header(content: &str) -> String {
|
||||
let mut lines: Vec<&str> = content.lines().collect();
|
||||
|
||||
// Remove "# Project Memory" if first line
|
||||
if !lines.is_empty() && lines[0].starts_with("# Project Memory") {
|
||||
// Remove "# Workspace Memory" if first line
|
||||
if !lines.is_empty() && lines[0].starts_with("# Workspace Memory") {
|
||||
lines.remove(0);
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ fn remove_header(content: &str) -> String {
|
||||
fn update_header(content: &str, timestamp: &str, size: &str) -> String {
|
||||
let body = remove_header(content);
|
||||
format!(
|
||||
"# Project Memory\n> Updated: {} | Size: {}\n\n{}",
|
||||
"# Workspace Memory\n> Updated: {} | Size: {}\n\n{}",
|
||||
timestamp,
|
||||
size,
|
||||
body.trim()
|
||||
@@ -145,20 +145,20 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_merge_memory_append() {
|
||||
let existing = "# Project Memory\n> Updated: 2025-01-10 | Size: 1k\n\n### Feature A\n- `a.rs` [0..50]";
|
||||
let existing = "# Workspace Memory\n> Updated: 2025-01-10 | Size: 1k\n\n### Feature A\n- `a.rs` [0..50]";
|
||||
let new_notes = "### Feature B\n- `b.rs` [0..100]";
|
||||
let result = merge_memory(existing, new_notes);
|
||||
|
||||
assert!(result.contains("### Feature A"));
|
||||
assert!(result.contains("### Feature B"));
|
||||
assert!(!result.contains("# Project Memory")); // Header removed for re-adding
|
||||
assert!(!result.contains("# Workspace Memory")); // Header removed for re-adding
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_remove_header() {
|
||||
let content = "# Project Memory\n> Updated: 2025-01-10 | Size: 1k\n\n### Feature\n- details";
|
||||
let content = "# Workspace Memory\n> Updated: 2025-01-10 | Size: 1k\n\n### Feature\n- details";
|
||||
let result = remove_header(content);
|
||||
assert!(!result.contains("# Project Memory"));
|
||||
assert!(!result.contains("# Workspace Memory"));
|
||||
assert!(!result.contains("> Updated:"));
|
||||
assert!(result.contains("### Feature"));
|
||||
}
|
||||
@@ -168,7 +168,7 @@ mod tests {
|
||||
let content = "### Feature\n- details";
|
||||
let result = update_header(content, "2025-01-10T12:00:00Z", "500 chars");
|
||||
|
||||
assert!(result.starts_with("# Project Memory"));
|
||||
assert!(result.starts_with("# Workspace Memory"));
|
||||
assert!(result.contains("> Updated: 2025-01-10T12:00:00Z | Size: 500 chars"));
|
||||
assert!(result.contains("### Feature"));
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
//! - `webdriver` - Browser automation via WebDriver
|
||||
//! - `misc` - Other tools (screenshots, code search, etc.)
|
||||
//! - `research` - Web research via scout agent
|
||||
//! - `memory` - Project memory (read_memory, remember)
|
||||
//! - `memory` - Workspace memory (remember)
|
||||
//! - `acd` - Aggressive Context Dehydration (rehydrate)
|
||||
|
||||
pub mod executor;
|
||||
|
||||
@@ -292,7 +292,7 @@ Perform web-based research on a topic.
|
||||
|
||||
### remember
|
||||
|
||||
Save discoveries to project memory.
|
||||
Save discoveries to workspace memory.
|
||||
|
||||
**Parameters**:
|
||||
- `notes` (string, required): Markdown-formatted notes to add to memory
|
||||
|
||||
Reference in New Issue
Block a user