Genesis Blackbox
Deterministic Runtime Flight Recorder and AST Blast-Radius Causal Crash Compiler for AI-assisted engineering and autonomous coding agents.
Overview
When coding agents (Claude, Cursor, Windsurf) encounter runtime crashes, standard stack traces leave them guessing. They lack the execution history leading up to the error, the local variable state across stack frames, and the static dependency blast radius.
Genesis Blackbox captures execution context with sub-millisecond overhead:
- SQLite WAL Ring-Buffer (
wal_ring.py): Circular bounded log for HTTP requests, SQL queries with sanitized parameters, and subprocess activity. - Deep Exception Serializer (
exception_hook.py): Automatically captures local variables per frame at crash time with circular-reference safety and credential redaction. - AST Blast-Radius Engine (
ast_engine/): Static call-graph analyzer that maps upstream callers and downstream callee dependencies. - Causal Crash Compiler (
compiler/): Synthesizes timeline events, frame variables, and AST blast radius into a self-contained.blackbox.mdAutopsy Capsule. - Native MCP Server (
mcp_server.py): Direct Model Context Protocol interface exposing timeline queries, crash autopsies, and blast-radius tools over stdio. - Embedded Visual Timeline (
ui/): Lightweight local web inspector for timeline events and crash autopsies.
Architecture
flowchart LR
subgraph Runtime ["Runtime Interceptors"]
HTTP["HTTP (ASGI / WSGI)"]
SQL["SQL (sqlite3 / DBAPI)"]
end
WAL[("SQLite WAL Ring-Buffer<br/>(Sub-ms Circular Store)")]
AST["AST Blast-Radius Engine<br/>(Static Call Graph)"]
Compiler["Causal Crash Compiler"]
Capsule[(".blackbox.md<br/>Autopsy Capsule")]
AIAgent["AI Agent 1-Shot Fix<br/>(Claude, Cursor, Windsurf)"]
HTTP --> WAL
SQL --> WAL
WAL --> Compiler
AST --> Compiler
Compiler --> Capsule
Capsule --> AIAgent
+-------------------------------------------------+
| Runtime Interceptors |
| ASGI / WSGI Middleware & SQL Drivers |
+------------------------+------------------------+
|
v
+-------------------------------------------------+
| SQLite WAL Ring-Buffer |
| (Sub-ms Overhead, Circular Pruning) |
+------------------------+------------------------+
| +-----------------------------+
| | AST Blast-Radius Engine |
| | (Static Call Graph Nodes) |
+--------+---------+--------------+--------------+
| |
v v
+------------------------------------------------+
| Causal Crash Compiler |
+------------------------+-----------------------+
|
v
+------------------------------------------------+
| .blackbox.md Capsule |
| (Timeline + Frame State + Blast Radius) |
+------------------------+-----------------------+
|
v
+------------------------------------------------+
| AI Agent 1-Shot Deterministic Fix |
| (Claude, Cursor, Windsurf) |
+------------------------------------------------+
Quickstart
1. Installation
pip install genesis-blackbox
For development dependencies (pytest, pytest-asyncio, build, twine):
pip install genesis-blackbox[dev]
2. Frictionless Recording
Execute any Python entrypoint or microservice under the flight recorder wrapper:
blackbox record -- python app.py
The flight recorder automatically:
- Initializes a local bounded SQLite WAL ring buffer at
.blackbox/wal.sqlite. - Hooks
sys.excepthookandthreading.excepthookfor deep variable serialization upon crash. - Redacts sensitive headers (Authorization, Cookie, API keys) and SQL credentials.
You can also record custom events directly from the CLI or your code:
blackbox record --type HTTP_REQ --payload '{"path": "/api/users", "status": 500, "error": "DatabaseTimeout"}'
3. Visual Inspection
Launch the embedded local web inspector to explore recent events, execution timelines, and crash autopsy capsules:
blackbox ui --port 8765
Navigate to http://127.0.0.1:8765 in your browser.
4. Causal Autopsy Generation
Generate a complete Markdown autopsy document from the latest recorded crash:
blackbox autopsy
This compiles .blackbox.md in the current directory with:
- Target exception class, message, and formatted traceback.
- Local variables across each stack frame.
- Recent execution timeline leading to the crash.
- AST blast-radius analysis showing impacted callers and callees.
To inspect the recent execution timeline via CLI:
blackbox timeline --limit 20
To run a blast-radius calculation on a file or specific symbol:
blackbox blast-radius app.py --symbol handle_request
MCP Server Configuration
Genesis Blackbox includes a native Model Context Protocol (MCP) server (blackbox.mcp_server) exposing diagnostic tools directly to AI coding agents.
Exposed MCP tools:
get_crash_autopsy: Compiles.blackbox.mdfrom recorded WAL events.get_blast_radius: Analyzes upstream and downstream code dependencies.query_execution_timeline: Queries recent HTTP, SQL, and exception events.record_event: Ingests custom execution events into the WAL ring buffer.
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"blackbox": {
"command": "python",
"args": ["-m", "blackbox.mcp_server"]
}
}
}
Cursor
Add to your .cursor/mcp.json:
{
"mcpServers": {
"blackbox": {
"command": "python",
"args": ["-m", "blackbox.mcp_server"]
}
}
}
Windsurf
Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"blackbox": {
"command": "python",
"args": ["-m", "blackbox.mcp_server"]
}
}
}
Support
If this tool is helpful for your workflow, you can support its maintenance on Ko-fi.
License
This project is licensed under the MIT License. Copyright (c) Johann Schiffer.
Metadata
Release files for genesis-blackbox 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| genesis_blackbox-0.1.2.tar.gz | 54.9 kB | Without provenance | Details for genesis_blackbox-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| genesis_blackbox-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for genesis_blackbox-0.1.2-py3-none-any.whl |
Total release size: 104.9 kB
Release files / genesis_blackbox-0.1.2.tar.gz
| Download URL | genesis_blackbox-0.1.2.tar.gz |
|---|---|
| Size | 54.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c5f5bc39c037ddf39b06ff29faebd029c5e7912afdd6dd566a1dbb616a5e3feb
|
|
BLAKE2b-256 checksum How to use checksums |
b14b13856b4ff251d23286d316f61a10c15846a55d4d82d55464d7f81d6f9d6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / genesis_blackbox-0.1.2-py3-none-any.whl
| Download URL | genesis_blackbox-0.1.2-py3-none-any.whl |
|---|---|
| Size | 50.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
82411b1ff9d8763e3608dac5ab6a82fa4a270f41519f8e144face3db0b910119
|
|
BLAKE2b-256 checksum How to use checksums |
47f597d266e159d32472d52025692f4c6aa9e6bbd521d36e7318df8a9a532cfb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Security for genesis-blackbox 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.