TL;DR
SlotGuard is a local privacy boundary for LLM agents that prevents sensitive data—like file paths and API keys—from leaking into provider-bound transcripts. By replacing private info with "smart," context-aware placeholders and restoring them only during local execution, it achieves 0% credential leakage while maintaining near-original agent performance.
What Problem Does This Paper Address?
LLM agents are increasingly used for autonomous tasks like software development and data analysis. To do this, they interact with local file systems, shells, and APIs. The "observations" from these tools (e.g., a list of files, a shell log, or a database connection string) are appended to the agent's transcript and sent to model providers like OpenAI or Anthropic.
This creates a massive privacy hole. Transcripts often contain absolute paths (revealing usernames or project names), internal hostnames, and even hardcoded credentials printed in debug logs.
Existing solutions usually rely on "naïve redaction"—replacing a path with a generic label like [PATH]. However, this is brittle. If an LLM doesn't know a file ends in .py or where it sits in a directory tree, it can't reason about how to use it. This leads to a "utility-privacy trade-off" where strong redaction breaks the agent's ability to actually do its job.
Methods
SlotGuard acts as a transparent shim between the local agent runtime and the remote LLM. It uses a multi-step approach to preserve "compatibility" while hiding "content":
- Typed, Suffix-Aware Slots: Instead of hiding a path entirely, SlotGuard replaces the sensitive root with a stable handle (e.g.,
[REPO_ROOT_1]) but keeps the file extension and the last few directory components. For example,/Users/alice/project/src/main.pybecomes[REPO_ROOT_1]/src/main.py. - Format-Preserving Synthetic (FPS) Substitution: For secrets like API keys, SlotGuard doesn't just use a label. It generates a "fake" key that matches the expected format (length, character set, prefix). This ensures that shell commands and configuration parsers don't crash due to unexpected syntax.
- Semantic Entity Graph (SEG): To handle cases where a secret or path is referenced across multiple turns or in slightly different forms, SlotGuard maintains a session-scoped graph. This ensures that if the LLM refers back to a previously seen (and redacted) value, the mapping remains consistent.
- Guarded Rebinding: This is the "trusted" part of the loop. When the LLM sends back a command containing a placeholder, SlotGuard swaps it back for the real value locally just before the tool is executed. The raw value never leaves the user's machine.
Datasets
The authors evaluated SlotGuard using three main workloads:
- Structural & Credential Corpora: Synthetic datasets containing over 9,000 paths and 852 "planted" credentials (API keys, tokens, etc.) to test leakage.
- Workflow Probes: A suite of 200 shared tasks designed to test if the agent can still complete complex workflows across four different models (DeepSeek-V3.2, GPT-5.4, Kimi-K2.6, and Llama-3.3-70B).
- TAC-lite: A benchmark derived from The Agent Company, focusing on real-world repository-centric tasks with grounded file handles.
Key Insights and Ideas
- Structure > Raw Data: The core "aha" moment is that LLMs don't need the actual private string to reason; they need the metadata and syntax associated with it. By preserving the "shape" of a path or the "grammar" of a credential, the model stays functional.
- Deterministic Stability: By using HMAC-based handles, SlotGuard ensures that the same private value always maps to the same placeholder within a session, which is critical for the LLM's long-term memory.
- The Latency of Opaque Tokens: Interestingly, the authors found that "proxy-style" placeholders (like
__VG_PATH_123__) can actually make LLMs slower because they are high-entropy tokens that the model finds harder to reason about, leading to more retries. SlotGuard’s path-like rewrites avoid this "model friction."
Key Results
- Privacy: SlotGuard reduced credential leakage to 0.0% across all 852 planted values. In contrast, even advanced baselines leaked about 23.5% of credentials due to "split" or embedded exposures.
- Utility: While generic redaction caused task success to collapse to a measly 2.5%, SlotGuard remained remarkably close to the "raw" (unprotected) baseline. For models like Kimi and Llama, it achieved 100% of the raw success rate.
- Efficiency: The system is incredibly fast. Transcript rewriting takes a median of only 14.4 microseconds per turn, making the overhead negligible compared to the seconds-long latency of the LLM itself.
Limitations and Future Work
- Semantic Inference: SlotGuard protects literal strings, but it cannot prevent an LLM from inferring private information from the surrounding context (e.g., if a log says "Processing payroll for Bob," the model knows Bob is an employee even if his email is redacted).
- Adversarial Reconstruction: The current study focuses on accidental leakage. The authors note that a "capable attacker" might try to reconstruct data from residual context, a threat model that requires further study.
- SEG Complexity: The Semantic Entity Graph is currently keyword-based. Future versions could benefit from more advanced coreference resolution to handle complex, indirect references to private data.
Summary updated