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/history_manager.py

View on GitHub
#!/usr/bin/env python3
"""
历史记录管理脚本

功能:
- 管理初始化历史
- 管理自定义历史
- 提供历史查询功能

协议:AGPL-3.0
作者:kiwifruit
"""

import json
import os
import argparse
from datetime import datetime, timezone
from typing import Dict, List, Optional


class HistoryManager:
    """历史记录管理器"""
    
    INIT_HISTORY_FILE = "./agi_memory/init_history.json"
    CUSTOM_HISTORY_FILE = "./agi_memory/custom_history.json"
    
    @staticmethod
    def _load_history(file_path: str) -> dict:
        """加载历史记录"""
        if not os.path.exists(file_path):
            return {}
        
        try:
            with open(file_path, 'r', encoding='utf-8') as f:
                return json.load(f)
        except Exception as e:
            print(f"加载历史记录失败: {e}", file=sys.stderr)
            return {}
    
    @staticmethod
    def _save_history(file_path: str, history: dict) -> bool:
        """保存历史记录"""
        try:
            os.makedirs(os.path.dirname(file_path), exist_ok=True)
            with open(file_path, 'w', encoding='utf-8') as f:
                json.dump(history, f, indent=2, ensure_ascii=False)
            return True
        except Exception as e:
            print(f"保存历史记录失败: {e}", file=sys.stderr)
            return False
    
    @staticmethod
    def record_init(nickname: str, traits: List[str], source: str = "init_command") -> bool:
        """
        记录初始化历史
        
        参数:
            nickname: 用户昵称
            traits: 核心特质列表
            source: 来源(init_command 或 auto)
        
        返回:
            True 表示成功
        """
        try:
            history = HistoryManager._load_history(HistoryManager.INIT_HISTORY_FILE)
            
            # 初始化结构
            if 'init_records' not in history:
                history['init_records'] = []
            
            # 创建记录
            record = {
                'timestamp': datetime.now(timezone.utc).isoformat(),
                'type': 'default',
                'source': source,
                'user_nickname': nickname,
                'core_traits': traits,
                'status': 'success'
            }
            
            # 添加记录
            history['init_records'].append(record)
            history['initialized'] = True
            history['init_count'] = len(history['init_records'])
            history['last_init_time'] = datetime.now(timezone.utc).isoformat()
            
            # 保存
            return HistoryManager._save_history(HistoryManager.INIT_HISTORY_FILE, history)
        except Exception as e:
            print(f"记录初始化历史失败: {e}", file=sys.stderr)
            return False
    
    @staticmethod
    def record_custom(answers: List[str], nickname: str, traits: List[str]) -> bool:
        """
        记录自定义历史
        
        参数:
            answers: 7个答案
            nickname: 用户昵称
            traits: 核心特质列表
        
        返回:
            True 表示成功
        """
        try:
            history = HistoryManager._load_history(HistoryManager.CUSTOM_HISTORY_FILE)
            
            # 初始化结构
            if 'custom_records' not in history:
                history['custom_records'] = []
            
            # 创建记录
            record = {
                'timestamp': datetime.now(timezone.utc).isoformat(),
                'type': 'custom',
                'source': 'root_command',
                'answers': answers,
                'user_nickname': nickname,
                'core_traits': traits,
                'status': 'success'
            }
            
            # 添加记录
            history['custom_records'].append(record)
            history['custom_count'] = len(history['custom_records'])
            history['last_custom_time'] = datetime.now(timezone.utc).isoformat()
            
            # 保存
            return HistoryManager._save_history(HistoryManager.CUSTOM_HISTORY_FILE, history)
        except Exception as e:
            print(f"记录自定义历史失败: {e}", file=sys.stderr)
            return False
    
    @staticmethod
    def check_first_interaction() -> dict:
        """
        检查是否为首次交互
        
        返回:
            {
                'is_first': bool,
                'init_count': int,
                'last_init_time': str or None
            }
        """
        try:
            history = HistoryManager._load_history(HistoryManager.INIT_HISTORY_FILE)
            
            is_first = not history.get('initialized', False)
            init_count = history.get('init_count', 0)
            last_init_time = history.get('last_init_time', None)
            
            return {
                'is_first': is_first,
                'init_count': init_count,
                'last_init_time': last_init_time
            }
        except Exception as e:
            print(f"检查首次交互失败: {e}", file=sys.stderr)
            return {
                'is_first': True,
                'init_count': 0,
                'last_init_time': None
            }
    
    @staticmethod
    def get_init_history(limit: int = 10) -> List[dict]:
        """获取初始化历史"""
        try:
            history = HistoryManager._load_history(HistoryManager.INIT_HISTORY_FILE)
            records = history.get('init_records', [])
            return records[-limit:]
        except Exception as e:
            print(f"获取初始化历史失败: {e}", file=sys.stderr)
            return []
    
    @staticmethod
    def get_custom_history(limit: int = 10) -> List[dict]:
        """获取自定义历史"""
        try:
            history = HistoryManager._load_history(HistoryManager.CUSTOM_HISTORY_FILE)
            records = history.get('custom_records', [])
            return records[-limit:]
        except Exception as e:
            print(f"获取自定义历史失败: {e}", file=sys.stderr)
            return []


def main():
    """命令行入口"""
    import sys
    
    parser = argparse.ArgumentParser(description="AGI History Manager")
    
    subparsers = parser.add_subparsers(dest="command", help="Available commands")
    
    # check-first 命令
    subparsers.add_parser("check-first", help="Check if first interaction")
    
    # get-init-history 命令
    init_parser = subparsers.add_parser("get-init-history", help="Get initialization history")
    init_parser.add_argument("--limit", type=int, default=10, help="Limit number of records")
    
    # get-custom-history 命令
    custom_parser = subparsers.add_parser("get-custom-history", help="Get customization history")
    custom_parser.add_argument("--limit", type=int, default=10, help="Limit number of records")
    
    args = parser.parse_args()
    
    if args.command == "check-first":
        result = HistoryManager.check_first_interaction()
        print(json.dumps(result, ensure_ascii=False, indent=2))
    
    elif args.command == "get-init-history":
        records = HistoryManager.get_init_history(args.limit)
        print(json.dumps(records, ensure_ascii=False, indent=2))
    
    elif args.command == "get-custom-history":
        records = HistoryManager.get_custom_history(args.limit)
        print(json.dumps(records, ensure_ascii=False, indent=2))
    
    else:
        parser.print_help()


if __name__ == "__main__":
    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