Genesis Blackbox
Deterministic runtime flight recorder and AST blast-radius causal crash compiler for Python services and coding agents.
Overview
When coding agents (Claude Code, Cursor, Windsurf) encounter runtime failures, plain stack traces omit the HTTP/SQL/subprocess events that preceded the error, the local variable bindings inside each frame, and the static call-graph impact of a proposed fix.
genesis-blackbox records runtime context with zero external runtime dependencies:
- SQLite WAL Ring-Buffer (
wal_ring.py): Bounded circular log for HTTP transactions, SQL queries with redacted bind parameters, subprocess invocations, and exceptions. - Deep Exception Serializer (
exception_hook.py): Captures per-frame local variable scopes acrosssys.excepthookandthreading.excepthookwith circular-reference bounds and secret redaction. - Zero-Config & Framework Instrumentation (
instrumentation.py,integrations/): Drop-inauto_instrument()plus idiomatic adapters for FastAPI/Starlette (ASGI), Flask (WSGI), sqlite3/DB-API, and SQLAlchemy. - AST Blast-Radius & Impact Selector (
ast_engine/): Static call-graph analyzer that computes upstream callers, downstream callees, and impacted pytest files for modified code. - Causal Crash Compiler, Reproducer & Patch Validator (
compiler/): Compiles.blackbox.mdautopsy capsules, synthesizes standalone pytest reproduction scripts, validates candidategit diffpatches with guaranteed rollback, and writes.blackbox-resolved.mdverification receipts. - Pytest Plugin & GitHub Actions Summary (
pytest_plugin.py,ci/): Nativepytest --blackboxhook and collapsible$GITHUB_STEP_SUMMARYMarkdown exporter. - Native MCP Server & Local Web Inspector (
mcp_server.py,ui/): Stdio MCP server (blackbox-mcp) exposing 7 diagnostic tools alongside a zero-dependency localhost timeline viewer.
Architecture
flowchart LR
subgraph Runtime ["Runtime Interceptors"]
HTTP["HTTP (ASGI / WSGI)"]
SQL["SQL (DB-API / SQLAlchemy)"]
PROC["Subprocess & Exceptions"]
end
WAL[("SQLite WAL Ring-Buffer")]
AST["AST Blast-Radius & Impact Engine"]
Compiler["Causal Crash Compiler"]
Capsule[(".blackbox.md + Reproducer Test")]
Validator["Patch Validator & Receipt Verifier"]
HTTP --> WAL
SQL --> WAL
PROC --> WAL
WAL --> Compiler
AST --> Compiler
Compiler --> Capsule
Capsule --> Validator
Quickstart
1. Installation
pip install genesis-blackbox
2. Record Any Python Command or Service
blackbox record -- python app.py
Or attach inside application code with one line:
from blackbox import auto_instrument
auto_instrument(db_path=".blackbox/wal.sqlite")
Framework-specific helpers are also included:
from blackbox import instrument_fastapi, instrument_flask, instrument_engine
instrument_fastapi(fastapi_app)
instrument_flask(flask_app)
instrument_engine(sqlalchemy_engine)
3. Pytest Plugin & Impact Test Selection
Capture autopsies and standalone reproduction scripts automatically on test failures:
pytest --blackbox
Select and execute only the tests affected by modified source symbols:
blackbox test-impact --diff --run
4. Compile Autopsies, Reproduce, and Verify Fixes
# Compile .blackbox.md from the latest crash in .blackbox/wal.sqlite
blackbox autopsy
# Synthesize a standalone pytest reproduction script
blackbox reproduce --output test_blackbox_reproduce.py
# Run the reproduction test and emit .blackbox-resolved.md once fixed
blackbox verify --test test_blackbox_reproduce.py
# Export collapsible Markdown to GitHub Actions $GITHUB_STEP_SUMMARY
blackbox ci-summary --autopsy .blackbox.md
# Initialize agent workflow rules (.cursorrules, CLAUDE.md, or .windsurfrules)
blackbox init-rules --type claude
# Launch the localhost timeline and autopsy web inspector
blackbox ui --port 8765 --no-browser
MCP Server Configuration
genesis-blackbox ships the blackbox-mcp stdio server exposing 7 MCP tools:
get_crash_autopsy: Compiles.blackbox.mdfrom recorded WAL events.generate_reproduction_test: Synthesizes an executable pytest reproduction script from the latest recorded exception.verify_crash_resolution: Executes the reproduction test and emits.blackbox-resolved.mdwhen resolved.test_candidate_patch: Evaluates a unifiedgit diffagainst reproduction and AST-impacted tests with automatic rollback.get_blast_radius: Computes upstream callers and downstream callees for a Python file or symbol.query_execution_timeline: Queries recent HTTP, SQL, subprocess, and exception events.record_event: Appends structured execution telemetry to the circular WAL buffer.
Claude Desktop / Cursor / Windsurf
{
"mcpServers": {
"blackbox": {
"command": "uvx",
"args": ["--from", "genesis-blackbox", "blackbox-mcp"]
}
}
}
If installed into an active virtual environment, you can invoke blackbox-mcp directly:
{
"mcpServers": {
"blackbox": {
"command": "blackbox-mcp",
"args": ["--db", ".blackbox/wal.sqlite"]
}
}
}
Support
If this project is useful in your engineering workflow, you can support ongoing open-source maintenance on Ko-fi.
License
Licensed under the MIT License. Copyright (c) Johann Schiffer.
Metadata
Release files for genesis-blackbox 0.1.5
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.5.tar.gz | 73.8 kB | Without provenance | Details for genesis_blackbox-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| genesis_blackbox-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for genesis_blackbox-0.1.5-py3-none-any.whl |
Total release size: 138.7 kB
Release files / genesis_blackbox-0.1.5.tar.gz
| Download URL | genesis_blackbox-0.1.5.tar.gz |
|---|---|
| Size | 73.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
86e3512f210d4e9b4f38258e1583a32c53a087f87566b8a66791e482887a0597
|
|
BLAKE2b-256 checksum How to use checksums |
244ac2977465ea1e921b49cd3b04cb5652f7655d159f8dc465e21cd0ec7eb33f
|
| 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.5-py3-none-any.whl
| Download URL | genesis_blackbox-0.1.5-py3-none-any.whl |
|---|---|
| Size | 64.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
07fda5d9aed1fb957d30817214a2aa4db140e62bb41b41d25ebace29476c09ed
|
|
BLAKE2b-256 checksum How to use checksums |
fdef5c30e260c661d6622e05e9b18ae01240640a5589b2e5ae42f97e06f56369
|
| 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.5
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.