This serves as an experimental project and provides an opportunity to revisit Scheme and Racket.
A self-healing Racket language. Write a program in #lang lazarus; if a form
fails, lazarus repairs it — first with learned strategies, then via the Claude
API — verifies the whole program against its checks, rewrites the source, and
commits the heal to git.
#lang lazarus
(define total 10)
(displayln (+ totl 5)) ; typo — will be healed to (+ total 5)
(check-equal? (+ total 5) 15) ; the bar a heal must passraco pkg install --link --auto ./lazarus # once
racket broken.rkt # heals, verifies, rewrites, commits
racket broken.rkt # now runs cleanRules of the game:
- A fix only persists when the file's checks pass (yours, or generated ones
written to
<file>.checks.rktfor review). Failed verification leaves the file byte-identical. - Persistence requires a clean git state for the file; every heal is one
auditable commit (
git revertto undo). - Verified LLM fixes are generalized into strategy modules under
strategies/, validated, and reused on future runs — the system extends its own code, andgit log strategies/is the record of it learning. - No
ANTHROPIC_API_KEY? Built-in and learned strategies still heal; learning and check generation are disabled.
Design: docs/superpowers/specs/2026-09-03-lazarus-lang-design.md. The v1
expression-level system remains under src/ (Racket and Chez Scheme).
- Racket 8.0+ installed
- Required packages:
net/http-client,json,racket/system
- Chez Scheme 9.5+ (recommended) or compatible Scheme implementation
- Basic R6RS/R7RS support
- Anthropic API key for Claude models (primary)
- OpenAI API key for GPT models (fallback)
-
Configure API Keys (for LLM integration):
export ANTHROPIC_API_KEY=your-anthropic-api-key-here # Optional fallback: export OPENAI_API_KEY=your-openai-api-key-here
-
Clone and Navigate:
git clone <repository-url> cd experiment
#lang racket
(require "src/racket/auto-fix.rkt")
;; Evaluate with automatic error fixing
(safe-eval-with-fix '(+ 1 2 3)) ; Works normally: 6
;; Handle undefined variables
(safe-eval-with-fix '(+ undefined-var 5)) ; Attempts to fix
;; Fix type errors
(safe-eval-with-fix '(+ "hello" 5)) ; Suggests type conversion
;; Run example demonstrations
(example-usage)(load "src/scheme/auto-fix.scm")
;; Same syntax as Racket
(safe-eval-with-fix '(+ 1 2 3))
(safe-eval-with-fix '(+ undefined-var 5))
(example-usage)#lang racket
(require "src/racket/meta-auto-fix.rkt")
;; Use the with-auto-fix macro for expressions
(with-auto-fix (/ 10 0)) ; Handles division by zero
;; Define functions with built-in error handling
(auto-fix-function safe-divide (x y)
(/ x y))
(safe-divide 10 0) ; Automatically handles errors
;; Create custom error handlers
(define-auto-fix-handler my-handler syntax-error
(lambda (condition code)
(displayln "Custom syntax fix applied")))(load "src/scheme/meta-auto-fix.scm")
;; Same macro syntax
(with-auto-fix (/ 10 0))
;; Define auto-fixing functions
(auto-fix-function safe-divide (x y)
(/ x y))
;; Create custom fix modules
(define-auto-fix-module my-system
(safe-divide safe-multiply))Run the comprehensive test suite:
# From project root directory:
racket tests/racket/test-auto-fix.rkt # Basic functionality
racket tests/racket/meta-test.rkt # Metaprogramming features# From project root directory (Chez Scheme):
scheme --script tests/scheme/test-auto-fix.scm # Basic functionality
scheme --script tests/scheme/meta-test.scm # Metaprogramming features
scheme --script tests/scheme/test-metaprog-comprehensive.scmexport ANTHROPIC_API_KEY=your-key
# Uses: claude-sonnet-4-6 model
# Endpoint: https://api.anthropic.com/v1/messagesexport OPENAI_API_KEY=your-key
# Uses: gpt-3.5-turbo model
# Endpoint: https://api.openai.com/v1/chat/completions