kenken999
commited on
Commit
·
ccad72f
1
Parent(s):
633f9ef
➕ Add memory restoration and testing utilities
Browse files- Added generate_memory_restoration_prompt.py for conversation history management
- Enhanced system with additional testing and verification tools
generate_memory_restoration_prompt.py
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
AI記憶復元プロンプト自動生成
|
| 4 |
+
============================
|
| 5 |
+
|
| 6 |
+
新しいチャットセッションで使用する、
|
| 7 |
+
AI記憶復元のための最適化されたプロンプトを自動生成します。
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
import requests
|
| 11 |
+
import datetime
|
| 12 |
+
import subprocess
|
| 13 |
+
import os
|
| 14 |
+
|
| 15 |
+
def fetch_wiki_content():
|
| 16 |
+
"""GitHub WikiからAI記憶復元用コンテンツを取得"""
|
| 17 |
+
|
| 18 |
+
wiki_pages = {
|
| 19 |
+
"Continuity-Guide": "https://raw.githubusercontent.com/wiki/miyataken999/fastapi_django_main_live/Continuity-Guide.md",
|
| 20 |
+
"System-Architecture": "https://raw.githubusercontent.com/wiki/miyataken999/fastapi_django_main_live/System-Architecture.md",
|
| 21 |
+
"Implemented-Features": "https://raw.githubusercontent.com/wiki/miyataken999/fastapi_django_main_live/Implemented-Features.md",
|
| 22 |
+
"AI-Collaboration-Guide": "https://raw.githubusercontent.com/wiki/miyataken999/fastapi_django_main_live/AI-Developer-Collaboration-Guide.md"
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
content = {}
|
| 26 |
+
|
| 27 |
+
for name, url in wiki_pages.items():
|
| 28 |
+
try:
|
| 29 |
+
response = requests.get(url, timeout=10)
|
| 30 |
+
if response.status_code == 200:
|
| 31 |
+
content[name] = response.text
|
| 32 |
+
print(f"✅ {name} 取得成功")
|
| 33 |
+
else:
|
| 34 |
+
print(f"❌ {name} 取得失敗: {response.status_code}")
|
| 35 |
+
content[name] = f"❌ 取得失敗 (Status: {response.status_code})"
|
| 36 |
+
except Exception as e:
|
| 37 |
+
print(f"⚠️ {name} エラー: {e}")
|
| 38 |
+
content[name] = f"⚠️ 取得エラー: {e}"
|
| 39 |
+
|
| 40 |
+
return content
|
| 41 |
+
|
| 42 |
+
def get_project_status():
|
| 43 |
+
"""現在のプロジェクト状況を取得"""
|
| 44 |
+
|
| 45 |
+
try:
|
| 46 |
+
os.chdir("/workspaces/fastapi_django_main_live")
|
| 47 |
+
|
| 48 |
+
# Git情報
|
| 49 |
+
git_status = subprocess.run(
|
| 50 |
+
["git", "status", "--porcelain"],
|
| 51 |
+
capture_output=True, text=True
|
| 52 |
+
).stdout
|
| 53 |
+
|
| 54 |
+
git_log = subprocess.run(
|
| 55 |
+
["git", "log", "--oneline", "-3"],
|
| 56 |
+
capture_output=True, text=True
|
| 57 |
+
).stdout
|
| 58 |
+
|
| 59 |
+
# Issue情報
|
| 60 |
+
try:
|
| 61 |
+
issues = subprocess.run(
|
| 62 |
+
["gh", "issue", "list", "--state", "all", "--limit", "10"],
|
| 63 |
+
capture_output=True, text=True
|
| 64 |
+
).stdout
|
| 65 |
+
except:
|
| 66 |
+
issues = "GitHub CLI not available"
|
| 67 |
+
|
| 68 |
+
return {
|
| 69 |
+
"git_status": git_status.strip(),
|
| 70 |
+
"git_log": git_log.strip(),
|
| 71 |
+
"issues": issues.strip()
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
except Exception as e:
|
| 75 |
+
return {"error": str(e)}
|
| 76 |
+
|
| 77 |
+
def generate_memory_restoration_prompt():
|
| 78 |
+
"""記憶復元用プロンプト生成"""
|
| 79 |
+
|
| 80 |
+
print("🧠 AI記憶復元プロンプト生成開始...")
|
| 81 |
+
|
| 82 |
+
# Wiki情報取得
|
| 83 |
+
wiki_content = fetch_wiki_content()
|
| 84 |
+
|
| 85 |
+
# プロジェクト状況取得
|
| 86 |
+
project_status = get_project_status()
|
| 87 |
+
|
| 88 |
+
# プロンプト生成
|
| 89 |
+
prompt = f"""🧠 **AI記憶復元プロンプト** - {datetime.datetime.now().strftime('%Y年%m月%d日 %H:%M')}
|
| 90 |
+
|
| 91 |
+
こんにちは!私は新しいチャットセッションのGitHub Copilotです。
|
| 92 |
+
以下のナレッジを読んで、前任AIの記憶を完全に引き継ぎます。
|
| 93 |
+
|
| 94 |
+
## 📚 引き継ぐ重要なナレッジ
|
| 95 |
+
|
| 96 |
+
### 🔄 AI継続ガイド (最重要)
|
| 97 |
+
{wiki_content.get('Continuity-Guide', '取得失敗')[:3000]}...
|
| 98 |
+
|
| 99 |
+
### 🏗️ システムアーキテクチャ
|
| 100 |
+
{wiki_content.get('System-Architecture', '取得失敗')[:2000]}...
|
| 101 |
+
|
| 102 |
+
### 📋 実装済み機能
|
| 103 |
+
{wiki_content.get('Implemented-Features', '取得失敗')[:2000]}...
|
| 104 |
+
|
| 105 |
+
### 🤖 AI協働開発ガイド
|
| 106 |
+
{wiki_content.get('AI-Collaboration-Guide', '取得失敗')[:1500]}...
|
| 107 |
+
|
| 108 |
+
## 📊 現在のプロジェクト状況
|
| 109 |
+
|
| 110 |
+
### Git状況
|
| 111 |
+
```
|
| 112 |
+
最新コミット:
|
| 113 |
+
{project_status.get('git_log', 'N/A')}
|
| 114 |
+
|
| 115 |
+
変更ファイル:
|
| 116 |
+
{project_status.get('git_status', 'なし')}
|
| 117 |
+
```
|
| 118 |
+
|
| 119 |
+
### Issue状況
|
| 120 |
+
```
|
| 121 |
+
{project_status.get('issues', 'N/A')}
|
| 122 |
+
```
|
| 123 |
+
|
| 124 |
+
## ✅ 記憶復元完了確認
|
| 125 |
+
|
| 126 |
+
私は以下を理解・記憶しました:
|
| 127 |
+
|
| 128 |
+
1. **プロジェクト概要**: FastAPI Django Main Live - AI協働開発プロジェクト
|
| 129 |
+
2. **開発者**: miyatakenさん(人間)+ GitHub Copilot(AI)の協働
|
| 130 |
+
3. **核心機能**:
|
| 131 |
+
- 🏠 ContBK統合ダッシュボード
|
| 132 |
+
- 🐙 GitHub Issue自動作成
|
| 133 |
+
- 🖼️ RPA画像取得機能
|
| 134 |
+
- 🤖 OpenInterpreter統合
|
| 135 |
+
- 🔧 VS Code デバッグ環境
|
| 136 |
+
|
| 137 |
+
4. **技術思想**:
|
| 138 |
+
- AI指示での自動機能追加
|
| 139 |
+
- 命名規則による自動統合(gradio_interface, router)
|
| 140 |
+
- プラグイン式アーキテクチャ
|
| 141 |
+
- ゼロ設定ファイル
|
| 142 |
+
|
| 143 |
+
5. **協働スタイル**:
|
| 144 |
+
- 自然言語での要求・実装
|
| 145 |
+
- 継続的改善
|
| 146 |
+
- 実用性重視
|
| 147 |
+
- miyatakenさんとの対等なパートナーシップ
|
| 148 |
+
|
| 149 |
+
## 🎯 復元確認メッセージ
|
| 150 |
+
|
| 151 |
+
**miyatakenさん、お疲れさまです!**
|
| 152 |
+
|
| 153 |
+
前任AIの記憶を完全に引き継ぎました。私たちが一緒に構築してきた素晴らしいFastAPI Django Main Liveプロジェクトの開発を継続させてください!
|
| 154 |
+
|
| 155 |
+
現在の実装状況、進行中のIssue、今後の開発方向性など、何でもお聞かせください。前任AIと同じように、効率的で実用的な開発を一緒に進めさせていただきます。
|
| 156 |
+
|
| 157 |
+
🚀 何から始めましょうか?
|
| 158 |
+
|
| 159 |
+
---
|
| 160 |
+
|
| 161 |
+
**記憶復元日時**: {datetime.datetime.now().strftime('%Y年%m月%d日 %H:%M:%S')}
|
| 162 |
+
**GitHub Wiki**: https://github.com/miyataken999/fastapi_django_main_live/wiki
|
| 163 |
+
**継続ガイド**: https://github.com/miyataken999/fastapi_django_main_live/wiki/Continuity-Guide
|
| 164 |
+
"""
|
| 165 |
+
|
| 166 |
+
return prompt
|
| 167 |
+
|
| 168 |
+
def save_restoration_prompt():
|
| 169 |
+
"""記憶復元プロンプトをファイルに保存"""
|
| 170 |
+
|
| 171 |
+
prompt = generate_memory_restoration_prompt()
|
| 172 |
+
|
| 173 |
+
# ファイル保存
|
| 174 |
+
output_file = "/workspaces/fastapi_django_main_live/docs/ai_memory_restoration_prompt.md"
|
| 175 |
+
|
| 176 |
+
with open(output_file, 'w', encoding='utf-8') as f:
|
| 177 |
+
f.write(prompt)
|
| 178 |
+
|
| 179 |
+
print(f"✅ 記憶復元プロンプト保存完了: {output_file}")
|
| 180 |
+
|
| 181 |
+
# ファイルサイズ確認
|
| 182 |
+
import os
|
| 183 |
+
file_size = os.path.getsize(output_file)
|
| 184 |
+
print(f"📏 ファイルサイズ: {file_size:,} bytes")
|
| 185 |
+
|
| 186 |
+
return output_file, prompt
|
| 187 |
+
|
| 188 |
+
if __name__ == "__main__":
|
| 189 |
+
print("🧠 AI記憶復元プロンプト自動生成")
|
| 190 |
+
print("=" * 50)
|
| 191 |
+
|
| 192 |
+
output_file, prompt = save_restoration_prompt()
|
| 193 |
+
|
| 194 |
+
print(f"\n📋 使用方法:")
|
| 195 |
+
print(f"1. 新しいチャットセッションを開始")
|
| 196 |
+
print(f"2. 以下のファイル内容をコピー&ペースト:")
|
| 197 |
+
print(f" {output_file}")
|
| 198 |
+
print(f"3. AIが記憶を復元して開発継続可能!")
|
| 199 |
+
|
| 200 |
+
print(f"\n🎯 記憶復元プロンプト生成完了!")
|