Borrowing it
Nothing to install: this file belongs to lucky-aeon/AgentX. 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/lucky-aeon/AgentX/master/.claude/commands/RAG快照机制完善需求文档.mdgit clone --depth 1 https://github.com/lucky-aeon/AgentXWrote 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/commands/lucky-aeon/agentx/rag)<a href="https://agentmods.dev/commands/lucky-aeon/agentx/rag"><img src="https://agentmods.dev/badge/commands/lucky-aeon/agentx/rag/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/commands/lucky-aeon/agentx/rag"><img src="https://agentmods.dev/badge/commands/lucky-aeon/agentx/rag.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.00000 | $0.02099 |
| Opus 5.5 | $0.00000 | $0.00840 |
| Sonnet 5.5 | $0.00000 | $0.00420 |
| Haiku 4.5 | $0.00000 | $0.00210 |
Grade A, and why
RAG快照机制完善需求文档 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 2mo 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 — 204 lines — stays where its author put it; the contents beside it link to each section on GitHub.
RAG快照机制完善需求文档
业务背景
RAG系统架构概述
AgentX的RAG(知识库)系统采用分层发布机制:
- 原始RAG数据集:用户创建和维护的工作数据,可随时修改
- 版本快照:发布到市场的固化版本,内容不可变
- 用户安装快照:用户从市场安装的个人副本,完全隔离
版本管理机制
- 用户创建RAG后自动生成0.0.1版本(REFERENCE类型),仅创建者可见
- 用户可发布RAG版本到市场(1.0.0、1.1.0等),生成SNAPSHOT类型的快照
- 其他用户只能看到和安装已发布的SNAPSHOT版本
- 0.0.1版本永远不会被其他用户安装
安装类型说明
REFERENCE类型(引用类型):
- 仅用于用户自己创建的RAG的0.0.1版本
- 动态引用原始RAG数据,随原始数据变化而更新
- 用户修改原始RAG时,对应的0.0.1版本安装记录也会同步更新
SNAPSHOT类型(快照类型):
- 用于所有发布版本和他人安装的版本
- 完全独立的数据副本,与原始RAG隔离
- 安装后内容固定,不会因原始RAG变化而改变
当前问题分析
1. 快照数据不完整
目前的快照机制只复制了基本信息(name、description、icon),但缺少:
- 文件数据的完整快照
- 文档单元的完整快照
- 相关配置和元数据的快照
2. 数据访问逻辑混乱
在查看已安装RAG信息时:
- REFERENCE类型应该显示原始RAG的实时信息
- SNAPSHOT类型应该显示快照数据
- 但当前实现中都从
rag_versions表获取信息,违背了快照原则
3. 快照服务未完善
RagDataAccessService中的快照方法大多返回空列表,未实现真正的快照数据获取。
需要修改的代码模块
1. 数据模型扩展
UserRagDTO (/AgentX/src/main/java/org/xhy/application/rag/dto/UserRagDTO.java)
修改内容:
- 添加
installType字段 - 添加
isReferenceType()和isSnapshotType()判断方法
UserRagEntity 相关表结构
确认字段:
install_type字段已存在- 快照数据字段(name、description、icon等)已存在
2. 快照创建机制
RagPublishAppService (/AgentX/src/main/java/org/xhy/application/rag/RagPublishAppService.java)
需要完善的功能:
- 发布版本时创建完整快照
- 复制所有文件到
rag_version_files表 - 复制所有文档单元到
rag_version_documents表 - 复制相关配置和元数据
RagVersionDomainService (/AgentX/src/main/java/org/xhy/domain/rag/service/RagVersionDomainService.java)
需要添加的方法:
createCompleteSnapshot()- 创建完整版本快照copyFilesToVersion()- 复制文件快照copyDocumentsToVersion()- 复制文档快照
3. 快照安装机制
UserRagDomainService (/AgentX/src/main/java/org/xhy/domain/rag/service/UserRagDomainService.java)
需要完善的方法:
installRag()- 安装SNAPSHOT类型时创建用户专属快照- 添加快照数据复制逻辑
新增服务类建议
UserRagSnapshotService:
- 专门处理用户级别的快照创建和管理
createUserSnapshot()- 为用户创建专属快照copySnapshotToUser()- 从版本快照复制到用户快照
4. 数据访问优化
RagDataAccessService (/AgentX/src/main/java/org/xhy/domain/rag/service/RagDataAccessService.java)
需要完善的方法:
// 当前返回空列表,需要实现
private List<FileDetailEntity> getSnapshotFiles(String versionId)
private List<DocumentUnitEntity> getSnapshotDocuments(String versionId)
private List<DocumentUnitEntity> getSnapshotDocumentsByOriginalFile(String versionId, String originalFileId)
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.
- 2mo ago First seen · 204 lines · 0 tokens per session scan A 017bb1e29057
RAG快照机制完善需求文档 is a command published in the GitHub repository lucky-aeon/AgentX (850 stars, last pushed 4mo ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 2,099 tokens. 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.
RAG快照机制完善需求文档 compared with commands from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| RAG快照机制完善需求文档lucky-aeon/AgentX | Command | 850 | 4mo ago | Apache-2.0 | A | 0 | Claude Code |
| queryingupstash/redis-js | Command | 983 | yesterday | MIT | A | 0 | Claude Code |
| ingestGalbaz1/video-research-mcp | Command | 23 | 6d ago | MIT | A | 10 | Claude Code |
| agentget-convex/convex-agent-plugins | Command | 117 | 24d ago | MIT | A | 21 | Claude Code, Cursor |
| proofragunshDee/proofrag | Command | 2 | 6d ago | MIT | A | 22 | Claude Code |
| inference.embedstratalab/strata-core | Command | 5 | 1mo ago | Apache-2.0 | A | 0 | Claude Code |
| vector.batch_existsstratalab/strata-core | Command | 5 | 1mo ago | Apache-2.0 | A | 0 | Claude Code |