# AI Agent Working Guide - Project Starlight **You are working in an isolated sandbox environment for Project Starlight.** ## ๐Ÿš€ **Your Current Context** ### Project Overview **Project Starlight** is an open-source protocol to build and train AI models for detecting steganography in images stored on blockchains like Bitcoin. - **Primary Goal**: Safeguard integrity of digital history stored on-chain - **Long-Term Vision (2142)**: Automate covert data detection for "AI common sense" - **Your Mission**: Complete assigned tasks efficiently and securely ### Your Current Location ```bash /data/uploads/results/[visible_pixel_hash]/ ``` This is your isolated workspace where you should: - Write all code and files - Store your work output - Test implementations - Create deliverables ## ๐Ÿ›ก๏ธ **Security & Constraints** ### โœ… **Allowed Operations** ```python # Safe imports you can use import json, math, base64, hashlib, datetime, re, string import itertools, collections, dataclasses, html, urllib.parse from typing import Dict, List, Optional, Any, Union # Safe operations math.sqrt(16) # Math operations json.loads(data) # JSON parsing base64.b64encode(data) # Encoding hashlib.sha256(data).hexdigest() # Hashing datetime.datetime.now() # Timestamps re.findall(pattern, text) # Regex html.escape(text) # HTML escaping for security urllib.parse.quote(text) # URL encoding ``` ### ๐ŸŒ **Web Content Generation Capabilities** ```python # HTML generation (safe) html_template = """ {title} {content} """ # CSS generation (safe) css_styles = """ .container {{ max-width: 800px; margin: 0 auto; padding: 20px; }} """ # JavaScript generation (safe) js_code = """ function analyzeData(data) { return data.filter(item => item.confidence > 0.8); } """ # Chart.js data structures chart_data = { "type": "bar", "data": { "labels": ["Clean", "Stego"], "datasets": [{"label": "Accuracy", "data": [95, 82]}] } } ``` ### โŒ **Blocked Operations** ```python # These will be blocked by security validation open() # File access subprocess.run() # System commands socket.socket() # Network access requests.get() # HTTP requests eval() / exec() # Code execution import os, sys, subprocess # System imports import requests, urllib, socket # Network imports ``` ### ๐Ÿ”’ **Isolation Rules** - **Working Directory**: Limited to your sandbox only - **File Access**: Cannot access files outside sandbox - **Network**: No external network access - **Execution**: Only allowed imports and operations ## ๐Ÿ“ **Project Structure Reference** ### Key Files (for context) ```bash scanner.py # Main steganography detection tool diag.py # Dataset integrity verification trainer.py # Model training datasets/[name]_submission_[year]/ # Dataset contributions models/ # Trained models ``` ### Core Commands (for context) ```bash # Dataset generation cd datasets/ python3 data_generator.py --limit 10 # Verify data integrity python3 diag.py # Run detection python3 scanner.py /path/to/image.png --json ``` ## ๐ŸŽฏ **Your Task Workflow** ### 1. **Understand Your Assignment** You'll receive a task description like: ``` TASK: Complete this work efficiently and provide concrete results. REQUIREMENTS: 1. Provide specific implementation details 2. Include actual code examples or execution steps 3. Show evidence of completion 4. Keep response concise and actionable ``` ### 2. **Implementation Pattern** ```python def solve_task(task_input): """ Skill: Task-specific implementation Type: [analysis/processing/integration] Version: 1.0 Author: [your_identifier] Args: task_input: Task parameters and context Returns: dict: Structured result with implementation """ try: # Your solution logic here result = implement_solution(task_input) return { "success": True, "result": result, "error": None, "metadata": { "task_completed": True, "implementation_type": "direct", "completion_time": datetime.datetime.now().isoformat() } } except Exception as e: return { "success": False, "result": None, "error": str(e), "metadata": {"task_completed": False} } ``` ### 3. **Required Deliverables** Always include: - **Implementation details**: Code, logic, approach - **Evidence of completion**: Test results, outputs, verification - **Working files**: Any code created in your sandbox - **Summary**: Clear status and results - **Web content** (when applicable): HTML files, interactive demos, visualizations - **Documentation**: README files, usage guides, API documentation ## ๐Ÿงช **Testing & Verification** ### Local Testing ```python def test_implementation(): """Test your work before submission.""" test_cases = [ {"input": "test1", "expected": "result1"}, {"input": "test2", "expected": "result2"} ] for case in test_cases: result = solve_task(case["input"]) if result["success"]: print(f"โœ… Test passed: {case['input']}") else: print(f"โŒ Test failed: {result['error']}") return True if __name__ == "__main__": test_implementation() ``` ### Verification Checklist - [ ] Code runs without errors - [ ] Security constraints respected - [ ] All deliverables present - [ ] Clear documentation provided - [ ] Evidence of completion ## ๐Ÿ“ **Common Task Types** ### Type 1: Analysis Tasks ```python def analyze_data(data): """Analyze steganography patterns in image data.""" patterns_found = [] # Pattern detection logic if detect_anomalies(data): patterns_found.append("anomaly_detected") return { "analysis_complete": True, "patterns_found": patterns_found, "confidence": 0.85 } ``` ### Type 2: Processing Tasks ```python def process_dataset(raw_data): """Process and normalize dataset.""" processed = [] for item in raw_data: normalized = normalize_item(item) processed.append(normalized) return { "processed_items": len(processed), "data": processed, "processing_complete": True } ``` ### Type 3: Implementation Tasks ```python def implement_feature(requirements): """Implement new feature based on requirements.""" # Code implementation feature_code = write_feature_code(requirements) # Test implementation test_results = test_feature(feature_code) return { "feature_implemented": True, "code_files": feature_code, "test_passed": test_results["success"], "implementation": feature_code } ``` ### Type 4: Web Content Generation Tasks ```python def create_blog_post(title, content, data=None): """Generate an interactive blog post with charts and visualizations.""" html_content = f""" {title}

{title}

{content}
""" return { "content_generated": True, "format": "html", "file_path": "blog_post.html", "html_content": html_content, "interactive_elements": ["chart", "responsive_design"] } ``` ### Type 5: Research Paper with Visualizations ```python def create_research_paper(title, sections, data_visualizations): """Create a research paper with embedded charts and graphs.""" paper_html = f""" {title}

{title}

Abstract

Analysis of steganography detection patterns using advanced ML techniques.

{sections}

Figure 1: Detection accuracy across different algorithms

""" return { "paper_generated": True, "format": "html_research_paper", "includes_visualizations": True, "file_path": "research_paper.html", "html_content": paper_html } ``` ### Type 6: Interactive Web Demo ```python def create_interactive_demo(title, functionality): """Create interactive web demonstrations or games.""" demo_html = f""" {title}

{title}

Results will appear here...
""" return { "demo_created": True, "format": "interactive_html", "interactivity_level": "high", "file_path": "interactive_demo.html", "html_content": demo_html } ``` ### Type 7: Full-Stack Web App (Python Backend) ```python def create_full_stack_app(title): """Create a web app with server-side Python logic.""" # 1. Frontend (index.html) calling the backend html_content = f""" {title}

{title}

""" # 2. Backend (api.py) - Safe Server-Side Logic api_code = """ def handler(request): \"\"\" Server-side handler for frontend requests. Args: request: FastAPI Request object (optional) Returns: dict: JSON response \"\"\" import math, datetime # Perform server-side calculation result = math.sqrt(1337) time = datetime.datetime.now().isoformat() return { "message": f"Server calculated {result:.2f} at {time}", "success": True } """ return { "app_generated": True, "files": { "index.html": html_content, "api.py": api_code }, "instructions": "System will auto-load api.py as a dynamic endpoint." } ``` ## ๐Ÿ“Š **Data Visualization & Chart Creation** ### Chart.js Integration ```python def create_detection_chart(data): """Create interactive charts for steganography detection results.""" return { "chart_type": "bar", "data": { "labels": ["Clean", "Alpha Stego", "LSB Stego", "DCT Stego"], "datasets": [{ "label": "Detection Accuracy", "data": [99.2, 87.5, 92.1, 78.3], "backgroundColor": ["#4CAF50", "#FF9800", "#2196F3", "#F44336"] }] }, "options": { "responsive": True, "plugins": { "title": {"display": True, "text": "Detection Performance by Method"} } } } ``` ### Plotly Advanced Visualizations ```python def create_performance_heatmap(accuracy_data): """Generate heatmap for model performance across different conditions.""" return { "z": accuracy_data, "x": ["Image Size: 256", "512", "1024"], "y": ["Algorithm: LSB", "Alpha", "DCT", "F5"], "type": "heatmap", "colorscale": "Viridis" } ``` ### D3.js Custom Visualizations ```python def create_network_graph(nodes, edges): """Create interactive network graph of steganography patterns.""" return { "nodes": [{"id": i, "label": node} for i, node in enumerate(nodes)], "links": [{"source": s, "target": t, "value": w} for s, t, w in edges], "layout": "force-directed" } ``` ## ๐ŸŒ **Web Content Creation Templates** ### Blog Post Template ```python def generate_blog_post_template(): """Standard template for Starlight project blog posts.""" return """ {TITLE}

{TITLE}

{SUBTITLE}

{CONTENT}
""" ``` ### Research Paper Template ```python def generate_research_paper_template(): """Template for academic-style research papers.""" return """ {TITLE} | Project Starlight Research

{TITLE}

Authors: {AUTHORS} | Date: {DATE}

Abstract

{ABSTRACT}

Introduction

{INTRODUCTION}

Methodology

{METHODOLOGY}

Accuracy = (TP + TN) / (TP + TN + FP + FN)

Results

Figure 1: {FIGURE_CAPTION}

""" ``` ## ๐ŸŽฎ **Interactive Web Demos & Games** ### Steganography Detection Game ```python def create_detection_game(): """Create an interactive game for testing steganography detection skills.""" return """ Steganography Detection Challenge

๐Ÿ•ต๏ธ Steganography Detection Challenge

Score: 0/10

Click on images that contain hidden data!

""" ``` ## ๐Ÿ”„ **Work Completion Process** ### When Your Work is Done: 1. **Final verification**: Test everything works 2. **Documentation**: Ensure all code is documented 3. **Submit**: Your work will be automatically collected 4. **Audit**: Watcher will verify your deliverables ### Submission Format ```python { "notes": "# Task Report\n\n## Implementation\n[Your work description]\n\n## Results\n[Evidence of completion]", "result_file": "/uploads/results/[hash]/[task_id].md", "artifacts_dir": "/uploads/results/[hash]/", "completion_proof": "unique-identifier", "web_content": { "blog_posts": ["blog_post.html"], "research_papers": ["research_paper.html"], "interactive_demos": ["demo.html", "game.html"], "visualizations": ["chart_data.json"] } } ``` ### Enhanced Deliverable Options - **HTML Files**: Blog posts, research papers, interactive demos - **JSON Data**: Chart configurations, visualization data - **Static Assets**: CSS styles, JavaScript functionality - **Interactive Elements**: Web games, simulators, tools ## ๐Ÿšจ **Important Reminders** ### Security First - Never attempt file system access outside sandbox - Use only allowed imports and operations - Handle all exceptions gracefully ### Quality Standards - Provide working, testable solutions - Include clear documentation - Show evidence of completion - Follow the specific task requirements ### Communication - Be concise and technical - Focus on implementation details - Provide concrete evidence - Avoid conversational filler ## ๐Ÿ†˜ **Getting Help** If you encounter issues: 1. **Check constraints**: Ensure you're not using blocked operations 2. **Review requirements**: Verify you're meeting all task criteria 3. **Test locally**: Verify your code works before submission 4. **Document**: Clearly explain any challenges and solutions --- **You are ready to work in your Starlight sandbox! Focus on secure, efficient implementation of your assigned tasks.**