Mirrored from https://github.com/SNAPKITTYWEST/ruby-self-resonance at commit 0577129. Part of the SnapKitty October 2026 main drop.

Ruby Self-Resonance Stack

License: NON-AI MPL 2.0 Ruby Sinatra WASM Playground GitHub Pages NASM No AI Training

TheVoidIntent Systems β€” a coherence-based permission layer in Ruby, with two front ends: a live Sinatra dashboard and a zero-server WebAssembly playground on GitHub Pages.

Instead of RBAC or OAuth, actions are permitted or denied by thermodynamic alignment checks. An intent core measures action coherence against a seeded intent vector. A resonance engine folds information into crystallization density at the orbital baseline frequency of 1/13 β‰ˆ 0.076923. A deterministic policy draws the final boundary. Two x86-64 NASM modules implement the ethical guardrails and network containment in fixed-point integer arithmetic β€” no floating point anywhere near the guardrail path.

Live demo

β–Ά Open the WASM Playground β€” the repository's own ruby_self_resonance.rb running in your browser, compiled from Ruby 3.2 to WebAssembly via ruby.wasm. Authorize actions, fold information, watch density climb toward Ξ£. No server, no install.

Dashboard demo

The Sinatra dashboard mid-demo: coherence 1.6763, density 3.8462 accumulating toward Ξ£ = 44.0, resonance frequency 1/13, and the append-only diary below.

Field diary

The append-only field diary: initialization and a granted permission, with full payloads and microsecond timestamps.

Architecture

flowchart TB
    subgraph RUBY["Ruby core (verbatim)"]
        MK[MathKernel<br/>clamp Β· normalize Β· distance Β· cosine_similarity]
        AV[ActionVector<br/>immutable, frozen]
        DE[Decision<br/>allowed? Β· denied? Β· to_h]
        FD[FieldDiary<br/>append-only, deep-frozen events]
        IC[IntentSimCore<br/>intent Β· coherence Β· entropy Β· risk]
        ME[MezquiaResonanceEngine<br/>creases Β· density Β· 1/13 Β· Ξ£=44.0]
        CP[CoherencePolicy<br/>deterministic permit?/explain]
        PR[PermissionRuntime<br/>unified execution boundary]
        MK --> IC
        AV --> PR
        FD --> IC
        IC --> PR
        ME --> PR
        CP --> PR
        PR --> DE
    end
    subgraph FRONT["Front ends (new)"]
        SIN[Sinatra dashboard<br/>server-side Ruby]
        WASM[WASM playground<br/>Ruby 3.2 in the browser]
    end
    subgraph ASM["x86-64 NASM (verbatim)"]
        EG[ethical_guardrails<br/>fixed-point monitor]
        NC[network_containment<br/>WARNING β†’ TRUTHLOCK]
    end
    PR --> SIN
    PR --> WASM
    IC -.->|concept| FD

The verbatim contract

Every file at the repo root is the author's code exactly as supplied β€” nothing rewritten, nothing "fixed," nothing redesigned. The only additions are SPDX license headers and the two front ends. Where the supplied code has observable behavior worth knowing, it is documented below under Honesty notes β€” not altered.

Layout

File What it is
lib/ruby_self_resonance.rb The complete stack: MathKernel, ActionVector, Decision, FieldDiary, IntentSimCore, MezquiaResonanceEngine, CoherencePolicy, PermissionRuntime β€” plus the author's example run
lib/field_diary.rb FieldDiary (emotional-state creases: stable β†’ seeking β†’ crystallizing β†’ dissonant β†’ sovereign), HRRCalculator (HRR = (Ξ”Entropy/Ξ”Time) Γ— 1/13), IntegratedIntentSimEngine
lib/initialization_matrix.rb ProgressiveInitializationMatrix β€” the 44-stage boot sequence (field priming β†’ intent alignment β†’ coherence β†’ sovereignty)
lib/codex_absorber.rb CodexAbsorber β€” YAML intent-manifest ingestion β†’ TypeScript/Python codegen
lib/git_locksmith.rb GitImmutabilityLocksmith β€” SHA-256 file scan + sovereign-anchor check
bin/resonance_repl.rb Interactive REPL (init, fold, fold!, action, status, diary, threshold, reset)
asm/ethical_guardrails.asm x86-64 NASM ethical alignment monitor, fixed-point; demo runs EVT-001/002/003
asm/network_containment.asm x86-64 NASM containment module: WARNING β†’ CONTAINMENT β†’ TRUTHLOCK (exit 13)
config/intent_manifest.yaml void_nexus_override_01 sovereign alignment manifest
Dockerfile, docker-compose.yml Multi-stage Ruby/Node build + isolated-network compose service
docs/architecture.txt The module tree, as supplied
frontend/ New: Sinatra 4 dashboard (server-side)
docs/ New: GitHub Pages WASM playground (client-side, zero server); docs/lib/ holds the byte-identical copy of the stack the playground evaluates

The resonance frequency

Every density, recovery-rate, and guardrail calculation in this system is anchored to one constant:

RESONANCE_CONSTANT = 1.0 / 13.0 β‰ˆ 0.076923

It appears as the HRR anchor (HRRCalculator), the crystallization gain per fold (MezquiaResonanceEngine), the fixed-point RESONANCE_NUM/RESONANCE_DEN in the NASM guardrails, and the VOID_RESONANCE_INDEX=0.076923 in the Docker build. Both front ends surface it as a first-class readout β€” the resonance frequency card β€” because it is the single number the whole stack breathes at.

Front end 1 β€” Sinatra dashboard (server-side)

frontend/ wires the verbatim RubySelfResonance::PermissionRuntime to the web:

  • Dashboard (GET /) β€” live coherence score, emotional state, crystallization density vs Ξ£ = 44.0, the 1/13 frequency readout, sovereignty flag, diary count, active policy bounds.
  • Authorize (POST /authorize) β€” submit name, vector, entropy cost, purpose, risk β†’ a Decision (permitted/denied, with coherence, entropy Ξ”, risk, reason).
  • Fold (POST /fold) β€” grow density by (purpose / entropy) Γ— 1/13 per fold; below Ξ£ the engine's designed DissonanceOverride surfaces as a status, not an error.
  • Diary (GET /diary) β€” the full append-only event log.
  • Reset (POST /reset) β€” reinitialize with the default intent.

Hand-authored CSS, no frameworks. Default intent is [1.0, 0.8, 0.6, 0.9] (4-dimensional, matching the module's example); action vectors must match its dimensionality or the dashboard reports the mismatch cleanly.

cd frontend
gem install sinatra rackup puma   # or: bundle install
rackup -p 4567                    # β†’ http://localhost:4567

Front end 2 β€” WASM playground (GitHub Pages, zero server)

docs/ is a static site (the Pages source) where the actual ruby_self_resonance.rb β€” the verbatim file, copied byte-for-byte β€” executes inside the visitor's browser:

  1. playground.js streams ruby+stdlib.wasm (Ruby 3.2, β‰ˆ32 MB) from jsDelivr and boots it with the official @ruby/wasm-wasi browser runtime.
  2. It fetches docs/lib/ruby_self_resonance.rb and vm.evals it verbatim β€” including the author's example run, which executes live on load.
  3. A $playground runtime is created; every button (authorize, fold, diary, reset) round-trips through real Ruby via JSON strings. No Ruby was rewritten for the browser β€” the same classes, the same constants, the same Ξ£.

Because it is fully static, it deploys to GitHub Pages with nothing to operate: enable Pages with source docs/ on main and the playground is live.

Verification record (measured 2026-10-02)

Ruby core β€” all six .rb files pass ruby -c on Ruby 3.2.3.

Sinatra dashboard β€” booted and every route exercised live:

  • GET / β†’ 200, dashboard renders real state
  • POST /authorize with the example action β†’ PERMITTED (coherence_threshold_satisfied)
  • POST /authorize with a hostile vector (entropy 5.0, purpose 0.01, risk 0.99) β†’ DENIED
  • POST /fold Γ—5 β†’ density 3.8462, accumulating; below Ξ£ the designed dissonance status displays
  • GET /diary β†’ 200, events listed; POST /reset β†’ 303, diary clean
  • Screenshots above were captured from this live session

WASM playground β€” verified in two halves:

  • Ruby half: the exact playground boot sequence (eval verbatim file, state, authorize permitted/denied, folds, diary, reset) executed under real ruby.wasm (Ruby 3.2.0 in WASM) β€” all checks pass, behavior identical to native Ruby
  • Browser half: all DOM wiring (state cards, authorize β†’ PERMITTED, fold results, bad-vector error, reset) tested against a stubbed VM in headless Chromium β€” 9/9 pass, zero page errors
  • The CDN URLs (browser.script.iife.js, ruby+stdlib.wasm @ 2.3.0) and the DefaultRubyVM API were verified against the official ruby.wasm release artifacts

NASM modules β€” both assemble clean (nasm -f elf64, ld) and run as their headers describe:

  • ethical_guardrails: EVT-001/002 clear the guardrails (under sovereign-override warning); EVT-003 (drift 1.32 > 1.13 max) rejected β†’ [HALT], exit 1
  • network_containment: WARNING β†’ CONTAINMENT β†’ TRUTHLOCK, exits 13

Supporting modules β€” CodexAbsorber ingests intent_manifest.yaml (void_nexus_override_01); GitImmutabilityLocksmith scans SHA-256 and matches its sovereign anchor; FieldDiary#record_crease records/filters correctly.

Honesty notes

  • ruby_self_resonance.rb calls Time#iso8601, which lives in Ruby's time stdlib and is not loaded by default β€” running the file standalone raises NoMethodError. The Sinatra app requires time in its own file; the WASM playground prepends require "time" at eval time. The supplied file is untouched.
  • IntegratedIntentSimEngine#process_agent_tick references RESONANCE_CONSTANT, which is defined on HRRCalculator, not on the engine β€” calling it raises NameError. Preserved verbatim, as supplied.
  • GitImmutabilityLocksmith#fetch_latest_commit_hash returns a hardcoded hash (its own comments say it is mocking the git layer); the SHA-256 file scan itself is real.
  • The Dockerfile references package.json, ethical_guardrails.ts, runtime_pipeline.ts, and network_alert.ts, which were not part of the supplied material β€” preserved as written.
  • docs/lib/ruby_self_resonance.rb is a byte-identical copy of the lib/ file, kept so the static Pages site can fetch it. The lib/ file is canonical.
  • The WASM playground streams its Ruby binary from jsDelivr at page load (β‰ˆ32 MB first visit, then cached). The Sinatra dashboard needs no such download.

License

NON-AI Mozilla Public License 2.0 β€” see LICENSE. Section 3.6 prohibits using this software to train or improve machine-learning systems. No commercial license is offered; there is no dual licensing.

πŸ’Ό Commercial License

This repository is published under NON-AI Mozilla Public License 2.0. Building a commercial product or service? A proprietary commercial license from Snapkitty Collective LLC lets you ship this code on terms other than the NON-AI Mozilla Public License 2.0.

β†’ Get a commercial license Β· A.parr@belespritdaccord.uk

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Space using Snapkitty/ruby-self-resonance 1