What Is the Counter-Example Extractor in Cangjie-Skill? Purpose and Implementation
The counter-example-extractor identifies author-provided warnings, failure patterns, and cognitive traps from source books to populate the Boundary segment of the Cangjie-Skill generation pipeline.
The counter-example-extractor is a specialized component in the kangarooking/cangjie-skill repository that transforms literary warnings into structured safety boundaries. As one of five parallel extractors running during stage 1 of the pipeline, it scans source materials to isolate negative examples that prevent skill misuse.
Purpose of the Counter-Example Extractor
The primary purpose of the counter-example-extractor is to identify explicit negative examples and cognitive hazards that authors embed in their texts. These extractions form the B (Boundary) segment during stage 2 of the pipeline, supplying essential context that distinguishes Cangjie-Skill outputs from ordinary book summaries.
Without this extractor, generated skills would lack clear operational boundaries, risking inappropriate application. By capturing admissions like "don’t X," "many people think X but actually…," or personal mistakes acknowledged by the author, the system defines the limits of positive skills. This ensures the final knowledge base includes actionable "what not to do" guidance alongside productive techniques.
How the Counter-Example Extractor Works
Input Sources and Signal Recognition
The extractor operates on BOOK_OVERVIEW.md and the raw book text, scanning for specific linguistic signals that indicate authorial warnings. According to the specification in extractors/counter-example-extractor.md, it matches patterns such as:
- "最大的错误是…" (the biggest mistake is…)
- "千万不要…" (never/under no circumstances…)
- "很多人以为…" (many people think… [but are wrong])
These signals reveal failure modes—explicit negative examples where the author describes what went wrong, why it went wrong, and how to recognize the trap before falling into it.
Output Structure and YAML Format
The extractor produces structured YAML documents that standardize these warnings for downstream processing. Each entry includes fields for the failure mechanism, psychological underpinnings, and observable warning signs.
- id: ce01
title: 过度自信偏误
type: counter-example
source_chapter: 误判心理学 · 第 12 条
source_quote: |
"大多数人都认为自己比平均水平更聪明、更公正、更有能力。
这种自我评价偏误在投资中尤其致命。"
failure_mode: |
在自己不懂的领域自认为懂, 导致做出超出能力圈的决策。
mechanism: |
人脑默认把"熟悉"等同于"理解", 把"喜欢"等同于"正确"。
没有外部校正机制时, 过度自信会随成功次数累积而强化。
warning_signs:
- 决策时感到"这很简单"
- 没有 plan B
- 不愿意向人请教
bound_to:
- "能力圈判断"
- "检查清单决策"
tags: [counter-example, cognitive-bias, overconfidence]
The failure_mode field describes the specific error, while mechanism explains the psychological process behind it. The warning_signs array provides behavioral red flags, and bound_to links the counter-example to related positive skills that it constrains.
Integration with the Cangjie-Skill Pipeline
As documented in methodology/02-stage1-parallel-extract.md, the counter-example-extractor runs in parallel with four other specialized extractors during the initial processing stage. This parallel architecture ensures comprehensive coverage of the source material without sequential bottlenecks.
The extractor's outputs feed directly into the assembly process defined in the framework at extractors/framework-extractor.md. During stage 2, these extracted counter-examples integrate into SKILL.md as the Boundary (B) segment, creating a safety layer around the core skill definitions. This integration ensures that every positive capability defined in the skill file carries its corresponding failure modes and limitations.
Why Counter-Examples Matter in Skill Generation
Counter-examples serve three critical functions in the final skill artifact:
- Define operational limits: They specify boundary conditions where the skill should not be applied (e.g., "only use this technique when X is true").
- Expose cognitive biases: They catalog psychological pitfalls that readers frequently encounter when attempting to apply the material.
- Generate preemptive warnings: They provide concrete mechanisms and warning signs that explain why failures occur before they happen.
This failure-mode material transforms static book summaries into actionable, safety-conscious knowledge bases. The counter-example-extractor ensures that the wisdom of what to avoid travels alongside the wisdom of what to pursue.
Summary
- The counter-example-extractor populates the B (Boundary) segment with actionable failure modes derived from author warnings.
- It recognizes specific Chinese signal patterns—including "最大的错误是…" and "千万不要…"—to identify cognitive traps in source texts.
- Output YAML documents contain structured fields for
failure_mode,mechanism,warning_signs, andbound_torelationships. - Defined in
extractors/counter-example-extractor.md, the extractor runs in parallel during stage 1 and integrates intoSKILL.mdduring stage 2 assembly.
Frequently Asked Questions
What text patterns does the counter-example-extractor identify?
The extractor matches explicit warning signals such as "最大的错误是…" (the biggest mistake is…), "千万不要…" (never…), and "很多人以为…" (many people think…). These patterns indicate author-provided negative examples, admitted mistakes, or cognitive traps that readers should avoid.
How does the counter-example-extractor fit into the parallel extraction stage?
According to methodology/02-stage1-parallel-extract.md, the extractor runs simultaneously with four other extractors during stage 1 of the pipeline. Its YAML outputs feed into stage 2, specifically composing the Boundary (B) segment that constrains the positive skills defined in the final document.
What is the relationship between counter-examples and the final SKILL.md?
The extracted counter-examples integrate into SKILL.md as structured boundaries that define when not to apply a specific skill. The bound_to field in the output YAML creates explicit links between particular failures and their corresponding positive skills, ensuring users understand operational limits.
Why are warning signs important in the extractor's output?
The warning_signs array provides concrete behavioral indicators—such as "决策时感到'这很简单'" (feeling "this is simple" when deciding) or lacking a Plan B—that help practitioners recognize when they are approaching a failure mode before committing to the error. This preemptive recognition capability prevents costly mistakes during skill application.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →