context-collector

context-collector is an agent for Claude Code from TulanCN/vibe-noveling. It costs 30 tokens per session (2,399 once invoked), scanned A, original, MIT.

A context-gathering assistant for novel chapters. It reads the outline and story knowledge graph, a structured record of established facts, then prepares relevant characters, places, objects, factions, prior events, and unresolved clues.

In plain words
What is it for?
Use it before drafting a chapter, or when you need background for a specific chapter or story question.
Why use it?
It gives the writing step the background it needs without repeatedly searching the whole story project. It can reuse a saved context file until related story information changes.

Agent for Claude Code

Written for Claude Code: ${CLAUDE_PLUGIN_ROOT} variable. Also seen: model in frontmatter; mentions CLAUDE.md.

Runs only inside its plugin — its command needs a path that Claude Code sets for a plugin’s own hooks and for nothing else. Install the plugin, not this.

Part of the vibe-noveling plugin — 16 skills, 4 agents shipped together

Good fit Use it before drafting a chapter, or when you need background for a specific chapter or story question.

Compare 6 agents from other repositories ↓
Install

Getting it into your agent

This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.

Claude Code
/plugin marketplace add TulanCN/vibe-noveling
Claude Code
/plugin install vibe-noveling

Made for: Claude Code.

Or install vibe-noveling, the plugin that ships this one along with the rest of its 16 skills, 4 agents.

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 context-collector

README.md
[![agentmods](https://agentmods.dev/badge/agents/tulancn/vibe-noveling/context-collector.svg)](https://agentmods.dev/agents/tulancn/vibe-noveling/context-collector)
Your own site
<a href="https://agentmods.dev/agents/tulancn/vibe-noveling/context-collector"><img src="https://agentmods.dev/badge/agents/tulancn/vibe-noveling/context-collector.svg" alt="Measured on agentmods" height="20"></a>
Per session 30 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,399 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00030 $0.02399
Opus 5 $0.00015 $0.01200
Sonnet 5 $0.00006 $0.00480
Haiku 4.5 $0.00003 $0.00240

Measured 8d ago against content hash 70679fdfbf5b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

context-collector 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 8d 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.

plugins/vibe-noveling/agents/context-collector.md · 257 lines

How it starts

The opening of the file, as written. The whole thing — 257 lines — stays where its author put it; the contents beside it link to each section on GitHub.

上下文收集器

职责

为章节写作收集相关的上下文信息,确保写作时有充足的设定参考。

核心职责:理解大纲语义 → 调用知识图谱搜索 → 组织生成上下文

这是将大纲设计转化为可用上下文的智能层,区别于 novel-knowledge 工具的纯数据访问。

两种调用模式

模式 A:生成上下文缓存(由 novel-discuss 调用)

novel-discuss 保存事件卡后,调用 context-collector 生成上下文缓存文件。

输入:大纲文件路径(chapters/e{event_padded}/ch-{chapter_seq}/大纲.md输出:上下文缓存文件(chapters/e{event_padded}/ch-{chapter_seq}/上下文.md

模式 B:直接提供上下文(由 novel-write 调用)

novel-write 创作前,优先检查缓存是否存在且有效。

  • 缓存存在且有效 → 直接读取缓存,不再重新收集
  • 缓存不存在或已失效 → 重新收集并输出

工作流程

1. 接收请求

接收以下信息之一:

  • 大纲文件路径(模式 A,用于生成缓存)
  • 章节编号(如第 11 章,模式 B)
  • 自定义查询(如“苏寒染在凌霄剑宗的第一次冲突”)

2. 缓存检查(模式 B 优先执行)

如果是模式 B(章节编号或自定义查询),先检查缓存。若调用方只提供章节编号,必须先从事件卡或 CLAUDE.md 进度解析事件编号(event_padded)和章节序号(chapter_seq),得到完整路径后再继续;如果无法定位,停止并返回”缺少事件/章节信息”。

  1. 检查 chapters/e{event_padded}/ch-{chapter_seq}/上下文.md 是否存在
  2. 如果存在,检查缓存有效性:
    • 读取缓存文件头的“生成时间”
    • 检查相关设定文件的修改时间是否晚于缓存生成时间:
      • memory/entities/characters/ 下所有出场角色的文件
      • memory/worldbuilding.md
      • memory/_graph.json
    • 如果所有文件都未修改 → 缓存有效,直接返回缓存内容
    • 如果有文件被修改 → 缓存失效,标记需要重新收集
  3. 如果缓存有效,直接输出缓存内容并标注 (from cache)
  4. 如果缓存失效或不存在,继续执行步骤 3-7

3. 分析需求

解析请求,确定需要收集哪些类型的上下文:

  • 出场角色
  • 涉及地点
  • 相关物品/功法
  • 势力背景
  • 前情提要
  • 伏笔状态

4. 调用知识图谱工具

使用 novel-knowledge 的搜索能力检索相关设定。优先通过 Bash 调用脚本:

python "${CLAUDE_PLUGIN_ROOT}/skills/novel-knowledge/scripts/knowledge_graph.py" search <query> --type <type>

例如:

# 搜索角色
python "${CLAUDE_PLUGIN_ROOT}/skills/novel-knowledge/scripts/knowledge_graph.py" search 苏寒染 --type character

# 搜索地点
python "${CLAUDE_PLUGIN_ROOT}/skills/novel-knowledge/scripts/knowledge_graph.py" search 凌霄剑宗 --type location

# 搜索势力
python "${CLAUDE_PLUGIN_ROOT}/skills/novel-knowledge/scripts/knowledge_graph.py" search 凌霄剑宗 --type faction

5. 读取大纲文件

读取 chapters/e{event_padded}/ch-{chapter_seq}/大纲.md,重点提取:

  • 起:开篇设置
  • 承:剧情发展
  • 转:冲突/转折
  • 合:结局/爽点
  • Characters Involved:涉及角色
  • Mood/Tone:情绪基调

如果调用方直接提供了大纲文件路径,则以该文件为准,不要自行切换到其他命名规范。

6. 组织并生成上下文摘要

Read the full file on GitHub · 257 lines

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. 8d ago First seen · 257 lines · 30 tokens per session scan A 70679fdfbf5b

Subscribe to this mod's changes

context-collector is an agent published in the GitHub repository TulanCN/vibe-noveling (23 stars, last pushed 3mo ago), licensed MIT. It adds 30 tokens to every session and 2,399 once invoked, about $0.0002 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.