zafiro: Instructions file for Codex

AGENTS.md

zafiro AGENTS.md is an instructions file for Codex, OpenCode from niki914/zafiro. It costs 2,834 tokens per session, scanned A, original, MIT.

A repository instruction document describing Zafiro's Android architecture, terminology, storage, process boundaries, and implementation rules.

In plain words
What is it for?
Use it when modifying Zafiro's host integration, chat screens, persistence, inter-process communication, or Python support.
Why use it?
It gives an agent project-specific context so it can use the repository's terms and follow its constraints.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: reads .claude/ paths; mentions subagents.

This is niki914/zafiro's own configuration. It tells Codex and OpenCode 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/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/niki914/zafiro

Made for: Codex, OpenCode.

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 AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/niki914/zafiro/agents-md/github.svg)](https://agentmods.dev/instructions/niki914/zafiro/agents-md)
Your own site
<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.

agentmods 80×15 button for zafiro AGENTS.md

Your own site · 80×15
<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>
Per session 2,834 This file is loaded in full into every session.
When invoked 2,834 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.02834 $0.02834
Opus 5.5 $0.01134 $0.01134
Sonnet 5.5 $0.00567 $0.00567
Haiku 4.5 $0.00283 $0.00283

Measured 3d ago against content hash 685dfe8a1a09, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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.

AGENTS.md · 175 lines

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 要通过框架拿,不要自己去取

Read the full file on GitHub · 175 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. 3d ago Changed · +1 lines 685dfe8a1a09
  2. 7d ago Changed · +7 tokens per session 6bc7bf5930d0
  3. 10d ago Changed · +27 tokens per session c4110c78f228
  4. 11d ago Changed · +21 tokens per session b08f46a115ee
  5. 12d ago Changed · +8 lines · +179 tokens per session 641c02ca941b
  6. 14d ago Changed · +5 lines · +50 tokens per session 5c7f4d204971
  7. 15d ago Changed · +21 lines · +302 tokens per session 3e73dde8307d
  8. 19d ago Changed · +28 lines · +477 tokens per session da0e296901f9
  9. 22d ago Changed · +4 lines · +223 tokens per session 9f1244586d7f
  10. 24d ago First seen · 108 lines · 1,548 tokens per session scan A dbad8ab3ce34

Subscribe to this mod's changes

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.

Related

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

microsoft/vscode · 9,649 tokens

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,549 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, cache eligibility and rollout and applying the notice (cutover).

microsoft/vscode · 5,262 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,680 tokens

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

microsoft/vscode · 2,731 tokens

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.

denoland/deno · 3,077 tokens