Communitygithub.com

圣诞老人方法

多智能体对抗验证与收敛循环框架。两个独立的审查智能体必须同时通过,输出才能交付。适用于输出必须经过两个独立对抗性审查者同意才能发布的场景。

圣诞老人方法 是什么?

圣诞老人方法(Santa Method)是一种多智能体对抗验证框架,旨在解决单一智能体自我审查时因共享相同偏见、知识盲点和系统错误而导致的验证失效问题。该方法通过在生成阶段后引入两个上下文隔离的独立审查智能体,配合客观的通过/失败标准评估准则,有效捕捉事实性错误、幻觉内容、合规性问题和内部不一致等缺陷。只有当两个审查者都判定通过时,输出才会进入交付阶段;否则,所有标记的问题将被收集并修复,然后重新进入审查循环,直至收敛或达到最大迭代次数(默认为3次)后升级至人工处理。该框架支持Claude Code子代理模式(推荐)、顺序内联模式和批量采样模式,适用于代码发布、内容生产、合规文档等高风险输出场景,可将系统性问题检出率提升至90%以上,同时通过采样策略控制成本仅为全量验证的15-20%。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/ECC/tree/main/skills/santa-method

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

圣诞老人方法 是做什么的?

多智能体对抗验证框架。列个清单,检查两遍。如果不乖,就修到乖为止。

核心洞察:单个智能体对自己的输出进行审查时,会共享产生该输出的相同偏见、知识盲点和系统错误。两个没有共享上下文的独立审查者可以打破这种失效模式。

何时激活

在以下场景中调用此技能:

  • 输出将发布、部署或提供给最终用户
  • 必须执行合规、监管或品牌约束
  • 代码在没有人工审查的情况下发布到生产环境
  • 内容准确性至关重要(技术文档、教育材料、面向客户的文案)
  • 批量大规模生成,抽检无法发现系统性模式
  • 幻觉风险较高(主张、统计数据、API 引用、法律语言)

不要用于内部草稿、探索性研究或具有确定性验证的任务(这些应使用构建/测试/lint 流水线)。

架构

┌─────────────┐
│   生成器     │  阶段 1:列个清单
│  (智能体 A)  │  生成可交付物
└──────┬───────┘
       │ 输出
       ▼
┌──────────────────────────────┐
│     双独立审查               │  阶段 2:检查两遍
│                                │
│  ┌───────────┐ ┌───────────┐  │  两个智能体,相同评估准则,
│  │ 审查者 B  │ │ 审查者 C  │  │  无共享上下文
│  └─────┬─────┘ └─────┬─────┘  │
│        │              │        │
└────────┼──────────────┼────────┘
         │              │
         ▼              ▼
┌──────────────────────────────┐
│        判决门                 │  阶段 3:乖还是不乖
│                                │
│  B 通过且 C 通过 → 乖         │  两者都必须通过。
│  否则 → 不乖                  │  没有例外。
└──────┬──────────────┬─────────┘
       │              │
    乖              不乖
       │              │
       ▼              ▼
   [ 交付 ]    ┌─────────────┐
               │  修复循环    │  阶段 4:修到乖为止
               │              │
               │ iteration++ │  收集所有标记。
               │ if i > MAX: │  修复所有问题。
               │   升级      │  重新运行两个审查者。
               │ else:       │  循环直到收敛。
               │   goto 阶段2│
               └──────────────┘

阶段详情

阶段 1:列个清单(生成)

执行主要任务。正常生成工作流程无需更改。圣诞老人方法是生成后的验证层,而非生成策略。

# 生成器正常运行
output = generate(task_spec)

阶段 2:检查两遍(独立双审查)

并行生成两个审查智能体。关键不变量:

  1. 上下文隔离 — 两个审查者互不见对方的评估
  2. 相同评估准则 — 两者都收到相同的评估标准
  3. 相同输入 — 两者都收到原始规格说明和生成的输出
  4. 结构化输出 — 每个都返回类型化的判决,而非散文
REVIEWER_PROMPT = """
你是一个独立的质量审查者。你没有见过任何其他关于此输出的审查。

## 任务规格说明
{task_spec}

## 待审查输出
{output}

## 评估准则
{rubric}

## 说明
针对每个评估准则评估输出。对于每个准则:
- 通过:准则完全满足,没有问题
- 失败:发现具体问题(引用确切问题)

以结构化的 JSON 返回你的评估:
{
  "verdict": "通过" | "失败",
  "checks": [
    {"criterion": "...", "result": "通过|失败", "detail": "..."}
  ],
  "critical_issues": ["..."],   // 必须修复的阻塞项
  "suggestions": ["..."]         // 非阻塞性改进建议
}

请严格严谨。你的工作是发现问题,而不是批准。
"""
# 并行生成审查者(Claude Code 子代理)
review_b = Agent(prompt=REVIEWER_PROMPT.format(...), description="圣诞审查者 B")
review_c = Agent(prompt=REVIEWER_PROMPT.format(...), description="圣诞审查者 C")

# 两者并发运行 — 互不见对方

评估准则设计

评估准则是最重要的输入。模糊的准则会产生模糊的审查。每一个准则必须有客观的通过/失败条件。

准则通过条件失败信号
事实准确性所有主张可依据来源材料或常识性知识验证虚构统计数据、错误的版本号、不存在的 API
无幻觉没有虚构的实体、引用、URL 或引用链接到不存在的页面、归因引用无来源
完整性规格说明中的每个要求都得到了处理缺失部分、跳过边缘情况、覆盖不全
合规性通过所有项目特定约束使用了禁用术语、语气违规、不符合监管要求
内部一致性输出内部无矛盾A 部分说 X,B 部分说 not-X
技术正确性代码可编译/运行、算法正确语法错误、逻辑错误、错误的复杂度声明

领域特定评估准则扩展

内容/营销:

  • 品牌语气一致性
  • SEO 要求满足(关键词密度、元标签、结构)
  • 无竞品商标滥用
  • 行动号召(CTA)存在且链接正确

代码:

  • 类型安全(无 any 泄漏,适当的 null 处理)
  • 错误处理覆盖
  • 安全(代码中无密钥、输入验证、注入防护)
  • 新路径的测试覆盖

合规敏感型(监管、法律、金融):

  • 无结果保证或无根据声明
  • 存在必要的免责声明
  • 仅使用批准的术语
  • 适合司法管辖区的语言

阶段 3:乖还是不乖(判决门)

def santa_verdict(review_b, review_c):
    """两个审查者都必须通过。没有部分通过。"""
    if review_b.verdict == "通过" and review_c.verdict == "通过":
        return "乖"  # 交付它

    # 合并两个审查者的标记,去重
    all_issues = dedupe(review_b.critical_issues + review_c.critical_issues)
    all_suggestions = dedupe(review_b.suggestions + review_c.suggestions)

    return "不乖", all_issues, all_suggestions

为什么两者都必须通过:如果只有一个审查者发现问题,这个问题就是真实存在的。另一个审查者的盲点正是圣诞老人方法存在的理由。

阶段 4:修到乖为止(收敛循环)

MAX_ITERATIONS = 3

for iteration in range(MAX_ITERATIONS):
    verdict, issues, suggestions = santa_verdict(review_b, review_c)

    if verdict == "乖":
        log_santa_result(output, iteration, "passed")
        return ship(output)

    # 修复所有关键问题(建议可选)
    output = fix_agent.execute(
        output=output,
        issues=issues,
        instruction="仅修复已标记的问题。不要重构或添加未请求的更改。"
    )

    # 在修复后的输出上重新运行两个审查者(全新智能体,无上一轮记忆)
    review_b = Agent(prompt=REVIEWER_PROMPT.format(output=output, ...))
    review_c = Agent(prompt=REVIEWER_PROMPT.format(output=output, ...))

# 迭代耗尽 — 升级
log_santa_result(output, MAX_ITERATIONS, "escalated")
escalate_to_human(output, issues)

关键:每一轮审查都使用全新智能体。审查者之间不得携带上一轮的记忆,因为先前的上下文会形成锚定偏差。

实现模式

模式 A:Claude Code 子代理(推荐)

子代理提供真正的上下文隔离。每个审查者是一个独立的进程,没有共享状态。

# 在 Claude Code 会话中,使用 Agent 工具生成审查者
# 两个代理并行运行以提高速度
# 调用 Agent 工具的伪代码
reviewer_b = Agent(
    description="圣诞审查 B",
    prompt=f"审查此输出的质量...\n\n评估准则:\n{rubric}\n\n输出:\n{output}"
)
reviewer_c = Agent(
    description="圣诞审查 C",
    prompt=f"审查此输出的质量...\n\n评估准则:\n{rubric}\n\n输出:\n{output}"
)

模式 B:顺序内联(回退方案)

当子代理不可用时,通过明确的上下文重置模拟隔离:

  1. 生成输出
  2. 新上下文:“你是审查者 1。仅针对此评估准则进行评估。发现问题。”
  3. 逐字记录发现结果
  4. 完全清除上下文
  5. 新上下文:“你是审查者 2。仅针对此评估准则进行评估。发现问题。”
  6. 比较两个审查结果,修复,重复

子代理模式严格优于内联模式——内联模拟有上下文在审查者之间泄漏的风险。

模式 C:批量采样

对于大批量(100+ 项),对每个项目都进行完整的圣诞老人方法成本高昂。使用分层采样:

  1. 对随机样本(批量的 10-15%,至少 5 项)运行圣诞老人方法
  2. 按类型对失败进行分类(幻觉、合规性、完整性等)
  3. 如果出现系统性模式,对整批应用有针对性的修复
  4. 重新采样并重新验证修复后的批次
  5. 持续直到获得干净的样本通过为止
import random

def santa_batch(items, rubric, sample_rate=0.15):
    sample = random.sample(items, max(5, int(len(items) * sample_rate)))

    for item in sample:
        result = santa_full(item, rubric)
        if result.verdict == "不乖":
            pattern = classify_failure(result.issues)
            items = batch_fix(items, pattern)  # 修复所有匹配模式的项
            return santa_batch(items, rubric)   # 重新采样

    return items  # 干净样本 → 交付批次

失效模式与缓解措施

失效模式症状缓解措施
无限循环修复后审查者不断发现新问题最大迭代次数上限(3)。升级。
橡皮图章两个审查者都通过所有内容对抗性提示:“你的工作是发现问题,而不是批准。”
主观歧义审查者标记风格偏好而非错误严格的评估准则,仅包含客观的通过/失败标准
修复回归修复问题 A 引入问题 B每轮使用全新审查者可以捕获回归问题
审查者一致性偏差两个审查者都遗漏了同一件事通过独立性可缓解,但无法完全消除。对于关键输出,添加第三个审查者或人工抽查。
成本爆炸对于大型输出迭代次数过多批量采样模式。每个验证周期的预算上限。

与其他技能的集成

技能关系
验证循环用于确定性检查(构建、lint、测试)。圣诞老人方法用于语义检查(准确性、幻觉)。先运行验证循环,后运行圣诞老人方法。
评估工具圣诞老人方法结果反馈给评估指标。追踪圣诞老人方法运行中的 pass@k 以衡量生成器随时间的变化质量。
持续学习 v2圣诞老人方法的发现结果成为“直觉”。相同准则反复失败 → 学习到的行为以规避该模式。
战略压缩在压缩之前运行圣诞老人方法。不要在验证过程中丢失审查上下文。

指标

追踪以下指标以衡量圣诞老人方法的效果:

  • 首次通过率:第 1 轮即通过圣诞老人方法的输出百分比(目标:>70%)
  • 收敛平均轮次:达到“乖”的平均轮数(目标:<1.5)
  • 问题分类:失败类型的分布(幻觉 vs. 完整性 vs. 合规性)
  • 审查者一致性:两个审查者共同标记 vs. 仅一个审查者标记的问题百分比(一致性低 = 评估准则需要收紧)
  • 逃逸率:交付后发现但圣诞老人方法本应捕获的问题(目标:0)

成本分析

圣诞老人方法的成本大约是每轮验证仅生成成本的 2-3 倍。对于大多数高风险输出而言,这是划算的:

圣诞老人方法成本 = (生成代币数) + 2×(每轮审查代币数) × (平均轮数)
不采用圣诞老人方法的成本 = (声誉损害) + (修正工作量) + (信任侵蚀)

对于批量操作,采样模式将成本降至全量验证的约 15-20%,同时捕获 >90% 的系统性问题。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/content-engine

Create platform-native content systems for X, LinkedIn, TikTok, YouTube, newsletters, and repurposed multi-platform campaigns. Use when the user wants social posts, threads, scripts, content calendars, or one source asset adapted cleanly across platforms.

affaan-m/ECC

Multi-platform content distribution across X, LinkedIn, Threads, and Bluesky. Adapts content per platform using content-engine patterns. Never posts identical content cross-platform. Use when the user wants to distribute content across social platforms.

affaan-m/fal-ai-media

Unified media generation via fal.ai MCP — image, video, and audio. Covers text-to-image (Nano Banana), text/image-to-video (Seedance, Kling, Veo 3), text-to-speech (CSM-1B), and video-to-audio (ThinkSound). Use when the user wants to generate images, videos, or audio with AI.

affaan-m/manim-video

日本語翻訳:このファイルは manim-video 用の日本語翻訳が必要です

affaan-m/remotion-video-creation

Remotion のベストプラクティス - React で動画を作成する。3D、アニメーション、音声、字幕、チャート、トランジションなどをカバーするドメイン固有の29のルール。

affaan-m/video-editing

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

agent-self-evaluation

Use after completing any non-trivial task. The agent self-rates its output on 5 axes — accuracy, completeness, clarity, actionability, conciseness — with concrete evidence per criterion. Produces a structured 1-5 scorecard with specific improvement suggestions.

agent-sort

Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.

ai-first-engineering

Engineering operating model for teams where AI agents generate a large share of implementation output. Use when setting team process, review gates, or ownership rules for a codebase largely written by agents.

ai-regression-testing

Regression testing strategies for AI-assisted development. Sandbox-mode API testing without database dependencies, automated bug-check workflows, and patterns to catch AI blind spots where the same model writes and reviews code. Use when adding regression coverage to AI-assisted code, or when the same model both wrote and reviewed a change.

android-clean-architecture

Clean Architecture patterns for Android and Kotlin Multiplatform projects — module structure, dependency rules, UseCases, Repositories, and data layer patterns. Use when structuring modules, layers, or data flow in an Android or KMP project.

angular-developer

Generates Angular code and provides architectural guidance. Trigger when creating projects, components, or services, or for best practices on reactivity (signals, linkedSignal, resource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, or CLI tooling.

相关技能