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)
-`crates/g3-core/src/retry.rs` [0..12000] - `execute_with_retry()`, `retry_operation()`, `RetryConfig`, `RetryResult` - used by g3-planner but not g3-cli
-`crates/g3-core/src/compaction.rs` [195..240] - ACD integration in `perform_compaction()`, creates fragment and stub when `acd_enabled`
-`crates/g3-core/src/context_window.rs` [10100..10700] - `reset_with_summary_and_stub()` adds stub before summary
-`crates/g3-cli/src/lib.rs` [157..161] - `--acd` CLI flag
-`crates/g3-cli/src/lib.rs` [1476..1525] - `/fragments` and `/rehydrate` commands
### ACD Fragment Storage Format
```json
{
"fragment_id":"abc123",
"created_at":"2026-01-11T...",
"messages":[...],
"message_count":47,
"user_message_count":23,
"assistant_message_count":24,
"tool_call_summary":{"read_file":4,"shell":5},
"estimated_tokens":18500,
"topics":["implemented auth","fixed bug"],
"preceding_fragment_id":"xyz789"
}
```
### UTF-8 Safe String Slicing Pattern
**Problem**: Rust string slices (`&s[..n]`) use byte indices, not character indices. Multi-byte UTF-8 characters (emoji, bullets `•`, `×`, `⚡`) cause panics if sliced mid-character.
**Solution**: Use `char_indices()` to find byte boundaries:
```rust
// Get byte index of the Nth character
letbyte_idx=s.char_indices()
.nth(char_limit)
.map(|(i,_)|i)
.unwrap_or(s.len());
lettruncated=&s[..byte_idx];
// For length checks, use chars().count() not len()
ifs.chars().count()<=max_len{...}
```
**Danger zones**: Display truncation, ACD stubs, user input handling, any string with non-ASCII characters.
### CLI Module Structure (Post-Refactor)
-`crates/g3-cli/src/lib.rs` [0..415] - Entry point, `run()`, mode dispatch, config loading
@@ -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)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.