π‘οΈ GhostSlate
Autonomous AST Program Repair, Time-Travel Debugger & Self-Healing Execution Sandbox. Built on Hexagonal Ports & Adapters with Tree-Sitter C grammars, a Two-Tier Multi-Agent Debate Loop (Triage Synthesizer β Adversarial Critic), and an isolated subprocess test runner guaranteeing 100% Green verification before code suggestions are displayed.
- No Whole-File Hallucinations: Traditional AI coding tools perform destructive whole-file rewrites that wipe comments, format unrelated blocks, and alter surrounding logic. GhostSlate uses Tree-Sitter C grammars and Python AST to isolate the exact syntax node (
IfStatement,MethodBody,Comparison) responsible for the breach. - Enclosing Scope Bounds: Intelligently maps syntax coordinates (
start_pointtoend_point) and preserves surrounding indentations, types, and class structures intact.
- Frame-by-Frame Execution Playback: Don't just inspect where an error triggeredβscrub backwards and forwards in time to inspect how state mutated into corruption.
- Live Variable Delta Inspection: Dynamic variable scope cards show real-time variable mutations at every execution frame.
- Invariant Breach Alerting: Automatically traps invalid states (e.g. negative balances, boundary overflows, null pointer dereferences, or ledger imbalances) and highlights the culprit variable, expected invariant condition, and corrupt runtime value.
- β‘ Triage Agent (Synthesizer): Analyzes the runtime invariant violation, identifies the faulty AST node, and crafts a minimal reproducible unit test alongside a surgical diff patch.
- π‘οΈ Adversarial Critic (Auditor): Actively red-teams proposed patches against edge cases, boundary conditions, and type invariants (e.g. barring negative transaction inputs or typecasting nullable JSON tokens).
- Consensus Gating: The patch only moves to execution when both agents reach cryptographic consensus and issue an audit approval.
- Zero Demo Flakiness: Runs inside an ephemeral temporary workspace using Python subprocess isolation.
- Strict Verification Gate: Code patches are never marked as valid or merged unless internal tests transition from
β Red Failed (Exit 1)toβ 100% Green Passed (Exit 0). - Microsecond Timing: Sub-second execution benchmarking with cryptographic proof tokens.
- High-Fidelity Code Studio: Embedded Monaco Diff Editor with side-by-side and inline visual diff toggles.
- Unified Diff Metrics: Real-time calculation of inserted, modified, and deleted lines, proving minimal change radius.
- 1-Click Copy: Instant clipboard export for git patches and unified diffs.
- One-Click Bug Scenarios & Live Code Studio: Pre-configured with 6 realistic scenarios including arbitrary user code execution:
- Concurrent Order Book Race Condition (Double-spending & negative balances)
- Sliding Window Rate Limiter Off-By-One (
len(timestamps) <= max_requestsboundary bug) - JWT Auth Context Null Pointer (
NoneTypemember dereference) - Double-Entry Financial Ledger Imbalance (Solvency conservation failure)
- High-Priority Stream Interrupt & Causal Watermark (Monotonic sequence reordering)
- Custom Evaluator Sandbox (Interactive source code & pytest assertion studio with live dynamic AST repair)
- 5-Stage Visual Stepper: Watch the healing pipeline progress live through Invariant Breach β AST Isolation β Agent Debate β Subprocess Pytest β 100% Green Verified.
- Hands-Free Keyboard Shortcuts: Rapid-fire hotkeys (
1-6scenario select,Spacetrigger heal,Eexport PR,?shortcuts cheat sheet,Escdismiss).
- Production-Ready PRs: Generates formatted markdown Pull Request descriptions with root cause summaries, unified diffs, and deterministic sandbox proofs.
- SARIF v2.1.0 Export: Direct export in Static Analysis Results Interchange Format for GitHub Security Code Scanning and CI/CD pipelines.
Full Documentation & Visual Proofs: See the
/feedbackdirectory for conversation logs, community critique, and verified screenshots.
Public Outreach: Shared on LinkedIn (https://lnkd.in/p/ddR6nADX) tagging @GREVIX.
GhostSlate was shared directly with peer developers, students, and backend engineers to gather unfiltered critique on how developers would use autonomous program repair in production.
| Contributor / Peer | Community Role | What People Told Us | What We Changed Because Of It | Status |
|---|---|---|---|---|
| Aarav S. | Systems Engineer | "The canned scenarios are great, but evaluators need to test their own code. Can I paste my own broken Python class and custom pytest assertion to see it self-heal live?" | Built Interactive Custom Evaluator Sandbox: Added live code and test textareas with presets (Buffer Overflow, Token Bucket, Vault Solvency) and dynamic AST boundary repair. | π’ Merged |
| Priya K. | Full-Stack Developer | "Switching scenarios and triggering heals with a mouse slows down live presentations. Can you add keyboard shortcuts?" | Engineered Hands-Free Hotkeys: Added global hotkeys for 1-6 (scenario switch), Space (run heal), E (PR export), ? (shortcuts cheat sheet), and Esc. |
π’ Merged |
| Dev M. | Distributed Systems Student | "For the out-of-order interrupt scenario, how can I be sure the re-sequencing actually happened under 15Β΅s latency rather than being pre-computed?" | Live Stream Sync Telemetry Banner: Integrated real-time jitter distance (frames), reordered frames count, causal watermark latency (Β΅s), and monotonic integrity proofs into the UI. | π’ Merged |
GhostSlate is built using an open, decoupled Hexagonal Ports & Adapters Architecture:
flowchart TB
subgraph Presentation["π₯οΈ Presentation Adapters"]
direction LR
WebStudio["Monaco Web Studio<br><i>(React + Vite)</i>"]
HeadlessCLI["Headless CLI Adapter<br><i>(SARIF / CI/CD)</i>"]
REST_WS["FastAPI & WebSockets<br><i>(Streaming Engine)</i>"]
end
subgraph Core["π‘οΈ GhostSlate Core Domain Engine"]
Trap["<b>State Invariant Trap</b><br>Captures frame-by-frame mutations"]
ASTEngine["<b>AST Scoping & Surgery</b><br>Tree-Sitter C node isolation"]
DebateLoop["<b>Two-Tier Agent Loop</b><br>Triage β Adversarial Critic"]
Sandbox["<b>Deterministic Sandbox</b><br>Isolated Subprocess Pytest"]
end
subgraph Providers["π Provider Adapters"]
direction LR
DeterministicEngine["Offline Deterministic Engine<br><i>(100% Zero-Flake)</i>"]
GeminiAdapter["Google Gemini 2.0 Flash<br><i>(Provider Adapter)</i>"]
TreeSitterAdapter["Tree-Sitter Grammars<br><i>(Python & JS Bindings)</i>"]
PyASTAdapter["Native Python AST<br><i>(Fallback Parser)</i>"]
end
Presentation ==> Core
Core ==> Providers
- Pluggable Presentation: Switch effortlessly between an interactive web canvas and a headless CLI bot for CI/CD pipelines.
- Pluggable Intelligence: Run 100% offline using the built-in deterministic engine, or hot-swap with Google Gemini 2.0 Flash or OpenAI models without modifying core domain logic.
- Pluggable Parsers: Load Tree-Sitter grammar bindings dynamically for Python, JavaScript, TypeScript, and Go.
| Module | Platform | Status | Runtime | Tech Stack |
|---|---|---|---|---|
| π‘οΈ GhostSlate Engine | Backend / API | π’ Active | Python 3.10+ | FastAPI, Pydantic, Tree-Sitter, Pytest |
| π» Diff Studio | Web / SPA | π’ Active | Modern Browsers | React, Vite, Monaco Editor, Lucide |
| π€ Headless CLI | Terminal / CI/CD | π’ Active | CLI (Cross-Platform) | Python, SARIF v2.1.0, JSON |
| π§ͺ Sandbox Runner | Subprocess | π’ Active | Ephemeral Temp | Pytest, Subprocess Isolation |
- Language & Framework: Python 3.10+, FastAPI, Starlette, Uvicorn
- AST Parsing:
tree-sitter,tree-sitter-python,tree-sitter-javascript, Pythonast - Verification Harness:
pytest, isolatedsubprocessrunners,tempfile - Data Validation:
pydanticv2
- Framework: React 19, Vite
- Code Editor:
@monaco-editor/react(Monaco Diff Editor) - Styling: Vanilla CSS with custom glassmorphic dark design tokens (
backdrop-filter: blur(16px)) - Typography: Google Fonts (
Plus Jakarta Sans,JetBrains Mono) - Icons:
lucide-react
GhostSlate/
βββ backend/
β βββ .gitignore # Python backend ignore rules
β βββ adapters/ # Hexagonal adapter layers
β β βββ parsers/ # AST grammar adapters
β β β βββ base.py # ASTParserPort interface
β β β βββ tree_sitter_parser.py # Tree-Sitter C parser adapter (Python/JS)
β β β βββ python_ast_parser.py # Python standard library AST fallback
β β βββ presentation/ # Non-web presentation adapters
β β β βββ cli_adapter.py # Headless CLI with SARIF v2.1.0 exporter
β β βββ providers/ # Model intelligence adapters
β β βββ base.py # ModelProviderPort interface
β β βββ deterministic_engine.py # Zero-flake offline synthesis engine
β βββ chaos/
β β βββ scenarios.py # 4 Production chaos scenarios & tests
β βββ core/ # Core domain engine
β β βββ agent_loop.py # End-to-end self-healing coordinator
β β βββ ast_engine.py # Surgical AST splicing & diff computation
β β βββ models.py # Pydantic domain models
β β βββ sandbox_runner.py # Subprocess test execution sandbox
β β βββ state_trap.py # Runtime state invariant & frame recorder
β βββ tests/
β β βββ test_core.py # Comprehensive automated test suite
β βββ main.py # FastAPI REST API & WebSocket server
βββ frontend/ # React + Vite + Monaco web studio
β βββ src/
β β βββ components/
β β β βββ ASTVisualizer.jsx # Tree-Sitter syntax tree inspector
β β β βββ AgentDebateStream.jsx # Dual-agent debate transcript stream
β β β βββ ChaosSimulator.jsx # 1-Click chaos injection & pipeline stepper
β β β βββ ExportModal.jsx # 1-Click PR & SARIF export modal
β β β βββ Header.jsx # Brand bar & provider selector
β β β βββ MonacoDiffStudio.jsx # Side-by-side Monaco diff studio
β β β βββ SandboxTerminal.jsx # Subprocess test terminal (Red -> Green)
β β β βββ StateTimeTravelScrubber.jsx # Step-by-step state scrubber
β β βββ styles/
β β β βββ index.css # Futuristic glassmorphic dark theme
β β βββ App.jsx # Master studio controller
β β βββ main.jsx
β βββ index.html
β βββ package.json
β βββ vite.config.js
βββ pytest.ini # Pytest path discovery configuration
βββ .gitignore # Root git ignore specification
βββ README.md # Master project documentation
# Clone the repository
git clone https://github.com/saad2134/GhostSlate.git
cd GhostSlate
# Install Python dependencies
pip install fastapi uvicorn pydantic pytest tree-sitter tree-sitter-python tree-sitter-javascript
# Start the FastAPI engine (port 8000)
python -m uvicorn backend.main:app --host 127.0.0.1 --port 8000# In a new terminal, navigate to frontend
cd frontend
# Install dependencies
npm install
# Start the Vite development studio (port 5173)
npm run devOpen your browser at http://127.0.0.1:5173 to launch GhostSlate.
You can run GhostSlate directly in headless CI/CD pipelines without opening the web interface:
# Run automated repair for a scenario and export a SARIF audit report
python -m backend.adapters.presentation.cli_adapter --scenario race_condition --output-sarif audit.sarifGhostSlate enforces strict defense-in-depth isolation across all program repair pipelines and sandbox execution environments:
- Isolated Ephemeral Subprocess Sandboxes: Every candidate patch is tested in an ephemeral temporary directory generated with
tempfile.TemporaryDirectory(). The test workspace is destroyed immediately after execution. - Sanitized Execution Environment (
clean_env): Subprocesses run with a stripped environment dictionary that purges all parent process secrets, tokens, API keys, and sensitive environment variables (os.environ). - Subprocess Resource Quotas & Timeouts: Sandbox runs enforce a strict 5.0-second execution deadline (
timeout=5.0). Infinite loops or hangs are forcefully terminated withSIGKILL/terminate(), preventing Denial of Service. - Arbitrary Code Execution Hardening: The sandbox runner inspects source strings for prohibited modules (
os.system,subprocess.Popen, arbitrary sockets) prior to dispatch. - Cryptographic Diff Line Boundaries: Tree-Sitter AST parser enforces surgical coordinate boundaries, ensuring zero unauthorized mutations outside the enclosing target scope.
GhostSlate is built to comply with WCAG 2.1 AA accessibility guidelines across all interaction vectors:
-
Keyboard Navigation & Global Hotkeys:
Shortcut Action Description 1β¦6Scenario Switch Instant toggle across 6 chaos scenarios SpaceTrigger Heal Dispatches live chaos injection & automated AST self-healing loop EExport Modal Opens 1-Click GitHub PR markdown & SARIF v2.1.0 exporter ?or/Hotkey Cheat Sheet Toggles interactive keyboard shortcuts modal EscDismiss Overlays Closes any open modal or active dialog -
Skip to Content Landmark: Features a top-level
<a href="#main-content" class="skip-to-content">allowing screen reader and keyboard-only users to bypass navigation straight to the interactive sandbox. -
Semantic HTML5 Landmarks: Built using
<header>,<main id="main-content">,<nav>, and<footer>with explicitaria-labeltags on all interactive buttons and icons. -
Touch Targets & Contrast: All interactive controls maintain minimum 44px touch envelopes with high-contrast text ratios exceeding WCAG AA standards (4.5:1 for body copy, 7:1 for headers).
GhostSlate adheres to a strict Vercel High-Contrast Monochrome visual design system:
- Pitch-Black Core Canvas:
#000000pitch black background paired with elevated#0a0a0acard backdrops and hairline#222222(var(--border-subtle)) borders. - Functional State Accents:
- Emerald (
#10b981): 100% Green Verified test passes and causal stream sync active state. - Crimson (
#ef4444): Invariant breaches, failed tests, and AST deletion diff lines. - Amber (
#f59e0b): Isolated AST target nodes, jitter warnings, and candidate repair warnings. - Sky (
#38bdf8): Subprocess execution and temporary workspace orchestration.
- Emerald (
- Non-Blocking Fluid Typography: Uses Geist, JetBrains Mono, and Inter loaded asynchronously via non-blocking media queries for optimal First Contentful Paint (FCP).
- Aceternity UI Micro-Interactions: Subtle spotlight borders (
SpotlightCard), fluid decrypted text reveals (DecryptedText), count-up counters, and animated shimmer action buttons (ShimmerButton).
All automated tests in GhostSlate are deterministic and run offline with zero cloud dependency.
| Test Module | Suite Focus | Verified Invariants | Tests | Status |
|---|---|---|---|---|
backend/tests/test_core.py |
Chaos Scenarios & Self-Heal | Race condition, Off-by-one, NullPointer, Ledger solvency, Custom Sandbox, SARIF export | 7 | π’ 100% Pass |
backend/tests/test_stream_sync.py |
Causal Stream Resequencing | In-order ingest, Out-of-order jitter buffer, High-priority interrupt interception, <15Β΅s watermark latency | 5 | π’ 100% Pass |
| Total Test Suite | Hexagonal Core & Stream | End-to-End AST Repair & Deterministic Pytest Gate | 12 / 12 | π’ 100% Pass |
# Run complete test suite with verbose output
pytest backend/tests/ -v============================= test session starts =============================
platform win32 -- Python 3.10.6, pytest-8.3.5, pluggy-1.6.0
rootdir: C:\Users\UwU\Desktop\app-projects\GhostSlate
configfile: pytest.ini
collected 12 items
backend/tests/test_core.py::test_all_chaos_scenarios_configured PASSED [ 8%]
backend/tests/test_core.py::test_custom_self_heal_loop PASSED [ 16%]
backend/tests/test_core.py::test_stream_interrupt_self_heal_loop PASSED [ 25%]
backend/tests/test_core.py::test_race_condition_self_heal_loop PASSED [ 33%]
backend/tests/test_core.py::test_off_by_one_self_heal_loop PASSED [ 41%]
backend/tests/test_core.py::test_null_pointer_self_heal_loop PASSED [ 50%]
backend/tests/test_core.py::test_financial_ledger_self_heal_loop PASSED [ 58%]
backend/tests/test_core.py::test_sarif_export_structure PASSED [ 66%]
backend/tests/test_stream_sync.py::test_stream_in_order_ingest PASSED [ 75%]
backend/tests/test_stream_sync.py::test_stream_out_of_order_resequencing PASSED [ 83%]
backend/tests/test_stream_sync.py::test_stream_high_priority_interrupt_interception PASSED [ 91%]
backend/tests/test_stream_sync.py::test_stream_latency_and_watermark_metadata PASSED [100%]
============================= 12 passed in 19.32s =============================
| Phase | Milestone | Focus Areas | Key Deliverables | Status |
|---|---|---|---|---|
| v1.0 | Deterministic Core & Web Studio | AST Program Repair & Time-Travel | Tree-Sitter C parser bindings, Python AST fallback, isolated subprocess pytest sandbox, Monaco Diff Studio, State Time-Travel Scrubber, Two-Tier Agent Loop, and SARIF v2.1.0 exporter. | π’ Released |
| v1.5 | Multi-Language Grammar Expansion | Cross-Language Coverage | Dynamic loading of Go and Rust Tree-Sitter grammars, integration with cargo test and go test subprocess runners. |
β³ Planned |
| v2.0 | Native GitHub Action & Bot | Continuous Self-Healing | Automated GitHub PR bot that intercepts failing CI runs, isolates faulty AST nodes, and submits verified PR fixes automatically. | β³ Planned |
Developed and published by Saaduddin Mohammed (@saad2134)
- GitHub: https://github.com/saad2134
This project is licensed under the MIT License - see the LICENSE file for details.
- β Commercial use
- β Modification
- β Distribution
- β Private use
- β Liability
- β Warranty
ast-repair self-healing program-synthesis tree-sitter fastapi react vite monaco-editor time-travel-debugger pytest hexagonal-architecture subprocesses sarif python open-source developer-tools