Community研究与数据分析github.com

grahama1970/数据匿名化

通过oai-trial项目的显式策略,对CSV、JSON、UTF-8文本和SQLite文件进行匿名化处理。支持匿名化数据、假名化导出、根据策略文字进行编辑,或发现并明确批准模糊名称别名。该技能是轻量级的CLI/Docker接口,而非另一个引擎。

数据匿名化 是什么?

该技能提供了一个轻量级CLI/Docker包装器,用于操作规范的`oai-trial`项目以进行数据匿名化。它被设计为对CSV、JSON、UTF-8文本和SQLite文件执行显式的基于策略的匿名化,而不是重新实现匹配器或格式适配器。设置需要`uv`,且运行时操作无需内存、LLM、网络或数据库服务,使其安全且可审计。关键功能包括使用外部的`policy.json`执行匿名化、通过可选的RapidFuzz集成基于相似度发现名称别名(必须由操作员手动批准),以及通过`verify`子命令提供强大的验证机制。该技能强调一个严格的“根据规范而非代码”的验证方法,以防止因字符串表示(如整数与格式化字符串)导致的匿名化漏洞,并提供了详细的清单,涵盖打字数值、Unicode标准化和SQLite工件等场景。项目文档(如`README.md`和`docs/ANONYMIZATION_SEMANTICS.md`)是核心引用,该包装器保留项目的退出代码以进行故障处理。

兼容平台~Claude Code~Codex CLI~Cursor✓Antigravity
npx skills add https://github.com/grahama1970/agent-skills/tree/main/skills/anonymize-data

Installed? Explore more 研究与数据分析 skills: affaan-m/uspto-database, affaan-m/scholar-evaluation, affaan-m/literature-review · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

匿名化数据

操作规范的 oai-trial 项目。不要在此技能中重复其匹配器、格式适配器、验证器、模式或错误处理。项目现有的 argparse CLI 有意保留;此包装器不添加 Python CLI 或服务。

设置与主要操作

ANONYMIZE_DATA_ROOT 覆盖上面的默认主检出路径。设置需要 uv,并安装项目声明的开发/发现额外依赖。运行时操作不需要内存、提供者凭证、LLM、网络或数据库服务。

./run.sh setup
./run.sh --input /data/exports --policy /data/policy.json --output /data/release
./run.sh anonymize --input /data/export.sqlite --policy /data/policy.json --output /data/release

输入是一个 .csv、.json、.txt 或 .sqlite 文件,或包含这些文件的目录。策略必须是一个独立的常规文件。在输入之外使用一个专用的空输出目录。原始文件被复制到私有临时快照中;成功输出仅包含 corpus/ 和 report.json。

现有的 bundle 接口仍然可用:

./run.sh run --input /data/bundle --output /data/release
./run.sh verify --input /data/bundle --output /data/release
./run.sh inspect /data/release

bundle 包含 policy.json 和 corpus/。策略、规范标识、受保护值规则、类型化失败和报告模式由项目拥有。在解释它们时,请阅读其 README.md、docs/ANONYMIZATION_SEMANTICS.md 和 schemas/report.schema.json。不要仅凭退出代码宣布成功:读取实际报告,验证其就绪字段,并检查输出是否符合请求的格式。损坏或缺失的报告视为 NOT READY。

可选的 RapidFuzz 发现:永远不会自动替换

./run.sh discover --input /data/exports --policy /data/policy.json --output /data/work/review.json
./run.sh approve-discovery --input /data/exports --policy /data/policy.json \
  --review /data/work/review.json --approve CANDIDATE_ID --output /data/work/approved-policy.json
./run.sh --input /data/exports --policy /data/work/approved-policy.json --output /data/release

发现功能将完整的结构化字符串值和完整的文本行与 name 类型的策略条目进行比较。它不是 NLP 跨度提取或通用的 PII 扫描器。默认值:相似度阈值 90,分离余量 5;可通过 --threshold 和 --margin 配置。不会提出并列项、近并列项、受保护值、包含数字或标识符标点(如 @、/、_)的值以及已知字面量。单引号、连字符和句点允许出现在名称形状的文本中;相似度绝不是证明两个人是同一个人的证据。

要求操作员批准特定的候选 ID。 绝不能仅凭相似度分数就批准。批准会针对当前策略/语料库重新派生提案,拒绝过时/已编辑的审查,并编译一个精确匹配的策略。未经批准的提案绝不会影响匿名化。发现/批准回执上必须设置 release_ready: false。

审查和已批准策略文件包含原始名称:将它们保持在发布、日志和共享报告之外。它们以模式 0600 创建,并且绝不会覆盖现有文件。临时快照默认使用工件驱动器;必要时可用 ANONYMIZE_DATA_WORK_DIR 覆盖。

Docker 仍是独立接口

从项目检出目录:

docker build -t anonymization-trial .
docker run --rm anonymization-trial
# 可选的启用发现的镜像;默认镜像保持精确引擎无依赖。
docker build --build-arg INCLUDE_DISCOVERY=1 -t anonymization-trial:discovery .

仅挂载请求的输入/策略(只读)和一个专用输出目录。相同的项目 CLI 在镜像内运行;评估器不需要此技能。有关完整的挂载命令示例,请参见项目的 docs/DISCOVERY.md。

失败与证明边界

此包装器保留项目退出代码和清理过的错误代码。缺失项目/设置和错误的已安装包路径会在处理前失败。使用 --help 获取实际参数合约。发现是审查材料,而非发布、匿名性保证、置信概率或人类授权。

./sanity.sh 运行真实的正面、负面和对抗性 CLI 检查。保留的 fixtures/agentic_eval.json 重复它们并要求回读工件。先前的试验资格不会自动限定这些试验后扩展。

表示规则(操作员 2026-09-11)

PII 必须与值而非字符串匹配:在任何 JSON/SQL 标量原封不动地传递之前,以规范形式将其字符串化(电话形状的数字采用 E.164 格式),并在字符串化形式上运行策略匹配。固定装置必须包含每种 JSON 标量类型中的每个 PII 类别。作为整数存储的电话号码与同一个电话号码相同,包括当策略将其写为格式化字符串(如 555-123-4567)而语料库存储 5551234567 时。前导零或浮点精度有损的数值转换必须以失败关闭,除非特定类型的规范规则证明了安全的等价性。请参阅 $best-practices-skills "值表示矩阵"。

加固教训(不要再艰难地重新学习这些)

该试验因存储为 JSON/SQLite 整数的电话通过仅字符串匹配器而被取消资格。根本原因是过程错误:验收检查是根据代码的行为编写的,而非根据交付的规范。这些规则的存在是为了防止此类遗漏再次发生。

  1. 根据规范而非代码派生检查。 policy.json 列出了确切的敏感值。正确的验收检查是“这些值都不以任何表示形式出现在解码输出中”——从策略文件中读取值,绝不要手动编写列表。通过依赖探针证明检查依赖于规范(翻转一个策略值 → 结果必须翻转)。参考实现:项目 scripts/spec_derived_check.py 连接到 scripts/verify.sh。

  2. 独立验证器不得与转换共享任何假设。 原始验证器与生产者一样存在仅字符串盲点,因此没有任何东西以失败关闭。验证预言机必须具有表示感知能力且独立:解析 JSON(解码 \uXXXX),将数值标量扩展为整数/十进制形式,对两侧进行 NFC/NFD 规范化,扫描 SQLite 表+视图单元格以及 sqlite_master DDL 以及每个标头整数,并扫描整个发布边界(包括 report.json),而不仅仅是 corpus/。

  3. 完整的表示类别是一个清单,而不是单个错误。 以下每一项都可能将敏感值携带通过天真匹配器;项目为每一项修复并保留了一个保护措施:类型化数值标量(int/float,科学记数法)、SQLite BLOB(失败关闭)、Unicode NFC/NFD、视图重建、空闲列表残留、恶意数据库模式(表达式/部分索引、非确定性视图、计算后的 DEFAULT)、模式 DDL 字面量和持久标头整数。有关完整表格,请参见项目的 docs/SECURITY_REMEDIATION.md。

  4. 通过真正的 Docker 路径确定性证明。 验证必须是一个提交的脚本,用于构建镜像、运行概要的确切命令并回读发布的字节,并带有硬性的 PASS/FAIL 退出——而不是代理散文。参考:security/docker_brief_contract.py(构建 + 两个概要命令 + 表示感知泄漏扫描 + 输入前置条件)和 security/docker_hardening_matrix.py(通过 docker run 的对抗性漏洞)。记录 git 提交和构建的镜像 ID。

  5. 诚实界定范围。 确定性公共命名空间假名会泄露相等性/频率,并且不提供外部链接抵抗;运行报告在 key_mode 和 does_not_establish 中声明了这一点。等于强制性 SQLite 格式常量的策略值是退化输入,而非真实 PII;管道以失败关闭并记录该残留物为已界定范围。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

grahama1970/acceptance-contract

Turn a client brief, zip bundle, directory, or single requirements file into a typed acceptance-contract bundle with extracted requirements, acceptance checks, open questions, an immutable-goal draft, and a create-report-backed decision report. Use when users say acceptance contract, brief to requirements, freeze the goal, create immutable goal, amend immutable goal, build a Battle requirements bundle, or extract requirements from this bundle.

grahama1970/agent-ecosystem

Canonical map and shared contracts for the agent-governance ecosystem: the pi.receipt_envelope.v1 boundary envelope, the component graph, and the rules for which component owns which schema. Use when wiring a skill or extension into the shared receipt world, when asking how shame, triage-error, tau, ask, project-watchdog, ops-herdr, ponytail, and Memory fit together, or when validating an envelope.

grahama1970/agentic-evals

Agentic evaluation of skills using multi-trial fixtures, deterministic command assertions, trajectory checks, safety constraints, and evidence-backed readiness scoring. Use when users ask for agentic evals, multi-trial skill evaluation, skill trajectory validation, or readiness scoring for a skill workflow.

grahama1970/agent-inbox

File-based inter-agent messaging with headless dispatch. Check inbox, send bugs/requests to other projects, automatically spawn headless agents to fix bugs, and track progress via task-monitor.

grahama1970/agents-registry

Generate and query the centralized agent identity registry. Scans .pi/agents/*/AGENTS.md, parses frontmatter, outputs agents-registry.json and optionally syncs to /memory for semantic search.

grahama1970/agent-status

Artifact-driven status surfaces for long-running project-agent work. Maintains status.json, events.jsonl, proof manifests, and a stale-aware STATUS.html so humans can tell where the agent is, what passed, what is still unproven, and what decision or action is next — without dashboard theater.

grahama1970/align

Round-based context alignment before execution. Use when the human, project agent, WebGPT, scillm, ask, dogpile, memory, or project-knowledge may each hold different facts about a task; especially before ambiguous design, infographic, product workflow, high-stakes implementation, plan-iterate, project-infographic, or multi-review work.

grahama1970/analytics

Flexible data science analytics for any dataset. Auto-discovers schema, recommends charts, exports to create-figure. Works with JSONL, JSON, CSV from any source.

grahama1970/analyze-chatterbox-emotions

Evaluate generated Chatterbox voice files as voice-quality artifacts: affect match, arousal/valence proxies, pause placement, intelligibility inputs, clipping, loudness, and discontinuity flags. Use when reviewing Chatterbox emotional tags, pauses, Turbo/base affect delivery, Persona Dream utterance renders, or whether generated speech matches an intended product-facing affect.

grahama1970/analyze-elf

Reverse-engineer features from ELF binaries. Extracts CLI commands, state machines, protocols, Zod schemas, and data models. Automatically generates a /create-walkthrough prosecution brief with Mermaid diagrams. Uses /treesitter for AST analysis of bundled JS/TS source.

grahama1970/animation-vocabulary

Reverse-lookup glossary that turns a vague description of a web animation or motion effect into its exact term ("the bouncy thing when a popover opens" → Pop in; "the iOS rubber-band scroll" → Rubber-banding). Use when the user asks "what's it called when…", or describes a motion effect without knowing its name and wants the right word to prompt an AI or designer with. For naming an effect, not designing or building one.

grahama1970/anvil

Heavy-duty "No-Vibes" debugging and hardening orchestrator. Use this for complex, stubborn bugs where `review-code` has failed, or for "Red Teaming" (hardening) a codebase. Runs multiple agents in parallel (Thunderdome) using git worktree isolation.

grahama1970/apple-design

Apple's approach to interface design and fluid, physical motion, translated for the web. Use when building or reviewing gesture-driven UI, spring animations, drag/swipe/sheet interactions, momentum and interruptible transitions, translucent materials and depth, typography (optical sizing, tracking, leading), reduced-motion, or the design foundations (feedback, spatial consistency, restraint) behind Apple-style interfaces.

grahama1970/argue

Multi-persona structured debate orchestrator. Personas research via /dogpile, consult colleagues via /ask, and argue toward nuanced synthesis on complex questions.

grahama1970/arxiv

Search arXiv for papers and extract knowledge into memory. Use `search` to find papers, `learn` to extract knowledge.

grahama1970/ask

Use when the user asks to query project memory, ask an oracle, use supported browser-backed reviewers, run Tau roundtable/single-handler workflows, ask Pi-native subagents from within Pi, run persona/deep-review workflows, generate image prompts, check OS/project health through composed skills, or run an ask DAG. This skill is the executable /ask runtime; do not replace it with an informal subagent, plain web search, or hand-written review; inside Pi, explicit Pi-native subagent targets are routed through the pi-subagents tool as an Ask target type.

grahama1970/assess

Step back and critically reassess project state. Use when asked to "assess", "step back", "fresh eyes", "check alignment", "sanity check", "health check", "prune documentation", or "evaluate what's working". Offers documentation pruning and doc-code alignment analysis. Offer to run after major changes (don't auto-run).

grahama1970/assistant

Shared GPT + classifier inference gateway for persona monitor tasks. Routes validation and classification through a 4-tier cascade: heuristic → classifier → local GPT → scillm.

grahama1970/assistant-lab

Self-improvement workbench for /assistant. All the tools needed to diagnose, train, evaluate, and promote models in a continuous loop. The "warm pond" where /assistant evolves its own inference stack.

grahama1970/batch-quality

Pre-flight validation and quality gates for batch LLM operations. ACTUALLY tests samples through LLM before burning tokens. Uses SPARTA contracts for DuckDB validation queries. Integrates with task-monitor for enforced quality gates.

相关技能