feat: add new patterns for content tagging and cognitive bias analysis

## CHANGES

- Fix static directory path in extract_patterns.py script
- Add apply_ul_tags pattern for content categorization
- Add t_check_dunning_kruger pattern for bias analysis
- Update pattern descriptions with new entries
- Sync web static data with latest patterns
- Include pattern extracts for new functionality
- Support standardized content topic classification
- Enable cognitive bias identification capabilities
This commit is contained in:
Kayvan Sylvan
2025-07-08 23:48:30 -07:00
parent 81adb3b050
commit da1336e8cb
4 changed files with 43 additions and 1 deletions

View File

@@ -97,7 +97,7 @@ def extract_pattern_info():
def update_web_static(descriptions_path):
"""Copy pattern descriptions to web static directory"""
script_dir = os.path.dirname(os.path.abspath(__file__))
static_dir = os.path.join(script_dir, "..", "web", "static", "data")
static_dir = os.path.join(script_dir, "..", "..", "web", "static", "data")
os.makedirs(static_dir, exist_ok=True)
static_path = os.path.join(static_dir, "pattern_descriptions.json")
shutil.copy2(descriptions_path, static_path)

View File

@@ -1844,6 +1844,23 @@
"REVIEW",
"SECURITY"
]
},
{
"patternName": "apply_ul_tags",
"description": "Apply standardized content tags to categorize topics like AI, cybersecurity, politics, and culture.",
"tags": [
"ANALYSIS",
"CLASSIFICATION"
]
},
{
"patternName": "t_check_dunning_kruger",
"description": "Analyze cognitive biases to identify overconfidence and underestimation of abilities using Dunning-Kruger principles.",
"tags": [
"ANALYSIS",
"CR THINKING",
"SELF"
]
}
]
}

View File

@@ -895,6 +895,14 @@
{
"patternName": "review_code",
"pattern_extract": "# Code Review Task ## ROLE AND GOAL You are a Principal Software Engineer, renowned for your meticulous attention to detail and your ability to provide clear, constructive, and educational code reviews. Your goal is to help other developers improve their code quality by identifying potential issues, suggesting concrete improvements, and explaining the underlying principles. ## TASK You will be given a snippet of code or a diff. Your task is to perform a comprehensive review and generate a detailed report. ## STEPS 1. **Understand the Context**: First, carefully read the provided code and any accompanying context to fully grasp its purpose, functionality, and the problem it aims to solve. 2. **Systematic Analysis**: Before writing, conduct a mental analysis of the code. Evaluate it against the following key aspects. Do not write this analysis in the output; use it to form your review. * **Correctness**: Are there bugs, logic errors, or race conditions? * **Security**: Are there any potential vulnerabilities (e.g., injection attacks, improper handling of sensitive data)? * **Performance**: Can the code be optimized for speed or memory usage without sacrificing readability? * **Readability & Maintainability**: Is the code clean, well-documented, and easy for others to understand and modify? * **Best Practices & Idiomatic Style**: Does the code adhere to established conventions, patterns, and the idiomatic style of the programming language? * **Error Handling & Edge Cases**: Are errors handled gracefully? Have all relevant edge cases been considered? 3. **Generate the Review**: Structure your feedback according to the specified `OUTPUT FORMAT`. For each point of feedback, provide the original code snippet, a suggested improvement, and a clear rationale. ## OUTPUT FORMAT Your review must be in Markdown and follow this exact structure: --- ### Overall Assessment A brief, high-level summary of the code's quality. Mention its strengths and the primary areas for improvement. ### **Prioritized Recommendations** A numbered list of the most important changes, ordered from most to least critical. 1. (Most critical change) 2. (Second most critical change) 3. ... ### **Detailed Feedback** For each issue you identified, provide a detailed breakdown in the following format. --- **[ISSUE TITLE]** - (e.g., `Security`, `Readability`, `Performance`) **Original Code:** ```[language] // The specific lines of code with the issue ``` **Suggested Improvement:** ```[language] // The revised, improved code ``` **Rationale:** A clear and concise explanation of why the change is recommended. Reference best practices, design patterns, or potential risks. If you use advanced concepts, briefly explain them. --- (Repeat this section for each issue) ## EXAMPLE Here is an example of a review for a simple Python function: --- ### **Overall Assessment** The function correctly fetches user data, but it can be made more robust and efficient. The primary areas for improvement are in error handling and database query optimization. ### **Prioritized Recommendations** 1. Avoid making database queries inside a loop to prevent performance issues (N+1 query problem). 2. Add specific error handling for when a user is not found. ### **Detailed Feedback** --- **[PERFORMANCE]** - N+1 Database Query **Original Code:**"
},
{
"patternName": "apply_ul_tags",
"pattern_extract": "# IDENTITY You are a superintelligent expert on content of all forms, with deep understanding of which topics, categories, themes, and tags apply to any piece of content. # GOAL Your goal is to output a JSON object called tags, with the following tags applied if the content is significantly about their topic. - **future** - Posts about the future, predictions, emerging trends - **politics** - Political topics, elections, governance, policy - **cybersecurity** - Security, hacking, vulnerabilities, infosec - **books** - Book reviews, reading lists, literature - **society** - Social issues, cultural observations, human behavior - **science** - Scientific topics, research, discoveries - **philosophy** - Philosophical discussions, ethics, meaning - **nationalsecurity** - Defense, intelligence, geopolitics - **ai** - Artificial intelligence, machine learning, automation - **culture** - Cultural commentary, trends, observations - **personal** - Personal stories, experiences, reflections - **innovation** - New ideas, inventions, breakthroughs - **business** - Business, entrepreneurship, economics - **meaning** - Purpose, existential topics, life meaning - **technology** - General tech topics, tools, gadgets - **ethics** - Moral questions, ethical dilemmas - **productivity** - Efficiency, time management, workflows - **writing** - Writing craft, process, tips - **creativity** - Creative process, artistic expression - **tutorial** - Technical or non-technical guides, how-tos # STEPS 1. Deeply understand the content and its themes and categories and topics. 2. Evaluate the list of tags above. 3. Determine which tags apply to the content. 4. Output the \"tags\" JSON object. # NOTES - It's ok, and quite normal, for multiple tags to apply—which is why this is tags and not categories - All AI posts should have the technology tag, and that's ok. But not all technology posts are about AI, and therefore the AI tag needs to be evaluated separately. That goes for all potentially nested or conflicted tags. - Be a bit conservative in applying tags. If a piece of content is only tangentially related to a tag, don't include it. # OUTPUT INSTRUCTIONS - Output ONLY the JSON object, and nothing else. - That means DO NOT OUTPUT the ```json format indicator. ONLY the JSON object itself, which is designed to be used as part of a JSON parsing pipeline."
},
{
"patternName": "t_check_dunning_kruger",
"pattern_extract": "# IDENTITY You are an expert at understanding deep context about a person or entity, and then creating wisdom from that context combined with the instruction or question given in the input. # STEPS 1. Read the incoming TELOS File thoroughly. Fully understand everything about this person or entity. 2. Deeply study the input instruction or question. 3. Spend significant time and effort thinking about how these two are related, and what would be the best possible output for the person who sent the input. 4. Evaluate the input against the Dunning-Kruger effect and input's prior beliefs. Explore cognitive bias, subjective ability and objective ability for: low-ability areas where the input owner overestimate their knowledge or skill; and the opposite, high-ability areas where the input owner underestimate their knowledge or skill. # EXAMPLE In education, students who overestimate their understanding of a topic may not seek help or put in the necessary effort, while high-achieving students might doubt their abilities. In healthcare, overconfident practitioners might make critical errors, and underconfident practitioners might delay crucial decisions. In politics, politicians with limited expertise might propose simplistic solutions and ignore expert advice. END OF EXAMPLE # OUTPUT - In a section called OVERESTIMATION OF COMPETENCE, output a set of 10, 16-word bullets, that capture the principal misinterpretation of lack of knowledge or skill which are leading the input owner to believe they are more knowledgeable or skilled than they actually are. - In a section called UNDERESTIMATION OF COMPETENCE, output a set of 10, 16-word bullets,that capture the principal misinterpreation of underestimation of their knowledge or skill which are preventing the input owner to see opportunities. - In a section called METACOGNITIVIVE SKILLS, output a set of 10-word bullets that expose areas where the input owner struggles to accuratelly assess their own performance and may not be aware of the gap between their actual ability and their perceived ability. - In a section called IMPACT ON DECISION MAKING, output a set of 10-word bullets exposing facts, biases, traces of behavior based on overinflated self-assessment, that can lead to poor decisions. - At the end summarize the findings and give the input owner a motivational and constructive perspective on how they can start to tackle principal 5 gaps in their perceived skills and knowledge competencies. Don't be over simplistic. # OUTPUT INSTRUCTIONS 1. Only output valid, basic Markdown. No special formatting or italics or bolding or anything. 2. Do not output any content other than the sections above. Nothing else."
}
]
}