mio-chat-backend: Instructions file for Codex

AGENTS.md

mio-chat-backend AGENTS.md is an instructions file for Codex, OpenCode from Pretend-to/mio-chat-backend. It costs 5,949 tokens per session, scanned A, original, MIT.

Repository instructions for a chat application's backend. They define project rules for database changes, migrations, branch use, testing, process restarts, and tool registration.

In plain words
What is it for?
Use them when changing the backend, its database schema, startup and reload behaviour, plugins, chat connections, or development workflow.
Why use it?
They give a coding assistant one source of truth for working safely in the repository, especially where careless database or runtime changes could cause damage.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions CLAUDE.md; mentions subagents; mentions AGENTS.md.

This is Pretend-to/mio-chat-backend's own configuration. It tells Codex and OpenCode how to work on mio-chat-backend 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 mio-chat-backend configures →

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is 本仓库配套前端仓库 `mio-chat-frontend`(本机通常在 `../mio-chat-frontend`)。.

Reuse

Borrowing it

Nothing to install: this file belongs to Pretend-to/mio-chat-backend. 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/Pretend-to/mio-chat-backend/master/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/Pretend-to/mio-chat-backend

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 mio-chat-backend AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/pretend-to/mio-chat-backend/agents-md/github.svg)](https://agentmods.dev/instructions/pretend-to/mio-chat-backend/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/pretend-to/mio-chat-backend/agents-md"><img src="https://agentmods.dev/badge/instructions/pretend-to/mio-chat-backend/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 mio-chat-backend AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/pretend-to/mio-chat-backend/agents-md"><img src="https://agentmods.dev/badge/instructions/pretend-to/mio-chat-backend/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 5,949 This file is loaded in full into every session.
When invoked 5,949 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.05949 $0.05949
Opus 5.5 $0.02380 $0.02380
Sonnet 5.5 $0.01190 $0.01190
Haiku 4.5 $0.00595 $0.00595

Measured 1mo ago against content hash 460dcb349cb1, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

mio-chat-backend 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 1mo 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 · 281 lines

How it starts

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

AGENTS.md

本文件是 mio-chat-backend 的唯一权威 Agent 指南(人类协作者同样适用)。 CLAUDE.md 是指向本文件的软链接 —— 读 AGENTS.md 或 CLAUDE.md 的工具都能命中同一份内容。 本仓库配套前端仓库 mio-chat-frontend(本机通常在 ../mio-chat-frontend)。

项目定位

Mio-Chat 的后端,自称 "Agent OS":不只是 API 转发,而是带 Hook 拦截、三层插件体系、真实终端桥接的 Agent 运行环境。

作者自用的个人项目,仍在开发阶段,没有外部用户。由此推出三条工作原则:

  • 数据结构可以直接改到对的形态,不必为兼容旧数据写迁移分支(真需要迁移时走 lib/migration/,启动时自动检测执行)。
  • CI 只构建 Docker 镜像,不卡合并。主干是 dev;本地另有 master / production 作为发布分支,不主动合并。
  • 有测试但覆盖不全,不要假设改动会被测试拦住。

红线(动手前先读这一节)

  1. 数据库路径唯一:<cwd>/data/app.db,由 lib/database/databasePath.js 解析。不存在环境变量覆盖,也不要再加 —— 历史上"测试写进真库"就是路径不唯一造成的。
  2. 破坏性 schema 变更必须写成迁移,而不是靠 db push:放 lib/migration/schema/*.js(幂等 + 事务 + 行数校验 + 记账 _schema_migrations + 自动备份)。启动流程会用 findDestructiveSchemaChanges() 拦停破坏性 diff,assertDatabaseIntact() 拒绝在库缺失时静默建空库。纯增量(新表 / 可空列 / 索引)才允许自动 push。
  3. 热重载边界:lib/**、channels/**、插件的 index.js 与 lib/** 不在插件热重载白名单里,改完必须重启进程(详见"插件与 Skill → 热重载范围")。
  4. 工具注册名 = <name>_mid_<schemaHash>(lib/function.js)。hash 的输入包含 description —— 改一句工具描述就会让存量配置里的该工具失效。详见"工具命名与权限"。
  5. OneBot 连接的唯一入口是 lib/chat/onebot/connectOnebot.js(启动 / 保存配置 / 手动重连都走它)。
  6. 不要提交 .env、data/*.db、凭据、运行期渠道数据。

命令

pnpm dev               # node --watch app.js,日志打到 stdout
pnpm start             # pm2 start ./config/pm2.json(生产)
pnpm lint / lint:fix   # oxlint
pnpm format            # prettier --write .

pnpm test:unit         # 单测:隔离 cwd + 真库一致副本(最常用)
pnpm test              # 完整套件(内部驱动 test:unit + 集成)
pnpm test:integration  # 只跑集成用例,需要服务跑在 http://localhost:3080
pnpm test:all          # 全部

pnpm db:push           # prisma db push(纯增量字段才用;破坏性变更走 lib/migration/schema/)
pnpm db:studio         # 可视化查看 data/app.db
pnpm docker:up / docker:down / docker:logs
  • 单测用 Node 内置 node --test,无第三方框架。适配器测试最全(每个 provider 一个文件),业务逻辑覆盖较薄。
  • 单测跑不到真库:scripts/utils/testIsolation.js 会换 cwd 并复制一份真库副本给测试进程。不要给单测进程注入 ADMIN_CODE / USER_CODE / NODE_ENV。
  • 已知失败:tests/adapters/image-url.test.js 的 2 个用例(GeminiAdapter base64、Image URL pre-processing),与你的改动无关时不要当回归信号。
  • 单测每个用例默认 60s 死线(TEST_TIMEOUT_MS=0 可关掉),并带 --test-force-exit:漏了 close 的定时器 / 长连接不会再让套件永生(曾见测试进程挂死 5 天;两个开关都在 scripts/utils/run-unit-tests.js)。目标参数可以是文件或目录(目录递归展开),但仍应给带定时器 / 长连接的测试在 t.after 里显式 close。

Read the full file on GitHub · 281 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. 1mo ago Changed · +1 lines · +28 tokens per session 460dcb349cb1
  2. 1mo ago First seen · 280 lines · 5,921 tokens per session scan A 574e22615944

Subscribe to this mod's changes

mio-chat-backend AGENTS.md is an instructions file published in the GitHub repository Pretend-to/mio-chat-backend (39 stars, last pushed 2d ago), licensed MIT. It adds 5,949 tokens to every session, about $0.0238 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-24.

Related

Other instructions, from other repositories

plan-forge caching.instructions.md

Caching patterns for .NET — IDistributedCache, Redis, in-memory, cache-aside, TTL strategies.

srnichols/plan-forge · 733 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 · 9,715 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,461 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,750 tokens