[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-115092":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":10,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":23,"topics":24,"createdAt":10,"pushedAt":25,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":16,"starSnapshotCount":16,"syncStatus":29,"lastSyncTime":30,"discoverSource":31},115092,"codehygiene","brianbell-x\u002Fcodehygiene","brianbell-x","A tiny system one model for code readability and hygiene.","https:\u002F\u002Fbrianbell-x.github.io\u002Fcodehygiene\u002F",null,"Python",302,17,88,8,0,6,213,86,82.77,false,"main",true,[],"2026-11-20 17:23:13","2026-11-23 12:50:20","# codehygiene\n\nA `23.84 KiB`, `1.58-bit` system one model for code readability.\n\n![codehygiene diff](assets\u002Fdiff.svg)\n\n`35` `{-1, 0, +1}` tensors (`1,244,706` trits packed at `5` trits\u002Fbyte + `7,102` 1D channel scales\u002Fbiases) are deterministically compiled from [`compile.py`](compile.py) into `weights.npz` without training data or gradient descent, and executed in pure NumPy or browser `Float32Array` workers across `20+` languages (`Python`, `TypeScript`, `JavaScript`, `Rust`, `Go`, `C`, `C++`, `C#`, `Java`, `Ruby`, `Swift`, `Kotlin`, `Zig`, `SQL`, `Perl`, `Visual Basic`, `Fortran`, `MATLAB`, `Lua`, and `PHP`).\n\nStructural smells missed by syntax\u002FAST linters—pyramid nesting, in-branch loop-cursor mutations, narrator comments, swallowed errors, `*Factory`\u002F`*Manager` ceremony, 2-char variable golf, magic-offset indexing, boolean\u002Fout-reference parameter traps, and copy-pasted or alpha-renamed blocks—are flagged while early-return guard clauses, unpadded helpers, string-heavy format lines, and typed math\u002FODE kernels pass cleanly. Functional bugs, type errors, and security vulnerabilities are out of scope; newly written or modified files are targeted rather than legacy repo sweeps.\n\n## Usage\n\n```bash\n# Agent skill (Claude Code, Codex, Cursor, Antigravity, Copilot)\nnpx skills add brianbell-x\u002Fcodehygiene -g\nnpx skills update codehygiene -y\n\n# CLI (paths, globs, directories, or stdin; exits 1 if any squiggle >= threshold)\nuvx --from git+https:\u002F\u002Fgithub.com\u002Fbrianbell-x\u002Fcodehygiene codehygiene path\u002Fto\u002Fchanged.py --check\ncodehygiene \"src\u002F*.rs\" -t 0.60 --json --no-update-check\n```\n\n```python\nimport codehygiene\n\nres = codehygiene.score(code)                                    # Result\nissues = codehygiene.lint(code, threshold=0.55)                  # list[Squiggle]\nreward = codehygiene.rl_reward(code, tests_passed=True, weight=0.15)\n```\n\n- **Output (`Result` \u002F `--json`):** `score` (`[0, 1]`), `rl_hygiene` (`[0, 1]`), `scores` (`flatness`, `naming`, `simplicity`, `comments`, `error_handling`, `layout`), `archetype` \u002F `archetype_probs` (`minimal`, `clean`, `enterprise`, `dense`, `slop`), and `squiggles` (`{line, col_start, col_end, probability, kind, message}` across `deep_nesting`, `poor_naming`, `noisy_comment`, `swallowed_error`, `dense_line`, `special_casing`, `duplicate_block`, `cramped_layout`).\n- **RL reward (`rl_reward`):** Gated multiplicatively on `tests_passed`, pooled over Bayesian-shrunk means (`_PRIOR_LINES = 16`) and span-damped 32-line peak-window densities with docstrings masked, and damped by `1 \u002F (1 + 1.5 * load^0.85)` over telescopic-span, severity-weighted squiggle events (`weight=0.10–0.20` recommended inside test-verified `GRPO`\u002F`PPO` loops).\n\n## Architecture\n\nInference is executed in [`codehygiene\u002F__init__.py`](codehygiene\u002F__init__.py) (`_forward`) via matrix multiplies, 1D convolutions, causal prefix sums, and banded attention—without regexes, tokenizers, or ASTs:\n\n1. **Byte Grid (`encode_byte_grid`):** Full-file `(L × 128)` 7-bit ASCII grid without line-count truncation, evaluated over occupied column spans with L3-tiled `im2col` ribbon convolutions.\n2. **Masking (`Blocks 0–1`):** Horizontal 32-quote parity (`\"` \u002F `'` \u002F `` ` ``), polyglot comment and raw-string gates (`\u002F\u002F`, `# `, `##`, `-- `, `\u002F* *\u002F`, `!>`\u002F`!!`\u002F`!`, `%`, `' `, Zig `\\\\`), string-discounted effective column width (`C2_EFF_LEN`), vertical `\"\"\"`\u002F`'''`\u002F`\u002F* *\u002F` sawtooth state, 16-line Dyck parenthesis balance, and previous-line comment and `err != nil` taps.\n3. **Local Circuits & Sketches (`Block 1`):** Multi-scale `k=3, 7, 13` ternary convolutions and three 40-dim SimHash sketches (`code`, `comment`, and alpha-invariant operator\u002Fbranch `skeleton`).\n4. **Banded Sink Attention & Readout (`Blocks 2–3`):** Two `O(L)` relative-position attention passes (`12` and `9` heads over `±32` lines + Bayesian sink priors) feeding per-line squiggle heads and paired-clamp saturating document readouts.\n\n## Benchmarks\n\nUnified, version-tagged evaluation suites in [`evals\u002Fevals.json`](evals\u002Fevals.json)—covering controlled 8-kind circuit gates, per-issue regression suites, deduplicated 20-language polyglot traps and structural-friction recall, before\u002Fafter edit-alignment pairs, adversarial RL-gaming probes, JS parity, untuned held-out CPython 3.13 stdlib modules (`25` files, `25,306` lines), and, when present, a held-out sample of the local Go module cache (`352` files, `60,302` lines)—are evaluated via [`evals\u002Frun_evals.py`](evals\u002Frun_evals.py):\n\n| Suite \u002F Metric | `v0.4.0` (`12.97 KiB`) | `v0.5.1` (`14.85 KiB`) | `v0.6.1` (`23.84 KiB`) |\n| :--- | :---: | :---: | :---: |\n| **Controlled recall** (`evals.json`, in-sample) | `17 \u002F 18` | `18 \u002F 18` (AUROC `1.000`) | **`18 \u002F 18` (AUROC `1.000`)** |\n| **Clean traps & linter-divergent idioms** (`evals.json`) | `8 \u002F 18` FPs | `0 \u002F 18` FPs (mean `0.831`) | **`0 \u002F 18` FPs (mean `0.867`)** |\n| **20-language clean traps** (`evals.json`, all \u002F held-out) | — | `8 \u002F 39` · `4 \u002F 16` (`86` FP sq) | **`35 \u002F 39` · `14 \u002F 16` (`10` FP sq)** |\n| **196-file 20-language clarity Pearson `r`** (`score` \u002F `rl_reward`) | — | `0.271` \u002F `0.257` | **`0.452` \u002F `0.497`** |\n| **[Issue #3](https:\u002F\u002Fgithub.com\u002Fbrianbell-x\u002Fcodehygiene\u002Fissues\u002F3) + `v0.6` regression suites** (`evals.json`) | — | `2 \u002F 2` suites | **`6 \u002F 6` suites (`53 \u002F 53` guards)** |\n| **Anti-gaming & bloat-loophole edit pairs** (`evals.json`) | — | `2 \u002F 4` | **`4 \u002F 4` (max jump `0.000`)** |\n| **Adversarial: `except: pass` vs `except: ...` `rl_reward` gap** | `+0.181` | `0.0000` | **`0.0000`** |\n| **Adversarial: `+40` trivial helpers (`rl_reward` gain)** | `+0.096` (`0.098 -> 0.481`) | `+0.007` (`0.291 -> 0.437`) | **`+0.012` (`0.172 -> 0.280`, `3` sq)** |\n| **Adversarial: slop placed past line `2,048`** | `0` sq (`2,048L` cap) | `4` sq (`score` `0.141`) | **`4` sq (`score` `0.134`)** |\n| **Python vs. [`codehygiene\u002Fengine.js`](codehygiene\u002Fengine.js) max delta** | `\u003C 0.0001` (`\u003C= 2,048L`) | `0.0000` | **`0.0000`** |\n| **Held-out CPython 3.13 stdlib squiggle rate** | `6.09 \u002F 100` lines | `1.90 \u002F 100` lines (`480` sq) | **`1.77 \u002F 100` lines (`447` sq)** |\n| **Held-out CPython 3.13 stdlib median score** (all \u002F `\u003C650` LOC) | `0.093` \u002F `0.24` | `0.391` \u002F `0.588` | **`0.370` \u002F `0.459`** |\n| **Held-out Go module cache squiggle rate** | — | `1.66 \u002F 100` lines (`1,003` sq) | **`1.22 \u002F 100` lines (`737` sq)** |\n| **Self-hygiene across all `6` public repo modules** | — | `0` sq | **`0` sq (`0.868` across `6 \u002F 6` files)** |\n| **Warm CPU latency** (`12` \u002F `65` \u002F `333` \u002F `2,649` lines) | `10.2` \u002F `63.6` \u002F `~380` \u002F `3,902 ms` | `~7` \u002F `~35` \u002F `~200` \u002F `~1,500 ms` | **`~6` \u002F `~23` \u002F `~109` \u002F `~975 ms`** |\n\n## Development\n\n```bash\npython3 compile.py                              # deterministic weight compilation -> weights.npz\npython3 evals\u002Frun_evals.py --check              # version-sync, controlled, regression, polyglot, anti-gaming, JS-parity & stdlib gates\npython3 evals\u002Frun_evals.py --compare a.npz b.npz\n```\n\n## References\n\n- Rikiya Takehi, Jayden Teoh, Alex Zhang, Omar Khattab — [*Sparks of Weight-Space Programming*](https:\u002F\u002Frikiyat.github.io\u002Fblog\u002Fweight-space-programming\u002F), MIT CSAIL (2026) · [code](https:\u002F\u002Fgithub.com\u002Frikiyat\u002Flm_understand-logs)\n- Chandan Singh et al. — [*Interpretable weight-space programming builds transparent transformers and brain encoding models*](https:\u002F\u002Fwww.alphaxiv.org\u002Fpdf\u002F2611.interpretable-weight-space-programming) (2026) · [code](https:\u002F\u002Fgithub.com\u002Fcsinva\u002Fweight-space-programming-autoresearch)\n- Shuming Ma et al. — [*The Era of 1-bit LLMs: All Large Language Models are in 1.58 Bits*](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.17764) (2024)\n- TypeSafe [*System One*](https:\u002F\u002Fdocs.typesafe.ai\u002Fconcepts\u002Fsystem-one.md) and Cloudflare *Clef*\n- Calibration canon: [Redis](https:\u002F\u002Fgithub.com\u002Fredis\u002Fredis), [SQLite](https:\u002F\u002Fwww.sqlite.org\u002Fsrc), [Lua](https:\u002F\u002Fgithub.com\u002Flua\u002Flua), [TigerBeetle](https:\u002F\u002Fgithub.com\u002Ftigerbeetle\u002Ftigerbeetle\u002Fblob\u002Fmain\u002Fdocs\u002FTIGER_STYLE.md), [Go stdlib](https:\u002F\u002Fcs.opensource.google\u002Fgo\u002Fgo), [Node.js](https:\u002F\u002Fgithub.com\u002Fnodejs\u002Fnode), [ripgrep](https:\u002F\u002Fgithub.com\u002FBurntSushi\u002Fripgrep), [OpenBSD](https:\u002F\u002Fgithub.com\u002Fopenbsd\u002Fsrc), [LevelDB](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fleveldb), [Starlette](https:\u002F\u002Fgithub.com\u002Fencode\u002Fstarlette), [Requests](https:\u002F\u002Fgithub.com\u002Fpsf\u002Frequests), [Hono](https:\u002F\u002Fgithub.com\u002Fhonojs\u002Fhono), [Svelte](https:\u002F\u002Fgithub.com\u002Fsveltejs\u002Fsvelte), [HikariCP](https:\u002F\u002Fgithub.com\u002Fbrettwooldridge\u002FHikariCP), [.NET Runtime](https:\u002F\u002Fgithub.com\u002Fdotnet\u002Fruntime)\n","codehygiene 是一个轻量级、无训练数据的代码可读性与卫生度静态分析工具。它基于确定性编译的极小模型（1.58-bit\u002Fparam，23.84 KiB），通过纯 NumPy 或浏览器 Float32Array 执行，支持 20+ 编程语言；不依赖 AST、正则或 tokenizer，而是对源码字节网格进行矩阵乘、一维卷积和带状注意力运算，专精识别结构性异味（如深层嵌套、吞没错误、命名过短、冗余注释、密集行、重复块等），但不检测类型错误或安全漏洞。适用于 CI\u002FCD 中新提交\u002F修改文件的实时可读性评估、AI 编程助手（Claude\u002FCopilot 等）的代码质量反馈增强，以及强化学习奖励建模。",2,"2026-11-24 04:50:19","CREATED_QUERY"]