From 42a747e74547f43c3aac409a355e744d3ed0694a Mon Sep 17 00:00:00 2001 From: "Dhanji R. Prasanna" Date: Mon, 12 Jan 2026 05:14:25 +0530 Subject: [PATCH] Move UTF-8 safety pattern from AGENTS.md to project memory The UTF-8 string slicing pattern is better suited as a remembered pattern in project memory rather than a static AGENTS.md section. This keeps AGENTS.md focused on codebase-specific invariants while the pattern remains accessible for reference. Agent: g3 --- AGENTS.md | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index ee2566d..0a5ce05 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -71,18 +71,6 @@ - Different configs for interactive vs autonomous mode - **Risk**: Aggressive retries can hit rate limits harder -### UTF-8 String Slicing (Throughout Codebase) - -- Rust string slices (`&s[..n]`) use **byte indices**, not character indices -- Multi-byte UTF-8 characters (emoji, bullets `•`, `×`, `⚡`) cause panics if sliced mid-character -- **Risk**: Runtime panic on any string containing non-ASCII characters -- **Fix**: Use `char_indices()` to find byte boundaries: - ```rust - let byte_idx = s.char_indices().nth(char_limit).map(|(i, _)| i).unwrap_or(s.len()); - let truncated = &s[..byte_idx]; - ``` -- **Danger zones**: Display truncation, ACD stubs, user input handling - ## Do's and Don'ts for Automated Changes ### Do @@ -111,7 +99,6 @@ 3. **"Tool results are always small"** - File reads can return megabytes 4. **"Sessions persist across runs"** - Sessions are ephemeral by default 5. **"All platforms are equal"** - macOS has more features (Vision, Accessibility) -6. **"String length equals character count"** - `s.len()` returns bytes; use `s.chars().count()` for characters ## Dependency Analysis Artifacts