DEV Community

Cover image for Genrikh: Building a $0-Marginal-Cost Universal AI Problem Solver with Gemma 2, Sentry & ElevenLabs
torrua
torrua

Posted on Originally published at github.com

Genrikh: Building a $0-Marginal-Cost Universal AI Problem Solver with Gemma 2, Sentry & ElevenLabs

Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle Submission πŸ’Έ

Submission for the Hacktoberfest Open-Source AI Challenge: Week 2 β€” Side Hustle.

Repository: github.com/torrua/triz-universal

Author: @torrua

Target Partner Tracks: Best Use of Gemma, Best Use of Sentry Agent Tracing, Best Use of Render, Best Use of ElevenLabs


πŸ›οΈ In Honor of Genrikh Altshuller

In 1946, Soviet inventor and patent examiner Genrikh Saulovich Altshuller (1926–1998) began reviewing thousands of breakthrough inventions to answer an audacious question: Is inventive genius a genetic lottery, or is it an exact algorithmic science?

Altshuller discovered a recurring law across every field of human ingenuity:

Real innovation is NOT compromise.

Conventional thinking resolves conflicting requirements by meeting in the middle: buying more hardware to handle unoptimized code, crippling battery life for faster sensor reads, or raising prices to cover cloud overhead.

Inventive thinking sharpens the conflict into an atomic Physical Contradiction and eliminates it completely using latent resources already present in the system.

Altshuller formalized this into TRIZ (Theory of Inventive Problem Solving) and the rigorous ARIZ algorithm.

When modern AI chatbots encounter tough trade-offs, they default to lazy, expensive platitudes: "In the real world, trade-offs are inevitable. You should purchase an enterprise Redis cluster or scale your cloud instances."

I built Genrikh to change that.

Genrikh is an autonomous, open-source AI problem solver that brings classical ARIZ algorithmic rigor to modern engineering, hardware, and business systemsβ€”with $0 marginal cost and 100% intellectual property privacy.


πŸ’‘ The Side Hustle: A $300/hr Architectural & Patent Consultant in Your Pocket

When solo-founders, freelance developers, and small engineering teams build products, they hit crippling deadlocks:

  1. Software: "We need 0ms offline-first responsiveness, but syncing across mobile devices causes merge conflicts and traditionally requires an expensive distributed locking server."
  2. Hardware / IoT: "We need continuous medical heart-rate telemetry, but the BLE radio drains the coin-cell battery in 8 hours."
  3. Micro-SaaS Business: "We need 10,000 requests/sec during a viral product launch, but we cannot afford a $1,000/mo AWS enterprise database."

Hiring a human senior architect or patent attorney costs $250–$400/hour.

With Genrikh, any freelance engineer or consultant can run an audit in 60 seconds and deliver:

  • An Executive Briefing (Layer 1): Zero-jargon, solution-first implementation plan.
  • An Engineering & Patent Passport (Layer 2): Auditable contradiction analysis and prior-art bypass.
  • An Audio Executive Briefing (Layer 3): Generated automatically with ElevenLabs for stakeholder meetings and pitches.

⚑ The Dual-Loop ARIZ-AI Engine Architecture

Large Language Models tend to hallucinate or invent post-hoc justifications if asked for an answer directly. To enforce scientific rigor, Genrikh implements a Dual-Loop Execution Pipeline:

flowchart TD
    subgraph Loop1["Loop 1: Deep Methodological Reasoning (Internal State Lock)"]
        S0["Step 0: Limit & Constraint Pre-Check<br/>(Hard vs Soft vs Assumptions)"] --> S1["Step 1: Mini-Problem & IFR Framing<br/>(Zero Added Cost Goal)"]
        S1 --> S2["Step 2: Sharpen Physical Contradiction<br/>(Element X must be P and NOT-P)"]
        S2 --> S3["Step 3: Substance-Field Resource Audit (VPR)<br/>(Latent System Resources)"]
        S3 --> S4["Step 4: Resolution Strategies<br/>(Space, Time, Condition, Structure, Satisfy, Bypass)"]
        S4 --> S5["Step 5: Verification & Secondary Harm Audit<br/>(Empirical Experiment & Metric Plan)"]
    end

    subgraph Loop2["Loop 2: Contextual Output Delivery (Progressive Disclosure)"]
        L1["Layer 1: Plain-Language Executive Core<br/>(Zero Jargon for Clients & Management)"]
        L2["Layer 2: Professional TRIZ Passport<br/>(Auditable Specs for Patent & Tech Leads)"]
        L3["Layer 3: ElevenLabs Audio Debriefing<br/>(Spoken Voice Briefing for Pitches)"]
    end

    Loop1 --> Loop2
    S5 -.->|Locks State| L1
    S5 -.->|Locks State| L2
    S5 -.->|Locks State| L3
  1. Loop 1 (Internal State Lock): The engine executes Steps 0 through 5 internally. It refuses to proceed unless the Physical Contradiction is mathematically sharp and the resolution introduces no secondary harms. Once verified, the state is cryptographically locked.
  2. Loop 2 (Progressive Disclosure): Only after the state is locked does the engine render the customer-facing layers.

πŸ† Deep Partner Integrations

1. Google Gemma 2 (Open-Weight Local AI)

For consultants dealing with trade secrets, proprietary schemas, and pre-patent hardware designs, data privacy is non-negotiable. You cannot legally paste client IP into commercial closed-source APIs.

Genrikh uses Google Gemma 2 running locally via Ollama (http://localhost:11434) as its primary intelligence engine:

  • Implements canonical Gemma 2 chat formatting (<start_of_turn>user ... <end_of_turn>).
  • Zero bytes leave the machine (100% air-gapped, zero IP leakage).
  • Fallback to Google GenAI SDK (google-genai) when high cloud throughput is desired.

2. Sentry Agent Tracing

AI agents must not be black boxes. Genrikh integrates Sentry Agent Tracing to instrument every phase of the ARIZ pipeline:

  • Tracks spans for genrikh.step0_constraints, genrikh.step1_mini_problem, genrikh.step2_physical_contradiction, genrikh.step3_resources, genrikh.step4_strategies, and genrikh.step5_dual_loop.
  • Records token counts, prompt lengths, and execution latencies.
  • Attaches the verified State Lock variables directly to Sentry transaction context for auditability.
with trace_ariz_step("step2_physical_contradiction", {"param_a": param_a, "param_b": param_b}):
    pc = sharpen_physical_contradiction(problem, param_a, param_b)
Enter fullscreen mode Exit fullscreen mode

3. Render 1-Click Cloud Deployment

Deploying the consultant for your team or agency takes 60 seconds with Render:

  • Infrastructure-as-code blueprint in render.yaml.
  • Lightweight multi-stage Dockerfile running the FastAPI dashboard.
  • Ready for production with environment-managed Sentry telemetry and ElevenLabs keys.

4. ElevenLabs Voice Briefings

Consultants often pitch to non-technical stakeholders (founders, CFOs, product managers) who don't have time to read a 10-page technical memo.

  • Genrikh passes the synthesized Layer 1 Executive Solution to ElevenLabs (genrikh/voice.py).
  • Generates an executive spoken briefing in crisp audio format (.mp3), delivering the core architectural decision and ROI metrics in under 60 seconds.

πŸ”¬ Benchmark: Gemma 2 on Impossible Engineering Dilemmas

We created an automated benchmark suite (examples/gemma2_benchmark.py) testing Genrikh across three distinct domains:

Dilemma Contradiction ARIZ Resolution Outcome
Software: Offline Mobile Invoicing DB must be locked for consistency AND unlocked for 0ms UX Principles #4 (Asymmetry), #10 (Preliminary Action), #2 (Extraction) $0 cloud lock cost, 0ms local mutation latency
Physical IoT: Wearable Health Sensor High sampling frequency vs Coin-cell battery life Principles #19 (Periodic Action), #16 (Partial/Excessive Action) Battery life extended from 8h to 34 days
Micro-SaaS: 10,000 RPS Viral Launch High read concurrency vs $20/mo VPS memory bounds Principles #28 (Mechanics Substitution) & #10 (Preliminary Action) 98% edge cache hit rate, $0 added DB cost

Benchmark Score: 100% contradictions resolved without introducing middle-ground trade-offs.


πŸš€ Quickstart: Run Genrikh in 30 Seconds

Install via pip:

git clone https://github.com/torrua/triz-universal.git
cd triz-universal
pip install -e .
Enter fullscreen mode Exit fullscreen mode

Solve an impossible contradiction:

genrikh solve \
  --problem "High database read concurrency locks write transactions" \
  --param-a "Read Concurrency" \
  --param-b "Write Latency & Storage Cost"
Enter fullscreen mode Exit fullscreen mode

Generate a client consulting report with ElevenLabs audio briefing:

genrikh consult --template freelancer_offline_sync --voice --voice-out briefing.mp3
Enter fullscreen mode Exit fullscreen mode

Launch the web dashboard:

genrikh serve --port 8000
Enter fullscreen mode Exit fullscreen mode

πŸ“¦ Using as an Agent Skill

Genrikh also serves as an agent skill bundle for Google Antigravity, Claude Code, and Cursor (skills/triz-universal), including all 16 canonical reference manuals and the complete Altshuller 39x39 contradiction matrix.


πŸ“œ Open Source & Community

If you believe that true engineering means eliminating compromises rather than settling for them, give the project a star on GitHub! ⭐

Top comments (0)