PrivacySentry is an Android build-time privacy compliance tool that modifies application bytecode to detect calls to sensitive APIs and records the results. Android developers can use it to inspect privacy-related API usage and generate reports for application review.
Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add instructions/allenymt/privacysentry/claude-mdgit clone --depth 1 https://github.com/allenymt/PrivacySentryWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/allenymt/privacysentry/claude-md)<a href="https://agentmods.dev/instructions/allenymt/privacysentry/claude-md"><img src="https://agentmods.dev/badge/instructions/allenymt/privacysentry/claude-md.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.01561 | $0.01561 |
| Opus 5 | $0.00781 | $0.00781 |
| Sonnet 5 | $0.00312 | $0.00312 |
| Haiku 4.5 | $0.00156 | $0.00156 |
Grade A, and why
PrivacySentry CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 169 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
项目概述
PrivacySentry 是一个 Android 隐私合规检测工具,通过 ASM 字节码插桩技术在编译期和运行期拦截敏感 API 调用,帮助开发者规避应用市场上架时的隐私合规检测问题。
核心架构
三层架构设计
-
plugin-sentry (Gradle 插件层)
- 基于 AGP 8.0+ 和 Booster 框架的 Gradle 插件
- 负责在编译期进行字节码转换 (Transform)
- 两阶段 Transform:
- 第一阶段: 收集需要拦截的敏感函数 (MethodProxyCollectTransform, ClassProxyCollectTransform)
- 第二阶段: 替换敏感函数调用 (MethodHookTransform, FieldProxyTransform, ClassProxyTransform)
- 关键类:
PrivacySentryPlugin.kt,PrivacyTransformTask.kt
-
privacy-annotation (注解层)
- 定义编译期注解用于声明需要拦截的方法和字段
- 核心注解:
@PrivacyMethodProxy: 标记需要代理的方法@PrivacyFieldProxy: 标记需要代理的字段@PrivacyClassProxy: 标记包含代理方法的类@PrivacyClassBlack: 标记不需要拦截的黑名单类
-
hook-sentry (运行时 Hook 层)
- 提供运行时的 SDK 初始化和日志收集功能
- 支持三种缓存策略: 内存缓存 (MemoryCache)、时效性磁盘缓存 (TimeLessDiskCache)、永久磁盘缓存 (DiskCache)
- 日志输出到文件 (.xls 格式)
- 关键类:
PrivacySentry.kt,PrivacySentryBuilder.kt
-
privacy-proxy (预置代理实现)
- 提供常用敏感 API 的拦截实现
- 通过注解声明拦截规则,由插件在编译期自动收集
- 关键类:
PrivacyProxyCall.kt,PrivacyTelephonyProxy.kt,PrivacySensorProxy.kt
工作原理
- 编译期: 插件扫描所有
@PrivacyMethodProxy注解,收集需要拦截的方法列表 - 字节码转换: 将目标方法调用替换为代理方法调用
- 运行期: 代理方法执行实际逻辑,并记录调用堆栈和时机到日志文件
常用命令
构建项目
./gradlew clean build
编译调试 (本地依赖模式)
修改 config.gradle:
build = [
local_debug: true,
local_debug_dir : "${rootProject.projectDir}/local"
]
发布到本地 Maven
./gradlew publishToMavenLocal
运行测试应用
./gradlew :app:installDebug
项目模块说明
- app: 示例应用,演示如何集成和使用 PrivacySentry
- plugin-sentry: Gradle 插件,负责字节码转换
- hook-sentry: 运行时 SDK 核心库
- privacy-annotation: 注解定义模块
- privacy-proxy: 预置的敏感 API 拦截实现
- privacy-replace: 类替换功能 (已废弃,不再维护)
- privacy-test: 测试模块
版本兼容性
- 当前版本 (1.3.7_v820_beta4): 支持 AGP 8.0+
- 旧版本 (1.3.6): 支持 AGP 8.0 以下版本
- 最低 Android SDK: minSdkVersion 19
- 编译 SDK: compileSdkVersion 34
- Kotlin: 1.8.10
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 6d ago First seen · 169 lines · 1,561 tokens per session scan A 2866343b7206
PrivacySentry CLAUDE.md is an instructions file published in the GitHub repository allenymt/PrivacySentry (2,290 stars, last pushed 8mo ago), licensed MIT. It adds 1,561 tokens to every session, about $0.0078 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other instructions, from other repositories
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
spec-kit AGENTS.md
AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).