Skip to content
AtomiceatscodePublic

About

Open-source macOS calculator rebuilt clean-room from black-box observation. Swift 6 + SwiftUI, 189/189 recorded behaviours matched.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

OpenCalc

An open-source macOS calculator, rebuilt clean-room from black-box observation.
Basic, Scientific and Programmer modes · Swift 6 + SwiftUI · zero dependencies

CI: build + 189 tests CI status tests: 189/189 passing match rate: 100.0% license: MIT

Swift: 6 SwiftUI: native platform: macOS 14+ dependencies: zero Xcode: not needed

method: clean room ✓ built with: Craft Anything implemented by: Claude Haiku 5.5 studied by: Claude Opus 5.5

lines of code: 2,758 Swift files: 12 app size: 1.3 MB code size repo size top language

last commit commit activity issues stars

How it was made · Build · Stats · Code map · Spec

What it is

OpenCalc is an original calculator for macOS that behaves like the built-in one. Every rule it follows (precedence, repeated =, percent, rounding to 8 places, Undefined / Indeterminate / Overflow, 64-bit programmer arithmetic) was recorded from the real app and is checked by 189 test vectors on every push.

  • Basic: expression-style display, ⌫, AC, %, ±, repeated equals
  • Scientific: parentheses, powers and roots, logs, factorial (gamma for decimals), trig in degrees or radians, hyperbolic functions, EE, π, e, memory
  • Programmer: bases 8/10/16, 64-bit binary view, AND / OR / XOR / NOR / NOT / NEG, shifts, rotates, byte and word flips, mod

How it was made

OpenCalc is a clean-room reimplementation. Nothing inside the original app (its code, files or artwork) was read, decompiled or copied.

  1. Study (black box). Claude Opus 5.5 operated the real calculator from outside through the macOS accessibility interface, pressing its buttons and reading its display, and recorded 189 results plus layout measurements.
  2. Spec. Those observations became spec/SPEC.md and spec/test-vectors.csv. Only written behaviour crossed over.
  3. Build. Craft Anything ran Claude Code on Claude Haiku 5.5 in clean-room mode to write the app from the spec alone.
  4. Check. Every vector is replayed against the engine; the window was compared side by side with screenshots of the original for layout, sizes and colours.

The icon and all drawing are original. OpenCalc is not affiliated with or endorsed by Apple.

Build and run

Needs macOS 14+ and Swift 6 (the Command Line Tools are enough; Xcode is not needed).

swift build                     # build everything
swift run OpenCalc              # run the app
scripts/make-app.sh             # package dist/OpenCalc.app
scripts/check-vectors.sh        # replay the 189 recorded results
python3 -I scripts/stats.py     # refresh the badges, stats and treemap below

Stats

Overall
Behaviour match 189/189 recorded results (100.0%)
Lines of code (excluding spec) 2,758 across 12 Swift files
App bundle 1.3 MB (original app: 3.4 MB, 0.4×)
Vector replay time 0.7 s (including incremental build)
Commits 2
Mode Recorded results Passing Progress
Basic 89 89 ████████████████████ 100%
Programmer 46 46 ████████████████████ 100%
Scientific 54 54 ████████████████████ 100%
Module Non-blank lines
Engine 1,434
App (SwiftUI) 905
Scripts 361
Spec 326
Tests 58

Generated by scripts/stats.py on 2026-11-10.

Code map

Each box is a file, sized by its non-blank lines and coloured by module.

Treemap of the source files by lines of code

Layout

Path What it is
Sources/OpenCalcCore The calculator engine. No UI.
Sources/OpenCalc The SwiftUI app.
scripts/check-vectors Command-line replay of the vectors (swift run OpenCalcTests).
Tests/OpenCalcCoreTests The same replay as Swift Testing tests.
spec/ The behaviour spec and the recorded test vectors.

Contributors

Made by Claude (Opus 5.5 and Haiku 5.5) with Craft Anything.

License

MIT

About

Open-source macOS calculator rebuilt clean-room from black-box observation. Swift 6 + SwiftUI, 189/189 recorded behaviours matched.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages