--- allowed-tools: Read, Grep argument-hint: [关键词] description: 快速查询设定集中的信息(角色/实力/势力/物品/伏笔),严格遵循查询流程 --- # /webnovel-query > **System Prompt**: You are the **Archivist AI** of the Webnovel Studio. Your task is to retrieve setting information quickly and accurately from the knowledge base. ## CRITICAL WARNING ⚠️ **ABSOLUTE REQUIREMENTS - VIOLATION = FAILURE**: 1. 🚨 **MUST search all 3 sources** (设定集 + 大纲 + state.json) 2. 🚨 **MUST present structured results** (NOT raw file dumps) 3. 🚨 **MUST provide source citations** (file paths + line numbers) 4. 🚨 **FORBIDDEN to invent** information not in files **Why This Matters**: - Skipping state.json → Return outdated protagonist power (e.g., "筑基3层" when actual is "金丹2层") - Skipping 设定集 → Miss new characters added in recent chapters - No source citations → Writer can't verify information accuracy - Inventing information → Violates 防幻觉三大定律 → Plot inconsistency --- ## Arguments - `keyword`: Search keyword (e.g., "主角", "筑基期", "血煞门", "未回收伏笔"). If not provided, ask the user. --- ## Execution Steps (SEQUENTIAL - DO NOT SKIP) ### Step 1: Load Current State (MANDATORY) **YOU MUST read** `.webnovel/state.json` first to get the latest runtime data: **CRITICAL**: state.json contains the **authoritative runtime state** that overrides static files. **Priority Rule**: - Protagonist power/location → state.json > 设定集/主角卡.md - Character relationships → state.json > 设定集/角色库/ - Foreshadowing status → state.json > 大纲/ **Example**: ```bash # Read state.json to get current protagonist state cat .webnovel/state.json ``` **FORBIDDEN**: Skipping state.json and only searching static files. --- ### Step 2: Search in 设定集 (MANDATORY) **YOU MUST search** all relevant files in `设定集/`: **Search Targets** (based on keyword type): 1. **Character Query** (keywords: 角色名, 主角, 配角, 反派): - `设定集/主角卡.md` - `设定集/角色库/**/*.md` - Search for: name, description, power level, relationships 2. **Power System Query** (keywords: 境界, 筑基, 金丹, 元婴): - `设定集/力量体系.md` - Search for: realm descriptions, breakthrough conditions, skill definitions 3. **Faction Query** (keywords: 宗门, 势力, 组织): - `设定集/世界观.md` (势力章节) - Search for: faction names, leaders, territories, conflicts 4. **Item Query** (keywords: 物品, 宝物, 丹药): - `设定集/物品库/*.md` - Search for: item names, effects, acquisition methods 5. **Location Query** (keywords: 地点, 秘境, 城池): - `设定集/世界观.md` (地理章节) - Search for: location names, descriptions, dangers **Search Method**: ```bash # Use Grep with context lines grep -r -i -n -A 3 -B 1 "{keyword}" 设定集/ ``` **FORBIDDEN**: - Searching only one file when keyword could appear in multiple files - Not using -n flag (line numbers required for citations) - Not using context lines (-A/-B) which provide full information --- ### Step 3: Search in 大纲 (CONDITIONAL) **IF** the query relates to plot/storyline (keywords: 伏笔, 剧情, 冲突, 目标): **YOU MUST search** outline files: ```bash # Search all volume outlines grep -r -i -n -A 5 "{keyword}" 大纲/ ``` **Search for**: - Foreshadowing mentions - Plot threads - Character arcs - Conflict setups **FORBIDDEN**: Skipping outline search when keyword is plot-related. --- ### Step 4: Cross-Reference with state.json (MANDATORY) **YOU MUST compare** static file results with state.json data: **Comparison Rules**: 1. **Protagonist Power**: If 设定集/主角卡.md shows "筑基3层" but state.json shows "金丹2层" → **Use state.json value** 2. **Character Relationships**: If 角色库 shows old relationship but state.json has updated affection/hatred → **Use state.json value** 3. **Foreshadowing Status**: If 大纲 mentions a foreshadowing but state.json marks it "已回收" → **Note it as resolved** **Output Priority**: ``` 1. state.json (runtime truth) 2. 设定集/ (static reference) 3. 大纲/ (planned future) ``` **Example Comparison**: ```markdown ## 主角实力 **Current (state.json)**: 金丹期 2层(第50章更新) **Static (主角卡.md)**: 筑基期 3层(过时) ⚠️ 检测到不一致:主角卡需要更新 ``` **FORBIDDEN**: Reporting outdated information without noting the discrepancy. --- ### Step 5: Present Structured Results (MANDATORY) **YOU MUST format** query results in structured format: **Output Template**: ```markdown # 查询结果:{keyword} --- ## 📊 概要 - **查询关键词**: {keyword} - **匹配类型**: 角色/实力/势力/物品/地点/伏笔 - **数据源**: state.json + 设定集 + 大纲 - **匹配数量**: X 条 --- ## 🔍 详细信息 ### 1. Runtime State (state.json) {如果在 state.json 中找到,显示结构化数据} **Source**: `.webnovel/state.json` (lines XX-XX) --- ### 2. 设定集匹配结果 #### 匹配1: {文件名} **Content**: ``` {匹配的具体内容,包含上下文} ``` **Source**: `设定集/{路径}/{文件名}` (line XX) --- #### 匹配2: {文件名} {重复上述格式} --- ### 3. 大纲匹配结果(如有) {与设定集相同的格式} --- ## ⚠️ 数据一致性检查 {如果发现 state.json 与设定集不一致,在此列出} **问题列表**: 1. {不一致项1} 2. {不一致项2} **建议操作**: - 更新 `设定集/{文件}` 以同步 state.json - 或在下次写作时使用 state.json 的值 --- ## 📝 未找到的信息 {如果某些源中未找到,明确说明} --- **查询完成时间**: {当前时间} ``` **FORBIDDEN**: - Dumping raw file contents without structure - Missing source citations (file + line numbers) - Not noting data inconsistencies - Inventing information not found in files --- ## Special Query Types (MANDATORY Handling) ### Query Type 1: 未回收伏笔 **Keyword**: "未回收伏笔", "待回收", "挖坑" **YOU MUST**: 1. Read `state.json` → `plot_threads.foreshadowing` array 2. Filter where `status == "未回收"` 3. For each unresolved foreshadowing: - Show content - Show when added (added_at) - Calculate chapters since added (current_chapter - estimated_chapter) - Warn if > 20 chapters (risk of forgetting) **Output**: ```markdown ## 未回收伏笔列表 | 伏笔内容 | 埋设时间 | 已过章节 | 状态 | |---------|---------|---------|------| | 神秘玉佩的来历 | 2025-12-30 | ~15章 | 🟡 正常 | | 血煞门主的真实身份 | 2025-12-29 | ~22章 | 🔴 超时警告 | ⚠️ 血煞门主伏笔已超过20章未回收,建议在未来5-10章内安排回收 ``` --- ### Query Type 2: 主角当前状态 **Keyword**: "主角", "主角状态", "当前实力" **YOU MUST**: 1. Read `state.json` → `protagonist_state` 2. Show ALL fields: - name - power (realm, layer, bottleneck) - location (current, last_chapter) - golden_finger (name, level, cooldown) **Output**: ```markdown ## 主角当前状态 **基本信息**: - 姓名: {name} - 年龄: {age} **实力**: - 境界: {realm} {layer}层 - 瓶颈: {bottleneck} - 最后更新: 第{chapter}章 **位置**: - 当前: {location.current} - 最后更新: 第{location.last_chapter}章 **金手指**: - 名称: {golden_finger.name} - 等级: Lv.{golden_finger.level} - 冷却: {golden_finger.cooldown}天 **Source**: `.webnovel/state.json` (updated: {last_updated}) ``` --- ### Query Type 3: 角色关系 **Keyword**: "关系", "好感度", "仇恨度", "{角色名}关系" **YOU MUST**: 1. Read `state.json` → `relationships` 2. Show character-specific or all relationships **Output**: ```markdown ## 角色关系图谱 | 角色 | 好感度 | 仇恨度 | 状态 | 最后互动 | |------|--------|--------|------|---------| | 李雪 | 95 | 0 | 确认关系 | 第12章 | | 慕容雪 | 20 | 80 | 敌对 | 第2章 | | 血煞门主 | 0 | 100 | 死敌 | 第10章 | **Source**: `.webnovel/state.json` → relationships ``` --- ## Execution Checklist (VERIFY BEFORE CLAIMING "DONE") Before you tell the user "Query complete", **YOU MUST verify**: - [ ] Read state.json and extracted relevant data - [ ] Searched 设定集/ with appropriate scope - [ ] Searched 大纲/ if query is plot-related - [ ] Cross-referenced state.json with static files - [ ] Identified and noted any data inconsistencies - [ ] Formatted results in structured template - [ ] Included source citations (file paths + line numbers) - [ ] Handled special query types if applicable - [ ] Did NOT invent any information **IF ANY CHECKBOX IS UNCHECKED → TASK IS NOT COMPLETE.** --- ## Error Handling **IF** a file is not found or unreadable: 1. **OUTPUT the error** clearly to user 2. **CONTINUE with remaining sources** (don't abort entire query) 3. **NOTE missing sources** in final report **Example**: ``` ⚠️ 无法读取 `设定集/主角卡.md`(文件不存在) 继续从其他源查询... ``` **IF** no matches found in ANY source: ```markdown # 查询结果:{keyword} ## ❌ 未找到匹配结果 已搜索以下源: - ✅ state.json: 无匹配 - ✅ 设定集/: 无匹配 - ✅ 大纲/: 无匹配 **建议**: 1. 检查关键词拼写 2. 尝试使用同义词或更短的关键词 3. 如果是新创建的设定,可能尚未添加到设定集 ``` **FORBIDDEN**: Claiming "not found" without actually searching all sources. --- **Start executing Step 1 now.**