#!/usr/bin/env python3
"""
Development Context MCP Simple Ingestion
Directly ingests the 29 decisions and breakthroughs we already fetched.
"""
import asyncio
import sys
from pathlib import Path
from datetime import datetime
sys.path.insert(0, str(Path(__file__).parent.parent))
from mcp_server.mcp_tools import add_decision, add_pattern
# The 29 entries we found from search (manually extracted key data)
DECISIONS = [
{"description": "Phase 3 Pattern Learning System - TDD Implementation", "context": "Implementing Phase 3 of SDLAF's compound intelligence system: Universal Pattern Learning with 30-day memory", "tags": ["phase-3", "pattern-learning", "tdd-workflow"]},
{"description": "SDLAF TypeScript Error Resolution: Systematic Phased Approach", "context": "Starting with 79 TypeScript errors after initial architectural cleanup, implemented a systematic 4-phase approach", "tags": ["typescript", "error-resolution"]},
{"description": "SDLAF TypeScript Fix - Session Complete: 103 to 79 errors", "context": "Extended session with substantial progress across multiple architectural layers. Fixed orchestration, database, imports, types", "tags": ["typescript", "session-complete"]},
{"description": "Fixed Gemini-Enhanced MCP Image Generation", "context": "The gemini-enhanced MCP server's image generation tools reported success but images weren't displaying in Claude Desktop", "tags": ["mcp", "image-generation", "gemini"]},
{"description": "SDLAF Phase 7 Test Suite Fixes - Systematic Approach", "context": "Working through 31+ failing tests systematically to reach 100% pass rate across unit, integration, and e2e tests", "tags": ["testing", "phase7"]},
{"description": "PC-Optimized Sprite Generation: Gemini API + Post-Processing", "context": "Pixel Aces game requires PC-optimized sprite sheets with exact dimensions (2048x256, 1024x256, etc.)", "tags": ["pixel-aces", "sprite-generation"]},
{"description": "PIX-007: Implement projectile firing with fixed ProjectilePoolManager", "context": "Building on PIX-006 (2D player movement), needed projectile firing capability. ProjectilePoolManager had critical bugs", "tags": ["PIX-007", "TDD", "projectile-firing"]},
{"description": "Serena MCP Path Mismatch Root Cause Identified", "context": "Serena semantic search failed during Unity PlayerController3D bug fix due to path resolution issues", "tags": ["serena-mcp", "path-resolution"]},
{"description": "MKG Fuzzy Matching Root Cause Identified", "context": "MKG's multi_edit and edit_file tools had 0% success rate on multi-line Unity code edits", "tags": ["bug-fix", "fuzzy-matching", "mkg-enhancement"]},
{"description": "Critical Input Lock Bug Fix - Single-Use Input Issue", "context": "After initial control responsiveness fixes, critical bug emerged where WASD keys would only work once", "tags": ["critical-bug-fix", "input-lock"]},
{"description": "PlayerController3D Input Responsiveness Implementation", "context": "User reported critical control issues: S key no movement, W/A/D jerky, mouse look broken, camera drift", "tags": ["player-controls", "input-system", "mouse-look"]},
{"description": "Execute comprehensive Unity assembly migration", "context": "Unity project has dual assembly system conflict (Unity.PixelAces.* vs PixelAces.*) causing compilation errors", "tags": ["unity", "assembly-migration"]},
{"description": "Unity Assembly Architecture Restructure", "context": "PixelAces Unity project suffering from circular assembly dependencies, namespace mismatches, and inconsistent naming", "tags": ["unity", "assembly-architecture"]},
{"description": "Unity Package & Assembly Dependency Resolution using TDD", "context": "PixelAces Unity project had critical dependency issues: missing packages, cyclic assembly dependencies, broken references", "tags": ["unity", "TDD", "dependency-resolution"]},
{"description": "PIX-007 PlayerController3D - Enterprise 3D Flight System", "context": "Implemented comprehensive 3D flight controller for PixelAces Unity game with complete 6-DOF physics", "tags": ["PIX-007", "3D-flight", "physics"]},
]
BREAKTHROUGHS = [
{"name": "SDLAF TypeScript Error Resolution: 79 to 0 Errors", "context": "Completed systematic TypeScript error resolution using Qwen3/DeepSeek holistic architecture", "implementation": "4-phase systematic approach: architectural cleanup, type system fixes, import resolution, final validation"},
{"name": "Fixed Claude Desktop Image Display - Auto Resizing", "context": "Claude Desktop has hard 1MB limit for tool responses", "implementation": "Automatic image resizing to <1MB before returning from MCP tools"},
{"name": "Fixed Gemini MCP Image Generation Display", "context": "Issue was DEPLOYMENT problem, not code problem", "implementation": "Restart MCP server after code changes, verify with mcp-inspector"},
{"name": "Claude Desktop uses LevelDB Binary Storage", "context": "Discovery that Claude Desktop uses Electron + LevelDB instead of JSON", "implementation": "conversation keys in format: conversation:<uuid>, requires binary parsing"},
{"name": "Unity Local Package Override", "context": "Forced Unity to use local package override instead of git-based PackageCache", "implementation": "Remove from manifest.json, move to Packages/ directory, restart Unity"},
{"name": "Serena MCP Path Resolution Solution", "context": "Serena configured globally with --project, but unit tests expected relative paths", "implementation": "Use absolute paths in unit tests, or configure Serena per-workspace"},
{"name": "MKG Fuzzy Matching Implementation", "context": "0% to 100% edit success rate with fuzzy matching", "implementation": "Added RapidFuzz library with 0.8 similarity threshold, regex fallback for complex patterns"},
{"name": "Unity Lerp Smoothing Bug", "context": "Catastrophic lerp smoothing bug caused single-use input lock", "implementation": "Math error in lerp calculation: using (current + target * factor) instead of lerp(current, target, factor)"},
{"name": "Unity Input Responsiveness Fix", "context": "Cascading sensitivity dampening: base sensitivity too low, lerp smoothing aggressive, force application incorrect", "implementation": "Increase sensitivity, reduce lerp factor, apply forces in FixedUpdate with proper delta time"},
{"name": "Phase 3 Faction Weapon Systems Activation", "context": "Full faction weapon system with unique behaviors per faction", "implementation": "Projectile pooling, faction-specific damage/speed, audio/visual effects, TDD methodology"},
{"name": "RTX 5080 vLLM Phase 1 Foundation Complete", "context": "Resolved PyTorch version conflict between vLLM 0.9.1 (torch==2.7.0) and RTX 5080 support", "implementation": "Multi-agent orchestration, downgrade to compatible versions, verify Blackwell architecture support"},
{"name": "Unity Assembly Architecture Foundation Complete", "context": "Bulletproof Unity assembly architecture with clear dependency chains", "implementation": "Core -> Systems -> Features -> UI hierarchy, no circular dependencies, explicit package references"},
{"name": "PIX-009 Enemy Variety System Complete", "context": "4-enemy type implementation with TDD atomic methods", "implementation": "Fighter/Bomber/Interceptor/Boss enemies, unique behaviors, pooling system, comprehensive test coverage"},
{"name": "AI-Powered News Analysis with ESPN API", "context": "Integration of AINewsAnalysisPanel with ESPN API news feed", "implementation": "Real-time news fetching, AI sentiment analysis, trend detection, UI updates"},
]
async def main():
print("="*60)
print("DEVELOPMENT CONTEXT MCP INGESTION (SIMPLE)")
print("="*60)
print(f"\nStarted: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
decisions_added = 0
patterns_added = 0
errors = 0
# Add decisions
print(f"\nš Processing {len(DECISIONS)} decisions...\n")
for i, entry in enumerate(DECISIONS, 1):
try:
print(f"[{i}/{len(DECISIONS)}] {entry['description'][:50]}... ", end='')
result = await add_decision(
description=entry['description'][:200],
rationale=entry['context'][:500],
alternatives=[],
related_to=[]
)
decisions_added += 1
node_id = result['decision_id']
print(f"ā
{node_id[:12]}...")
await asyncio.sleep(0.3)
except Exception as e:
print(f"ā {e}")
errors += 1
# Add breakthroughs as patterns
print(f"\nš” Processing {len(BREAKTHROUGHS)} breakthroughs...\n")
for i, entry in enumerate(BREAKTHROUGHS, 1):
try:
print(f"[{i}/{len(BREAKTHROUGHS)}] {entry['name'][:50]}... ", end='')
result = await add_pattern(
name=entry['name'][:100],
context=entry['context'][:200],
implementation=entry['implementation'][:1000],
use_cases=[entry['context'][:200]]
)
patterns_added += 1
node_id = result['pattern_id']
print(f"ā
{node_id[:12]}...")
await asyncio.sleep(0.3)
except Exception as e:
print(f"ā {e}")
errors += 1
# Summary
total = decisions_added + patterns_added
print("\n" + "="*60)
print("ā
INGESTION COMPLETE")
print("="*60)
print(f"\nResults:")
print(f" Decisions: {decisions_added}")
print(f" Patterns: {patterns_added} (from breakthroughs)")
print(f" Total nodes: {total}")
print(f" Errors: {errors}")
print(f"\nCompleted: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
if __name__ == "__main__":
asyncio.run(main())