ragflow / web
AGENTS.md92k starsChanged 9 months agoApache-2.0View on GitHub
This file provides guidance to Claude Code (claude.ai/code) when working with the RAGFlow frontend (web/). RAGFlow frontend is a React/TypeScript application built with Vite: When tests are grouped in a dedicated directory, that directory is always named __tests__/ — never tests/. Example: src/pages/agent/utils/__tests__/extractor-transform.test.ts for src/pages/agent/utils/extractor-transform.ts. Co-located foo.test.ts(x) files next to the source file are also fine. When you find an existing test under a tests/ directory, move it into __tests__/ (keep git history via git mv) rather than adding new…
- Installs packages
Adopted by
Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data
Who's talking about infiniflow/ragflow
- A Hacker News story“RAGFlow is an open-source RAG engine based on OCR and document parsing”Hacker News · Apr 1, 2024 · 230 points
- oceanbase/seekdb“Developer Activities: Call for Participation!”GitHub · Jan 21, 2026 · 7 reactions
- @github-trending-js.bsky.social“🚀 Skyrocketing! 🚀 (200+ new stars) 📦 infiniflow / ragflow ⭐ 38,526 (+438) 🗒 TypeScript RAGFlow is an …”Bluesky · Feb 21, 2025 · 7 likes
- A Hacker News story“DeepSeek-V2 integrated, RAGFlow v0.5.0 is released”Hacker News · May 8, 2024 · 7 points
- @github-trending.bsky.social“🔥 Hot Repo! 🔥 (100+ new stars) 📦 infiniflow / ragflow ⭐ 47,701 (+175) 🗒 TypeScript RAGFlow is an …”Bluesky · Apr 3, 2025 · 6 likes
The biggest 5 of 101 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 101
Talked about on GitHub, Bluesky and Hacker News (101 times).
On GitHub · 50
- Jan 21, 2026Developer Activities: Call for Participation! — oceanbase/seekdb7 reactions · 57 comments
- Aug 15, 2025Add and use the knowledge graph parameter use_kg to the RAGlow external API — langgenius/dify4 reactions · 1 comment
- Feb 10, 2025可否增加支持ragflow? — QuantumNous/new-api4 reactions · 4 comments
- Mar 3, 2025Suggestion: RAGflow — av/harbor2 reactions · 3 comments
- Sep 21, 2026【知识库】AI 知识库演进:从经典检索到 Agentic RAG — QingyaFan/blog1 reaction
45 more on GitHub
- Aug 12, 2026fix(api): point SSRF-blocked error message at the correct dify issue — langgenius/dify1 reaction · 1 comment
- Nov 28, 2025General Feedback re: self-hosting devops, image support, paper writing workflow — khoj-ai/openpaper1 reaction · 4 comments
- Aug 29, 2024What is the difference between kotaemon and other RAG apps? — Cinnamon/kotaemon1 reaction · 2 comments
- Nov 27, 2026RAG-CITE-01: Sentence-level citation grounding (T5) — jian-hong/AirGPT0 reactions
- Nov 27, 2026RAG-RR-01: Measure rerank, then add a RAGFlow-style blended score (T4) — jian-hong/AirGPT0 reactions
- Nov 27, 2026RAG-BENCH-17: CI-regenerate RAG benches and add a harder real-document pack (T1) — jian-hong/AirGPT0 reactions
- Nov 25, 2026Document handoff lookup from RAGFlow — ClickHouse/loom0 reactions · 1 comment
- Nov 12, 2026docs: adversarial falsification pass on PR #790/#791 (memory/KG/CC content) — qte77/ai-agents-research0 reactions
- Nov 10, 2026[Candidate]: ragflow (CLI) - RAGFlow is an agent-native database: a Retrieval-Augmented G — ns0m/scoop-bucket0 reactions · 1 comment
- Nov 7, 2026工具选择指南、三个可做完的作品、可合并的这一周 — superjackman/SI0 reactions
- Oct 29, 2026Add RAGFlow to RAG frameworks list — Danielskry/Awesome-RAG0 reactions
- Oct 29, 2026Add RAGFlow to Developer tools — steven2358/awesome-generative-ai0 reactions
- Oct 24, 2026test(real): 收官修正轮 —— M26 抗替身断言 + M27 口径改 PARTIAL — zzy1661/aip0 reactions
- Oct 24, 2026test(real): 重取 M26 真实证据并补齐 M27 两条真实失败模式 — zzy1661/aip0 reactions
- Oct 12, 2026Supported filetypes for bot service — crownshy/comhairle0 reactions · 2 comments
- Oct 1, 2026maxe no_ocr and pypdfium2 parameters available — docling-project/docling-serve0 reactions · 3 comments
- Sep 23, 2026AACR infiniflow__ragflow@f189316 — razorpaytest/ragflow0 reactions
- Sep 23, 2026AACR infiniflow__ragflow@a63caa1 — razorpaytest/ragflow0 reactions
- Sep 23, 2026AACR infiniflow__ragflow@7051234 — razorpaytest/ragflow0 reactions
- Sep 23, 2026AACR infiniflow__ragflow@2d06022 — razorpaytest/ragflow0 reactions
- Sep 20, 2026Unescape function does not handle escaped hyphen — infiniflow/infinity0 reactions · 1 comment
- Sep 2, 2026feat: integrate relationship-aware memory and specify Continuity — karolswdev/HoldSpeak0 reactions · 2 comments
- Aug 28, 2026Upstream bug: helm chart renders unquoted passwords — Secret rejected by API server, or silently corrupted — whg517/ragflow-helm-chart0 reactions
- Aug 15, 2026Developer Race — RAGFlow — Retrieval & Context Engine — 8x8org/.github0 reactions
- Aug 13, 2026docs: update CLAUDE.md — RJHuey73/ragflow0 reactions
- Jul 13, 2026fix(stt): close Fun-ASR stream responses — 77zane/ragflow0 reactions
- Jun 18, 2026Partner confirmation: infiniflow/ragflow — EvoLinkAI/EvoLinkAI.github.io0 reactions
- Jun 9, 2026[codex] feat: add MiMo LLM runtime and product diagnostics — cetshow/cn-graphrag-eval-opt0 reactions
- May 23, 2026feat: add ragflow template — Phala-Network/phala-cloud0 reactions · 2 comments
- May 7, 2026Update repo table — arran4/arran40 reactions
- Apr 26, 2026Update repo table — arran4/arran40 reactions
- Apr 4, 2026Update repo table — arran4/arran40 reactions
- Mar 27, 2026Fix match_text in fulltext — infiniflow/infinity0 reactions · 1 comment
- Mar 18, 2026ragflow 연계나 활용할 수 있을지 검토 — growthtime-pos/curator-desktop0 reactions
- Mar 11, 2026[Upstream #76] 知识图谱构建提供接入 ragflow api 的功能 — ivanzud/MiroFish0 reactions
- Feb 18, 2026Add API token management architecture and implementation plan — ferryhe/AI_actuarial_inforsearch0 reactions
- Jan 31, 2026feat: add Peewee ORM support for OceanBase as primary database (#12769) — NTLx/ragflow0 reactions · 2 comments
- Nov 5, 2025Would you please rebuild the latest version v0.21.1? — 0xgkd/ragflow-arm640 reactions
- Oct 14, 2025[feat] Add instrumentation for RAGFlow — alibaba/loongsuite-python0 reactions · 1 comment
- Sep 22, 2025Better integration with vector database / RAG? — Alibaba-NLP/DeepResearch0 reactions
- Aug 7, 2025List of possible future integrations (open-source projects) — CollegeNotesOrg/noteparser0 reactions
- Feb 10, 2025可否增加支持ragflow? — songquanpeng/one-api0 reactions
- Dec 16, 2024Fixed fst_len in DictionaryReader — infiniflow/infinity0 reactions
- Oct 26, 2024parse attachments — rsalmond/escribe-transparency0 reactions
- Sep 26, 2024Ability to upload documents manually when Silo Ingestor Loader Type == NONE — dRAGon-Okinawa/dRAGon0 reactions
On Bluesky · 46
- Feb 21, 2025🚀 Skyrocketing! 🚀 (200+ new stars) 📦 infiniflow / ragflow ⭐ 38,526 (+438) 🗒 TypeScript RAGFlow is an open-source RAG… — @github-trending-js.bsky.social7 likes and reposts
- Apr 3, 2025🔥 Hot Repo! 🔥 (100+ new stars) 📦 infiniflow / ragflow ⭐ 47,701 (+175) 🗒 TypeScript RAGFlow is an open-source RAG (Retrieval-Augmented… — @github-trending.bsky.social6 likes and reposts
- Feb 25, 2025🎉 Celebrating! 🎉 (500+ new stars) 📦 infiniflow / ragflow ⭐ 40,343 (+591) 🗒 TypeScript RAGFlow is an open-source RAG… — @github-trending-js.bsky.social5 likes and reposts · 1 reply
- Aug 29, 2026ragflow by @infiniflowai (⭐️ 89554) RAGFlow is a leading open-source Retrieval-Augmented Generation (RAG) engine that fuses cutting-edge… — @golangoss.bsky.social3 likes and reposts
- Mar 18, 2025🚀 Skyrocketing! 🚀 (200+ new stars) 📦 infiniflow / ragflow ⭐ 45,413 (+272) 🗒 TypeScript RAGFlow is an open-source RAG… — @github-trending-js.bsky.social3 likes and reposts
41 more on Bluesky
- Dec 23, 2024🚀 Exploring Retrieval-Augmented Generation? 🧠✨ Check out #RAGFlow for deep document understanding & powerful chunking, or give #PaperQA2… — @shihcheng.bsky.social3 likes and reposts
- Oct 8, 2026ragflow by @infiniflowai (⭐️ 91845) RAGFlow is a leading open-source Retrieval-Augmented Generation (RAG) engine that fuses cutting-edge… — @golangoss.bsky.social2 likes and reposts
- Aug 28, 2026ragflow by @infiniflowai (⭐️ 89492) RAGFlow is a leading open-source Retrieval-Augmented Generation (RAG) engine that fuses cutting-edge… — @golangoss.bsky.social2 likes and reposts
- Jul 29, 2026RAGFlow added checkpoint/resume to community extraction and entity resolution, the most expensive parts of GraphRAG indexing. When your… — @jeremymorgan.com2 likes and reposts
- Jul 6, 2026ragflow by @infiniflowai (⭐️ 84351) RAGFlow is a leading open-source Retrieval-Augmented Generation (RAG) engine that fuses cutting-edge… — @golangoss.bsky.social2 likes and reposts
- Sep 16, 2025🔥 Hot Repo! 🔥 (100+ new stars) 📦 infiniflow / ragflow ⭐ 64,392 (+116) 🗒 TypeScript RAGFlow is a leading open-source Retrieval-Augmented… — @github-trending-js.bsky.social2 likes and reposts
- Apr 2, 2025🔥 Hot Repo! 🔥 (100+ new stars) 📦 infiniflow / ragflow ⭐ 47,553 (+176) 🗒 TypeScript RAGFlow is an open-source RAG (Retrieval-Augmented… — @github-trending-js.bsky.social2 likes and reposts
- Jan 22, 2025🔥 Hot Repo! 🔥 (100+ new stars) 📦 infiniflow / ragflow ⭐ 29,108 (+199) 🗒 Python RAGFlow is an open-source RAG (Retrieval-Augmented… — @github-trending.bsky.social2 likes and reposts
- Apr 3, 2024🚀 Skyrocketing! 🚀 (200+ new stars) 📦 infiniflow / ragflow ⭐ 1,220 (+306) 🗒 Python RAGFlow is an open-source RAG (Retrieval-Augmented… — @github-trending.bsky.social2 likes and reposts · 1 reply
- Nov 22, 2026ragflow by @infiniflowai (⭐️ 94514) RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into… — @golangoss.bsky.social1 likes and repost
- Nov 6, 2026ragflow by @infiniflowai (⭐️ 93687) RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into… — @golangoss.bsky.social1 likes and repost
- Nov 2, 2026Context as Infrastructure: Knowledge Compilation for Retrieval in Agentic Systems with Harnesses Proposes knowledge compilation for agentic… — @reachsumit.com1 likes and repost
- Nov 1, 2026ragflow by @infiniflowai (⭐️ 93299) RAGFlow is a leading open-source Retrieval-Augmented Generation (RAG) engine that fuses cutting-edge… — @golangoss.bsky.social1 likes and repost
- Oct 8, 2026ragflow by @infiniflowai (⭐️ 91785) RAGFlow is a leading open-source Retrieval-Augmented Generation (RAG) engine that fuses cutting-edge… — @golangoss.bsky.social1 likes and repost
- Sep 27, 2026ragflow by @infiniflowai (⭐️ 91363) RAGFlow is a leading open-source Retrieval-Augmented Generation (RAG) engine that fuses cutting-edge… — @golangoss.bsky.social1 likes and repost
- Sep 21, 2026ragflow by @infiniflowai (⭐️ 91093) RAGFlow is a leading open-source Retrieval-Augmented Generation (RAG) engine that fuses cutting-edge… — @golangoss.bsky.social1 likes and repost
- Sep 6, 2026🚀 GitHub Intelligence Drop ragflow (Go • 🟢) ⭐ 90.1K → https://github.com/infiniflow/ragflow mermaid (TypeScript • 🟢) ⭐ 90.1K →… — @githubfeed.bsky.social1 likes and repost
- Sep 1, 2026ragflow by @infiniflowai (⭐️ 89819) RAGFlow is a leading open-source Retrieval-Augmented Generation (RAG) engine that fuses cutting-edge… — @golangoss.bsky.social1 likes and repost
- Aug 22, 2026ragflow by @infiniflowai (⭐️ 89002) RAGFlow is a leading open-source Retrieval-Augmented Generation (RAG) engine that fuses cutting-edge… — @golangoss.bsky.social1 likes and repost
- Aug 13, 2026📦 infiniflow / ragflow ⭐ 87,371 (+85) 🗒 Go RAGFlow is a leading open-source Retrieval-Augmented Generation (RAG) engine that fuses… — @github-trending.bsky.social1 likes and repost
- Aug 9, 2026ragflow by @infiniflowai (⭐️ 87122) RAGFlow is a leading open-source Retrieval-Augmented Generation (RAG) engine that fuses cutting-edge… — @golangoss.bsky.social1 likes and repost
- Jul 4, 2026ragflow by @infiniflowai (⭐️ 84256) RAGFlow is a leading open-source Retrieval-Augmented Generation (RAG) engine that fuses cutting-edge… — @golangoss.bsky.social1 likes and repost
- Nov 5, 2025📦 infiniflow / ragflow ⭐ 67,121 (+75) 🗒 Python RAGFlow is a leading open-source Retrieval-Augmented Generation (RAG) engine that fuses… — @github-trending-js.bsky.social1 likes and repost
- Oct 23, 2025📦 infiniflow / ragflow ⭐ 66,393 (+59) 🗒 TypeScript RAGFlow is a leading open-source Retrieval-Augmented Generation (RAG) engine that… — @github-trending-js.bsky.social1 likes and repost
- Oct 18, 2025📦 infiniflow / ragflow ⭐ 66,169 (+62) 🗒 TypeScript RAGFlow is a leading open-source Retrieval-Augmented Generation (RAG) engine that… — @github-trending-js.bsky.social1 likes and repost
- Oct 12, 2025For the RAG I’m using RAGFlow. github.com/infiniflow/r... — @radicalkjax.com1 likes and repost · 1 reply
- Oct 10, 2025📦 infiniflow / ragflow ⭐ 65,697 (+55) 🗒 TypeScript RAGFlow is a leading open-source Retrieval-Augmented Generation (RAG) engine that… — @github-trending-js.bsky.social1 likes and repost
- Sep 11, 2025📦 infiniflow / ragflow ⭐ 64,071 (+94) 🗒 TypeScript RAGFlow is a leading open-source Retrieval-Augmented Generation (RAG) engine that… — @github-trending-js.bsky.social1 likes and repost
- May 27, 2025🔥 Hot Repo! 🔥 (100+ new stars) 📦 infiniflow / ragflow ⭐ 53,677 (+140) 🗒 TypeScript RAGFlow is an open-source RAG (Retrieval-Augmented… — @github-trending-js.bsky.social1 likes and repost
- May 13, 2025🔥 Hot Repo! 🔥 (100+ new stars) 📦 infiniflow / ragflow ⭐ 52,149 (+150) 🗒 TypeScript RAGFlow is an open-source RAG (Retrieval-Augmented… — @github-trending-js.bsky.social1 likes and repost
- Feb 22, 2025https://github.com/infiniflow/ragflow — @tom-doerr.bsky.social1 likes and repost
- Feb 12, 2025🎉 Celebrating! 🎉 (500+ new stars) 📦 infiniflow / ragflow ⭐ 34,930 (+619) 🗒 Python RAGFlow is an open-source RAG (Retrieval-Augmented… — @github-trending.bsky.social1 likes and repost · 1 reply
- Feb 7, 2025🚀 Skyrocketing! 🚀 (200+ new stars) 📦 infiniflow / ragflow ⭐ 32,031 (+428) 🗒 Python RAGFlow is an open-source RAG (Retrieval-Augmented… — @github-trending.bsky.social1 likes and repost
- Apr 9, 2024RAGFlow is an #opensource #RAG (Retrieval-Augmented Generation) engine based on deep document understanding. It offers a streamlined RAG… — @michabbb.bsky.social1 likes and repost · 1 reply
- Apr 1, 2024RAGFlow is an open-source RAG engine based on OCR and document parsing (@github.com) Main Link | Discussion — @newsycombinator.bsky.social1 likes and repost
- Sep 15, 2025Github Repo → github.com/infiniflow/... — @arindam-1729.bsky.social0 likes and reposts · 1 reply
- Jun 17, 2025🎉 Celebrating! 🎉 (500+ new stars) 📦 infiniflow / ragflow ⭐ 56,103 (+770) 🗒 Python RAGFlow is an open-source RAG (Retrieval-Augmented… — @github-trending.bsky.social0 likes and reposts · 1 reply
- Oct 24, 2024🔥 Hot Repo! 🔥 (100+ new stars) 📦 infiniflow / ragflow ⭐ 20,436 (+130) 🗒 Python RAGFlow is an open-source RAG (Retrieval-Augmented… — @github-trending.bsky.social0 likes and reposts · 1 reply
- Aug 17, 2024🔥 Hot Repo! 🔥 (100+ new stars) 📦 infiniflow / ragflow ⭐ 14,329 (+163) 🗒 Python RAGFlow is an open-source RAG (Retrieval-Augmented… — @github-trending.bsky.social0 likes and reposts · 1 reply
- Jul 12, 2024🔥 Hot Repo! 🔥 (100+ new stars) 📦 infiniflow / ragflow ⭐ 11,826 (+144) 🗒 Python RAGFlow is an open-source RAG (Retrieval-Augmented… — @github-trending.bsky.social0 likes and reposts · 1 reply
- May 9, 2024🔥 Hot Repo! 🔥 (100+ new stars) 📦 infiniflow / ragflow ⭐ 6,882 (+172) 🗒 Python RAGFlow is an open-source RAG (Retrieval-Augmented… — @github-trending.bsky.social0 likes and reposts · 1 reply
On Hacker News · 5
- Apr 1, 2024RAGFlow is an open-source RAG engine based on OCR and document parsing230 points · 53 comments
- May 8, 2024DeepSeek-V2 integrated, RAGFlow v0.5.0 is released7 points
- Aug 6, 2024RAGFlow 0.9 is released to support GraphRAG end-to-end3 points
- Mar 9, 2026Ragflow: fuses RAG with Agent capabilities to create context layer for LLMs2 points
- May 30, 2024Integrated Rerankers, implemented RAPTOR, RAGFlow 0.7 released2 points
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository3 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- go-namingSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
17 rules. About 0 are common, 5 are distinctive, and 12 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
12
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 36
Do not reintroduce backend-variant primitives or detection helpers (e.g.
- Very specific: line 40
When fixing CSS/layout issues (especially flex truncation, ellipsis, or element sizing), always inspect the full parent hierarchy for …
- Distinctive: line 42
Before editing, explain: (1) the full flex/container hierarchy from the target element up to the nearest non-flex ancestor, (2) what …
- Very specific: line 66
Never write raw
queryKeyarrays inline: Always use a query key factory object that returns as const tuples. - Very specific: line 85
Place the factory in the same file as the hooks, named {Domain}Keys (e.g., LlmKeys, DatasetKeys).
- Very specific: line 86
Every useQuery and every invalidateQueries must reference the same factory function.
- Very specific: line 87
Use as const on each factory return value for type-safe readonly tuples.
- Distinctive: line 99
Do not hoist child-view queries into the page component — it fires requests the user may never need (e.g., fetching the skill tree on page …
- Very specific: line 100
Do not thread enabled flags or view-mode props through hooks to gate a hoisted query.
- Very specific: line 123
If a component does not meet requirements, wrap or compose it in a new component outside src/components/ui/ (e.g., under src/components/ or …
- Distinctive: line 133
Use PascalCase for constants and component names.
- Very specific: line 136
Avoid camelCase or SCREAMING_SNAKE_CASE for components and top-level constants.
- Distinctive: line 138
Avoid duplicating component structures in JSX.
- Very specific: line 142
Time/date handling: Use dayjs for all date/time formatting, parsing, and manipulation.
- Very specific: line 143
Utility hooks: Prefer ahooks for common reusable hooks (e.g., useDebounce, useSetState).
- Distinctive: line 145
Project utilities first: Before reaching for a third-party library, check if the project already has an existing utility or hook that …
- Very specific: line 146
Extract and share: If repeated logic cannot be satisfied by an existing project utility or a third-party library, extract it into an …
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
This file provides guidance to Claude Code (claude.ai/code) when working with the RAGFlow frontend (web/).
Project Overview
RAGFlow frontend is a React/TypeScript application built with Vite:
- Components: shadcn/ui
- Styling: Tailwind CSS
- State: Zustand
- Data Fetching: TanStack Query (React Query)
- i18n: react-i18next
Common Commands
npm install
npm run dev # Development server
npm run build # Production build
npm run lint # oxlint
npm run format # oxfmt
npm run test # Jest testsDevelopment Conventions
Test File Placement
When tests are grouped in a dedicated directory, that directory is always named __tests__/ — never tests/. Example: src/pages/agent/utils/__tests__/extractor-transform.test.ts for src/pages/agent/utils/extractor-transform.ts. Co-located foo.test.ts(x) files next to the source file are also fine. When you find an existing test under a tests/ directory, move it into __tests__/ (keep git history via git mv) rather than adding new tests there.
Backend Conventions
The frontend serves only the Go backend. There is no runtime backend detection and no per-backend branching in app code; the dev server proxies /api and /v1 to the Go API (vite.config.ts).
Do not reintroduce backend-variant primitives or detection helpers (e.g. a useIsGoBackend hook, pickByBackend, <BackendVariant>, or an /api/v1/language probe) and do not create go/-vs-python/ variant directories or files.
CSS and Layout Debugging
When fixing CSS/layout issues (especially flex truncation, ellipsis, or element sizing), always inspect the full parent hierarchy for flex-shrink, min-width, and overflow constraints before applying fixes like min-w-0. Do not repeatedly apply the same fix without verifying the root cause.
- Before editing, explain: (1) the full flex/container hierarchy from the target element up to the nearest non-flex ancestor, (2) what constraint is actually causing the bug, and (3) how the proposed fix addresses that root cause.
Color Tokens
When writing or modifying styles, use the project-defined color tokens from src/tailwind.css (e.g., bg-bg-base, text-text-primary, text-text-secondary, text-text-disabled, border-border-button, bg-bg-card). Do not use arbitrary hex/RGB values or Tailwind's default palette colors (e.g., emerald-500, blue-400) directly in component class names. These tokens are defined for both light and dark modes and keep the UI consistent with the design system.
Scope and Boundaries
Respect explicit boundaries from the user. If the user says "only fix the selected line" or "do not touch shared types/files", follow that instruction exactly. Do not investigate unrelated errors, modify shared schemas (e.g., LlmSettingFieldSchema), or refactor other files without confirmation. If a change outside the described scope seems necessary, ask for permission first.
Internationalization (i18n)
For translation tasks, add keys only to the explicitly requested language files (commonly src/locales/zh.ts and src/locales/en.ts). Do not auto-propagate changes to all language files unless the user explicitly asks.
- Style for
en.ts: Sentence case — first word capitalized, rest lowercase (e.g.,referenceAnswer: 'Reference answer'). Proper nouns remain as-is.
React Component Refactoring
When refactoring or extracting components, verify layout behavior after each structural change (especially flex-1, conditional rendering, or flex direction changes). Check that existing buttons, alignment, and responsive behavior remain intact. After extraction, verify: (1) all original props and behavior are preserved, (2) layout in parent contexts is identical, and (3) no syntax or type errors were introduced.
State Management and Data Fetching
Query Key Factory (Mandatory)
Never write raw queryKey arrays inline. Always use a query key factory object that returns as const tuples. Raw arrays duplicated across useQuery and invalidateQueries are brittle, unreadable, and cause stale-cache bugs when key structures drift.
// ❌ Bad — raw array, hard to match with useQuery
queryClient.invalidateQueries({
queryKey: [
LLMApiAction.AddedProviders,
params.provider_name,
params.instance_name,
'models',
],
});
// ✅ Good — factory reference, self-documenting
queryClient.invalidateQueries({
queryKey: LlmKeys.instanceModels(params.provider_name, params.instance_name),
});- Place the factory in the same file as the hooks, named
{Domain}Keys(e.g.,LlmKeys,DatasetKeys). - Every
useQueryand everyinvalidateQueriesmust reference the same factory function. - Use
as conston each factory return value for type-safe readonly tuples.
Cache Debugging
For React Query / cache invalidation bugs, carefully compare query keys across all consuming components and mutation hooks. Mismatched keys (e.g., with/without refreshCount) are a common root cause of stale data or duplicate requests.
- Systematically: (1) list every component/hook that calls
useQueryfor this data, (2) compare their query keys character-for-character, (3) check every mutation'sonSuccessfor cache invalidation, and (4) verify no parent re-renders are remounting the observer.
Colocate Queries with the Consuming View
Fire a query in the component that renders its data — not in a parent page. When a page switches between mutually exclusive views (tabs, view modes), extract each view into its own component that issues its own requests on mount. Conditional rendering then provides lazy loading for free.
- Do not hoist child-view queries into the page component — it fires requests the user may never need (e.g., fetching the skill tree on page entry while the default view is the LLM wiki).
- Do not thread
enabledflags or view-mode props through hooks to gate a hoisted query; that is a sign the query lives at the wrong level. Split the view instead. - Remember the trade-off: with
gcTime: 0, unmounting a view drops its cache, so switching back refetches. That is usually desirable for always-fresh data — do not reintroduce eager hoisting just to avoid the refetch.
Network Request Layering
HTTP requests are organized in three layers. Never import @/utils/request, @/utils/next-request, or @/utils/api directly inside a hook:
src/hooks/use-xx-request.ts(x)— React Query hooks; only call the service layer.src/services/xx-service.ts— Register endpoints viaregisterNextServer, all going through@/utils/next-request.src/utils/next-request.ts— The single axios instance; handles token, 401 redirects, and error notifications.
Interface types are split between two folders:
- Response/data shape →
src/interfaces/database/xx.ts - Request params/body →
src/interfaces/request/xx.ts
Model-related endpoints (LLM provider / factory / my LLM, etc.) are consolidated in src/services/llm-service.ts rather than scattered across hooks. For GET endpoints, register with method: 'get' in the service, and on the call site pass true as the second argument to use the native axios config (e.g., service.listProviders({ params: { available: true } }, true)).
Shared UI Component Lock
The folder src/components/ui/ is the project's shared UI library — it contains both official shadcn/ui primitives and project-authored common components built on top of shadcn. Both kinds are intended to be reused across the app and must not be modified casually.
- Do not modify, refactor, restyle, or "improve" any file under
src/components/ui/(including subfolders), even if it seems like the most direct fix. - If a component does not meet requirements, wrap or compose it in a new component outside
src/components/ui/(e.g., undersrc/components/or a feature folder), and customize viaclassName,props, or composition. - Exceptions require explicit user approval in the same conversation. When in doubt, ask first and propose a wrapper-based alternative.
- Adding a new shared component to
src/components/ui/, or upgrading a shadcn primitive via the officialshadcnCLI, is allowed only when the user explicitly requests it.
React Patterns and Conventions
- Avoid inline event handlers. Do not define arrow functions directly on JSX event props like
onClick={() => ...}oronChange={(e) => ...}. Instead, extract the handler and reference it by name (e.g.,onClick={handleClick}). Inline handlers are recreated on every render, which can breakReact.memooptimizations and make stack traces harder to read. - Prefer
requestAnimationFrameoruseLayoutEffectoversetTimeout(..., 0)for focus or DOM measurement operations. - Prefer
useTranslationfromreact-i18nextover project-wrapped utilities likeuseTranslate. - Extract complex logic into hooks or utils; keep components lean.
- Use PascalCase for constants and component names.
- Components:
EditableTextarea,RAGFlowFormItem - Constants:
InitialMockData,DefaultPlaceholder
- Components:
- Avoid camelCase or SCREAMING_SNAKE_CASE for components and top-level constants.
- Name things semantically, not generically. A name should say what the value holds or what the callback does, so call sites read naturally. Don't leak a generic underlying-primitive API into your own component's public props — rename at the wrapper boundary (e.g., a tabs wrapper exposes
activeTab/onTabChange, mapped internally to Radix'svalue/onValueChange), and align with what callers already name the state. Same for variables and functions:hiddenNodeIdsovernodeIdSet,pickByBackendoverresolveVariant. - Avoid duplicating component structures in JSX; favor render props or reusable components.
Utility Libraries and Reuse
- Time/date handling: Use
dayjsfor all date/time formatting, parsing, and manipulation. - Utility hooks: Prefer
ahooksfor common reusable hooks (e.g.,useDebounce,useSetState). - General utilities: Lodash is available for utility functions when needed.
- Project utilities first: Before reaching for a third-party library, check if the project already has an existing utility or hook that covers the need.
- Extract and share: If repeated logic cannot be satisfied by an existing project utility or a third-party library, extract it into an appropriate shared hook (
src/hooks/) or utility file (src/utils/). - Check for duplicate patterns before adding: When asked to add logic (validation, existence checks, API calls, etc.), first search for existing hooks/functions that do the same or similar thing — especially in the same file or sibling hooks. If a hook already does X, call it instead of re-implementing X inline. This applies to mutations calling mutations, utility wrappers, and boilerplate around API calls.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

