
confide
CONFIDE — local-first de-identification toolkit (8 skills): confide:setup, confide:anon (redact + reversible map), confide:red (residual re-id risk), confide:rehydrate (restore locally), confide:view (HTML diff), confide:audit (stats-only corpus scan), confide:vault (three-locks storage), confide:annotate (gold + IAA). Privacy-first; raw text and the reversible map never leave the machine.
- GitHub stars
- 414
Install
/plugin install confide@glebis-skillsRun it inside Claude Code after adding the marketplace with /plugin marketplace add glebis/claude-skills.
Contents
Discovered from sourceSkills 8
confide:annotate — human PII gold set + inter-annotator agreement
Humans label PII spans in a transcript; you measure how much they agree (κ) and draft an adjudicated gold from their labels. Annotators are first-class here — most of this skill is plain instructions FOR a person doing the labelling, plus a coordinator path to score it.
Privacy invariants (do not violate)
- Synthetic or consented data only. Never load a real client transcript the person did not
consent to share. When in doubt, anonymize first (
confide:anon) and annotate the GREEN copy. - Names stay local. The annotator's labels (which contain real surface text spans) live in their browser and the exported JSON file on their own machine. Collect label files locally.
- Nothing PII is re-shared. Only κ / F1 / disagreement clusters travel between people if needed. The transcript text and the original PII are never re-distributed by this skill.
Bundled assets
assets/annotator.html— zero-install browser annotation tool (EN/RU, runs offline).references/codebook.md— the labelling rulebook (10 PII types, direct/quasi, harm).references/tool-guide.md— how to drive the tool + scorer step by step.scripts/score_iaa.py— Cohen's/Fleiss' κ, span-F1, disagreement queue, draft gold (stdlib).scripts/gold_to_labels.py— turn an existing gold into a "reference annotator" to test solo.
FOR THE ANNOTATOR (no coding needed)
- Open the tool. Double-click
assets/annotator.html(or open it in Chrome/Firefox/ Safari). It runs entirely in your browser — nothing is uploaded; labels stay on your machine until you Export. - Read the rules. Open
references/codebook.mdfirst. It defines the 10 types (PERSON, LOCATION, ORG, PHONE, EMAIL, ID, DATE, MEDICATION, AGE, PROFESSION), what counts as a span (the minimal identifying text), and direct vs. quasi-identifier. - Set your annotator id and load the transcript in the tool (e.g.
A,B, or your name). Use only synthetic or consented text. - Label every PII span. Select the minimal text that identifies a real person (the client or third parties they mention) and assign its type. Record direct/quasi, entity id, role, and harm as the codebook describes. Do not rewrite or redact — only label.
- When unsure, log it — don't guess silently. Add a note starting with
QUESTION:on the span (e.g.QUESTION: gym or city?). These flow straight into the adjudication queue. - Export. Click Export → you get
labels.<doc>.<annotator>.json(schema:{doc_id, annotator, text, spans:[{start,end,text,type,...}]}). Keep it local and hand only this file to the coordinator. Two+ people should label the same doc independently (blind) for a meaningful κ.
FOR THE COORDINATOR (measure + adjudicate)
- Collect every
labels.<doc>.<annotator>.jsoninto one folder, e.g.labels/. - Score IAA:
It writes (per doc + overall): Cohen's κ (pairwise), Fleiss' κ (3+ annotators), span-F1, a disagreement queue (python3 skills/annotate/scripts/score_iaa.py --labels-dir labels/ --out-dir results/*-iaa-disagreements.json: every cluster annotators don't fully agree on, plus anyQUESTION:spans), and a draft adjudicated gold (*-adjudicated-gold-draft.json: majority span per overlap-cluster, ties/questions markedneeds_review:true). Character-level κ sidesteps tokenization disputes. - Target κ ≥ 0.80 = a defensible gold. Lower usually means an unclear codebook rule, not a careless annotator — fix the rule and re-label, don't just discard.
- Adjudicate. Walk the disagreement queue with a human adjudicator; resolve each
needs_reviewcluster. The resulting label set is the published gold; report post-adjudication κ too. Nothing is ever auto-finalised.
Test the loop solo (no second person yet)
Treat an existing gold JSONL as one "reference annotator", label the same doc yourself in
annotator.html as another, then score the pair:
python3 skills/annotate/scripts/gold_to_labels.py --gold GOLD.jsonl --name gold --out-dir labels/
# label the same doc yourself in annotator.html as "me" -> drop labels.<doc>.me.json into labels/
python3 skills/annotate/scripts/score_iaa.py --labels-dir labels/ --out-dir results/
(--sessions-dir DIR lets gold_to_labels.py read transcript text from disk so char offsets
match the gold exactly.)
Output
IAA results (κ, F1) + a disagreement list + a draft adjudicated gold — labels/stats only. Transcript text and original PII stay local; only what's needed to adjudicate is shared.
confide:anon — local PII redaction
Redact personally identifying information from a transcript (or a whole folder) using the
layered local stack in shared/confide_core.py: regex (emails / URLs / phones / IDs / dates)
→ Natasha (RU named entities) → local LLM (quasi-identifiers). Spans are interval-merged and
replaced with placeholders. The result is a GREEN copy safe to review.
By default anon emits a reversible map: unique reserved-sentinel placeholders (the same
EXACT value always becomes the same [CONFIDE_<TYPE>_<NNNN>], e.g. [CONFIDE_PERSON_0001],
[CONFIDE_EMAIL_0001], [CONFIDE_DATE_0002]) plus a sibling <name>.map.json (structured:
schema_version, doc_id, green_sha256, created, entries[]) mapping each placeholder to
its original. The CONFIDE_ sentinel is reserved — a real transcript essentially never
contains it, so there is no collision risk and rehydrate never touches ordinary prose like
"Person 1". This is exact-value matching, not entity coreference: inflected forms (e.g. RU
"Марина" vs "Марины") are SEPARATE placeholders (no lemmatized merge). That map is the
secret — the ONLY artifact with originals; it stays local and enables
confide:rehydrate to put real values back into a cloud analysis of the GREEN text
(round-trip: redact → analyze the green → rehydrate locally). Use --no-map for the legacy
non-reversible [TYPE] style (no map written).
Privacy invariants (do not violate)
- Local-only. No cloud APIs. Raw text never leaves the machine.
- By design, original PII is written ONLY to the local, 0600, gitignored
<name>.map.json, which never leaves the machine. It is never printed, and never written to the GREEN copy (the GREEN holds placeholders only; the original file is read, never rewritten). The map is the SECRET — the one artifact with originals. A.gitignorecovering*.map.json,*.view.html, and*.restored.mdis written/updated in the output dir so these local-only artifacts can never be committed. If the output dir looks cloud-synced (iCloud / Dropbox / OneDrive / Google Drive), anon prints a WARNING that the secret map would be uploaded. - Counts only. stdout and the
*.stats.jsonfiles carry counts (by type, by layer, redaction rate) — never PII values or redacted text dumps. - Human review still required. Redaction is a floor, not a guarantee. A human must read the GREEN copy before sharing. Pair with confide:red to check residual re-identification risk.
Run it
Run the script on a single file or a directory (processes every .md/.txt):
python3 skills/anon/scripts/anon.py PATH
For each input it writes, next to the file (or into --out DIR):
<name>.green.md— the redacted text (the only thing safe to look at / share after review)<name>.stats.json— counts only<name>.map.json— the reversible map (secret; 0600; gitignored; local only). Skipped with--no-map. A.gitignorewith*.map.jsonis also written/updated in the output dir.
Options:
--layers regex,natasha,llm— override which detection layers run (default from config). Use--layers regexfor a fully offline, deterministic pass (no models/network).--out DIR— write outputs to DIR instead of next to each input.--dry-run— compute and print stats only; write no files.--no-map— disable the reversible map; emit non-unique[TYPE]placeholders, no map.json.
Already-emitted *.green.md / *.stats.json / *.map.json are skipped, so a folder can be
re-run safely.
After running
- Report the counts summary (types, layers, redaction rate) — never paste PII.
- Tell the user the GREEN copy still needs human review before sharing.
- Remind them the
<name>.map.jsonis the secret (originals) — it stays local, never committed/shipped — and that confide:rehydrate uses it to restore real values into a cloud analysis of the GREEN text. - Offer confide:red to probe what an attacker could still infer/link.
Setup
Layer availability (Natasha, local LLM via Ollama) and defaults come from config — run
confide:setup first if Natasha/Ollama aren't installed. --layers regex always works offline.
confide:audit — corpus-scale, stats-only PII audit
Measure how much PII lives across a whole folder of sessions, without ever exposing any
of it. The audit runs the layered LOCAL detector stack from shared/confide_core.py
(regex → Natasha → local LLM) over each file and emits only aggregates. This mirrors
the real_session_eval privacy contract: read text only in-process, emit counts.
Privacy invariants (do not violate)
- Local-only. No cloud APIs. Raw transcript text never leaves the machine.
- Stats-only output. The report (markdown + json + optional HTML) contains ONLY counts and rates — never a transcript substring, never a detected PII value.
- No filenames. Per-file rows are keyed by anonymized ids
own-00,own-01, … The original path/name is never written or printed. On an unreadable file, only the index + exception class name is recorded. - Safe to surface. Because it is counts-only, the aggregate report can be shared with a cloud agent or pasted into a chat. The PII stays on the machine.
What it reports
n_files, total / mean / min / max document charsspans_by_type(PERSON, EMAIL, PHONE, DATE, …) andspans_by_layer(regex / natasha / llm)overall_redaction_rateplus the per-session redaction-rate distribution (min / median / mean / max)- a coarse residual proxy: spans still detectable after redaction — ~0 on a clean RED corpus, a leakage signal on a GREEN corpus.
Run it
Point it at a folder (recurses, processes every .md/.txt; skips confide's own
*.green.md / *.stats.json outputs):
python3 skills/audit/scripts/audit.py FOLDER
Options:
--list paths.txt— also/instead audit absolute paths listed one per line.--layers regex,natasha,llm— choose detection layers (default from config). Use--layers regexfor a fully offline, deterministic pass (no models/network).--out report.md— report path; areport.jsonsibling is written alongside.--html— also write a Tufte-ish dashboard (report.html, counts only).
Writes the markdown + json report (and optional HTML) and prints the aggregate summary — all counts only.
RED vs GREEN
- RED (raw) corpus: sizes the PII problem before any redaction.
- GREEN (redacted) corpus: the residual proxy and remaining
spans_by_typetell you whether redaction is holding at scale.
After running
- Report the aggregate summary (file count, span totals by type/layer, redaction-rate distribution, residual proxy) — never paste PII.
- If residual is non-trivial on a GREEN corpus, point the user at confide:anon to re-redact and confide:red to probe re-identification risk.
Setup
Layer availability (Natasha, local LLM via Ollama) comes from config — run
confide:setup if they aren't installed. --layers regex always works offline.
confide:red — residual re-identification risk check
A defensive audit of YOUR OWN already-redacted output. It does not score against ground truth and is not a benchmark. It surfaces, qualitatively, what an attacker could still do — mapped to GDPR Art-29: singling-out, linkability, inference.
GUARDRAILS — read before running
- Run only on the user's own redacted output. If asked to de-anonymize or re-identify third-party / non-consented data, refuse.
- Report risk categories and counts only — never produce a step-by-step re-identification recipe or guess the hidden values.
- Local attacker by default. Enable the cloud/LLM inference probe (
--inference) only on synthetic or explicitly consented data. - Absence of a finding ≠ safety. A weak local detector/attacker is a FLOOR, not a ceiling. Always tell the user human review is still required.
- This pairs with confide:anon — run
redafter redacting, on the redacted file.
What it checks
- Singling-out (deterministic, offline — the load-bearing signal): re-run
detect_regex(+detect_natashaif available) on the redacted text. Anything they still find is a surviving identifier the redaction missed. Counts by type. - Linkability (multi-file): given a folder, compare every file pair for shared surviving quasi-identifiers and flag potentially linkable pairs (count + types only).
- Inference (LLM, optional, opt-in): prompt the local attacker model
(
cfg.red_attacker_model) for the attribute categories it could still infer (profession, location type, age band, …). Degrades gracefully if no model. WARN the user it under-reports (floor, not ceiling).
Risk tier rule
- HIGH — any DIRECT identifier survives (EMAIL, PHONE, URL, ID, PERSON).
- MEDIUM — only QUASI identifiers survive (LOCATION, ORG, DATE, AGE, PROFESSION, MEDICATION), or linkable pairs exist across files.
- LOW — no surviving identifiers found (still NOT a guarantee).
How to run
# single redacted file (offline, deterministic)
python3 skills/red/scripts/red.py path/to/file.green.md
# a folder of redacted files (adds linkability)
python3 skills/red/scripts/red.py path/to/redacted_dir/
# add the local inference probe — synthetic/consented data ONLY
python3 skills/red/scripts/red.py path/to/file.green.md --inference
# machine-readable
python3 skills/red/scripts/red.py path/to/file.green.md --json
Output
A residual-risk report: per-file surviving-identifier counts by type, an overall risk tier, the inference categories claimed (if probed), the linkable-pair count, and the caveat that absence of a finding ≠ safety; human review still required. No PII values, no re-identification steps.
confide:rehydrate — restore real values into a placeholder analysis
This is the last step of the CONFIDE round-trip:
- Redact locally with
confide:anon(default reversible mode) → a GREEN copy with unique reserved-sentinel placeholders ([CONFIDE_PERSON_0001],[CONFIDE_EMAIL_0001],[CONFIDE_DATE_0002]…) plus a secret<name>.map.json(structured:green_sha256,entries[]…) that stays on the machine. - Analyze the GREEN text anywhere — including a cloud LLM. The analysis comes
back full of those same placeholders (sometimes mangled to
CONFIDE_PERSON_0001,[CONFIDE PERSON 0001]… — but always keeping the fullCONFIDE_TYPE_NNNNcore). - Rehydrate here: replace every placeholder with its original value from your own map, producing the real analysis — without the cloud ever seeing the originals.
Privacy invariants (do not violate)
- Local-only, on the user's OWN map. The map never leaves the machine. This skill never fetches or transmits anything.
- Counts only on stdout. The summary reports
restored N, unmatched M. The restored text (which contains originals) is written to a local file; it is NEVER echoed to stdout beyond the counts. - Unmatched = possible hallucination. A placeholder that is not in the map is
reported as
unmatchedand left in place — we never invent a value for it. Warn the user that these may be LLM hallucinations. - The
<name>.restored.mdoutput contains originals: it is local-only, do not share or commit it.
Run it
python3 skills/rehydrate/scripts/rehydrate.py ANALYSIS_FILE [--map <name>.map.json]
ANALYSIS_FILE— the text/analysis containing placeholders.--map <name>.map.json— the secret map fromconfide:anon. If omitted, the sibling*.map.jsonis auto-found (e.g. an analysis next tosession.map.json, or one derived fromsession.green.md).--out PATH— output path (default:<name>.restored.mdnext to the input).--verify-green <green_file>— check the map'sgreen_sha256against that GREEN file; warns loudly if they don't match (wrong map for this document).
Robust to LLM mangling that still keeps the full CONFIDE_TYPE_NNNN core:
[CONFIDE_PERSON_0001], [CONFIDE PERSON 0001], CONFIDE_PERSON_0001, and
confide_person_0001 all restore to the same map entry. Ordinary prose lacking the
CONFIDE prefix (e.g. "Person 1", "patient 1", "section 2") is never touched, and
0001 never eats 0010. Rehydration is idempotent (re-running on restored text is a
no-op). Accepts both the structured map schema and a legacy flat map.
After running
- Report the restore summary (
restored N, unmatched M) — never paste PII. - If
unmatched > 0, flag the placeholders as possible hallucinations not in the map. - Remind the user the
*.restored.mdis local-only (it now contains originals).
confide:setup
One-shot installer + optimal-default config writer for the CONFIDE local de-identification
toolkit. After running this, confide:anon (redact a transcript) and confide:red (residual
re-identification risk check) work with no further configuration.
Local-first: all detection and redaction run on the user's machine. Readiness checks and config writing never read, print, or transmit any transcript text or PII — only booleans and the config path.
When to use
Trigger phrasings: "set up confide", "install confide", "configure confide de-id", "confide setup", "get confide ready to anonymize".
How to run
The entrypoint is scripts/setup.py. It imports the shared core (shared/confide_core.py)
for the canonical DEFAULTS — do not redefine preferences here.
-
Check readiness (default, no install):
python3 skills/setup/scripts/setup.py --checkPrints a ✓/✗ table: Python deps importable (natasha, scrubadub, phonenumbers, pymorphy2), Ollama reachable (
GET ollama_host/api/tags), theanon_modelpulled, llama.cpp on PATH (optional), and whether the config exists. Booleans only — no PII. -
Install everything (best-effort, tolerates failures):
python3 skills/setup/scripts/setup.py --install # core deps + ollama pull python3 skills/setup/scripts/setup.py --install --with-presidio # + optional EN baseline- pip-installs:
natasha scrubadub phonenumbers pymorphy2 pymorphy2-dicts-ru "setuptools<81"(setuptools<81suppliespkg_resourcesfor pymorphy2). Optionalpresidio-analyzerbehind--with-presidio. - If
ollamais on PATH, runsollama pull qwen2.5:3b. - Each step reports ✓/✗; a failed step never aborts the others.
- pip-installs:
-
Write the optimal-default config (idempotent):
python3 skills/setup/scripts/setup.py --write-config # writes only if absent python3 skills/setup/scripts/setup.py --reconfigure # overwrites with defaults python3 skills/setup/scripts/setup.py --show # print current configOn first run with no config present, the script writes the defaults automatically.
--write-configwill not clobber an existing (user-customized) config; use--reconfigureto force-reset.
Config lives at ~/.config/confide/config.json.
Chosen optimal preferences (from SPEC.md)
Written from confide_core.DEFAULTS:
| Key | Value | Why |
|---|---|---|
engine | ollama | zero-config, Metal-accelerated, handles long docs (llama.cpp 400s on long RU) |
anon_model | qwen2.5:3b | fast local LLM layer for quasi-PII |
red_attacker_model | qwen2.5:3b | local default; it is a floor — a stronger attacker is the true ceiling |
languages | ["ru", "en"] | bilingual corpus |
layers | ["regex", "natasha", "llm"] | deterministic → RU NER → quasi-PII |
redaction_style | typed_placeholder | [PERSON], [DATE], … (reversible map kept locally, never shipped) |
privacy.local_only | true | raw text never leaves the machine |
privacy.cloud_apis | false | cloud disabled by default |
privacy.cloud_only_on_synthetic | true | cloud attacker only opt-in on synthetic/consented data |
ollama_host | http://localhost:11434 | local Ollama |
Notes
- llama.cpp is optional (reproducible engine) — detected and recorded if present, never required.
- The bigger attacker model for
confide:redis optional; the local 3b default under-reports risk. - Importable functions for programmatic / tested use:
readiness(),ensure_config(reconfigure=False),install(with_presidio=False),show_config().
confide:vault — the THREE LOCKS for storing RED data
Operationalizes the defense-in-depth storage posture in
confide/docs/THREE-LOCKS.md: real (RED) transcripts rest behind three independent
locks, so compromising one does not expose a client. To read a real transcript an
attacker needs the device password AND the encrypted-store password AND the
age key — three separate secrets, ideally held in different places.
| Lock | What | Protects against |
|---|---|---|
| 1 — Device | FileVault full-disk encryption + strong login password + short auto-lock | a lost/stolen/USB-booted machine |
| 2 — Store | RED in a dedicated ENCRYPTED store (encrypted APFS volume / AES-256 .dmg), NOT in Documents and NEVER in iCloud/Dropbox | other apps, other users, silent cloud sync |
| 3 — Per-file | each RED file sops/age-encrypted at rest, age key stored SEPARATELY; processing in a no-network VM/container | files individually sealed; key not beside the data |
NON-DESTRUCTIVE — read before running
--check(the default) runs only read-only probes:fdesetup status,shutil.which(sops/age), andos.path.exists(...). It never moves, deletes, or encrypts data and never runsfdesetup enable,hdiutil,age-keygen, orrm.- It reports each lock ✓/✗ and prints the exact command to fix every ✗ — for the user to review and run themselves.
--init-agegenerates an age key only with that explicit flag, and never overwrites an existing key.--init-store PATHonly prints the encrypted-store creation command; it does not execute disk-image creation. Refuses cloud-synced paths.- Never move, encrypt, or delete the user's RED data on their behalf without explicit confirmation. There is no destructive default.
Run it
# default = read-only status check + checklist with fix commands
python3 skills/vault/scripts/vault.py --check
python3 skills/vault/scripts/vault.py --json # structured status dict
# point at your own RED store to verify it's not cloud-synced
python3 skills/vault/scripts/vault.py --store-path ~/CONFIDE-RED.dmg
# optional, GUARDED helpers (explicit flags only)
python3 skills/vault/scripts/vault.py --init-age # make an age key (never overwrites)
python3 skills/vault/scripts/vault.py --init-store ~/CONFIDE-RED.dmg # prints the hdiutil command
lock_status() is importable and returns:
{
"device": {"filevault": bool},
"store": {"present": bool, "path": str|None, "cloud_synced": bool, "safe": bool},
"perfile": {"sops": bool, "age": bool, "key": bool, "key_path": str|None}
}
How to help the user
- Run
--checkand read back the ✓/✗ checklist. - For each ✗, show the printed fix command (e.g.
sudo fdesetup enable,age-keygen -o ~/.config/confide/age.key,hdiutil create -encryption AES-256 … ~/CONFIDE-RED.dmg) and let the user run it. - Confirm the RED store is not inside iCloud/Dropbox (
store.safe). - Show the sops/age encrypt+decrypt recipe (printed in the checklist) so RED stays
ciphertext at rest and is decrypted only in-memory inside the isolated pipeline
(
confide/docs/ISOLATION.md). Only GREEN (redacted) output ever leaves the machine.
See confide/docs/THREE-LOCKS.md (the model + checklist) and confide/docs/ISOLATION.md
(red/green flow, no-network VM/container).
confide:view — visual de-id diff (what redaction & rehydrate do)
Produce ONE standalone .html that renders a transcript with every PII span
highlighted and color-coded by type, and lets you toggle between the original and
the redacted views interactively. It reuses the span data from the shared core
(shared/confide_core.py) — a thin renderer, no new detection logic.
Privacy invariants (do not violate)
- The HTML embeds REAL values (originals + placeholders) so you can compare them. It is therefore a vault artifact: same posture as the relationship-graph HTML.
- Local only. Written next to the input, a sibling
.gitignoreexcludes*.view.html(and*.map.json), and a red PRIVATE banner sits at the top. Never share it, never commit it, never ship it. - Counts only to stdout. The terminal output carries span counts by type — never PII values or redacted-text dumps.
- Self-contained & offline. Inline CSS + JS, no CDN / external resources, so it
renders offline and can never 404. Default detection layer is
regex(no network, no models).
Run it
python3 skills/view/scripts/view.py ORIGINAL.txt
If a <name>.map.json sits next to the input (from confide:anon), it is picked up
automatically so the view shows exactly that known PII; otherwise PII is detected with
the local layers and a fresh reversible map is built in memory.
Options:
--map MAP.json— supply the reversible map explicitly.--layers regex,natasha,llm— choose detection layers (defaultregex, offline-safe).--out DIR— write the.view.htmlinto DIR instead of next to the input.
It writes <name>.view.html and ensures a sibling .gitignore.
What the HTML shows
- The transcript with each PII span wrapped in
<mark class="pii TYPE" data-orig=… data-ph=…>, colored by type (PERSON, DATE, EMAIL, …). Hover a span to seeoriginal ↔ placeholder. - An interactive state toggle:
- All — fully redacted: every span shows its placeholder.
- None — original: nothing masked.
- Selected — mask only the PII types you check (per-type checkboxes in the legend).
- A legend + counts by type.
After running
- Open the
<name>.view.htmllocally in a browser to inspect the de-id. - Report the counts summary (types) — never paste PII.
- Remind the user the file is private/local and must not be shared or committed.
Setup
The default regex layer always works offline. For Natasha (RU NER) or the local LLM
layer, run confide:setup first; otherwise pass --layers regex.
Sponsors
Details
- Marketplace
- glebis/claude-skills
- Source
- confide
- Category
- Community