Adds optional path_mappings to agent.yaml so host directories are
transparently mapped to virtual paths in agent responses and CLAUDE.md.
Sanitizer replaces host paths (longest first, both slash styles) before
repoRoot/home substitutions. /new-agent accepts a host:virtual path
option with Windows-safe splitting and fs.existsSync validation.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The root cause was twofold:
1. Raw (unsanitized) agent responses were stored in the conversation
history DB. On subsequent calls, these paths were fed back to the
agent as context, causing it to reproduce full paths regardless of
Discord-side sanitization.
2. repoRoot (workspace_path) was not passed to sanitizeForDiscord,
so workspace-specific paths were only partially masked via the
home directory fallback.
Fix: sanitize the full response once before both sending to Discord
and storing in the DB. Pass workspace_path as repoRoot for precise
path replacement. Add Windows path tests.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add sanitizeForDiscord() in src/runtime/sanitize.ts.
Router applies sanitizer to all channel.send() calls.
Prevents path/token leaks into Discord channels.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>