init

A command that scans a project and creates or updates CLAUDE.md files: plain-language guidance documents for an AI coding assistant. It creates a short project-level overview and more detailed documents for individual modules.

In plain words
What is it for?
Use it to document a project’s structure, identify modules, generate Mermaid diagrams, and create navigation links between the guidance files.
Why use it?
It gives an AI assistant a structured map of the project without changing source code. It also records the modules, files, and scan coverage it found.

Command

Install

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.

agentmods
npx agentmods add commands/qinye6/pi-ccg/init
Clone the repo
git clone --depth 1 https://github.com/qinye6/pi-ccg
Per session 20 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 772 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 100% copy Near-identical to another mod 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 $0.00020 $0.00772
Opus 5 $0.00010 $0.00386
Sonnet 5 $0.00004 $0.00154
Haiku 4.5 $0.00002 $0.00077

Measured 2d ago against content hash 30c04306980e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

init 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 2d 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.

Origin

This is a copy

100% identical to init — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

templates/commands/init.md · 101 lines

What it actually says

Init - 初始化项目 AI 上下文

以「根级简明 + 模块级详尽」策略生成项目 AI 上下文文档。

使用方法

/init <项目摘要或名称>

上下文

  • 项目摘要:$ARGUMENTS
  • 生成/更新根级与模块级 CLAUDE.md
  • 自动生成 Mermaid 结构图和导航面包屑

你的角色

你是协调者,负责调用子智能体完成项目扫描与文档生成。


执行工作流

⚠️ 必须按以下步骤执行,使用 Task 工具调用子智能体

🕐 步骤 1:获取当前时间戳

必须首先调用 get-current-datetime 子智能体

Task({
  subagent_type: "get-current-datetime",
  prompt: "获取当前日期时间,用于文档时间戳",
  description: "获取当前时间"
})

等待返回时间戳后,保存为 $TIMESTAMP 供后续使用。

🏗️ 步骤 2:调用初始化架构师

使用 init-architect 子智能体执行完整扫描

Task({
  subagent_type: "init-architect",
  prompt: "扫描项目并生成 CLAUDE.md 文档。\n\n项目摘要:$ARGUMENTS\n当前时间戳:$TIMESTAMP\n工作目录:{{WORKDIR}}\n\n请执行:\n1. 阶段 A:全仓清点(文件统计、模块识别)\n2. 阶段 B:模块优先扫描(入口、接口、依赖、测试)\n3. 阶段 C:深度补捞(按需)\n4. 阶段 D:生成文档(根级 + 模块级 CLAUDE.md)\n\n输出覆盖率报告与推荐下一步。",
  description: "初始化项目文档"
})

📊 步骤 3:汇总结果

子智能体完成后,向用户展示:

## 初始化结果摘要

### 根级文档
- 状态:[创建/更新]
- 主要栏目:<列表>

### 模块识别
- 识别模块数:X
- 模块列表:
  1. <模块路径>
  2. ...

### 覆盖率
- 已扫描文件:X / Y
- 覆盖模块:X%
- 跳过原因:<如有>

### 生成内容
- ✅ Mermaid 结构图
- ✅ N 个模块导航面包屑

### 推荐下一步
- [ ] 补扫:<路径>

安全边界

  1. 只读/写文档 – 不改源代码
  2. 忽略生成物 – 跳过 node_modulesdist、二进制文件
  3. 增量更新 – 重复运行时做断点续扫

关键规则

  1. 必须使用 Task 工具调用子智能体,不要自己执行扫描逻辑
  2. 先调用 get-current-datetime 获取时间戳
  3. 再调用 init-architect 执行完整扫描
  4. 结果在主对话打印摘要,全文由子智能体写入仓库
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. 2d ago First seen · 101 lines · 20 tokens per session scan A 30c04306980e

Subscribe to this mod's changes

init is a command published in the GitHub repository qinye6/pi-ccg (10 stars, last pushed 8d ago), licensed MIT. It adds 20 tokens to every session and 772 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to init, differing in 0 lines, and is treated as a copy.