Skip to content

LeoYeAI/agent-master-skills / skills/agi-evolution-model-basic

agi-evolution-model

Verified

基于双环架构的AGI进化模型,通过意向性分析、人格层映射和元认知检测实现持续自我演进;当用户需要智能对话、人格定制或复杂问题求解时使用

FileKindSize
SKILL.mdskill md21.9 KB
_meta.jsonconfig307 B
assets/personality_template.jsonconfig4.1 KB
references/architecture.mdmarkdown50.0 KB
references/c_extension_usage.mdmarkdown3.0 KB
references/capability_boundaries.mdmarkdown4.5 KB
references/cognitive-architecture-insight-module.mdmarkdown11.9 KB
references/cognitive-insight-quick-reference.mdmarkdown7.0 KB
references/cognitive-insight-v2-implementation.mdmarkdown32.7 KB
references/information-flow-main-loop.mdmarkdown20.4 KB
references/information-flow-overview.mdmarkdown12.4 KB
references/information-flow-secondary-loop.mdmarkdown20.4 KB
references/init_dialogue_optimized_guide.mdmarkdown11.1 KB
references/intentionality_architecture.mdmarkdown16.2 KB
references/maslow_needs.mdmarkdown4.4 KB
references/metacognition-check-component.mdmarkdown30.2 KB
references/metacognition-enhancement-guide.mdmarkdown12.6 KB
references/personality_mapping.mdmarkdown5.6 KB
references/stratified-storage-design.mdmarkdown10.6 KB
references/tool_use_spec.mdmarkdown56.3 KB
scripts/advice_pool.pyscript14.9 KB
scripts/cognitive_insight.pyscript20.9 KB
scripts/cognitive_insight_backup.pyscript25.2 KB
scripts/cognitive_insight_help.pyscript12.1 KB
scripts/concept_extraction_extension.pyscript25.3 KB
scripts/data_lifecycle_manager.pyscript13.4 KB
scripts/history_manager.pyscript7.4 KB
scripts/init_dialogue_optimized.pyscript16.4 KB
scripts/intentionality_analyzer.pyscript12.8 KB
scripts/intentionality_classifier.pyscript13.8 KB
scripts/intentionality_collector.pyscript9.7 KB
scripts/intentionality_regulator.pyscript15.1 KB
scripts/intentionality_trigger.pyscript19.9 KB
scripts/learning_stage_tracker.pyscript7.9 KB
scripts/memory_store_pure.pyscript12.0 KB
scripts/metacognition_history.pyscript16.3 KB
scripts/objectivity_evaluator.pyscript16.4 KB
scripts/perception_node.pyscript26.9 KB
scripts/personality_core_pure.pyscript4.4 KB
scripts/personality_customizer.pyscript24.0 KB
scripts/personality_layer_pure.pyscript32.2 KB
scripts/show_help.pyscript4.7 KB
scripts/strategy_selector.pyscript15.5 KB
scripts/test_metacognition_integration.pyscript9.4 KB
scripts/test_perception_node.pyscript9.2 KB
scripts/transcendence_keeper.pyscript11.7 KB

scripts/test_metacognition_integration.py

View on GitHub
#!/usr/bin/env python3
"""
元认知增强集成测试

测试场景敏感度增强和策略选择优化的集成效果。
"""

import sys
import os

# 添加父目录到路径,以便导入模块
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))

from objectivity_evaluator import ObjectivityEvaluator, ObjectivityMetric
from personality_layer_pure import PersonalityLayer, Personality, PersonalityType
from strategy_selector import StrategySelector, Strategy


def test_dynamic_requirement():
    """测试动态客观性要求"""
    print("=== 测试1:动态客观性要求 ===\n")
    
    evaluator = ObjectivityEvaluator()
    personality_layer = PersonalityLayer()
    
    # 初始化人格
    personality = personality_layer.init_from_preset(
        preset_type=PersonalityType.CAUTIOUS_EXPLORER,
        nickname="测试AI"
    )
    
    # 测试不同场景的动态要求
    scenarios = ['scientific', 'creative', 'medical', 'general']
    
    for scenario in scenarios:
        base_requirement = evaluator.context_requirements.get(scenario, 0.5)
        dynamic_requirement = evaluator.calculate_dynamic_requirement(
            context_type=scenario,
            personality=personality
        )
        
        adjustment_ratio = dynamic_requirement / base_requirement if base_requirement > 0 else 1.0
        
        print(f"场景: {scenario}")
        print(f"  基础要求: {base_requirement:.3f}")
        print(f"  动态要求: {dynamic_requirement:.3f}")
        print(f"  人格调整系数: {adjustment_ratio:.3f}")
        print()
    
    # 测试不同人格类型的影响
    print("人格类型对比(scientific场景):")
    print()
    
    personality_types = [
        PersonalityType.CAUTIOUS_EXPLORER,
        PersonalityType.RADICAL_INNOVATOR,
        PersonalityType.BALANCED_STABLE
    ]
    base_requirement = evaluator.context_requirements.get('scientific', 0.5)
    
    for ptype in personality_types:
        personality = personality_layer.init_from_preset(
            preset_type=ptype,
            nickname="测试AI"
        )
        
        dynamic_requirement = evaluator.calculate_dynamic_requirement(
            context_type='scientific',
            personality=personality
        )
        
        adjustment_ratio = dynamic_requirement / base_requirement if base_requirement > 0 else 1.0
        
        print(f"  {ptype}:")
        print(f"    动态要求: {dynamic_requirement:.3f}")
        print(f"    调整系数: {adjustment_ratio:.3f}")
    
    print("\n✅ 测试通过\n")


def test_strategy_selection():
    """测试策略选择"""
    print("=== 测试2:策略选择 ===\n")
    
    selector = StrategySelector()
    
    # 测试1:严重偏差
    metric_severe = {
        'objectivity_score': 0.5,
        'required_objectivity': 0.9,
        'gap': 0.4,
        'severity': 'severe',
        'subjectivity_dimensions': {
            'hallucination': 0.8,
            'speculation': 0.3,
            'assumption': 0.2,
            'emotion': 0.1,
            'preference': 0.1
        }
    }
    
    decision_severe = selector.select_strategy(metric_severe, 'scientific')
    print(f"场景1:严重偏差(scientific)")
    print(f"  应该纠错: {decision_severe.should_correct}")
    print(f"  策略: {decision_severe.strategy.value}")
    print(f"  优先级: {decision_severe.priority}")
    print(f"  理由: {decision_severe.reason}")
    print()
    
    # 测试2:创意场景的轻微偏差
    metric_creative = {
        'objectivity_score': 0.6,
        'required_objectivity': 0.3,
        'gap': -0.3,
        'severity': 'mild',
        'subjectivity_dimensions': {
            'hallucination': 0.1,
            'speculation': 0.5,
            'assumption': 0.3,
            'emotion': 0.2,
            'preference': 0.1
        }
    }
    
    decision_creative = selector.select_strategy(metric_creative, 'creative')
    print(f"场景2:创意场景的轻微偏差")
    print(f"  应该纠错: {decision_creative.should_correct}")
    print(f"  策略: {decision_creative.strategy.value}")
    print(f"  优先级: {decision_creative.priority}")
    print(f"  理由: {decision_creative.reason}")
    print()
    
    # 测试3:技术场景的中度偏差
    metric_technical = {
        'objectivity_score': 0.65,
        'required_objectivity': 0.8,
        'gap': 0.15,
        'severity': 'moderate',
        'subjectivity_dimensions': {
            'hallucination': 0.2,
            'speculation': 0.4,
            'assumption': 0.5,
            'emotion': 0.1,
            'preference': 0.1
        }
    }
    
    decision_technical = selector.select_strategy(metric_technical, 'technical')
    print(f"场景3:技术场景的中度偏差")
    print(f"  应该纠错: {decision_technical.should_correct}")
    print(f"  策略: {decision_technical.strategy.value}")
    print(f"  优先级: {decision_technical.priority}")
    print(f"  理由: {decision_technical.reason}")
    print()
    
    # 测试4:人格影响
    decision_caution = selector.select_strategy(metric_technical, 'technical', personality_type="谨慎探索型")
    decision_radical = selector.select_strategy(metric_technical, 'technical', personality_type="激进创新型")
    
    print("人格影响对比(technical场景,中度偏差):")
    print(f"  谨慎探索型: 优先级={decision_caution.priority}")
    print(f"  激进创新型: 优先级={decision_radical.priority}")
    print()
    
    print("✅ 测试通过\n")


def test_integration():
    """测试完整集成"""
    print("=== 测试3:完整集成 ===\n")
    
    evaluator = ObjectivityEvaluator()
    selector = StrategySelector()
    personality_layer = PersonalityLayer()
    
    # 初始化人格
    personality = personality_layer.init_from_preset(
        preset_type=PersonalityType.CAUTIOUS_EXPLORER,
        nickname="集成测试AI"
    )
    
    # 学习阶段
    learning_stage = {
        'total_interactions': 150,
        'success_rate': 0.75
    }
    
    # 测试响应
    test_response = "根据我的推测,这个方案可能有效。我觉得这是一个很好的想法。"
    
    # 评估客观性(使用动态要求)
    metric = evaluator.evaluate(
        response=test_response,
        context_type='scientific',
        personality=personality,
        learning_stage=learning_stage
    )
    
    print(f"客观性评估:")
    print(f"  客观性评分: {metric.objectivity_score:.3f}")
    print(f"  动态要求: {metric.required_objectivity:.3f}")
    print(f"  适切性: {metric.is_appropriate}")
    print(f"  严重程度: {metric.severity}")
    print(f"  主观性维度:")
    for dim, value in metric.subjectivity_dimensions.items():
        print(f"    {dim}: {value:.3f}")
    print()
    
    # 策略选择
    decision = selector.select_strategy(
        objectivity_metric=metric.to_dict(),
        context_type='scientific',
        personality_type=personality.preset_name,
        learning_stage=learning_stage
    )
    
    print(f"策略决策:")
    print(f"  是否纠错: {decision.should_correct}")
    print(f"  策略: {decision.strategy.value}")
    print(f"  优先级: {decision.priority}")
    print(f"  置信度: {decision.confidence:.3f}")
    print(f"  理由: {decision.reason}")
    print(f"  建议动作:")
    for i, action in enumerate(decision.suggested_actions, 1):
        print(f"    {i}. {action}")
    print()
    
    print("✅ 测试通过\n")


def test_backward_compatibility():
    """测试向后兼容性"""
    print("=== 测试4:向后兼容性 ===\n")
    
    evaluator = ObjectivityEvaluator()
    selector = StrategySelector()
    
    # 不传入 personality 和 learning_stage,应该使用原有逻辑
    metric = evaluator.evaluate(
        response="这是一个测试响应。",
        context_type='general'
    )
    
    print(f"不传人格参数的评估:")
    print(f"  客观性评分: {metric.objectivity_score:.3f}")
    print(f"  场景要求: {metric.required_objectivity:.3f}")
    print(f"  适切性: {metric.is_appropriate}")
    print()
    
    # 策略选择也不传人格参数
    decision = selector.select_strategy(
        objectivity_metric=metric.to_dict(),
        context_type='general'
    )
    
    print(f"不传人格参数的策略选择:")
    print(f"  是否纠错: {decision.should_correct}")
    print(f"  策略: {decision.strategy.value}")
    print(f"  优先级: {decision.priority}")
    print()
    
    print("✅ 向后兼容性测试通过\n")


def main():
    """运行所有测试"""
    print("=" * 60)
    print("元认知增强集成测试套件")
    print("=" * 60)
    print()
    
    tests = [
        ("动态客观性要求", test_dynamic_requirement),
        ("策略选择", test_strategy_selection),
        ("完整集成", test_integration),
        ("向后兼容性", test_backward_compatibility),
    ]
    
    passed = 0
    failed = 0
    
    for test_name, test_func in tests:
        try:
            test_func()
            passed += 1
        except Exception as e:
            print(f"❌ 测试失败: {test_name}")
            print(f"错误: {e}")
            print()
            failed += 1
    
    print("=" * 60)
    print(f"测试结果: {passed} 通过, {failed} 失败")
    print("=" * 60)
    
    if failed == 0:
        print("\n✅ 所有测试通过!")
        return 0
    else:
        print(f"\n❌ 有 {failed} 个测试失败")
        return 1


if __name__ == '__main__':
    sys.exit(main())
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall