TL;DR
LLM agents frequently leak sensitive data like file paths and API keys because their raw tool outputs are appended directly to provider-bound transcripts. SlotGuard introduces a local, compatibility-preserving privacy boundary that replaces sensitive data with typed, format-preserving placeholders before it leaves your machine, maintaining privacy without sacrificing the agent's ability to reason and execute tasks.
What Problem Does This Paper Address?
When you deploy an LLM agent to automate tasks (e.g., writing code or analyzing data), the agent interacts with local tools like shells, compilers, and file systems. The outputs of these tools—which often contain absolute file paths, emails, or environment variables containing credentials—are automatically appended to the chat transcript and sent back to upstream LLM providers (like OpenAI or DeepSeek).
Traditional redaction techniques are brittle. If you naively replace a path with a generic token like [PATH], you strip away vital syntactic cues—such as directory structures and file extensions—that the LLM needs to generate valid subsequent tool calls. This creates a harsh trade-off: choose strong privacy and break your agent's workflow, or keep the agent functional but leak your data.
Methods
SlotGuard acts as a local proxy sitting between the agent runtime and the upstream LLM provider. It protects data using a multi-step pipeline:
- Two-Tier Detection: A fast, synchronous heuristic tier identifies common patterns (workspace roots, emails, credentials). An optional, asynchronous tier uses a small local model to catch trickier semantic cases like sensitive filenames.
- Compatibility-Preserving Rewriting:
- Structural Bindings: Instead of erasing paths, SlotGuard uses suffix-aware abstraction. It hides sensitive parent directories but preserves the file extension and immediate task-relevant suffixes (e.g.,
/Users/alice/project/data.csvbecomes[REPO_ROOT_1]/project/data.csv). - Secret Values: Instead of using a label like
[API_KEY], it uses Format-Preserving Synthetic Substitution (FPS). It generates a fake, synthetic token that perfectly matches the expected grammar and length of the original credential. - Semantic Entity Graph (SEG): A session-scoped graph tracks how protected values propagate across turns, ensuring that even if a secret is split or derived later in a shell log, it remains protected.
- Guarded Rebinding: When the upstream LLM returns a tool call using the placeholders, SlotGuard safely maps them back to the real local values only within the trusted local runtime, while strictly rejecting any malicious traversal or injection attempts.
Datasets
The authors evaluated SlotGuard across several distinct workloads:
- Structural Privacy Corpus: A synthetic dataset consisting of 30 randomized repository-like sessions containing 9,229 paths.
- Credential Privacy Corpus: 200 sessions embedded with 852 planted credentials across direct, embedded, split, and cross-turn contexts.
- Workflow Probes: A 12-task local probe and a larger 200-task multi-model probe evaluating task performance.
- TAC-lite: A lightweight replay benchmark derived from TheAgentCompany, featuring 33 task families and 160 replay tasks to test real-world agent behavior without complex containerized stacks.
Key Insights and Ideas
- Structure is a Reasoning Cue: LLMs don't just read text; they rely heavily on the syntax of paths, URIs, and credentials to plan tool calls. Preserving the "shape" of data is the secret to maintaining agent performance.
- Opaque Placeholders Slow Down Models: Interestingly, replacing text with generic tokens like
__VG_API_KEY__introduces high-entropy friction. The authors found that models take longer to reason over these opaque blocks, leading to more retries and higher end-to-end latency. Format-preserving fakes keep inference smooth. - Leaks Happen in the Background: Sensitive data rarely leaks from user prompts; it leaks from background tool execution (e.g., a
pscommand printing full process listings that happen to expose environment fallbacks).
Key Results
- Zero Leakage: SlotGuard successfully removed all 20,814 annotated sensitive structural characters and reduced credential leakage to 0.0% across the evaluation sets.
- Performance Preservation: While generic redaction caused agent task success to collapse to a dismal 2.5%, SlotGuard allowed models to perform near their raw, unprotected baselines. For instance, on the 200-task workflow probe, GPT-4/5.4 retained 98.0% success (compared to 100% raw), and Llama-3.3-70B matched its raw baseline perfectly at 93.5%.
- Microsecond Overhead: The core deterministic rewriting path is incredibly fast, taking a median of just 14.424 µs per agent turn, making it completely unnoticeable on the hot path.
Limitations and Future Work
- Production Validation: The current evaluation relies primarily on synthetic and replay-style workloads with planted ground truths. Testing SlotGuard against naturally occurring enterprise data traces remains an open next step.
- Adversarial Reconstruction: The paper does not deeply explore whether a highly capable, adversarial LLM provider could reconstruct hidden secrets based purely on the surrounding residual context.
- Early-Stage Entity Graph: The Semantic Entity Graph currently relies on keyword and pattern-based links. Upgrading it with richer coreference resolution would make it more robust against complex, indirect data references.
Summary updated