zafiro: Instructions file for Claude Code

CLAUDE.md

zafiro CLAUDE.md is an instructions file for Claude Code from niki914/zafiro. It costs 2,291 tokens per session, scanned A, original, MIT.

A repository guide for Zafiro, an Android application written in Kotlin that connects AI agents with voice-assistant apps. It explains the project’s terms, processes, communication between components, and engineering rules.

In plain words
What is it for?
Use it when developing Zafiro, especially its voice-assistant integration, permission-related components, inter-process communication, settings storage, or response rendering.
Why use it?
It gives a coding assistant the specialized background needed to change this multi-process Android project correctly.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md.

This is niki914/zafiro's own configuration. It tells Claude Code how to work on zafiro itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything zafiro configures →

Reuse

Borrowing it

Nothing to install: this file belongs to niki914/zafiro. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/niki914/zafiro/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/niki914/zafiro

Made for: Claude Code.

Wrote 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.

agentmods badge for zafiro CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/niki914/zafiro/claude-md.svg)](https://agentmods.dev/instructions/niki914/zafiro/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/niki914/zafiro/claude-md"><img src="https://agentmods.dev/badge/instructions/niki914/zafiro/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 2,291 This file is loaded in full into every session.
When invoked 2,291 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.02291 $0.02291
Opus 5 $0.01145 $0.01145
Sonnet 5 $0.00458 $0.00458
Haiku 4.5 $0.00229 $0.00229

Measured 8d ago against content hash 16cd3e3bc2e3, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

zafiro 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 8d 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.

CLAUDE.md · 142 lines

How it starts

The opening of the file, as written. The whole thing — 142 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENT RULES

项目定位

Zafiro 是一个 Android 应用,使用 Kotlin 技术栈。它通过 compose UI 结合 Root/Shizuku 等权限给 Agent 提供丰富的脚手架。同时支持通过基于 Binder + LSPosed 的接管系统将部分厂商语音助手换源为 Zafiro

重要优先级: 主应用 > Okia > py >> 宿主

术语(你在对话中会用到这些词)

  • 宿主 / Host:被 Hook 的语音助手 App。Breeno(ColorOS,com.heytap.speechassist)和 XiaoAi(HyperOS,com.miui.voiceassist
  • 主 App:Zafiro 自己的进程(com.niki914.zafiro),跑设置 UI + Runtime Service
  • takeover:本轮 query 的接管决策——InjectedLLM(Zafiro 替换回答)或 NativeTakeover(放行原生回复),由 TakeoverResolver 判定
  • turn:一轮"用户问 → 回答呈现"的完整生命周期,ConversationTurnState 跟踪
  • store:一个命名的 JSON 持久化单元(如 agent.main.configrules.takeover),原子写入 filesDir/ 下对应路径
  • render pipeline:LLM 响应注入宿主 UI 的链路。Breeno 走卡片全量刷新,XiaoAi 走响应目标捕获 + 指令分片注入

进程与 IPC 骨架

  • 宿主进程:Xposed Hook 注入点。通过 AgentRuntimeClient(Binder)向主 App 提交 LLM 查询,通过 XIpcBridge.StoreClient(Binder)读写 settings store
  • 主 App 进程:运行 AgentRuntimeService(前台 Service,Binder IPC),持有 store 持久化的本地访问权
  • 两条 IPC 通道XIpcBridge(配置读写/通知,走 StoreClient Binder 接口) + AgentRuntimeService(LLM query 提交与 RenderFrame 流式回调)

Engineering principles

  • Do not preserve backward compatibility. Remove obsolete paths instead of adding compatibility layers, fallbacks, or migrations.
  • Choose the simplest implementation that fully meets the current requirements. Avoid speculative abstractions, configuration, and indirection.
  • Grow the system in layers. Start from the smallest version that works end to end, and add each new capability on top of a product that already works. Never trade a working product for unfinished complexity.
  • Keep components modular and concerns clearly separated.
  • Prefer established, well-maintained libraries when they reduce overall complexity or improve reliability. Do not reimplement common functionality without a clear reason.
  • Lean on the dependencies already in the project before writing your own implementation or adding packages. Do not assume a library lacks a capability without checking its documentation and types.
  • Make architectural decisions for the long term. Do not accept a stopgap that only works for now and is meant to be replaced later.
  • Ask the user for help when a task is easy for the user but hard for you, such as refactoring code in Android Studio.
  • When a feature is hard to implement (difficulty above 6/10) and low in value, negotiate scope with the user before building it.
  • Use the android CLI for Android-related operations: build, install, device management, screenshots, UI inspection. Load the android-cli skill first.
  • Only implement code changes when the user explicitly requests implementation (e.g., 开发 / 改 / 开始实现). Otherwise, plan and discuss without editing files.
  • Before implementing, present the proposed solution and get the user's decision on the design.
  • The user wants to decide anything that affects architecture or code quality. Surface such decisions for them to make. For trivial choices that no architect would weigh in on, decide yourself and mention them in passing.
  • After implementing, recap the key changes. Do not commit unless the user asks.

Read the full file on GitHub · 142 lines

Changes

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.

  1. 8d ago First seen · 142 lines · 2,291 tokens per session scan A 16cd3e3bc2e3

Subscribe to this mod's changes

zafiro CLAUDE.md is an instructions file published in the GitHub repository niki914/zafiro (147 stars, last pushed yesterday), licensed MIT. It adds 2,291 tokens to every session, about $0.0115 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.

Related

Other instructions, from other repositories

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.

vercel/next.js · 7,296 tokens

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.

openai/codex · 5,153 tokens

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).

microsoft/vscode · 6,785 tokens

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).

microsoft/vscode · 5,001 tokens

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.

langchain-ai/langchain · 4,469 tokens

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.

github/spec-kit · 7,104 tokens