SpecFusion AGENTS.md

SpecFusion AGENTS.md is an instructions file for Codex, OpenCode from wxkingstar/SpecFusion. It costs 717 tokens per session, scanned A, original, MIT.

A project instruction file for SpecFusion, a service that searches technical API documentation from multiple Chinese platforms.

In plain words
What is it for?
Use it when installing dependencies, starting the development API, syncing documentation, building the service, or working with its Node.js, SQLite, and scraper code.
Why use it?
It gives the coding agent the project layout, development commands, build process, deployment details, and database conventions in one place.

Instructions file for CodexOpenCode

Install

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.

agentmods
npx agentmods add instructions/wxkingstar/specfusion/agents-md
Clone the repo
git clone --depth 1 https://github.com/wxkingstar/SpecFusion

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

README.md
[![agentmods](https://agentmods.dev/badge/instructions/wxkingstar/specfusion/agents-md.svg)](https://agentmods.dev/instructions/wxkingstar/specfusion/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/wxkingstar/specfusion/agents-md"><img src="https://agentmods.dev/badge/instructions/wxkingstar/specfusion/agents-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 717 This file is loaded in full into every session.
When invoked 717 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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 $0.00717 $0.00717
Opus 5 $0.00358 $0.00358
Sonnet 5 $0.00143 $0.00143
Haiku 4.5 $0.00072 $0.00072

Measured 4d ago against content hash 5633c626f4b8, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

SpecFusion 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 4d 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 · 68 lines

What it actually says

SpecFusion

多源 API 文档融合搜索 Skill — 云端检索,零安装,即问即答

项目结构

SpecFusion/
├── api/            # API 服务(Fastify + SQLite)
├── scrapers/       # 文档抓取/同步脚本(仅本地使用,不部署到服务器)
├── scripts/        # 部署脚本
├── specfusion/     # Skill 文件(SKILL.md)
├── dsh-plugin/     # DeepSeek Harness 插件(@wxkingstar/specfusion-dsh)
├── data/           # SQLite 数据库(specfusion.db)
├── Makefile        # K8s 部署 + 全量同步命令(make help 查看)

开发命令

# 安装依赖
npm install

# 启动 API 服务(开发模式,热重载)
npm run dev

# 运行文档同步
npm run sync -- --source feishu

# 构建
npm run build

部署

支持 Docker 和 Kubernetes 部署,详见 README.md 中的自部署指南。

官网

官网代码目录:/Users/wangxin/work/node/specfusion-web,部署在 Vercel 上。

技术栈

  • API:Node.js + Fastify + better-sqlite3 + FTS5
  • 中文分词:nodejieba
  • Scraper:Node.js + TypeScript + cheerio + playwright
  • 构建:tsup + tsx

关键设计

  • 所有公开 API 返回 text/markdown 格式(非 JSON),health 端点除外返回 JSON
  • 中文搜索使用 jieba 预分词 + FTS5 unicode61
  • 数据库仅使用 SQLite,不引入其他存储
  • tsup 将 API 打包为单文件 dist/index.js,代码中用 resolve(__dirname, '../../db/schema.sql') 定位 schema,Docker 和旧 VPS 部署均通过 symlink 解决路径
  • 详细设计见 SPECFUSION_PLAN.md

数据库路径

项目统一使用 data/specfusion.db(项目根目录)。dev 服务和 K8s 部署共用同一个文件,scraper 同步后可直接上传,无需合并。

Playwright Scraper 编码规范

编写使用 Playwright 的 scraper 时,注意以下性能陷阱:

  • 禁止在循环中用高 timeout 的 click/waitFor 探测元素是否存在page.click('text=xxx', { timeout: 2000 }) 在元素不存在时会白等 2 秒。如果在每页导航后都尝试多次,累积开销巨大(N 页 × M 次 × timeout)。应只在首次加载时探测,或用 page.locator().count() 零等待判断
  • fetchContent 循环中用 domcontentloaded 而非 networkidle:SPA 页面可能有持续的后台请求导致 networkidle 永远等不到。正确做法是 waitUntil: 'domcontentloaded' + waitForSelector 等待目标内容出现
  • 单页面串行导航时,并发度必须设为 1:Playwright 同一 page 实例不能并行 goto
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. 4d ago First seen · 68 lines · 717 tokens per session scan A 5633c626f4b8

Subscribe to this mod's changes

SpecFusion AGENTS.md is an instructions file published in the GitHub repository wxkingstar/SpecFusion (59 stars, last pushed 13d ago), licensed MIT. It adds 717 tokens to every session, about $0.0036 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.