You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Existing Files Related to Backlog Items
A. Symlink Handling
Key files:
src/tools/fs.rs — FileTools with workspace containment logic
Lines 27–50: normalize_workspace_path() with Windows verbatim (\?) prefix support
Line 134: Unix-only test rejects_symlink_escape_outside_workspace — creates a symlink to /etc and verifies the agent cannot read/write through it
Lines 518+: file_type.is_symlink() check in list_files/list_tree traversal
Lines 193–221: Windows-only tests verbatim_prefix_workspace_is_supported and absolute_verbatim_path_inside_workspace_resolves
src/tools/transaction.rs — WorkspaceTransaction
Line 275: if path.is_symlink() { continue; } — symlinks are skipped during workspace snapshot
src/agent/agent_loop.rs
Line 1642: if file_type.is_symlink() { continue; } in search_workspace_without_rg()
docs/adr/0008-robustness-and-floating-point-safety.md — Documents path traversal, symlink escape, and injection safety fixes
Windows-specific gap: Only the Unix symlink escape test exists (#[cfg(unix)]). There is no Windows junction/reparse-point symlink test. The Windows FileTools tests focus on verbatim path prefixes instead.
B. Search/Lookup Functionality (Regex-based)
Key files:
src/agent/agent_loop.rs
Lines 1622–1686: search_workspace_without_rg() — fallback regex search when rg is not installed. Uses regex::Regex::new(pattern) with literal fallback, scans files skipping symlinks, .git, target, node_modules, memory_data
Lines 850: "search_code" tool dispatch
Lines 1793–1794: Tool definition: "search_code" — "Search workspace text using a regex or literal pattern."
src/agent/executor.rs
Lines 302–370: search_code(state, pattern) function — prefers rg (ripgrep), falls back to search_workspace_without_rg()
Commands::Serve — launches terminal::server::serve() for browser access
Auto-detects TUI mode when stdin/stdout are terminals
Key Entry Points and Main Modules
Entry Point Location
main() src/main.rs:259
run_agent_loop() src/agent/agent_loop.rs
ui::run_ui() src/ui/mod.rs
terminal::server::serve() src/terminal/server.rs
repl() src/main.rs:384
build_router() src/main.rs:202
Testing Infrastructure
Framework: Rust built-in #[test] (no external test framework like rstest or proptest)
Test count: 298 test functions across the codebase
Dev dependency: wiremock (0.6) — available but not heavily used in the current inline tests
Test distribution by file:
File
src/agent/agent_loop.rs
src/tools/fs.rs
src/tools/shell.rs
src/llm/router.rs
src/memory/short_term.rs
src/config/settings.rs
src/compressor/layer1.rs
src/ui/file_search.rs
src/tools/transaction.rs
src/agent/state.rs
Test patterns:
Most tests use temp directories (std::env::temp_dir()) with cleanup
MCP tests use a clever self-spawning fake server (ANAMNESIC_FAKE_MCP_SERVER=1)
Platform-gated tests: #[cfg(unix)] for symlink tests, #[cfg(windows)] for verbatim path tests
Agent loop tests use a test_state() helper that creates isolated temp workspaces
Symlink escape prevention (Unix tested, Windows not explicitly tested for junctions)
C2 — Symbol / LSP search ✅ Implemented (regex-based, not full LSP)
TODO.md notes: "Melhora futura: símbolos via LSP/tree-sitter (ver C2 no backlog competitivo)" — indicates the regex approach is a stepping stone to full LSP
C8 — Notebook editing / timers / image gen ❌ Deferred
ADR states: "Requires heavy dependencies (tree-sitter, external APIs). Not in scope."
TODO.md: "Notebook editing (Claude/Cursor), timers/cron (Antigravity), image gen (Antigravity). Avaliar público-alvo."
Other C-items (for context):
Item Status
C3 Parallel sub-agents ✅
C4 Skills system ✅
C5 Checksums/change-tracking ✅
C6 Extended thinking ✅
C7 Adversarial verification ✅
C9 Background tasks ✅
Notable Gaps / Observations
Windows symlink testing is absent. The only symlink escape test is #[cfg(unix)]. On Windows, NTFS junctions/reparse points are not tested for escape scenarios.
Search is regex + ripgrep fallback, not LSP. search_code uses rg or a manual directory walk with regex::Regex. C2 was "implemented" as regex symbol extraction, but the TODO explicitly flags LSP/tree-sitter as the future direction.
No integration test harness with mock LLM providers. The dev-dependencies include wiremock but the inline tests use a self-spawning MCP fake server pattern instead. There is no mock Ollama/cloud provider for end-to-end agent loop testing.
Testing is all inline #[test] modules. No separate tests/ directory or integration test binaries (except the self-spawning MCP server trick).
C8 is explicitly deferred — notebook editing, timers, and image generation are out of scope per ADR 0015.
About
Anamnesic Coder — Rust coding agent (plan/act/verify loop with local LLM via Ollama). Canonical coding agent for the Anamnesic platform.