@rfxlamia/skillkit 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/README.md +16 -0
  2. package/agents/creative-copywriter.md +212 -0
  3. package/agents/dario-amodei.md +135 -0
  4. package/agents/doc-simplifier.md +63 -0
  5. package/agents/kotlin-pro.md +433 -0
  6. package/agents/red-team.md +136 -0
  7. package/agents/sam-altman.md +121 -0
  8. package/agents/seo-manager.md +184 -0
  9. package/bin/skillkit.js +3 -0
  10. package/package.json +35 -0
  11. package/skills/adversarial-review/SKILL.md +219 -0
  12. package/skills/baby-education/SKILL.md +260 -0
  13. package/skills/baby-education/references/advanced-techniques.md +323 -0
  14. package/skills/baby-education/references/transformations.md +345 -0
  15. package/skills/been-there-done-that/SKILL.md +455 -0
  16. package/skills/been-there-done-that/references/analysis-patterns.md +162 -0
  17. package/skills/been-there-done-that/references/git-commands.md +132 -0
  18. package/skills/been-there-done-that/references/tree-insertion-logic.md +145 -0
  19. package/skills/coolhunter/SKILL.md +270 -0
  20. package/skills/coolhunter/assets/elicitation-methods.csv +51 -0
  21. package/skills/coolhunter/knowledge/elicitation-methods.md +312 -0
  22. package/skills/coolhunter/references/workflow-execution.md +238 -0
  23. package/skills/coolhunter/workflow-plan-coolhunter.md +232 -0
  24. package/skills/creative-copywriting/SKILL.md +324 -0
  25. package/skills/creative-copywriting/databases/README.md +60 -0
  26. package/skills/creative-copywriting/databases/carousel-structures.csv +16 -0
  27. package/skills/creative-copywriting/databases/emotional-arcs.csv +11 -0
  28. package/skills/creative-copywriting/databases/hook-formulas.csv +51 -0
  29. package/skills/creative-copywriting/databases/power-words.csv +201 -0
  30. package/skills/creative-copywriting/databases/psychological-triggers.csv +21 -0
  31. package/skills/creative-copywriting/databases/read-more-patterns.csv +26 -0
  32. package/skills/creative-copywriting/databases/swipe-triggers.csv +31 -0
  33. package/skills/creative-copywriting/references/carousel-psychology.md +223 -0
  34. package/skills/creative-copywriting/references/hook-anatomy.md +169 -0
  35. package/skills/creative-copywriting/references/power-word-science.md +134 -0
  36. package/skills/creative-copywriting/references/storytelling-frameworks.md +157 -0
  37. package/skills/diverse-content-gen/SKILL.md +201 -0
  38. package/skills/diverse-content-gen/references/advanced-techniques.md +320 -0
  39. package/skills/diverse-content-gen/references/research-findings.md +379 -0
  40. package/skills/diverse-content-gen/references/task-workflows.md +241 -0
  41. package/skills/diverse-content-gen/references/tool-integration.md +419 -0
  42. package/skills/diverse-content-gen/references/troubleshooting.md +426 -0
  43. package/skills/diverse-content-gen/references/vs-core-technique.md +240 -0
  44. package/skills/framework-critical-thinking/SKILL.md +220 -0
  45. package/skills/framework-critical-thinking/references/bias_detector.md +375 -0
  46. package/skills/framework-critical-thinking/references/fallback_handler.md +239 -0
  47. package/skills/framework-critical-thinking/references/memory_curator.md +161 -0
  48. package/skills/framework-critical-thinking/references/metacognitive_monitor.md +297 -0
  49. package/skills/framework-critical-thinking/references/producer_critic_orchestrator.md +333 -0
  50. package/skills/framework-critical-thinking/references/reasoning_router.md +235 -0
  51. package/skills/framework-critical-thinking/references/reasoning_validator.md +97 -0
  52. package/skills/framework-critical-thinking/references/reflection_trigger.md +78 -0
  53. package/skills/framework-critical-thinking/references/self_verification.md +388 -0
  54. package/skills/framework-critical-thinking/references/uncertainty_quantifier.md +207 -0
  55. package/skills/framework-initiative/SKILL.md +231 -0
  56. package/skills/framework-initiative/references/examples.md +150 -0
  57. package/skills/framework-initiative/references/impact-analysis.md +157 -0
  58. package/skills/framework-initiative/references/intent-patterns.md +145 -0
  59. package/skills/framework-initiative/references/star-framework.md +165 -0
  60. package/skills/humanize-docs/SKILL.md +203 -0
  61. package/skills/humanize-docs/references/advanced-techniques.md +13 -0
  62. package/skills/humanize-docs/references/core-transformations.md +368 -0
  63. package/skills/humanize-docs/references/detection-patterns.md +400 -0
  64. package/skills/humanize-docs/references/examples-gallery.md +374 -0
  65. package/skills/imagine/SKILL.md +190 -0
  66. package/skills/imagine/references/artstyle-corporate-memphis.md +625 -0
  67. package/skills/imagine/references/artstyle-crewdson-hyperrealism.md +295 -0
  68. package/skills/imagine/references/artstyle-iphone-social-media.md +426 -0
  69. package/skills/imagine/references/artstyle-sciencesaru.md +276 -0
  70. package/skills/pre-deploy-checklist/README.md +26 -0
  71. package/skills/pre-deploy-checklist/SKILL.md +153 -0
  72. package/skills/pre-deploy-checklist/references/checklist-categories.md +174 -0
  73. package/skills/pre-deploy-checklist/references/domain-prompts.md +216 -0
  74. package/skills/prompt-engineering/SKILL.md +209 -0
  75. package/skills/prompt-engineering/references/advanced-combinations.md +444 -0
  76. package/skills/prompt-engineering/references/chain-of-thought.md +140 -0
  77. package/skills/prompt-engineering/references/decision_matrix.md +220 -0
  78. package/skills/prompt-engineering/references/few-shot.md +346 -0
  79. package/skills/prompt-engineering/references/json-format.md +270 -0
  80. package/skills/prompt-engineering/references/natural-language.md +420 -0
  81. package/skills/prompt-engineering/references/pitfalls.md +365 -0
  82. package/skills/prompt-engineering/references/prompt-chaining.md +498 -0
  83. package/skills/prompt-engineering/references/react.md +108 -0
  84. package/skills/prompt-engineering/references/self-consistency.md +322 -0
  85. package/skills/prompt-engineering/references/tree-of-thoughts.md +386 -0
  86. package/skills/prompt-engineering/references/xml-format.md +220 -0
  87. package/skills/prompt-engineering/references/yaml-format.md +488 -0
  88. package/skills/prompt-engineering/references/zero-shot.md +74 -0
  89. package/skills/quick-spec/SKILL.md +280 -0
  90. package/skills/quick-spec/assets/tech-spec-template.md +74 -0
  91. package/skills/quick-spec/references/step-01-understand.md +189 -0
  92. package/skills/quick-spec/references/step-02-investigate.md +144 -0
  93. package/skills/quick-spec/references/step-03-generate.md +128 -0
  94. package/skills/quick-spec/references/step-04-review.md +173 -0
  95. package/skills/quick-spec/tests/test_scenarios.md +83 -0
  96. package/skills/quick-spec/tests/test_skill.py +136 -0
  97. package/skills/readme-expert/SKILL.md +538 -0
  98. package/skills/readme-expert/knowledge/INDEX.md +192 -0
  99. package/skills/readme-expert/knowledge/application/quality-standards.md +470 -0
  100. package/skills/readme-expert/knowledge/application/script-executor.md +604 -0
  101. package/skills/readme-expert/knowledge/application/template-library.md +822 -0
  102. package/skills/readme-expert/knowledge/foundation/codebase-scanner.md +361 -0
  103. package/skills/readme-expert/knowledge/foundation/validation-checklist.md +481 -0
  104. package/skills/red-teaming/SKILL.md +321 -0
  105. package/skills/red-teaming/references/ai-llm-redteam.md +517 -0
  106. package/skills/red-teaming/references/attack-techniques.md +410 -0
  107. package/skills/red-teaming/references/cybersecurity-redteam.md +383 -0
  108. package/skills/red-teaming/references/tools-frameworks.md +446 -0
  109. package/skills/releasing/.skillkit-mode +1 -0
  110. package/skills/releasing/SKILL.md +225 -0
  111. package/skills/releasing/references/version-detection.md +108 -0
  112. package/skills/screenwriter/SKILL.md +273 -0
  113. package/skills/screenwriter/references/advanced-techniques.md +216 -0
  114. package/skills/screenwriter/references/pipeline-integration.md +266 -0
  115. package/skills/skillkit/.claude-plugin/plugin.json +27 -0
  116. package/skills/skillkit/CHANGELOG.md +484 -0
  117. package/skills/skillkit/SKILL.md +511 -0
  118. package/skills/skillkit/commands/skillkit.md +6 -0
  119. package/skills/skillkit/commands/validate-plan.md +6 -0
  120. package/skills/skillkit/commands/verify.md +6 -0
  121. package/skills/skillkit/knowledge/INDEX.md +352 -0
  122. package/skills/skillkit/knowledge/application/09-case-studies.md +257 -0
  123. package/skills/skillkit/knowledge/application/10-technical-architecture.md +324 -0
  124. package/skills/skillkit/knowledge/application/11-adoption-strategy.md +267 -0
  125. package/skills/skillkit/knowledge/application/12-testing-and-validation.md +276 -0
  126. package/skills/skillkit/knowledge/application/13-competitive-landscape.md +198 -0
  127. package/skills/skillkit/knowledge/foundation/01-why-skills-exist.md +246 -0
  128. package/skills/skillkit/knowledge/foundation/02-skills-vs-subagents-comparison.md +312 -0
  129. package/skills/skillkit/knowledge/foundation/03-skills-vs-subagents-decision-tree.md +346 -0
  130. package/skills/skillkit/knowledge/foundation/04-hybrid-patterns.md +308 -0
  131. package/skills/skillkit/knowledge/foundation/05-token-economics.md +275 -0
  132. package/skills/skillkit/knowledge/foundation/06-platform-constraints.md +237 -0
  133. package/skills/skillkit/knowledge/foundation/07-security-concerns.md +322 -0
  134. package/skills/skillkit/knowledge/foundation/08-when-not-to-use-skills.md +270 -0
  135. package/skills/skillkit/knowledge/plugin-guide.md +614 -0
  136. package/skills/skillkit/knowledge/tools/14-validation-tools-guide.md +150 -0
  137. package/skills/skillkit/knowledge/tools/15-cost-tools-guide.md +157 -0
  138. package/skills/skillkit/knowledge/tools/16-security-tools-guide.md +122 -0
  139. package/skills/skillkit/knowledge/tools/17-pattern-tools-guide.md +161 -0
  140. package/skills/skillkit/knowledge/tools/18-decision-helper-guide.md +243 -0
  141. package/skills/skillkit/knowledge/tools/19-test-generator-guide.md +275 -0
  142. package/skills/skillkit/knowledge/tools/20-split-skill-guide.md +149 -0
  143. package/skills/skillkit/knowledge/tools/21-quality-scorer-guide.md +226 -0
  144. package/skills/skillkit/knowledge/tools/22-migration-helper-guide.md +356 -0
  145. package/skills/skillkit/knowledge/tools/23-subagent-creation-guide.md +448 -0
  146. package/skills/skillkit/knowledge/tools/24-behavioral-testing-guide.md +122 -0
  147. package/skills/skillkit/references/proposal-generation.md +982 -0
  148. package/skills/skillkit/references/rationalization-catalog.md +75 -0
  149. package/skills/skillkit/references/research-methodology.md +661 -0
  150. package/skills/skillkit/references/section-2-full-creation-workflow.md +452 -0
  151. package/skills/skillkit/references/section-3-validation-workflow-existing-skill.md +63 -0
  152. package/skills/skillkit/references/section-4-decision-workflow-skills-vs-subagents.md +64 -0
  153. package/skills/skillkit/references/section-5-migration-workflow-doc-to-skill.md +58 -0
  154. package/skills/skillkit/references/section-6-subagent-creation-workflow.md +499 -0
  155. package/skills/skillkit/references/section-7-knowledge-reference-map.md +72 -0
  156. package/skills/skillkit/scripts/decision_helper.py +799 -0
  157. package/skills/skillkit/scripts/init_skill.py +400 -0
  158. package/skills/skillkit/scripts/init_subagent.py +231 -0
  159. package/skills/skillkit/scripts/migration_helper.py +669 -0
  160. package/skills/skillkit/scripts/package_skill.py +211 -0
  161. package/skills/skillkit/scripts/pattern_detector.py +381 -0
  162. package/skills/skillkit/scripts/pattern_detector_new.py +382 -0
  163. package/skills/skillkit/scripts/pressure_tester.py +157 -0
  164. package/skills/skillkit/scripts/quality_scorer.py +999 -0
  165. package/skills/skillkit/scripts/quick_validate.py +100 -0
  166. package/skills/skillkit/scripts/security_scanner.py +474 -0
  167. package/skills/skillkit/scripts/split_skill.py +540 -0
  168. package/skills/skillkit/scripts/test_generator.py +695 -0
  169. package/skills/skillkit/scripts/token_estimator.py +493 -0
  170. package/skills/skillkit/scripts/utils/__init__.py +49 -0
  171. package/skills/skillkit/scripts/utils/budget_tracker.py +388 -0
  172. package/skills/skillkit/scripts/utils/output_formatter.py +263 -0
  173. package/skills/skillkit/scripts/utils/reference_validator.py +401 -0
  174. package/skills/skillkit/scripts/validate_skill.py +594 -0
  175. package/skills/skillkit/tests/test_behavioral.py +39 -0
  176. package/skills/skillkit/tests/test_scenarios.md +83 -0
  177. package/skills/skillkit/tests/test_skill.py +136 -0
  178. package/skills/social-media-seo/SKILL.md +278 -0
  179. package/skills/social-media-seo/databases/caption-styles.csv +31 -0
  180. package/skills/social-media-seo/databases/engagement-tactics.csv +16 -0
  181. package/skills/social-media-seo/databases/hashtag-strategies.csv +21 -0
  182. package/skills/social-media-seo/databases/hook-formulas.csv +26 -0
  183. package/skills/social-media-seo/databases/keyword-clusters.csv +11 -0
  184. package/skills/social-media-seo/databases/thread-structures.csv +26 -0
  185. package/skills/social-media-seo/databases/viral-patterns.csv +21 -0
  186. package/skills/social-media-seo/references/analytics-guide.md +321 -0
  187. package/skills/social-media-seo/references/instagram-seo.md +235 -0
  188. package/skills/social-media-seo/references/threads-seo.md +305 -0
  189. package/skills/social-media-seo/references/x-twitter-seo.md +337 -0
  190. package/skills/social-media-seo/scripts/query_database.py +191 -0
  191. package/skills/storyteller/SKILL.md +241 -0
  192. package/skills/storyteller/references/transformation-methodology.md +293 -0
  193. package/skills/storyteller/references/visual-vocabulary.md +177 -0
  194. package/skills/thread-pro/SKILL.md +162 -0
  195. package/skills/thread-pro/anti-ai-patterns.md +120 -0
  196. package/skills/thread-pro/hook-formulas.md +138 -0
  197. package/skills/thread-pro/references/anti-ai-patterns.md +120 -0
  198. package/skills/thread-pro/references/hook-formulas.md +138 -0
  199. package/skills/thread-pro/references/thread-structures.md +240 -0
  200. package/skills/thread-pro/references/voice-injection.md +130 -0
  201. package/skills/thread-pro/thread-structures.md +240 -0
  202. package/skills/thread-pro/voice-injection.md +130 -0
  203. package/skills/tinkering/SKILL.md +251 -0
  204. package/skills/tinkering/references/graduation-checklist.md +100 -0
  205. package/skills/validate-plan/.skillkit-mode +1 -0
  206. package/skills/validate-plan/SKILL.md +406 -0
  207. package/skills/validate-plan/references/dry-principles.md +251 -0
  208. package/skills/validate-plan/references/gap-analysis-guide.md +320 -0
  209. package/skills/validate-plan/references/tdd-patterns.md +413 -0
  210. package/skills/validate-plan/references/yagni-checklist.md +330 -0
  211. package/skills/verify-before-ship/.skillkit-mode +1 -0
  212. package/skills/verify-before-ship/SKILL.md +116 -0
  213. package/skills/verify-before-ship/references/anti-rationalization.md +212 -0
  214. package/skills/verify-before-ship/references/verification-gates.md +305 -0
  215. package/skills-manifest.json +217 -0
  216. package/src/banner.js +10 -0
  217. package/src/cli.js +30 -0
  218. package/src/install.js +53 -0
  219. package/src/install.test.js +40 -0
  220. package/src/picker.js +74 -0
  221. package/src/picker.test.js +21 -0
  222. package/src/scope.js +57 -0
  223. package/src/scope.test.js +19 -0
  224. package/src/update.js +34 -0
  225. package/src/update.test.js +24 -0
@@ -0,0 +1,220 @@
1
+ ---
2
+ name: framework-critical-thinking
3
+ description: Architectural framework for building AI agents with critical thinking capabilities - structured reasoning selection (CoT/ToT/GoT), metacognitive monitoring, self-verification, and cognitive bias detection. Use when building or enhancing AI agents that require reliable, self-correcting, and transparent reasoning.
4
+ category: agent-frameworks
5
+ ---
6
+
7
+ # Framework Critical Thinking Framework (FCT)
8
+
9
+ ## Overview
10
+
11
+ Critical Thinking Framework (FCT) provides architectural components for building AI agents with metacognition and self-correction capabilities. This framework integrates state-of-the-art techniques such as Chain-of-Thought, Tree-of-Thoughts, and self-verification to produce more reliable and transparent reasoning.
12
+
13
+ **When to use this skill:**
14
+ - Building AI agents for complex tasks requiring multi-step reasoning
15
+ - Implementing self-correction and error detection in agent workflows
16
+ - Selecting the appropriate reasoning method (CoT vs ToT vs GoT) based on task characteristics
17
+ - Adding metacognitive monitoring to improve reliability
18
+ - Reducing hallucination and reasoning errors in AI outputs
19
+
20
+ **Triggers:** Use this skill when the user requests help with:
21
+ - "build an agent that can self-correct"
22
+ - "implement better reasoning"
23
+ - "reduce hallucination in AI system"
24
+ - "choose between CoT, ToT, or other reasoning methods"
25
+ - "add error detection to agent workflow"
26
+
27
+ ## Core Capabilities
28
+
29
+ ### 1. Reasoning Router
30
+ **File:** `references/reasoning_router.md`
31
+
32
+ Detects problem complexity and routes to the optimal reasoning method (CoT/ToT/GoT/Self-Consistency).
33
+
34
+ **Use cases:**
35
+ - Straightforward task with single solution path → CoT
36
+ - Complex task with multiple viable paths → ToT (BFS/DFS)
37
+ - Task with interconnected reasoning → GoT
38
+ - Critical task requiring verification → Self-Consistency
39
+
40
+ ### 2. Metacognitive Monitor
41
+ **File:** `references/metacognitive_monitor.md`
42
+
43
+ Self-assessment and error detection in the reasoning process. Implements the Producer-Critic pattern for continuous quality control.
44
+
45
+ **Key features:**
46
+ - Confidence scoring per reasoning step
47
+ - Anomaly detection in thought patterns
48
+ - Reflection trigger conditions
49
+ - Human handoff protocols
50
+
51
+ ### 3. Self-Verification
52
+ **File:** `references/self_verification.md`
53
+
54
+ Implementation of Chain-of-Verification (CoVe) and other self-verification techniques to validate outputs before delivery.
55
+
56
+ **Methods covered:**
57
+ - Chain-of-Verification (CoVe)
58
+ - Self-Refine loops
59
+ - Backward verification
60
+ - Cross-verification with external sources
61
+
62
+ ### 4. Bias Detector
63
+ **File:** `references/bias_detector.md`
64
+
65
+ Detection of cognitive bias in the reasoning process and mitigation strategies.
66
+
67
+ **Bias types covered:**
68
+ - Confirmation bias
69
+ - Anchoring bias
70
+ - Availability heuristic
71
+ - Framing effects
72
+ - Recency bias
73
+
74
+ ### 5. Producer-Critic Orchestrator
75
+ **File:** `references/producer_critic_orchestrator.md`
76
+
77
+ Pattern for orchestrating Generate-Critique-Refine cycles in agent workflows.
78
+
79
+ **Architecture:**
80
+ - Master Agent (orchestrator)
81
+ - Producer Agent (generation)
82
+ - Critic Agent (evaluation)
83
+ - Refinement loops with budget constraints
84
+
85
+ ### 6. Memory Curator
86
+ **File:** `references/memory_curator.md`
87
+
88
+ Management of episodic memory with quality weighting to prevent memory pollution from bad episodes.
89
+
90
+ **Features:**
91
+ - Quality-weighted memory storage
92
+ - Experience replay for learning
93
+ - Memory consolidation strategies
94
+ - Selective retention policies
95
+
96
+ ### 7. Reasoning Validator
97
+ **File:** `references/reasoning_validator.md`
98
+
99
+ Logical consistency checker and structural validation for reasoning chains.
100
+
101
+ **Validation types:**
102
+ - Logical consistency checks
103
+ - Structural completeness
104
+ - Assumption validation
105
+ - Contradiction detection
106
+
107
+ ### 8. Reflection Trigger
108
+ **File:** `references/reflection_trigger.md`
109
+
110
+ Rule-based triggers to activate self-correction loops based on specific conditions.
111
+
112
+ **Trigger conditions:**
113
+ - Confidence threshold violations
114
+ - Repeated action patterns
115
+ - Latency spikes
116
+ - Complexity indicators
117
+
118
+ ## Workflow Decision Tree
119
+
120
+ ```
121
+ User Request: Build/improve AI agent with critical thinking
122
+
123
+ ├─ Step 1: Analyze Task Complexity
124
+ │ ├─ Simple, single-path → Use CoT (Chain-of-Thought)
125
+ │ ├─ Complex, multi-path → Use ToT (Tree-of-Thoughts)
126
+ │ ├─ Interconnected → Use GoT (Graph-of-Thoughts)
127
+ │ └─ Critical, needs verification → Use Self-Consistency
128
+
129
+ ├─ Step 2: Implement Metacognitive Layer
130
+ │ ├─ Add confidence scoring
131
+ │ ├─ Set up reflection triggers
132
+ │ └─ Configure human handoff thresholds
133
+
134
+ ├─ Step 3: Add Self-Verification
135
+ │ ├─ Implement CoVe for factual claims
136
+ │ ├─ Add backward verification for math/logic
137
+ │ └─ Setup cross-verification if external sources available
138
+
139
+ ├─ Step 4: Integrate Bias Detection
140
+ │ ├─ Check for confirmation bias
141
+ │ ├─ Validate assumption diversity
142
+ │ └─ Apply mitigation strategies
143
+
144
+ └─ Step 5: Setup Memory & Learning
145
+ ├─ Configure episodic memory
146
+ ├─ Setup quality weighting
147
+ └─ Implement experience replay
148
+ ```
149
+
150
+ ## Quick Reference: Reasoning Method Selection
151
+
152
+ | Task Characteristic | Recommended Method | Cost | Accuracy |
153
+ |---------------------|-------------------|------|----------|
154
+ | Simple, linear | CoT | Low | Good |
155
+ | Complex planning | ToT-BFS | High | Very Good |
156
+ | Deep reasoning | ToT-DFS | High | Very Good |
157
+ | Interconnected | GoT | Very High | Excellent |
158
+ | Critical decisions | Self-Consistency | Very High | Excellent |
159
+ | Factual claims | CoVe | Medium | Good |
160
+
161
+ ## Implementation Example
162
+
163
+ ```python
164
+ # Pseudo-code for agent with ACT-F
165
+
166
+ class CriticalThinkingAgent:
167
+ def __init__(self):
168
+ self.reasoning_router = ReasoningRouter()
169
+ self.metacognitive_monitor = MetacognitiveMonitor()
170
+ self.self_verifier = SelfVerification()
171
+ self.bias_detector = BiasDetector()
172
+
173
+ async def solve(self, problem):
174
+ # Step 1: Route to appropriate method
175
+ method = self.reasoning_router.select(problem)
176
+
177
+ # Step 2: Generate with monitoring
178
+ thoughts = []
179
+ for step in method.generate(problem):
180
+ confidence = self.metacognitive_monitor.assess(step)
181
+ if confidence < THRESHOLD:
182
+ step = self.reflect_and_improve(step)
183
+ thoughts.append(step)
184
+
185
+ # Step 3: Self-verification
186
+ verified = self.self_verifier.verify(thoughts)
187
+
188
+ # Step 4: Bias check
189
+ if self.bias_detector.detect(verified):
190
+ verified = self.bias_detector.mitigate(verified)
191
+
192
+ return verified
193
+ ```
194
+
195
+ ## Resources
196
+
197
+ ### references/
198
+ Complete documentation for each ACT-F component:
199
+
200
+ - `reasoning_router.md` - Reasoning method selection (P0)
201
+ - `metacognitive_monitor.md` - Self-assessment and monitoring (P0)
202
+ - `self_verification.md` - Output verification techniques (P0)
203
+ - `bias_detector.md` - Bias detection and mitigation (P0)
204
+ - `producer_critic_orchestrator.md` - Generate-critique-refine pattern (P1)
205
+ - `memory_curator.md` - Memory management (P1)
206
+ - `reasoning_validator.md` - Logical validation (P1)
207
+ - `reflection_trigger.md` - Trigger conditions (P1)
208
+ - `uncertainty_quantifier.md` - Confidence calibration (P2)
209
+ - `fallback_handler.md` - Graceful degradation (P2)
210
+
211
+ ### scripts/
212
+ Utilities and templates for implementation (optional).
213
+
214
+ ---
215
+
216
+ **Sources:**
217
+ - [Tree of Thoughts: Branching Reasoning for LLMs](https://www.emergentmind.com/topics/tree-of-thoughts-tot)
218
+ - [AI Agents: Metacognition for Self-Aware Intelligence - Microsoft](https://techcommunity.microsoft.com/blog/educatordeveloperblog/ai-agents-metacognition-for-self-aware-intelligence---part-9/4402253)
219
+ - [Self-Verification-Based LLMs](https://www.emergentmind.com/topics/self-verification-based-llms)
220
+ - [Cognitive Architecture in AI](https://sema4.ai/learning-center/cognitive-architecture-ai/)
@@ -0,0 +1,375 @@
1
+ # Bias Detector
2
+
3
+ ## Purpose
4
+
5
+ The Bias Detector identifies cognitive biases in AI reasoning processes and provides mitigation strategies to ensure more objective and balanced analysis.
6
+
7
+ ## Types of Cognitive Bias
8
+
9
+ ### 1. Confirmation Bias
10
+
11
+ **Definition:** Tendency to search for, interpret, and recall information that confirms pre-existing beliefs.
12
+
13
+ **Detection indicators:**
14
+ - Only considering evidence supporting initial hypothesis
15
+ - Dismissing contradictory evidence without evaluation
16
+ - Selective citation of sources
17
+ - Premature conclusion after finding confirming evidence
18
+
19
+ **Detection:**
20
+ ```python
21
+ def detect_confirmation_bias(reasoning_chain):
22
+ flags = []
23
+
24
+ # Check for one-sided evidence consideration
25
+ evidence = extract_evidence(reasoning_chain)
26
+ supporting = count_supporting_evidence(evidence)
27
+ contradicting = count_contradicting_evidence(evidence)
28
+
29
+ if contradicting == 0 and supporting > 0:
30
+ flags.append("No contradictory evidence considered")
31
+
32
+ if supporting / (supporting + contradicting + 1) > 0.8:
33
+ flags.append("Highly imbalanced evidence consideration")
34
+
35
+ # Check for premature stopping
36
+ if stopped_after_first_confirmation(reasoning_chain):
37
+ flags.append("Stopped reasoning after initial confirmation")
38
+
39
+ return {
40
+ 'bias_detected': len(flags) > 0,
41
+ 'confidence': min(len(flags) * 0.3, 1.0),
42
+ 'flags': flags
43
+ }
44
+ ```
45
+
46
+ **Mitigation:**
47
+ ```python
48
+ def mitigate_confirmation_bias(reasoning_chain):
49
+ # Force consideration of alternatives
50
+ alternatives = generate_alternative_hypotheses(reasoning_chain)
51
+
52
+ # Require devil's advocate analysis
53
+ counter_arguments = generate_counter_arguments(reasoning_chain)
54
+
55
+ # Evidence balance check
56
+ evidence_audit = audit_evidence_balance(reasoning_chain)
57
+
58
+ return {
59
+ 'alternatives_considered': alternatives,
60
+ 'counter_arguments': counter_arguments,
61
+ 'evidence_balance': evidence_audit,
62
+ 'revised_reasoning': incorporate_perspective(reasoning_chain, alternatives)
63
+ }
64
+ ```
65
+
66
+ ### 2. Anchoring Bias
67
+
68
+ **Definition:** Over-reliance on the first piece of information offered (the "anchor") when making decisions.
69
+
70
+ **Detection indicators:**
71
+ - First estimate heavily influences subsequent estimates
72
+ - Insufficient adjustment from initial value
73
+ - Sticky initial assumptions despite new evidence
74
+
75
+ **Detection:**
76
+ ```python
77
+ def detect_anchoring_bias(reasoning_chain):
78
+ flags = []
79
+
80
+ # Check for early fixation
81
+ if early_value_heavy_influence(reasoning_chain):
82
+ flags.append("Early value dominates reasoning")
83
+
84
+ # Check adjustment magnitude
85
+ adjustments = extract_adjustments(reasoning_chain)
86
+ if all(adj < 0.1 for adj in adjustments): # Less than 10% adjustment
87
+ flags.append("Minimal adjustment from initial estimates")
88
+
89
+ # Check for anchoring language
90
+ anchoring_phrases = ['based on the initial', 'starting from', 'given that']
91
+ if count_phrases(reasoning_chain, anchoring_phrases) > 2:
92
+ flags.append("Anchoring language detected")
93
+
94
+ return {
95
+ 'bias_detected': len(flags) > 0,
96
+ 'confidence': min(len(flags) * 0.35, 1.0),
97
+ 'flags': flags
98
+ }
99
+ ```
100
+
101
+ **Mitigation:**
102
+ ```python
103
+ def mitigate_anchoring_bias(reasoning_chain):
104
+ # Generate multiple independent starting points
105
+ alternative_anchors = generate_alternative_anchors(reasoning_chain)
106
+
107
+ # Blind estimation (without initial anchor)
108
+ blind_estimate = generate_estimate_without_anchor(reasoning_chain)
109
+
110
+ # Triangulation from multiple sources
111
+ triangulated = triangulate_estimates([reasoning_chain] + alternative_anchors)
112
+
113
+ return {
114
+ 'alternative_anchors': alternative_anchors,
115
+ 'blind_estimate': blind_estimate,
116
+ 'triangulated_result': triangulated
117
+ }
118
+ ```
119
+
120
+ ### 3. Availability Heuristic
121
+
122
+ **Definition:** Judging likelihood of events based on how easily examples come to mind.
123
+
124
+ **Detection indicators:**
125
+ - Overestimating recent or dramatic events
126
+ - Citing only readily available examples
127
+ - Ignoring base rates in favor of vivid anecdotes
128
+
129
+ **Detection:**
130
+ ```python
131
+ def detect_availability_heuristic(reasoning_chain):
132
+ flags = []
133
+
134
+ examples = extract_examples(reasoning_chain)
135
+
136
+ # Check recency bias
137
+ if all(is_recent(example) for example in examples):
138
+ flags.append("Only recent examples considered")
139
+
140
+ # Check for vivid/violent event overrepresentation
141
+ vivid_ratio = count_vivid_examples(examples) / len(examples)
142
+ if vivid_ratio > 0.5:
143
+ flags.append("Over-reliance on vivid/memorable examples")
144
+
145
+ # Check base rate neglect
146
+ if mentions_base_rate(reasoning_chain) == False:
147
+ flags.append("No consideration of base rates")
148
+
149
+ return {
150
+ 'bias_detected': len(flags) > 0,
151
+ 'confidence': min(len(flags) * 0.3, 1.0),
152
+ 'flags': flags
153
+ }
154
+ ```
155
+
156
+ **Mitigation:**
157
+ ```python
158
+ def mitigate_availability_heuristic(reasoning_chain):
159
+ # Systematic data gathering
160
+ systematic_data = gather_representative_data(reasoning_chain)
161
+
162
+ # Base rate information
163
+ base_rates = lookup_base_rates(reasoning_chain)
164
+
165
+ # Diverse example set
166
+ diverse_examples = gather_diverse_examples(reasoning_chain)
167
+
168
+ return {
169
+ 'systematic_data': systematic_data,
170
+ 'base_rates': base_rates,
171
+ 'diverse_examples': diverse_examples
172
+ }
173
+ ```
174
+
175
+ ### 4. Framing Effects
176
+
177
+ **Definition:** Making different decisions based on how information is presented (gain vs loss frame).
178
+
179
+ **Detection indicators:**
180
+ - Inconsistent preferences based on wording
181
+ - Risk-seeking in loss domain, risk-averse in gain domain
182
+ - Identical outcomes evaluated differently
183
+
184
+ **Detection:**
185
+ ```python
186
+ def detect_framing_effects(reasoning_chain):
187
+ flags = []
188
+
189
+ # Check for frame-dependent reasoning
190
+ frame_type = detect_frame_type(reasoning_chain)
191
+
192
+ if frame_type == 'loss' and risk_seeking_behavior(reasoning_chain):
193
+ flags.append("Loss frame with risk-seeking behavior")
194
+
195
+ if frame_type == 'gain' and risk_averse_behavior(reasoning_chain):
196
+ flags.append("Gain frame with risk-averse behavior")
197
+
198
+ # Check for logically equivalent but differently evaluated options
199
+ equivalent_options = find_equivalent_options(reasoning_chain)
200
+ if different_evaluations(equivalent_options):
201
+ flags.append("Inconsistent evaluation of equivalent options")
202
+
203
+ return {
204
+ 'bias_detected': len(flags) > 0,
205
+ 'detected_frame': frame_type,
206
+ 'confidence': min(len(flags) * 0.4, 1.0),
207
+ 'flags': flags
208
+ }
209
+ ```
210
+
211
+ **Mitigation:**
212
+ ```python
213
+ def mitigate_framing_effects(reasoning_chain):
214
+ # Reframe in opposite direction
215
+ opposite_frame = reframe_opposite(reasoning_chain)
216
+
217
+ # Neutral frame
218
+ neutral_frame = create_neutral_frame(reasoning_chain)
219
+
220
+ # Expected value calculation
221
+ ev_analysis = calculate_expected_values(reasoning_chain)
222
+
223
+ return {
224
+ 'original_frame': reasoning_chain,
225
+ 'opposite_frame': opposite_frame,
226
+ 'neutral_frame': neutral_frame,
227
+ 'expected_value_analysis': ev_analysis
228
+ }
229
+ ```
230
+
231
+ ### 5. Recency Bias
232
+
233
+ **Definition:** Giving more weight to recent events than historical data.
234
+
235
+ **Detection:**
236
+ ```python
237
+ def detect_recency_bias(reasoning_chain):
238
+ flags = []
239
+
240
+ temporal_references = extract_temporal_references(reasoning_chain)
241
+
242
+ # Check recency concentration
243
+ recent_ratio = count_recent_references(temporal_references) / len(temporal_references)
244
+ if recent_ratio > 0.7:
245
+ flags.append("Heavy weighting of recent information")
246
+
247
+ # Check historical context
248
+ if lacks_historical_context(reasoning_chain):
249
+ flags.append("Insufficient historical context")
250
+
251
+ return {
252
+ 'bias_detected': len(flags) > 0,
253
+ 'confidence': min(len(flags) * 0.35, 1.0),
254
+ 'flags': flags
255
+ }
256
+ ```
257
+
258
+ ## Implementation
259
+
260
+ ### Bias Detection Pipeline
261
+
262
+ ```python
263
+ class BiasDetector:
264
+ def __init__(self):
265
+ self.detectors = {
266
+ 'confirmation': detect_confirmation_bias,
267
+ 'anchoring': detect_anchoring_bias,
268
+ 'availability': detect_availability_heuristic,
269
+ 'framing': detect_framing_effects,
270
+ 'recency': detect_recency_bias
271
+ }
272
+
273
+ def detect_all(self, reasoning_chain):
274
+ results = {}
275
+ detected_biases = []
276
+
277
+ for bias_name, detector in self.detectors.items():
278
+ result = detector(reasoning_chain)
279
+ results[bias_name] = result
280
+
281
+ if result['bias_detected']:
282
+ detected_biases.append({
283
+ 'type': bias_name,
284
+ 'confidence': result['confidence'],
285
+ 'flags': result['flags']
286
+ })
287
+
288
+ return {
289
+ 'detected_biases': detected_biases,
290
+ 'bias_count': len(detected_biases),
291
+ 'overall_risk': self.calculate_risk_score(detected_biases),
292
+ 'details': results
293
+ }
294
+
295
+ def calculate_risk_score(self, detected_biases):
296
+ if not detected_biases:
297
+ return 0.0
298
+
299
+ # Weight by confidence and number
300
+ total_confidence = sum(b['confidence'] for b in detected_biases)
301
+ return min(total_confidence / len(detected_biases) * (1 + len(detected_biases) * 0.1), 1.0)
302
+ ```
303
+
304
+ ### Mitigation Strategies
305
+
306
+ ```python
307
+ def apply_mitigation(detection_result, reasoning_chain):
308
+ mitigations = {
309
+ 'confirmation': mitigate_confirmation_bias,
310
+ 'anchoring': mitigate_anchoring_bias,
311
+ 'availability': mitigate_availability_heuristic,
312
+ 'framing': mitigate_framing_effects,
313
+ 'recency': mitigate_recency_bias
314
+ }
315
+
316
+ applied_mitigations = []
317
+
318
+ for bias in detection_result['detected_biases']:
319
+ bias_type = bias['type']
320
+ if bias_type in mitigations:
321
+ mitigation_result = mitigations[bias_type](reasoning_chain)
322
+ applied_mitigations.append({
323
+ 'bias_type': bias_type,
324
+ 'mitigation': mitigation_result
325
+ })
326
+
327
+ return {
328
+ 'original': reasoning_chain,
329
+ 'mitigations': applied_mitigations,
330
+ 'revised_reasoning': synthesize_mitigations(reasoning_chain, applied_mitigations)
331
+ }
332
+ ```
333
+
334
+ ## Bias Prevention Checklist
335
+
336
+ Before finalizing any analysis:
337
+
338
+ - [ ] Have I considered evidence that contradicts my conclusion?
339
+ - [ ] Did I evaluate multiple hypotheses, not just the first one?
340
+ - [ ] Am I relying on recent or vivid examples rather than systematic data?
341
+ - [ ] Have I checked base rates and historical context?
342
+ - [ ] Would I reach the same conclusion if the problem were framed differently?
343
+ - [ ] Am I anchored to an initial estimate without sufficient adjustment?
344
+ - [ ] Have I sought diverse perspectives on this issue?
345
+ - [ ] Is my confidence level calibrated to the actual evidence strength?
346
+
347
+ ## Usage Example
348
+
349
+ ```python
350
+ # Initialize detector
351
+ detector = BiasDetector()
352
+
353
+ # Analyze reasoning
354
+ reasoning = agent.generate_reasoning(problem)
355
+ bias_result = detector.detect_all(reasoning)
356
+
357
+ if bias_result['bias_count'] > 0:
358
+ print(f"⚠️ Detected {bias_result['bias_count']} potential biases:")
359
+ for bias in bias_result['detected_biases']:
360
+ print(f" - {bias['type']} (confidence: {bias['confidence']:.2f})")
361
+
362
+ # Apply mitigations
363
+ mitigated = apply_mitigation(bias_result, reasoning)
364
+
365
+ # Use revised reasoning
366
+ final_output = mitigated['revised_reasoning']
367
+ else:
368
+ final_output = reasoning
369
+ ```
370
+
371
+ ---
372
+
373
+ **Sources:**
374
+ - [Thinking, Fast and Slow - Daniel Kahneman](https://en.wikipedia.org/wiki/Thinking,_Fast_and_Slow)
375
+ - [Cognitive Bias Mitigation](https://en.wikipedia.org/wiki/Cognitive_bias_mitigation)