local-context-sanitization
Skill2 starsChanged 10 days agoMITView on GitHub
Sanitize sensitive repository context, credentials, and PII before forwarding prompts or tool outputs to external models or remote tools. Use when local privacy boundaries or prompt sanitization are requested. Not for preventing emails in committed code (use privacy-first) or revoking/rotating leaked secrets (use secrets-management).
- Reads credentials
In this repository63 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .agents/skills/avoid-ai-writing/AGENTS.mdAGENTS.md
- .agents/skills/do-web-doc-resolver/AGENTS.mdAGENTS.md
- .agents/skills/skill-evaluator/AGENTS.mdAGENTS.md
- scripts/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms-full.txtllms.txt
- llms.txtllms.txt
- accessibility-auditorSkill
- agent-browserSkill
- agentic-abstentionSkill
- agents-mdSkill
- api-design-firstSkill
- architecture-diagramSkill
- avoid-ai-writingSkill
- cicd-pipelineSkill
- cloudflare-worker-apiSkill
- codacySkill
- codeberg-apiSkill
- code-review-assistantSkill
- css-render-performanceSkill
- database-devopsSkill
- debuggerSkill
- delegateSkill
- dependency-upgradesSkill
- dist-channel-selectionSkill
- docs-hookSkill
- document-rendering-and-locatorsSkill
- dogfoodSkill
- dora-reportSkill
- do-web-doc-resolverSkill
- durable-objectsSkill
- eu-ai-act-complianceSkill
- git-github-workflowSkill
- goap-agentSkill
- implementerSkill
- intent-classifierSkill
- iterative-refinementSkill
- jules-delegatorSkill
- learnSkill
- lifecycle-managementSkill
- memory-contextSkill
- migration-refactoringSkill
- nested-build-isolationSkill
- privacy-firstSkill
- progressive-deliverySkill
- pwa-offline-syncSkill
- reader-ui-uxSkill
- readme-best-practicesSkill
- secrets-managementSkill
- secure-invite-and-accessSkill
- security-code-auditorSkill
- shell-script-qualitySkill
- skill-creatorSkill
- skill-evaluatorSkill
- static-analysisSkill
- testing-strategySkill
- test-runnerSkill
- triz-solverSkill
- turso-dbSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 47
Restoration Policy: Do not enable unmasking or restoring sensitive placeholders to the external calling model by default.
- Distinctive: line 69
Before attempting to send text containing sensitive context:
- Very specific: line 70
Check if the local sanitizer CLI or MCP server is installed and responsive (e.g., do-context-shield --version or checking local MCP tool …
- Distinctive: line 74
If the local sanitizer executable or MCP server is unavailable, fails, or throws an error:
- Very specific: line 81
Ensure redacted placeholders in output preserve structural context (e.g.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Local Context Sanitization
Guide the local sanitization of sensitive prompts, repository context, tokens, and PII before forwarding data to external AI models or remote tool endpoints.
When to Use
- User requests sanitization of prompt context before sending to external LLMs or third-party APIs.
- Handling confidential code, proprietary documentation, or local traces containing tokens or PII before sending to external services.
- Configuring or integrating local privacy tools (e.g., Model Context Protocol / MCP filters, local sanitization tools).
Not for:
- Preventing email addresses or PII from being committed into source files (use
privacy-first). - Revoking, rotating, or storing repository API keys and credentials (use
secrets-management). - General security code audits or static vulnerability scanning (use
security-code-auditor).
Explicit Scope & Responsibilities
To avoid overlap across security and privacy domain skills:
| Skill | Primary Scope & Responsibility |
privacy-first | Prevent personal data (e.g. emails) from being committed to git source code or documentation. |
secrets-management | Revoke, rotate, clean, and securely store leaked credentials and API keys in the codebase lifecycle. |
local-context-sanitization | Sanitize sensitive context (PII, internal paths, tokens) locally before sending to external models/tools, safely substituting placeholders. |
Guidance, Not a Runtime Security Control
This skill provides architectural guidance and agent workflow rules. It is not a software binary or active runtime security sandbox.
- Local & Trusted Setup: Any sanitization tool or MCP server (e.g.,
do-context-shield) must be installed, configured, and trusted locally on the host machine by the operator. - Restoration Policy: Do not enable unmasking or restoring sensitive placeholders to the external calling model by default. Placeholders (e.g.
<REDACTED_API_KEY>) should remain anonymized in external inference calls unless specifically configured with local decryption boundaries.
Optional Tooling: do-context-shield
Adopters seeking an executable CLI or MCP server for local context redaction can integrate do-context-shield.
Upstream References
- do-context-shield Repository
- Installation and Release Contract
- Configuration Reference
- Canonical Private Data Skill
- Client Integration Documentation
Upstream Compatibility Note
CLI flags, environment variables, and MCP integration options for do-context-shield are version-specific. Always consult the upstream client integration guide for the exact CLI syntax matching your installed version.
Agent Workflow & Fail-Safe Rules
1. Verify Local Sanitizer Availability
Before attempting to send text containing sensitive context:
- Check if the local sanitizer CLI or MCP server is installed and responsive (e.g.,
do-context-shield --versionor checking local MCP tool availability).
2. Fail-Safe Stopping Rule (CRITICAL)
If the local sanitizer executable or MCP server is unavailable, fails, or throws an error:
- NEVER claim that sanitization was completed.
- NEVER silently fall back to forwarding raw, un-sanitized sensitive text to external models or remote tools.
- STOP IMMEDIATELY and request explicit user confirmation or an approved alternative path before proceeding.
3. Handle Placeholders Safely
- Ensure redacted placeholders in output preserve structural context (e.g. replacing tokens with
<TOKEN_1>) so downstream code synthesis remains functional without exposing actual values.
Rationalizations
| Rationalization | Reality |
| "The sanitizer executable is missing, so I will just send the text directly." | Silent fallbacks expose sensitive context to external endpoints. Fail safely by halting execution. |
| "This skill automatically redacts all PII without any local tools." | Guidance skills cannot intercept network calls without a trusted local executable or MCP server installed. |
| "I should unmask placeholders before sending them to the remote model." | Unmasking sends raw data to the model, defeating the purpose of local sanitization. |
Red Flags
- Falling back to sending raw text when a local sanitization tool is missing or errors
- Claiming text was sanitized when no local sanitizer was executed
- Conflating
privacy-first(commit prevention) with local context filtering - Hardcoding upstream CLI flags without referencing upstream version docs
See Also
privacy-first— Prevent personal data in source code and documentationsecrets-management— Secrets lifecycle, revocation, and storagesecurity-code-auditor— Audit code for security vulnerabilities
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

