{"slug": "a-little-robot-for-your-website-with-a-brain-of-his-own", "title": "A little robot for your website, with a brain of his own", "summary": "Developer Erdem Ozkan released BoxNib v0.1.1, an embeddable website robot whose behavior is driven by \"Nib,\" a neural network of 6,839 numbers that runs entirely in the visitor's browser with no runtime downloads or data sent anywhere. Nib was trained by imitation on 40,000 made-up page situations and matches its rule-based teacher's chosen move 92% of the time on unseen situations, running on WebGPU when available and falling back to the CPU otherwise. The library ships as a single 108 KB file (55 KB gzipped) with five skins, configurable colors and content lines, shadow-DOM-isolated styles, and a CSP-friendly data-attribute mode that needs no 'unsafe-inline' or 'unsafe-eval'.", "body_md": "A little robot for your website, with a brain of his own.\n\n**Box** walks along the bottom of your page. He looks at your headings, reads along when someone selects\ntext, waves when the cursor comes close, jumps when you click him, and nods off when your visitor goes quiet\nto read.\n\n**Nib** is the brain that decides all that. It's a tiny neural network of 6,839 numbers, and it runs right in\nyour visitor's browser. Nothing is downloaded at run time, and nothing is sent anywhere.\n\nHe comes in five bodies, all driven by the same brain:\n\nPut these two lines just before `</body>`:\n\n```\n<script src=\"https://cdn.jsdelivr.net/gh/erdemozkan/boxnib@v0.1.1/dist/boxnib.min.js\"\n        integrity=\"sha384-daVl2Ssb2hqKy1rzY9t5ZrNpynnGqH8l/RGMBbDbacyMSUM8EaXwsUZiQKzNgsze\" crossorigin=\"anonymous\"></script>\n<script>BoxNib.start()</script>\n```\n\nThat's it. Refresh the page and say hello.\n\nThe `integrity` hash makes the browser refuse the file if it ever changes, so pin it together with the version.\n\nRather host it yourself? Download [`dist/boxnib.min.js`](https://github.com/erdemozkan/boxnib/blob/main/dist/boxnib.min.js) and point the `src` at your copy.\nIt's one file of 108 KB (55 KB gzipped) with the brain inside.\n\nPick a body and give him your site's colours:\n\n```\nBoxNib.start({\n  skin: 'pixel',          // box, pixel, wire, doodle or puppet\n  ink: '#f1efe8',         // outlines and text\n  paper: '#1d2027',       // fills\n  accent: '#ffb02e'       // eyes, lights, highlights\n});\n```\n\nTeach him a few lines about your own content:\n\n```\nBoxNib.start({\n  lines: { greet: ['Welcome to the shop!', 'Hi! {name} here.'] },\n  about: [\n    ['pricing', ['Free! Well, nearly.']],\n    [/bread|sourdough/i, ['I can almost smell it.']]\n  ]\n});\n```\n\nKeep him inside one part of the page, like a hero banner:\n\n```\nBoxNib.create({ container: '#hero', skin: 'wire' });\n```\n\nIf your site has a strict Content-Security-Policy, skip the second script tag and set the options on the first one:\n\n```\n<script src=\"boxnib.min.js\" data-boxnib data-skin=\"doodle\" data-accent=\"#0e7a5a\"></script>\n```\n\nHe needs no `'unsafe-inline'`, no `'unsafe-eval'` and no network access. His styles live in his own shadow\nroot, so your CSS can't break him and his can't leak onto your page.\n\n| Option | What it does | \n|---|---|\n| `size: 80` | Make him smaller or bigger (height in pixels) | \n| `bottom: 60` | Lift him above a cookie bar or bottom menu | \n| `mind: 'nib'` | Use the brain without the memory (or `'random'` for plain dice) | \n| `memory: false` | Never remember anything about the visitor | \n| `storage: false` | Never write anything to the visitor's device | \n| `annotate: false` | Hide the name tags and the \"what I'm thinking\" labels | \n| `zIndex: 50` | Put him behind something (the default is 1000) | \n\nThere are plenty more, plus the full API, in **[docs/OPTIONS.md](https://github.com/erdemozkan/boxnib/blob/main/docs/OPTIONS.md)**.\n\nNib is two tiny networks. The first takes 60 numbers describing the moment (where Box is, where the cursor is, what's on screen, what he did last) and picks a move: walk, look, talk, wave, jump, idle or doze. The second scores each thing on screen to decide what he looks at.\n\nThey were trained by watching a teacher. I wrote a page of plain rules for how a charming robot should behave, ran it on 40,000 made-up page situations, and had Nib learn to copy it. On situations it had never seen, Nib picks the same move as the teacher 92% of the time.\n\nIn the browser it runs on the graphics card with WebGPU when it can, and on the processor when it can't.\nClick the coloured **mind** tag above his head to see what he chose and how sure he was.\n\nNib HD gives Box a memory. Every moment becomes a pattern of 10,240 bits, and similar moments make similar patterns. When a visitor reacts well to something (comes closer, clicks him, clicks what he pointed at), he remembers. Next time a moment feels familiar, he leans towards what worked. He also notices what people click and select, and points out related things.\n\nIt's all stored in the visitor's own browser. They can wipe it any time: click the mind tag and press\n**Forget me**.\n\n- No network requests, cookies or analytics. The brain ships inside the script.\n- The memory stays in the visitor's localStorage, and never leaves it.\n- Use `memory: false` or`storage: false` if you'd rather he remembered nothing. If your visitors are in the\nEU or UK, that's worth thinking about until they've agreed to non-essential storage.\n\nClone the repo, run `python3 -m http.server`, and open [http://localhost:8000/examples/](http://localhost:8000/examples/). You'll find:\n\n- a plain page\n- a styled dark page\n- a robot in a box\n- a strict-CSP page\n- an ES module version\n- the whole lineup\n\nHe's happy on phones too.\n\nYou don't have to. But if you'd like Box to behave differently, change the rules in `training/train.py`, then:\n\n```\npython3 training/train.py          # about a minute; needs numpy\nnode build.mjs                     # rebuilds dist/\nnode training/check_parity.mjs     # makes sure JavaScript and Python agree\n```\n\nYou only need Node 22 or newer. There are no npm packages to install.\n\n```\nnode build.mjs           # builds dist/\nnode test/browser.mjs    # opens every example in headless Chrome and checks for errors\n```\n\nMIT. Do what you like with him; just keep the [licence](https://github.com/erdemozkan/boxnib/blob/main/LICENSE) with it.", "url": "https://wpnews.pro/news/a-little-robot-for-your-website-with-a-brain-of-his-own", "canonical_source": "https://github.com/erdemozkan/boxnib", "published_at": "2026-11-30 08:14:53+00:00", "updated_at": "2026-11-30 08:45:43.673595+00:00", "lang": "en", "topics": ["artificial-intelligence", "machine-learning", "neural-networks", "ai-tools", "developer-tools"], "entities": ["BoxNib", "Nib", "Erdem Ozkan", "WebGPU", "jsDelivr"], "also_reported_by": [], "takeaway": "BoxNib v0.1.1 ships a 6,839-parameter Nib network in a single 108 KB (55 KB gzipped) script that runs client-side on WebGPU with a CPU fallback and matches its teacher's move 92% of the time on unseen page situations.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/a-little-robot-for-your-website-with-a-brain-of-his-own", "markdown": "https://wpnews.pro/news/a-little-robot-for-your-website-with-a-brain-of-his-own.md", "text": "https://wpnews.pro/news/a-little-robot-for-your-website-with-a-brain-of-his-own.txt", "jsonld": "https://wpnews.pro/news/a-little-robot-for-your-website-with-a-brain-of-his-own.jsonld"}}