Skip to content

Instantly share code, notes, and snippets.

View chadbrewbaker's full-sized avatar

Chad Brewbaker chadbrewbaker

View GitHub Profile
@chadbrewbaker
chadbrewbaker / Polish_gravity.md
Created July 31, 2026 19:33
Fable applying some taint analysis research to OpenWave grounding

Grounding Exercise: M5 Gravity — GW170817 Gate + Poland Fiber Program

Cell under grounding: FORCES / Gravity / Liquid Crystal (M5) in MODELS.md. Current status: ⚠️ — coupling mechanism measured (GEM ∝ (b·g)², zero at zero boost, m5_8_2q_delta_scaling.py), dynamical metric not implemented; the de Broglie clock sector IS implemented and validated. This document: the GW170817 radiative gate (§0–6), the terrestrial extension — desk gates on existing data plus the Poland fiber experiments (§7–10) — and the priority logic that orders them by how much model-unknown each uniquely grounds.

@chadbrewbaker
chadbrewbaker / marx.md
Created July 24, 2026 23:07
Marx species typecheck

The Manifesto Does Not Typecheck

A Reading of Marx and Engels (1848) in the Category of Combinatorial Species

with an appendix of compiler diagnostics and the author's marginalia


Abstract

@chadbrewbaker
chadbrewbaker / sims_analysis.md
Created July 24, 2026 17:00
Proofs of SIMD performance

Chapter N — Certified Resource Bounds for a UTF-8 Transcoder

Draft chapter in thesis register. Numbers measured on a single VM (Xeon 2.80 GHz, 1 core, 4 GB, GCC -O2); every claim is labelled proved, measured, or conjectured. Citation keys marked [verify] should be checked against the published record before submission.


@chadbrewbaker
chadbrewbaker / perm.md
Created July 18, 2026 19:39
Fable solution for a SIMD permutation problem.

Segment-wise SIMD shuffle under a variable permutation

Problem. Given a 64-byte vector v (one cache line, one zmm), a 64-bit boundary mask m (bit i set ⇔ a segment starts at byte i; bit 0 always set; k = popcount(m) segments), and a variable permutation π of {0..k-1}: produce the segments of v concatenated in the order π[0], π[1], …, π[k-1]. Both m and π vary per call — nothing can be precompiled into shuffle constants.

Hardware. Intel Xeon, family 6 model 207 = Emerald Rapids

@chadbrewbaker
chadbrewbaker / okasaki_sqlite.py
Created July 16, 2026 21:25
Okasaki style time traveling database experiment.
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.11"
# dependencies = []
# ///
"""Time travel: SQLite patterns vs Okasaki-style persistence. Value-checked.
Three ways to get "query the table AS OF transaction T":
SQLITE-AUDIT history table kvh(k, tx, v) PK(k, tx DESC), in-memory,
@chadbrewbaker
chadbrewbaker / oracle.md
Created June 8, 2026 15:51
Computational Depth Oracle Questions (ChatGPT prompted w Fortnow depth publication and P = NC literature

Oracle 1: Perfect Retrieval Suppose an oracle answers every factual question instantly. The model never forgets anything. Question: Does theorem proving become easy? If not, then factual knowledge wasn't the issue. This separates memory from reasoning. Oracle 2: Perfect Search Suppose an oracle instantly returns the best next action among all possibilities. Question:

@chadbrewbaker
chadbrewbaker / retardmaxx_muon.py
Created June 6, 2026 03:10
Retardmaxxing the Muon optimizer
import torch
import torch.nn as nn
from tqdm import tqdm
# --- CONFIG ---
DIM = 2048
BLOCK_SIZE = 16
LR = 0.01
ITERATIONS = 100
@chadbrewbaker
chadbrewbaker / run_gemma.sh
Created June 3, 2026 19:18
Gemma 12B llama.cpp settings
./llama-server \
-m gemma-4-12B-it-Q4_K_M.gguf \ # Target model
-md gemma-4-12B-it-assistant-Q5_K_M.gguf \ # MTP drafter (small ~0.4B)
--spec-type draft-mtp \ # Enable MTP speculative decoding
--spec-draft-n-max 4 \ # Typically 3-5 for Gemma 4 MTP (experiment)
--spec-draft-n-min 1 \
-c 131072 \ # Context (try 262144 if you have memory)
--cache-type-k q4_0 \ # 4-bit KV cache
--cache-type-v q4_0 \
-ngl 99 \ # Offload all layers to GPU
@chadbrewbaker
chadbrewbaker / README.md
Created May 25, 2026 18:23
Simple Hermes Agent profiler to diagnose API call hangs
uv run profile.py ~/.hermes/logs/agent.log
@chadbrewbaker
chadbrewbaker / interaction.c
Created May 3, 2026 20:01
Interaction calculus in C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Raw dog Interaction Calculus demo in C
// Demonstrates superpositions (SUP), lambdas, apps, global scoping via env
// Uses function pointers for reduction rules and term kinds
typedef enum {
TERM_VAR,