popsicle

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Popsicle

Popsicle

Agent-native onboarding doc generator. Discover. Map. Generate. Adapt. Validate. Loop.
Purpose: Make any repo agent-ready. A fresh AI agent with zero context should be able to read the docs and start working — without reading source code first.
Agent-ready output. Every artifact popsicle produces — coverage maps, health baselines, generated docs, agent adapters — is designed so a fresh AI agent can navigate your repo independently, not just a human skimming the README.
Install via npx:
bash
npx skills add fellowship-dev/dogfooded-skills/skills/ops/popsicle
Agent原生入门文档生成器。探索、映射、生成、适配、验证、循环。
用途: 让任意仓库具备Agent适配能力。一个完全没有上下文的全新AI Agent应该能通过阅读文档直接开始工作——无需先阅读源代码。
Agent就绪型输出。 Popsicle生成的所有产物——覆盖范围图、健康基线、生成文档、Agent适配器——均为让全新AI Agent能独立导航你的仓库而设计,而非仅供人类快速浏览README。
通过npx安装:
bash
npx skills add fellowship-dev/dogfooded-skills/skills/ops/popsicle

When to Use

使用场景

  • New repo onboarding: Bootstrap agent-readable docs from scratch.
  • After major refactors: Verify docs still match reality.
  • Periodic health check: Catch doc rot before it compounds.
  • Before handing a repo to agents: Confirm docs give a fresh agent enough to work independently.
  • Multi-tool teams: Use
    --agents
    to generate adapter files for Cursor, Copilot, and Codex.
  • 新仓库入门: 从零开始构建Agent可读文档。
  • 重大重构后: 验证文档是否仍与实际情况匹配。
  • 定期健康检查: 在文档老化问题恶化前及时发现。
  • 将仓库交付给Agent前: 确认文档能为全新Agent提供足够的独立工作信息。
  • 多工具团队: 使用
    --agents
    为Cursor、Copilot和Codex生成适配器文件。

Anti-Cheat Constraint

防作弊约束

Whatever you discover during research is the answer key. The repo docs are the test. The fresh validation session is the student.
Discovery artifacts (knowledge map) MUST live in
/tmp
, never in the repo. The validation sessions must have zero access to discovery artifacts. If they can see what you found, the test is worthless.

研究过程中发现的任何内容均为答案密钥。仓库文档是测试卷。全新验证会话是考生
探索产物(知识图谱)必须存放在
/tmp
目录,绝不能存入仓库。验证会话必须无法访问探索产物。若验证会话能看到你发现的内容,测试将失去意义。

Doc Types — What Goes Where

文档类型——内容归属

Agents need three kinds of documentation. Popsicle enforces separation:
Agent需要三类文档。Popsicle强制区分各类文档:

1.
CLAUDE.md
— Agent Instructions (≤80 lines)

1.
CLAUDE.md
— Agent指令(≤80行)

The entry point. An agent reads this first. It answers: "What is this repo, how do I work in it, and what rules must I follow?"
What belongs here:
  • Project identity (one sentence: what this is, what stack)
  • How to install, run, test, deploy (commands only, no explanation)
  • Key rules and constraints (things that break if violated)
  • Pointers to
    docs/
    for deeper reference
What does NOT belong here:
  • Architecture explanations (→
    docs/architecture.md
    )
  • API reference (→
    docs/api.md
    )
  • Config/env var tables longer than 5 rows (→
    docs/configuration.md
    )
  • Runbooks or troubleshooting (→
    docs/runbook.md
    )
  • History, context, or "why we built this" (→ README.md or nowhere)
Budget: ≤80 lines. If CLAUDE.md exceeds 80 lines after your changes, refactor: move detail into
docs/
and replace with a one-line pointer. Count lines with
wc -l CLAUDE.md
.
入口文件。Agent会首先阅读此文件。它需要回答:“这个仓库是什么?我如何在其中工作?必须遵守哪些规则?”
应包含内容:
  • 项目标识(一句话:项目用途、技术栈)
  • 安装、运行、测试、部署的指令(仅命令,无需解释)
  • 关键规则与约束(违反会导致故障的内容)
  • 指向
    docs/
    目录的深层参考链接
不应包含内容:
  • 架构说明(→
    docs/architecture.md
  • API参考(→
    docs/api.md
  • 超过5行的配置/环境变量表格(→
    docs/configuration.md
  • 运行手册或故障排查(→
    docs/runbook.md
  • 历史、背景或“我们为何构建此项目”(→ README.md或无需保留)
篇幅限制:≤80行。 若修改后
CLAUDE.md
超过80行,需重构:将细节移至
docs/
目录,并用一行链接替代。使用
wc -l CLAUDE.md
统计行数。

2.
docs/*.md
— Reference Documentation

2.
docs/*.md
— 参考文档

Deep knowledge an agent navigates to when working on specific areas. Each file covers one topic. An agent should be able to find the right file by name alone.
Standard files (create only the ones the repo needs):
  • docs/architecture.md
    — system boundaries, data flow, key abstractions, service map
  • docs/api.md
    — routes, endpoints, request/response shapes
  • docs/configuration.md
    — env vars, feature flags, config files with all options documented
  • docs/workflows.md
    — dev workflow, CI/CD, deploy process, release steps
  • docs/data-model.md
    — database schema, key tables, relationships
  • docs/glossary.md
    — domain terms that aren't obvious from code (only if needed)
  • docs/runbook.md
    — how to debug common issues, operational procedures
Rules:
  • One topic per file. If a file exceeds 200 lines, split it.
  • File names must be self-descriptive — an agent picks which file to read based on the name.
  • No
    docs/misc.md
    or
    docs/notes.md
    — if it doesn't have a clear topic, it doesn't belong.
  • Link between doc files when concepts cross boundaries.
Agent处理特定领域工作时会查阅的深层知识。每个文件对应一个主题。Agent应能仅通过文件名找到对应文件。
标准文件(仅创建仓库所需的文件):
  • docs/architecture.md
    — 系统边界、数据流、核心抽象、服务图谱
  • docs/api.md
    — 路由、端点、请求/响应格式
  • docs/configuration.md
    — 环境变量、功能开关、配置文件的所有选项说明
  • docs/workflows.md
    — 开发流程、CI/CD、部署流程、发布步骤
  • docs/data-model.md
    — 数据库 schema、核心表、关联关系
  • docs/glossary.md
    — 代码中无法明确体现的领域术语(仅在需要时创建)
  • docs/runbook.md
    — 常见问题调试方法、操作流程
规则:
  • 每个文件对应一个主题。若文件超过200行,需拆分。
  • 文件名必须自描述——Agent会根据文件名选择要阅读的文件。
  • 禁止创建
    docs/misc.md
    docs/notes.md
    ——若内容没有明确主题,则不应保留。
  • 概念跨领域时,在文档间添加链接。

3.
README.md
— Human Documentation (don't touch)

3.
README.md
— 人类文档(请勿修改)

README.md is for humans: badges, screenshots, marketing copy, contribution guides. Popsicle does not modify README.md. If critical info exists only in README.md and belongs in agent docs, copy the relevant facts into the appropriate
docs/
file or CLAUDE.md — don't restructure the README.

README.md面向人类:徽章、截图、营销文案、贡献指南。Popsicle不会修改README.md。 若关键信息仅存在于README.md且应归入Agent文档,需将相关内容复制到对应的
docs/
文件或
CLAUDE.md
中——不要重构README。

Instructions

操作步骤

0. Setup

0. 准备工作

bash
REPO_ROOT=$(git rev-parse --show-toplevel)
REPO_NAME=$(basename $(git remote get-url origin) .git)
TODAY=$(date +%Y-%m-%d)
ITERATION=1
MAX_ITERATIONS=5
PASS_THRESHOLD=80
Parse flags:
  • --loop
    — run the full loop until pass rate >= 80% or max iterations
  • --agents
    — generate agent adapter files (Phase 2.5)
  • --canonical agents
    — make
    AGENTS.md
    the source of truth;
    CLAUDE.md
    symlinks to it
Auto-detect
--agents
behavior: if
.cursor/
or
.github/copilot-instructions.md
already exists in the repo, treat
--agents
as set.
You MUST complete ALL phases in every iteration. Do not stop after validation — always grade, report, and decide whether to loop. If context is tight, keep grading terse (one line per concept).

bash
REPO_ROOT=$(git rev-parse --show-toplevel)
REPO_NAME=$(basename $(git remote get-url origin) .git)
TODAY=$(date +%Y-%m-%d)
ITERATION=1
MAX_ITERATIONS=5
PASS_THRESHOLD=80
解析参数:
  • --loop
    — 运行完整循环直至通过率≥80%或达到最大迭代次数
  • --agents
    — 生成Agent适配器文件(阶段2.5)
  • --canonical agents
    — 将
    AGENTS.md
    设为权威源;
    CLAUDE.md
    作为其符号链接
自动检测
--agents
行为:若仓库中已存在
.cursor/
.github/copilot-instructions.md
,则自动启用
--agents
模式。
必须完成每次迭代的所有阶段。 验证后不要停止——始终进行评分、报告,并决定是否循环。若上下文有限,可简化评分(每个概念仅用一行描述)。

Phase 1: Discover (Build the Answer Key)

阶段1:探索(构建答案密钥)

Scan the repo systematically. Build a knowledge map of what an agent SHOULD be able to learn from good docs.
What to scan:
  • Entry points (
    main
    ,
    index
    ,
    app
    , CLI entrypoints)
  • How to install, run, test (the commands, not just that they exist)
  • API routes and endpoints
  • Config files (env vars, feature flags, deploy config)
  • Important abstractions (key classes, modules, patterns)
  • Architecture (service boundaries, data flow, external deps)
  • Dev workflow (CI, deploy, release process)
  • Domain-specific terms that aren't obvious from code
Classify each concept by doc type — where should an agent find this?
CategoryTarget file
identity, stack, run/test commands, key rules
CLAUDE.md
system design, data flow, service boundaries
docs/architecture.md
routes, endpoints, request/response
docs/api.md
env vars, config files, feature flags
docs/configuration.md
dev workflow, CI/CD, deploy, release
docs/workflows.md
database schema, key tables
docs/data-model.md
domain terms
docs/glossary.md
Pick 5-10 concepts per iteration. Rotate across iterations so you eventually cover the whole repo. Don't repeat concepts that already PASSed.
Write the knowledge map to a temp file:
bash
KNOWLEDGE_MAP="/tmp/popsicle-knowledge-$(date +%s).json"
bash
python3 -c "
import json, sys
concepts = [
    {
        'id': 'concept-1',
        'category': 'architecture',
        'target_file': 'docs/architecture.md',
        'name': 'Short name',
        'description': 'What an agent should know about this',
        'evidence': 'Where you found it in the code (file:line)',
        'question': 'Question to ask the validation session',
        'nav_question': 'Which doc file would you read to learn about this?'
    },
    # ... 5-10 concepts
]
with open('$KNOWLEDGE_MAP', 'w') as f:
    json.dump({'repo': '$REPO_NAME', 'iteration': $ITERATION, 'concepts': concepts}, f, indent=2)
"
This file is the answer key. It stays in
/tmp
. Never commit it.

系统扫描仓库。构建知识图谱,明确Agent应从优质文档中获取的信息。
扫描内容:
  • 入口文件(
    main
    index
    app
    、CLI入口)
  • 安装、运行、测试的指令(具体命令,而非仅说明存在这些操作)
  • API路由与端点
  • 配置文件(环境变量、功能开关、部署配置)
  • 重要抽象(核心类、模块、模式)
  • 架构(服务边界、数据流、外部依赖)
  • 开发流程(CI、部署、发布流程)
  • 代码中无法明确体现的领域术语
按文档类型分类每个概念——Agent应从何处获取此信息?
类别目标文件
标识、技术栈、运行/测试命令、关键规则
CLAUDE.md
系统设计、数据流、服务边界
docs/architecture.md
路由、端点、请求/响应
docs/api.md
环境变量、配置文件、功能开关
docs/configuration.md
开发流程、CI/CD、部署、发布
docs/workflows.md
数据库schema、核心表
docs/data-model.md
领域术语
docs/glossary.md
每次迭代选择5-10个概念。 跨迭代轮换概念,最终覆盖整个仓库。不要重复已通过的概念。
将知识图谱写入临时文件:
bash
KNOWLEDGE_MAP="/tmp/popsicle-knowledge-$(date +%s).json"
bash
python3 -c "
import json, sys
concepts = [
    {
        'id': 'concept-1',
        'category': 'architecture',
        'target_file': 'docs/architecture.md',
        'name': 'Short name',
        'description': 'What an agent should know about this',
        'evidence': 'Where you found it in the code (file:line)',
        'question': 'Question to ask the validation session',
        'nav_question': 'Which doc file would you read to learn about this?'
    },
    # ... 5-10 concepts
]
with open('$KNOWLEDGE_MAP', 'w') as f:
    json.dump({'repo': '$REPO_NAME', 'iteration': $ITERATION, 'concepts': concepts}, f, indent=2)
"
此文件为答案密钥,需存放在
/tmp
目录,绝不提交至仓库。

Phase 1.5: Coverage Map

阶段1.5:覆盖范围图

After discovery, write a coverage map so that both humans and agents can see at a glance what is documented and what is not.
Write (or overwrite)
docs/coverage-map.md
:
markdown
undefined
探索完成后,编写覆盖范围图,让人类和Agent能快速了解已文档化和未文档化的内容。
写入(或覆盖)
docs/coverage-map.md
markdown
undefined

Coverage Map — {REPO_NAME}

覆盖范围图 — {REPO_NAME}

Generated by popsicle on {TODAY} (iteration {N}). ✓ = documented ✗ = gap ~ = partial
由Popsicle生成于{TODAY}(第{N}次迭代)。 ✓ = 已文档化 ✗ = 缺失 ~ = 部分文档化

{top-level-area/}

{顶级目录/}

  • src/index.ts
    — entry point, startup sequence
  • src/routes/
    — API routes (see docs/architecture.md)
  • src/workers/
    — background job processing (undocumented)
  • ~
    src/models/
    — data models exist in README but schema not captured
  • src/index.ts
    — 入口文件、启动流程
  • src/routes/
    — API路由(见docs/architecture.md)
  • src/workers/
    — 后台任务处理(未文档化)
  • ~
    src/models/
    — 数据模型在README中提及,但未记录schema

{another-area/}

{另一目录/}

  • scripts/deploy.sh
    — deployment procedure (gap)
  • .env.example
    — environment variables documented in CLAUDE.md

Rules:
- Use hierarchical file-tree order that mirrors the directory structure.
- Every file/area surfaced during discovery gets an entry.
- Do not fabricate entries for areas you did not scan.
- Mark `✓` only if a validation session could plausibly find the answer in docs. If uncertain, mark `~`.

Commit with doc changes (Phase 2 commit covers this file too).

---
  • scripts/deploy.sh
    — 部署流程(缺失)
  • .env.example
    — 环境变量已在CLAUDE.md中记录

规则:
- 使用与目录结构一致的层级文件树顺序。
- 探索过程中发现的每个文件/目录都需添加条目。
- 不要为未扫描的区域编造条目。
- 仅当验证会话能从文档中合理找到答案时标记`✓`。若不确定,标记`~`。

随文档变更提交(阶段2的提交包含此文件)。

---

Phase 2: Generate (Improve the Docs)

阶段2:生成(优化文档)

Read existing docs:
CLAUDE.md
,
docs/
directory,
README.md
(read-only reference).
For each concept in the knowledge map:
  1. Does the target file exist? If not, create it with a
    # Title
    header.
  2. Is the concept already documented in the right place? If yes, skip.
  3. If documented in the wrong place (e.g., architecture details in CLAUDE.md), move it.
  4. If missing, write it in the target file.
After all concepts are placed, enforce budgets:
bash
CLAUDE_LINES=$(wc -l < CLAUDE.md 2>/dev/null || echo 0)
if [ "$CLAUDE_LINES" -gt 80 ]; then
  echo "CLAUDE.md is $CLAUDE_LINES lines — over 80-line budget. Refactor."
fi
If CLAUDE.md exceeds 80 lines:
  1. Identify sections that are reference material (tables >5 rows, detailed explanations, examples).
  2. Move them to the appropriate
    docs/
    file.
  3. Replace with a one-line pointer:
    See [docs/configuration.md](docs/configuration.md) for full env var reference.
  4. Re-check the line count.
CLAUDE.md structure template (adapt to repo, don't force sections that don't apply):
markdown
undefined
阅读现有文档:
CLAUDE.md
docs/
目录、
README.md
(只读参考)。
针对知识图谱中的每个概念:
  1. 目标文件是否存在?若不存在,创建并添加
    # 标题
    头部。
  2. 概念是否已在正确位置文档化?若是,跳过。
  3. 若文档化位置错误(例如,架构细节在CLAUDE.md中),移动至正确位置。
  4. 若缺失,在目标文件中编写相关内容。
完成所有概念的处理后,强制执行篇幅限制:
bash
CLAUDE_LINES=$(wc -l < CLAUDE.md 2>/dev/null || echo 0)
if [ "$CLAUDE_LINES" -gt 80 ]; then
  echo "CLAUDE.md有$CLAUDE_LINES行——超过80行限制。请重构。"
fi
若CLAUDE.md超过80行:
  1. 识别属于参考材料的部分(超过5行的表格、详细说明、示例)。
  2. 将这些内容移至对应的
    docs/
    文件。
  3. 用一行链接替代:
    参见[docs/configuration.md](docs/configuration.md)获取完整环境变量参考。
  4. 重新检查行数。
CLAUDE.md结构模板(根据仓库调整,不要强行添加不适用的章节):
markdown
undefined

{Repo Name}

{仓库名称}

{One sentence: what this is and what stack.}
{一句话:项目用途与技术栈。}

Quick Start

快速开始

{install, run, test commands — no prose, just the commands}
{安装、运行、测试命令——仅命令,无需说明}

Key Rules

关键规则

{Things that break if violated — max 5 bullets}
{违反会导致故障的内容——最多5条}

Project Structure

项目结构

{Only if non-obvious — 5-10 lines max showing key directories}
{仅在结构不直观时添加——最多5-10行,展示核心目录}

Reference

参考

  • Architecture — {one-line summary}
  • Configuration — {one-line summary}
  • API — {one-line summary}
undefined
  • 架构 — {一句话总结}
  • 配置 — {一句话总结}
  • API — {一句话总结}
undefined

Health Baseline

健康基线

Write (or update)
docs/health-baseline.md
. Use categories, not scores:
markdown
undefined
写入(或更新)
docs/health-baseline.md
。使用分类而非评分:
markdown
undefined

Doc Health Baseline — {REPO_NAME}

文档健康基线 — {REPO_NAME}

Last updated by popsicle on {TODAY}.
由Popsicle最后更新于{TODAY}。

Architecture

架构

Docs exist:
docs/architecture.md
, CLAUDE.md §Architecture Missing: service dependency graph, data flow for async jobs Companion skills installed: none
已存在文档:
docs/architecture.md
、CLAUDE.md §Architecture 缺失内容: 服务依赖图、异步任务数据流 已安装配套技能:

API Contracts

API契约

Docs exist: README API section Missing: request/response schemas for /auth routes Companion skills installed: none
已存在文档: README的API章节 缺失内容: /auth路由的请求/响应schema 已安装配套技能:

Dev Setup

开发环境搭建

Docs exist: README §Getting Started Missing:
.env
values required for local OAuth Companion skills installed: hookshot (enforces freshness on commit)
已存在文档: README §入门指南 缺失内容: 本地OAuth所需的
.env
已安装配套技能: hookshot(通过提交钩子确保文档新鲜度)

Deployment

部署

Docs exist: none Missing: deploy command, required secrets, rollback procedure Companion skills installed: none

This file is a living foundation for ongoing monitoring. Other skills (entropy-check, hookshot) can consume it.
已存在文档:缺失内容: 部署命令、所需密钥、回滚流程 已安装配套技能:

此文件是持续监控的动态基础。其他技能(entropy-check、hookshot)可读取此文件。

Generated Docs

生成文档

Write auto-extracted facts to
docs/generated/
. These files are ephemeral — regenerated each iteration. They exist so agents don't have to re-discover them.
Always include a "last updated" header:
markdown
<!-- generated by popsicle on {TODAY} — do not edit manually -->
Files to generate (only when applicable):
  • docs/generated/env-vars.md
    — all environment variables found in the codebase (
    .env.example
    ,
    process.env.*
    ,
    os.environ
    , etc.)
  • docs/generated/api-routes.md
    — all API routes extracted from router files
  • docs/generated/db-schema.md
    — database schema summary (if ORM or migration files exist)
Commit all doc changes (including coverage-map.md and health-baseline.md):
bash
git add CLAUDE.md docs/
git commit -m "docs: popsicle iteration $ITERATION — structured agent docs

Concepts targeted: [list the concept names]
Coverage map updated. Health baseline updated."

将自动提取的事实写入
docs/generated/
目录。这些文件为临时文件——每次迭代都会重新生成。它们的存在是为了让Agent无需重复探索。
始终添加“最后更新”头部:
markdown
<!-- 由Popsicle生成于{TODAY} — 请勿手动编辑 -->
需生成的文件(仅在适用时创建):
  • docs/generated/env-vars.md
    — 代码库中所有环境变量(
    .env.example
    process.env.*
    os.environ
    等)
  • docs/generated/api-routes.md
    — 从路由文件中提取的所有API路由
  • docs/generated/db-schema.md
    — 数据库schema摘要(若存在ORM或迁移文件)
提交所有文档变更(包括coverage-map.md和health-baseline.md):
bash
git add CLAUDE.md docs/
git commit -m "docs: popsicle第$ITERATION次迭代——结构化Agent文档

目标概念:[列出概念名称]
覆盖范围图已更新。健康基线已更新。"

Phase 2.5: Agent Adapters

阶段2.5:Agent适配器

After doc generation, create agent-agnostic entry points so any AI tool can onboard to this repo.
文档生成完成后,创建Agent通用入口点,让任意AI工具都能快速入门此仓库。

Default (always run)

默认操作(始终执行)

Create
AGENTS.md
as a symlink to
CLAUDE.md
if it does not already exist:
bash
if [ ! -e "$REPO_ROOT/AGENTS.md" ]; then
  ln -s CLAUDE.md "$REPO_ROOT/AGENTS.md"
  git add "$REPO_ROOT/AGENTS.md"
  git commit -m "docs: add AGENTS.md symlink for Codex compatibility"
fi
If
--canonical agents
flag is set, reverse the relationship — make
AGENTS.md
the real file and
CLAUDE.md
the symlink. Only do this if neither file exists as a symlink yet.
AGENTS.md
不存在,创建指向
CLAUDE.md
的符号链接:
bash
if [ ! -e "$REPO_ROOT/AGENTS.md" ]; then
  ln -s CLAUDE.md "$REPO_ROOT/AGENTS.md"
  git add "$REPO_ROOT/AGENTS.md"
  git commit -m "docs: 添加AGENTS.md符号链接以兼容Codex"
fi
若设置了
--canonical agents
参数,反转关系——将
AGENTS.md
设为实际文件,
CLAUDE.md
作为符号链接。仅当两个文件都不是符号链接时执行此操作。

With
--agents
flag (or auto-detected)

启用
--agents
参数(或自动检测)

Auto-detection: if
.cursor/
or
.github/copilot-instructions.md
already exists in the repo, proceed as if
--agents
was passed.
Before writing any adapter, check if it already exists with custom content. If a file exists and does not contain the
generated by popsicle
marker, skip it — do not overwrite custom configs.
Write
.github/copilot-instructions.md
:
markdown
<!-- generated by popsicle — edit CLAUDE.md instead -->
自动检测:若仓库中已存在
.cursor/
.github/copilot-instructions.md
,则自动执行此阶段。
编写任何适配器前,检查是否已存在自定义内容。 若文件已存在且不包含
generated by popsicle
标记,跳过——不要覆盖自定义配置。
写入
.github/copilot-instructions.md
markdown
<!-- generated by popsicle — 请编辑CLAUDE.md -->

{REPO_NAME} — Copilot Instructions

{REPO_NAME} — Copilot指令

See CLAUDE.md for project identity and docs/ for reference material. Key docs: docs/architecture.md, docs/coverage-map.md, docs/health-baseline.md

Write `.cursor/rules/project.mdc`:

description: Project onboarding for {REPO_NAME} alwaysApply: true

<!-- generated by popsicle — edit CLAUDE.md instead -->
See CLAUDE.md for project identity and docs/ for reference material. Key docs: docs/architecture.md, docs/coverage-map.md, docs/health-baseline.md

**Adapter rules:**
- Adapters are thin pointers — no duplicated content.
- `CLAUDE.md` is always the source of truth (unless `--canonical agents` was set).
- Never overwrite existing custom configs (check for the `generated by popsicle` marker before writing).

Commit adapters (if any were written):

```bash
git add .github/copilot-instructions.md .cursor/rules/project.mdc 2>/dev/null
git diff --cached --quiet || git commit -m "docs: add agent adapter files (popsicle)"

参见CLAUDE.md获取项目标识,docs/目录获取参考材料。 核心文档:docs/architecture.md、docs/coverage-map.md、docs/health-baseline.md

写入`.cursor/rules/project.mdc`:

description: {REPO_NAME}项目入门 alwaysApply: true

<!-- generated by popsicle — 请编辑CLAUDE.md -->
参见CLAUDE.md获取项目标识,docs/目录获取参考材料。 核心文档:docs/architecture.md、docs/coverage-map.md、docs/health-baseline.md

**适配器规则:**
- 适配器仅作为轻量链接——不要重复内容。
- `CLAUDE.md`始终为权威源(除非设置了`--canonical agents`)。
- 绝不覆盖已存在的自定义配置(写入前检查`generated by popsicle`标记)。

提交适配器(若有写入):

```bash
git add .github/copilot-instructions.md .cursor/rules/project.mdc 2>/dev/null
git diff --cached --quiet || git commit -m "docs: 添加Agent适配器文件(popsicle)"

Phase 3: Validate (Test with Fresh Sessions)

阶段3:验证(通过全新会话测试)

Critical: the knowledge map must be invisible to validation sessions. It's already in
/tmp
(not in the repo), so fresh sessions can't see it.
Two types of validation per concept:
bash
RESULTS_DIR="/tmp/popsicle-results-$(date +%s)"
mkdir -p "$RESULTS_DIR"
Test A — Content validation (can the agent answer from docs?):
bash
claude -p "You are examining the repository at $REPO_ROOT. \
Using ONLY the documentation in this repo (CLAUDE.md, docs/*.md), \
answer this question. Do not read source code — only docs. \
If the docs don't cover this, say 'NOT DOCUMENTED'. \
\
Question: [concept.question]" \
  --model sonnet --output-format text \
  2>/dev/null > "$RESULTS_DIR/concept-N-content-1.txt"
Run 2 independent content sessions per concept.
Test B — Navigation validation (can the agent find WHERE to look?):
bash
claude -p "You are examining the repository at $REPO_ROOT. \
Look at the documentation files available (CLAUDE.md, docs/*.md). \
Do NOT read the full contents — only look at file names and headers. \
\
Question: Which specific doc file would you open to learn about: [concept.nav_question]? \
Answer with just the file path." \
  --model sonnet --output-format text \
  2>/dev/null > "$RESULTS_DIR/concept-N-nav.txt"
Run 1 navigation session per concept.
Run up to 3 sessions in parallel (background and
wait
). Do not exceed 3 concurrent — small machines will OOM.

关键:知识图谱必须对验证会话不可见。 它已存放在
/tmp
目录(不在仓库中),因此全新会话无法访问。
每个概念需进行两类验证:
bash
RESULTS_DIR="/tmp/popsicle-results-$(date +%s)"
mkdir -p "$RESULTS_DIR"
测试A — 内容验证(Agent能否从文档中找到答案?):
bash
claude -p "You are examining the repository at $REPO_ROOT. \
Using ONLY the documentation in this repo (CLAUDE.md, docs/*.md), \
answer this question. Do not read source code — only docs. \
If the docs don't cover this, say 'NOT DOCUMENTED'. \
\
Question: [concept.question]" \
  --model sonnet --output-format text \
  2>/dev/null > "$RESULTS_DIR/concept-N-content-1.txt"
每个概念运行2次独立的内容验证会话。
测试B — 导航验证(Agent能否找到正确位置?):
bash
claude -p "You are examining the repository at $REPO_ROOT. \
Look at the documentation files available (CLAUDE.md, docs/*.md). \
Do NOT read the full contents — only look at file names and headers. \
\
Question: Which specific doc file would you open to learn about: [concept.nav_question]? \
Answer with just the file path." \
  --model sonnet --output-format text \
  2>/dev/null > "$RESULTS_DIR/concept-N-nav.txt"
每个概念运行1次导航验证会话。
最多并行运行3个会话(后台执行并使用
wait
)。不要超过3个并发——小型机器会出现内存不足。

Phase 4: Grade + Staleness Detection

阶段4:评分 + 陈旧内容检测

Grading

评分

For each concept, score on two axes:
Content score (from Test A):
  • PASS (2/2): Both sessions answered correctly from docs.
  • WEAK (1/2): One got it, one didn't.
  • FAIL (0/2): Neither could answer.
Navigation score (from Test B):
  • HIT: Agent pointed to the correct file (matches
    target_file
    from knowledge map).
  • MISS: Agent pointed to wrong file or couldn't find it.
Combined verdict:
  • PASS: Content PASS + Nav HIT
  • PARTIAL: Content PASS + Nav MISS (info exists but hard to find), or Content WEAK + Nav HIT
  • FAIL: Content FAIL (regardless of nav), or Content WEAK + Nav MISS
针对每个概念,从两个维度评分:
内容评分(来自测试A):
  • 通过(2/2):两次会话均能从文档中正确回答。
  • 较弱(1/2):一次正确,一次错误。
  • 失败(0/2):两次均无法回答。
导航评分(来自测试B):
  • 命中:Agent指向了正确文件(与知识图谱中的
    target_file
    匹配)。
  • 未命中:Agent指向了错误文件或无法找到。
综合结论:
  • 通过:内容通过 + 导航命中
  • 部分通过:内容通过 + 导航未命中(信息存在但难以找到),或内容较弱 + 导航命中
  • 失败:内容失败(无论导航结果如何),或内容较弱 + 导航未命中

Staleness Detection

陈旧内容检测

After grading, run a staleness check by comparing doc claims against actual code. Read the docs produced or updated this iteration and check for factual mismatches.
What to check:
  • Port numbers (e.g., docs say "port 3000" but code uses
    PORT=4000
    )
  • Environment variable names (e.g., docs say
    DATABASE_URL
    but code reads
    DB_CONNECTION_STRING
    )
  • File paths (e.g., docs reference
    src/server.js
    but it was moved to
    src/app.js
    )
  • Command syntax (e.g., docs say
    npm start
    but
    package.json
    scripts changed)
  • Version numbers (e.g., docs specify Node 16 but
    .nvmrc
    says 20)
For each mismatch found, add a
STALE
entry:
json
{
  "type": "STALE",
  "doc_claim": "port 3000 (README line 42)",
  "actual": "PORT env var defaults to 4000 (src/config.ts:8)",
  "fix": "Update README to reference PORT env var"
}
Add STALE items to the gaps list in the report (Phase 5).
Compute the pass rate (PASS only, PARTIAL counts as half; STALE items do not affect pass rate — tracked separately):
bash
SCORE=$((PASS_COUNT * 100 + PARTIAL_COUNT * 50))
PASS_RATE=$((SCORE / TOTAL_CONCEPTS))

评分完成后,通过比较文档声明与实际代码进行陈旧内容检查。阅读本次迭代生成或更新的文档,检查事实不符之处。
检查内容:
  • 端口号(例如,文档说明“端口3000”但代码使用
    PORT=4000
  • 环境变量名称(例如,文档说明
    DATABASE_URL
    但代码读取
    DB_CONNECTION_STRING
  • 文件路径(例如,文档引用
    src/server.js
    但已移至
    src/app.js
  • 命令语法(例如,文档说明
    npm start
    package.json
    脚本已变更)
  • 版本号(例如,文档指定Node 16但
    .nvmrc
    为20)
针对每个发现的不符项,添加
STALE
条目:
json
{
  "type": "STALE",
  "doc_claim": "port 3000 (README第42行)",
  "actual": "PORT环境变量默认值为4000 (src/config.ts:8)",
  "fix": "更新README以引用PORT环境变量"
}
将STALE条目添加至报告的缺失内容列表(阶段5)。
计算通过率(仅通过项,部分通过项计为0.5;STALE项不影响通过率——单独跟踪):
bash
SCORE=$((PASS_COUNT * 100 + PARTIAL_COUNT * 50))
PASS_RATE=$((SCORE / TOTAL_CONCEPTS))

Phase 5: Report

阶段5:报告

bash
REPORT="$REPO_ROOT/docs/popsicle-report-${TODAY}.md"
markdown
undefined
bash
REPORT="$REPO_ROOT/docs/popsicle-report-${TODAY}.md"
markdown
undefined

Popsicle Report — {REPO_NAME}

Popsicle报告 — {REPO_NAME}

Date: {TODAY} Iteration: {N} Concepts tested: {count} Pass rate: {PASS_COUNT}/{TOTAL} ({PCT}%) Stale claims found: {STALE_COUNT}
日期:{TODAY} 迭代次数:{N} 测试概念数:{count} 通过率:{PASS_COUNT}/{TOTAL} ({PCT}%) 发现陈旧声明数:{STALE_COUNT}

Doc Structure

文档结构

FileLinesStatus
CLAUDE.md{n}{ok / over budget}
docs/architecture.md{n}{exists / created / n/a}
docs/configuration.md{n}{exists / created / n/a}
...
文件行数状态
CLAUDE.md{n}{正常 / 超出篇幅限制}
docs/architecture.md{n}{已存在 / 已创建 / 不适用}
docs/configuration.md{n}{已存在 / 已创建 / 不适用}
...

Results

结果

#ConceptTarget FileContentNavVerdict
1{name}docs/arch..PASSHITPASS
2{name}CLAUDE.mdWEAKHITPARTIAL
3{name}docs/api..FAILMISSFAIL
#概念目标文件内容导航结论
1{名称}docs/arch..通过命中通过
2{名称}CLAUDE.md较弱命中部分通过
3{名称}docs/api..失败未命中失败

Gaps Remaining

剩余缺失内容

  • {concept}: {why it failed — what's missing or misplaced}
  • ...
  • {概念}:{失败原因——缺失或位置错误的内容}
  • ...

Staleness

陈旧内容

<!-- Omit section if STALE_COUNT == 0 -->
  • {doc_claim} in
    {file}
    : actual value is
    {actual}
    . Fix: {fix}
  • ...
<!-- 若STALE_COUNT == 0则省略此章节 -->
  • {文档声明}
    {文件}
    中:实际值为
    {actual}
    。修复方案:{fix}
  • ...

Missing Knowledge

缺失的知识

<!-- Concepts that cannot be inferred from source code alone. These require human input. -->
  • Business rules: {e.g., "pricing tiers defined in Notion, not in code"}
  • External credentials: {e.g., "Stripe webhook secret — ask ops team"}
  • Deployment procedures: {e.g., "staging deploy requires VPN + manual approval"}
  • ...
<!-- 无法仅从源代码推断的概念。这些需要人工输入。 -->
  • 业务规则:{例如,“定价层级定义在Notion中,未在代码中体现”}
  • 外部凭证:{例如,“Stripe webhook密钥——询问运维团队”}
  • 部署流程:{例如,“预发布环境部署需要VPN + 手动审批”}
  • ...

Doc Changes This Iteration

本次迭代的文档变更

  • Updated
    CLAUDE.md
    : added {what}
  • Updated
    docs/architecture.md
    : added {what}
  • Updated
    docs/coverage-map.md
    : reflects new scan
  • Updated
    docs/health-baseline.md
    : added {category} section
  • Created
    docs/generated/env-vars.md
  • ...
  • 更新
    CLAUDE.md
    :添加{内容}
  • 更新
    docs/architecture.md
    :添加{内容}
  • 更新
    docs/coverage-map.md
    :反映最新扫描结果
  • 更新
    docs/health-baseline.md
    :添加{类别}章节
  • 创建
    docs/generated/env-vars.md
  • ...

Companion Skills

配套技能

These skills complement popsicle for ongoing doc health:
  • hookshot — enforces doc freshness via commit hooks
    npx skills add fellowship-dev/dogfooded-skills/skills/ops/hookshot
  • entropy-check — periodic doc drift sensor
    npx skills add fellowship-dev/dogfooded-skills/skills/ops/entropy-check
  • trash-truck — removes dead/duplicate code that confuses agents
    npx skills add fellowship-dev/dogfooded-skills/skills/ops/trash-truck
  • speckit — structured issue-to-PR pipeline for doc-gated features
    npx skills add fellowship-dev/dogfooded-skills/skills/ops/speckit

Commit the report:

```bash
git add "docs/popsicle-report-${TODAY}.md"
git commit -m "docs: popsicle report — iteration $ITERATION, ${PASS_RATE}% pass rate"

以下技能可与Popsicle配合使用,维护文档健康:
  • hookshot — 通过提交钩子确保文档新鲜度
    npx skills add fellowship-dev/dogfooded-skills/skills/ops/hookshot
  • entropy-check — 定期检测文档漂移
    npx skills add fellowship-dev/dogfooded-skills/skills/ops/entropy-check
  • trash-truck — 删除会混淆Agent的无效/重复代码
    npx skills add fellowship-dev/dogfooded-skills/skills/ops/trash-truck
  • speckit — 文档驱动功能的结构化Issue到PR流程
    npx skills add fellowship-dev/dogfooded-skills/skills/ops/speckit

提交报告:

```bash
git add "docs/popsicle-report-${TODAY}.md"
git commit -m "docs: popsicle报告——第$ITERATION次迭代,通过率${PASS_RATE}%"

Phase 6: Loop or Stop

阶段6:循环或停止

bash
if [ "$PASS_RATE" -ge "$PASS_THRESHOLD" ]; then
  echo "Pass rate ${PASS_RATE}% >= ${PASS_THRESHOLD}%. Docs are agent-ready. Stopping."
  exit 0
fi

if [ "$ITERATION" -ge "$MAX_ITERATIONS" ]; then
  echo "Hit max iterations ($MAX_ITERATIONS). Pass rate: ${PASS_RATE}%. Review remaining gaps manually."
  exit 0
fi

ITERATION=$((ITERATION + 1))
If pass rate is below threshold and iterations remain:
  1. Read the FAILed, PARTIAL, and STALE concepts from the report.
  2. For nav MISSes: restructure — move content to a more discoverable location or rename the file.
  3. For content FAILs: improve the docs in the target file. Fix STALE claims immediately.
  4. Go back to Phase 2.

bash
if [ "$PASS_RATE" -ge "$PASS_THRESHOLD" ]; then
  echo "通过率${PASS_RATE}% >= ${PASS_THRESHOLD}%。文档已具备Agent适配能力。停止。"
  exit 0
fi

if [ "$ITERATION" -ge "$MAX_ITERATIONS" ]; then
  echo "已达到最大迭代次数($MAX_ITERATIONS)。通过率:${PASS_RATE}%。请手动检查剩余缺失内容。"
  exit 0
fi

ITERATION=$((ITERATION + 1))
若通过率低于阈值且仍有迭代次数:
  1. 阅读报告中的失败、部分通过和陈旧内容。
  2. 针对导航未命中:重构——将内容移至更易发现的位置或重命名文件。
  3. 针对内容失败:优化目标文件中的文档。立即修复陈旧声明。
  4. 返回阶段2

Cleanup

清理

After all iterations complete:
bash
rm -f /tmp/popsicle-knowledge-*.json
rm -rf /tmp/popsicle-results-*
Discovery artifacts are ephemeral. Reports and doc changes are committed.

所有迭代完成后:
bash
rm -f /tmp/popsicle-knowledge-*.json
rm -rf /tmp/popsicle-results-*
探索产物为临时文件。报告和文档变更已提交至仓库。

Usage Modes

使用模式

One-shot (single iteration, report only):
bash
/popsicle
Loop (iterate until pass rate >= 80% or max 5 iterations):
bash
/popsicle --loop
With agent adapters (generate Copilot/Cursor files):
bash
/popsicle --agents
With canonical AGENTS.md (AGENTS.md is source of truth, CLAUDE.md symlinks to it):
bash
/popsicle --canonical agents
Crew mission (dispatched via Pylot):
bash
curl -X POST "$PYLOT_DISPATCH_URL" \
  -H "Authorization: Bearer $PYLOT_DISPATCH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"agent":"crew.lead","task":"Run popsicle in loop mode on this repo. Commit doc improvements and reports.","repo":"org/repo"}'

单次运行(单次迭代,仅生成报告):
bash
/popsicle
循环运行(迭代直至通过率≥80%或最多5次迭代):
bash
/popsicle --loop
生成Agent适配器(生成Copilot/Cursor文件):
bash
/popsicle --agents
设置AGENTS.md为权威源(AGENTS.md为权威源,CLAUDE.md为符号链接):
bash
/popsicle --canonical agents
团队任务(通过Pylot调度):
bash
curl -X POST "$PYLOT_DISPATCH_URL" \
  -H "Authorization: Bearer $PYLOT_DISPATCH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"agent":"crew.lead","task":"Run popsicle in loop mode on this repo. Commit doc improvements and reports.","repo":"org/repo"}'

Design Principles

设计原则

  1. No rubric. The skill discovers what matters by reading the code. No upfront configuration needed.
  2. Anti-cheat by architecture. Discovery artifacts live in
    /tmp
    . Validation sessions are fresh. The test is honest.
  3. Docs get better every iteration. This isn't just measurement — it actively fills gaps.
  4. Fresh sessions are the oracle. If a fresh agent can't learn it from docs, the docs are broken.
  5. Loop-first. One iteration is useful. Five iterations with targeted fixes is transformative.
  6. Agent-ready framing. Output is designed for autonomous agents, not just humans. Every doc should answer: "Can a fresh agent work independently in this repo?"
  7. Coverage over completeness. A coverage map showing known gaps beats docs that claim completeness. Agents prefer honest gaps over false confidence.
  8. Loose coupling. Each companion skill works independently. Popsicle generates artifacts (coverage-map.md, health-baseline.md) that other skills can optionally consume.
  1. 无评分标准。 技能通过阅读代码发现重要内容。无需预先配置。
  2. 架构层面防作弊。 探索产物存放在
    /tmp
    目录。验证会话为全新会话。测试真实有效。
  3. 文档每次迭代都会优化。 这不仅是测量——它会主动填补缺失内容。
  4. 全新会话为权威判断。 若全新Agent无法从文档中获取信息,则文档存在问题。
  5. 优先循环。 单次迭代有用。五次针对性修复的迭代能带来质的变化。
  6. Agent就绪视角。 输出为自主Agent设计,而非仅面向人类。每个文档都应回答:“全新Agent能否在此仓库独立工作?”
  7. 覆盖范围优先于完整性。 展示已知缺失内容的覆盖范围图,优于声称完整的文档。Agent更倾向于诚实的缺失内容,而非虚假的信心。
  8. 松耦合。 每个配套技能独立工作。Popsicle生成的产物(coverage-map.md、health-baseline.md)可供其他技能选择性读取。