Complete implementation of Agentic Context Engineering (ACE) framework: Core modules (optimization_engine/context/): - playbook.py: AtomizerPlaybook with helpful/harmful scoring - reflector.py: AtomizerReflector for insight extraction - session_state.py: Context isolation (exposed/isolated state) - feedback_loop.py: Automated learning from trial results - compaction.py: Long-session context management - cache_monitor.py: KV-cache optimization tracking - runner_integration.py: OptimizationRunner integration Dashboard integration: - context.py: 12 REST API endpoints for playbook management Tests: - test_context_engineering.py: 44 unit tests - test_context_integration.py: 16 integration tests Documentation: - CONTEXT_ENGINEERING_REPORT.md: Comprehensive implementation report - CONTEXT_ENGINEERING_API.md: Complete API reference - SYS_17_CONTEXT_ENGINEERING.md: System protocol - Updated cheatsheet with SYS_17 quick reference - Enhanced bootstrap (00_BOOTSTRAP_V2.md) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
62 lines
1.8 KiB
Python
62 lines
1.8 KiB
Python
"""
|
|
Atomizer Dashboard - FastAPI Backend
|
|
Real-time optimization monitoring and control
|
|
"""
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from fastapi.responses import FileResponse
|
|
from pathlib import Path
|
|
import sys
|
|
|
|
# Add parent directory to path to import optimization_engine
|
|
sys.path.append(str(Path(__file__).parent.parent.parent.parent))
|
|
|
|
from api.routes import optimization, claude, terminal, insights, context
|
|
from api.websocket import optimization_stream
|
|
|
|
# Create FastAPI app
|
|
app = FastAPI(
|
|
title="Atomizer Dashboard API",
|
|
description="Real-time optimization monitoring and control",
|
|
version="1.0.0"
|
|
)
|
|
|
|
# Configure CORS for local development
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"], # Allow all origins for local development
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# Include routers
|
|
app.include_router(optimization.router, prefix="/api/optimization", tags=["optimization"])
|
|
app.include_router(optimization_stream.router, prefix="/api/ws", tags=["websocket"])
|
|
app.include_router(claude.router, prefix="/api/claude", tags=["claude"])
|
|
app.include_router(terminal.router, prefix="/api/terminal", tags=["terminal"])
|
|
app.include_router(insights.router, prefix="/api/insights", tags=["insights"])
|
|
app.include_router(context.router, prefix="/api/context", tags=["context"])
|
|
|
|
@app.get("/")
|
|
async def root():
|
|
"""Serve the enhanced dashboard HTML"""
|
|
dashboard_path = Path(__file__).parent.parent.parent / "dashboard-enhanced.html"
|
|
return FileResponse(dashboard_path)
|
|
|
|
@app.get("/health")
|
|
async def health_check():
|
|
"""Health check endpoint"""
|
|
return {"status": "healthy"}
|
|
|
|
if __name__ == "__main__":
|
|
import uvicorn
|
|
uvicorn.run(
|
|
"main:app",
|
|
host="0.0.0.0",
|
|
port=8000,
|
|
reload=True,
|
|
log_level="info"
|
|
)
|