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.
npx agentmods add commands/lucky-aeon/agentx/rag-lifecycle-managementgit 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-lifecycle-management)<a href="https://agentmods.dev/commands/lucky-aeon/agentx/rag-lifecycle-management"><img src="https://agentmods.dev/badge/commands/lucky-aeon/agentx/rag-lifecycle-management.svg" alt="Measured on agentmods" 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 | $0.00000 | $0.02038 |
| Opus 5 | $0.00000 | $0.01019 |
| Sonnet 5 | $0.00000 | $0.00408 |
| Haiku 4.5 | $0.00000 | $0.00204 |
Grade A, and why
rag-lifecycle-management 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 5d 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 — 243 lines — stays where its author put it; the contents beside it link to each section on GitHub.
RAG生命周期管理重构方案
问题背景
当前RAG管理系统存在以下核心问题:
- 私有RAG使用困难:用户创建的RAG添加新文档后,需要重新发布并审核才能在Agent中使用最新数据
- 版本管理不灵活:每个版本需要单独安装,无法像工具市场一样在已安装RAG中切换版本
- 数据来源不统一:Agent需要从多个数据源获取RAG,增加了复杂度
解决方案
核心设计思路
引入动态引用机制,区分两种安装类型:
- REFERENCE类型:引用原始数据集,支持实时更新(用于私有RAG)
- SNAPSHOT类型:使用版本快照,内容固定(用于公开RAG)
版本管理模式
对标工具市场的版本管理:
- 安装RAG本身(而不是特定版本)
- 支持在已安装RAG中切换版本
- 统一从
user_rags表获取可用RAG
技术实施方案
1. 数据库表结构调整
user_rags表重新设计
ALTER TABLE user_rags ADD COLUMN original_rag_id VARCHAR(64) COMMENT '原始RAG数据集ID';
ALTER TABLE user_rags ADD COLUMN install_type VARCHAR(20) DEFAULT 'SNAPSHOT' COMMENT '安装类型:REFERENCE/SNAPSHOT';
ALTER TABLE user_rags ADD COLUMN current_version_id VARCHAR(64) COMMENT '当前选择的版本ID';
-- 为向后兼容,保留 rag_version_id 字段
-- 新增复合索引
CREATE INDEX idx_user_original_rag ON user_rags(user_id, original_rag_id);
CREATE INDEX idx_user_install_type ON user_rags(user_id, install_type);
安装类型枚举
REFERENCE:动态引用原始数据集,数据实时更新SNAPSHOT:使用版本快照数据,内容固定不变
2. 领域模型重构
新增InstallType枚举
public enum InstallType {
REFERENCE("REFERENCE", "引用类型"),
SNAPSHOT("SNAPSHOT", "快照类型");
}
UserRagEntity实体扩展
新增字段:
originalRagId:原始RAG数据集IDinstallType:安装类型currentVersionId:当前选择的版本ID
3. 核心业务逻辑重构
创建RAG时的自动安装
// RagQaDatasetAppService.createDataset()
1. 创建原始数据集
2. 创建0.0.1私有版本(用于版本管理)
3. 自动为创建者安装REFERENCE类型记录
- originalRagId: 数据集ID
- installType: REFERENCE
- currentVersionId: 0.0.1版本ID
RAG安装逻辑重构
// UserRagDomainService.installRag()
1. 检查是否已安装同一个RAG(按originalRagId检查)
2. 如果已安装,则更新版本;如果未安装,则创建新记录
3. 自己的RAG:安装REFERENCE类型
4. 他人的RAG:安装SNAPSHOT类型
版本切换功能
// UserRagDomainService.switchRagVersion()
1. 验证用户是否已安装该RAG
2. 验证目标版本是否可用
3. 更新currentVersionId
4. 如果切换到私有版本,更新installType为REFERENCE
4. Agent集成机制
统一RAG数据获取
// RagDataService.getRagData()
根据installType决定数据来源:
- REFERENCE类型:从原始数据集表获取最新数据
- SNAPSHOT类型:从版本快照表获取固定数据
检索服务适配
// 检索时的数据路由
if (userRag.getInstallType() == REFERENCE) {
// 从 rag_qa_dataset, rag_files, rag_documents 表查询
return getRealTimeRagData(userRag.getOriginalRagId());
} else {
// 从 rag_version_files, rag_version_documents 表查询
return getSnapshotRagData(userRag.getCurrentVersionId());
}
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.
- 5d ago First seen · 243 lines · 0 tokens per session scan A 3c8e97232f53
rag-lifecycle-management is a command published in the GitHub repository lucky-aeon/AgentX (834 stars, last pushed 2mo ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 2,038 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.
Other commands, from other repositories
querying
Query documents from a search index using type-safe filters with support for pagination, sorting, field selection, scoring, and highlighting. Count matching documents efficiently without returning results.
agent-brain-index
Index documents for semantic search.
agent
Add an AI agent / RAG backend (@convex-dev/agent) to the Convex app.
ingest
Manually add knowledge to the Weaviate store.
web-ingest
Crawl the configured source and generate knowledge markdown files.
web-update
Re-ingest a URL or refresh a local knowledge file, then rebuild the search index.