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.
curl -O https://raw.githubusercontent.com/niki914/zafiro/main/AGENTS.mdgit clone --depth 1 https://github.com/niki914/zafiroWrote 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/niki914/zafiro/agents-md)<a href="https://agentmods.dev/instructions/niki914/zafiro/agents-md"><img src="https://agentmods.dev/badge/instructions/niki914/zafiro/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/niki914/zafiro/agents-md"><img src="https://agentmods.dev/badge/instructions/niki914/zafiro/agents-md.svg" alt="Reviewed on agentmods" width="80" 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.02834 | $0.02834 |
| Opus 5.5 | $0.01134 | $0.01134 |
| Sonnet 5.5 | $0.00567 | $0.00567 |
| Haiku 4.5 | $0.00283 | $0.00283 |
Grade A, and why
zafiro AGENTS.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 3d 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 — 175 lines — stays where its author put it; the contents beside it link to each section on GitHub.
About
项目简介 - 详见 README.md
项目知识
仓库本体
./
├── .agents/skills/ # SKILLs 真实目录
├── .claude/skills/ # .agents/skills 的软链,不用修改这里的文件
├── .githooks/ # 提交前坏味道检查;规则、放行、清理方式见其 README.md
├── app/ # 主应用:Compose UI、AgentRuntimeService、Xposed 钩子
├── business/ # 业务核心层(契约与实现分离)
│ ├── api/ # 业务对外公共契约接口
│ ├── agent/ # Agent 核心逻辑、会话编排与状态流
│ ├── files/ # 文件附件与路径解析
│ ├── notification/ # 常驻通知、前台服务与通知渠道管理
│ ├── permission/ # 权限管理中心(Root / Shizuku 自动授权、统一审批)
│ └── application/ # 应用管理与生命周期
├── agent-runtime/ # Agent 运行时:LLM 调用、工具/Skill/MCP 执行、Python 运行时
├── xsettings/ # 轻量配置模块(业务按需依赖)
├── store/ # Store 持久化、IPC 桥(XIpcBridge)
├── ui-kit/ # 共享 Compose 组件、LiquidScreen 壳、导航
├── remote-view/ # 跨进程 / 悬浮窗 RemoteView 视图
├── xposed-api/ # Xposed 事件类型、共享常量(主应用与宿主进程共享)
├── xposed-runtime/ # Xposed 运行时、Hook 基类
└── libs/
├── logging/ # 日志库
├── okia/ # Okia Agent 运行时基础库
└── libterm/ # 终端库(含多个后端:libsu, shizuku, ssh 等)
MVI 架构
项目强制使用 MVI 心智:UI 只发意图、只读 VM 的 State,VM 通过更新 State 驱动 UI。基类见 ui-kit 的 ComposeMVIViewModel
State 与 Effect 的区别是持久与一次性,分界的判据是「换个时间再读还成立吗」:列表数据、弹窗开关属于 State;Toast、聚焦、退出页面属于 Effect,只发生一次、没接住就没了
弹窗最容易误判:触发弹窗是一次动作,但「弹窗开着」是界面当前的样子,重组、旋转、被压栈后回来都要能读到同一个答案,所以它是 State
宿主 / Host
本项目通过 LSPosed 对 com.heytap.speechassist 等应用做 Hook,将系统语音助手的回答换成 Zafiro Agent 回答,具体实现是通过 Binder + AgentRuntimeService。当前的实现重点是,复杂的数据结构从不穿过 Binder,IPC 传递纯语义数据(Thinking、Tools、Content)。宿主架构采用分层治理:上层 *Hook(如 BreenoHook)为纯胶水调度层,严禁堆砌反射与类名硬编码
我们把取代原生语音助手的功能称为 换源 / takeover / 接管。宿主是比较边缘的业务,在重要决策时,不应该为了宿主的业务而去妥协,应该牺牲宿主
主界面 / Home / Compose
这些都是指应用的主入口,Compose UI,具体的对话是在 HomChatViewModel 内通过 Agent API 维护。Compose 必须是无状态的,从配套的 MVI ViewModel 里取数据
这是整个应用的根基,它的重要性和优先级最高
UI 框架 / ui-kit
导航、导航栏、弹窗、设置项都用 ui-kit 里既定的那套,不要另起一套。实现涉及导航、ViewModel、弹窗的业务前 MUST 调研已有代码作为参考
导航
导航是自行实现的(ui-kit 的 nav 包),而不是使用 nav3。每个 entry 自带 viewmodel 生命周期,页面 VM 要通过框架拿,不要自己去取
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.
- 3d ago Changed · +1 lines 685dfe8a1a09
- 7d ago Changed · +7 tokens per session 6bc7bf5930d0
- 10d ago Changed · +27 tokens per session c4110c78f228
- 11d ago Changed · +21 tokens per session b08f46a115ee
- 12d ago Changed · +8 lines · +179 tokens per session 641c02ca941b
- 14d ago Changed · +5 lines · +50 tokens per session 5c7f4d204971
- 15d ago Changed · +21 lines · +302 tokens per session 3e73dde8307d
- 19d ago Changed · +28 lines · +477 tokens per session da0e296901f9
- 22d ago Changed · +4 lines · +223 tokens per session 9f1244586d7f
- 24d ago First seen · 108 lines · 1,548 tokens per session scan A dbad8ab3ce34
zafiro AGENTS.md is an instructions file published in the GitHub repository niki914/zafiro (288 stars, last pushed yesterday), licensed MIT. It adds 2,834 tokens to every session, about $0.0113 per session on Opus 5.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-09-25.
Other instructions, from other repositories
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).
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.
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, cache eligibility and rollout and applying the notice (cutover).
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 copilot-instructions.md
Copilot instructions for microsoft/vscode, covering vs code copilot instructions, project overview, root folders, core architecture (src/ folder) and built-in extensions (extensions/ folder).
deno copilot-instructions.md
Copilot instructions for denoland/deno, covering deno development guide for github copilot, network access, high level overview, key directories and key files to understand first.