Latest Posts (20 found)

How I fixed 55 bugs in a week by making my monorepo more agent-friendly

Hey, what's up? It's Takuya here. This week, I restructured my app 's monorepo so that my coding agents copy good patterns instead of bad ones. Along the way, about 55 bugs turned up and got fixed, and all of them were written by me, by hand. In this article, I'd like to share what inspired me, what I changed, and what I learned about working with agents. In the last article , I moved 39 repositories into a monorepo to boost my agentic coding. It has been working pretty well so far. I usually focus on one app at a time, like the desktop app or the mobile app. So when I switched to another app, I always found a lot of stale module versions that I had to upgrade. That was annoying. Now, when I update a module, my agent updates the other apps in the same change. The monorepo works as a restriction that forces every app to stay up to date, which is great. It also aligned my toolchain with the common tools, like Oxlint instead of ESLint and Vitest instead of Jest. With everything in one place, I found more outdated setups and strange mismatches between the packages. Still, reviewing the code that AI generated was taking a lot of my time. My agents kept making the same missteps. They inserted comments justifying their changes, which were boring and useless. They often patched the wrong files just to reach the goal. In other words, they went with local minimum solutions instead of thinking broadly over the whole project structure. I tried writing more rules for my agents, but it didn't solve these issues. I didn't know what else to do. Then, this week, I watched a talk by Lauren Tan (poteto): All Code is Slop Except Mine . What a spicy title. It was so insightful, and it gave me so many ideas to improve my repository. She said she shipped 3,000 pull requests to production in a month. I don't know if I can reach that level, but I was sure her ideas would help with my problems. Her key point is that your codebase is one of the largest inputs for agents, so it works as their memory. If the codebase has a bad pattern, the next agent will replicate it, because it looks like the established pattern. Code arrives so fast now that it grows like something organic, and she calls this "organic architecture". I totally agree with her. So, whenever you correct your agent, she suggests making it a deterministic check, like a lint rule, instead of adding another line to your rules or your AGENTS.md. By the way, last week, I got Claude Ultra free for six months from Anthropic's Claude for Open Source program , thanks to my OSS activity. It let me fully use Fable instead of Opus without worrying about the token allowance. It was the perfect timing to try her principles. First, I restructured the directories, because directory structure is a form of context. I myself read a directory name as the scope or the role of the code in it, so I have no doubt that AI agents read it that way, too. Her principle is to group code by features and layers. Categories like "utils" or "modules" are bad groupings. I fixed two things. First, who may import what: The main process and the renderer can no longer import each other, and lint reports it if they do. Every IPC channel is now typed against a shared contract, and only the main process writes the config file. Second, the layout of the desktop app. Before, the code was grouped by kind: After, it's grouped by feature: Each feature folder holds its components, hooks, actions, reducer, command handlers and tests, and the rest of the app imports it only through its . I did the same on the mobile app and the web editor, so the three apps share one shape. While restructuring, I found many illegal imports that crossed the boundaries. This was a bad pattern I had made, and now it's fixed. The structure is also easier for me to understand. Agents write massive amounts of code rapidly, and it's hard to keep track of it. Now, I can quickly find where to look when I review. My apps have a lot of IPC, between the main process and the renderer, and between the host app and the web view, which is complicated. With the feature folders, I no longer have to look here and there and miss the point. While working on it, I realized that I had been working just like my agents. I don't know if that's a good thing or a bad thing. When I started Inkdrop, I forked the Atom editor , so I already had a bunch of code and files. It was the first time I built an Electron app, and I didn't know the patterns. So I blindly followed Atom's directory structure and coding patterns, assuming they were the best practices. That worked pretty well, and I replicated so many patterns from it. But as the app grew, those patterns no longer fit its architecture and feature set. One directory ended up with hundreds of flat files, many of them with the suffix. That hid the scope and the role of the code, for me and for agents too. I did with Atom's code exactly what my agents do with mine: I followed whatever pattern was already there, without asking whether it still fit. Now I understand why agents work this way, because I did the same. And it was time to update my own principles for designing a codebase. I'm glad I learned that from this work. Strict lint rules are one of the crucial guardrails for agents, because they prohibit bad patterns deterministically. I personally trust the taste of Christoph Nakazawa , the creator of Jest, Yarn and Metro, who has been producing great output and contributing to projects at VoidZero. He recently published a new version of his oxlint config, @nkzw/oxlint-config . It's aimed at anti-slop: its rules are strict, so agents can't make silly mistakes, and it also cares about performance. Adopting it required a lot of changes, and I haven't finished yet. It reported 11,589 findings in 2,422 files at the start: But it already paid off a lot. alone found 18 real bugs, like hooks called after an early return or inside a loop. These rules forced me and my agents to revisit the current design and flow. Refactoring business logic with agents to satisfy new lint rules made me worried about regressions, since I can't fully trust them yet. I hadn't been writing unit tests except for the critical parts, like the data store and authentication, simply because it was economically impossible for a solo developer like me. But now, agents write code instead of me at a drastically fast speed. It's almost like managing a team at a company, back in the before-AI era. This scale can't be managed without thorough unit tests for every module, including the UI components. For example, requires every dependency of a to be listed. Adding one changes when the effect runs, so before each fix, my agents wrote component tests against the old code. None of these projects had component tests before: Writing those tests found far more bugs than the rule itself. About 55 are fixed so far, each with a test that failed first. For example, the editor's search bar subscribed on every effect run and never unsubscribed, so a single "find next" jumped over several matches. These bugs were all written by me, by hand. I expect this work to find more bugs before it's finished: 13 bugs on mobile are already pinned by tests and waiting for fixes. It feels good. Not everything went smoothly, though. poteto said in another talk : "It's not really a secret. It's a lot of hard work." That held for me. The new structure and boundaries made my codebase something I'm happy for an agent to copy, and the stricter lint rules turned out to be a bug finder, because they forced tests into code that never had any. I learned that I should doubt my codebase and my lint rules before adding another rule for my agents. As a next step, I'm eager to add more runtime verification. I think the engineering task for us humans has changed: from improving code by hand to building high trust with agents through tools and design. If your agents keep making the same mistakes, I hope this helps you look at your codebase first. That's it! Thanks for reading. My agents kept taking the nearest fix, and writing more rules for them didn't help. The codebase is the agent's memory: agents copy whatever pattern is already there. Directory structure is context, so I grouped the code by feature and made lint enforce the boundaries. I had been blindly following existing patterns too, just like agents do. Strict lint rules stop bad patterns before I review them. Writing tests before the lint fixes found about 55 bugs, all written by me, by hand. Building high trust with agents is the new engineering work. The automatic fixers are not always safe. renamed to , would have broken the alias in React Native, and rewrote in a file. Mass moves conflict with open branches. Merging into the lint branch after the directory moves gave me 145 conflicts. Require cycles on mobile. Exporting a feature's Redux state from its made the Redux roots load the components, which import the roots back: ten new cycles at launch. I fixed it with a second public file per feature, . Verification lags behind the code. I haven't made a packaged desktop build since the move yet, CI hasn't run the moved tests, and Windows, Linux and the account flows are still unchecked.

0 views

Sharp Tech on Video: Jensen’s Not Coming Back, AI Shopping, The iPhone Duo

Sharp Tech is, for the first time, available on video. You have three ways to consume it: YouTube, Spotify, and here on Stratechery

0 views

Roam Assistant: putting Home Assistant in the motorhome

In October Jen and I bought a 2024 Thor Chateau 22E on a Chevy chassis. It came with a thick binder of manuals for everything bolted inside it. What it didn't come with was any way to know what was going on in there when I wasn't standing in it. At home, Home Assistant runs pretty much everything, and I've gotten spoiled. The RV is a rolling house with its own batteries, water, propane, generator and internet, and from my couch I knew none of it. A few weeks back I was on the Home Assistant Podcast talking about my house and all the stuff I have on there, I may need to make another appearance talking about the RV. So the RV got its own Home Assistant. I named it Roam Assistant , because of course I did. This is the tour, not the how-to. Pretty much every section here is going to get its own post, so consider this the table of contents. Roam Assistant is a Raspberry Pi running Home Assistant OS, sitting on a Geekworm X728 UPS board. If you take one thing from this post, take the UPS. RVs lose 12V power constantly (battery disconnect, shore power swaps, converter hiccups), and a Pi that loses power mid-write is a Pi with a corrupted card. Now it tells me when it's on battery and shuts itself down cleanly if it has to. It's on Tailscale like everything else I own, so I can poke at it from anywhere the RV has internet. I also swapped the Pi's built-in Bluetooth for a USB adapter , because it turns out a lot of this coach talks Bluetooth. SmartyVan also pointed me at GeoLocator, one of his Community Projects . It moves Home Assistant's location based on GPS. The catch: we didn't have GPS. Not until the Winegard integration started reporting one. Now weather, sunrise and sunset, and everything else location-based follows the coach instead of thinking we're still at home. Then it gets nerdy. That same list introduced me to Public Lands , which tells me who manages the land we're parked on: BLM, Forest Service, state or private. Parked in my driveway right now, it reports "Private Land." Correct, and kinda funny. Public Lands got me thinking about campgrounds. I had Claude fork it, scrape every KOA location into a private database, and turn that into a sensor for nearby KOAs and whether we're checked into one. This is the part I didn't plan on, and it might be the most useful thing in the whole build. We downloaded every manual for everything in the coach and saved them to Google Drive. In another project those became a quick-lookup manual for us, so "how do I reset the water heater" is a question, not a binder dig. Then every maintenance interval in those PDFs went into Home Keeper , a maintenance and chore tracker for Home Assistant. Each task has a due date and cites the manual and page number it came from. We bought it used with no service history, so a bunch of those lit up as due on day one. Fun. That one's getting its own post too, because I think anyone who buys a used RV should do this. Every device we've uncovered so far has a full dashboard: chassis, network, power, generator, environment. I'm sure we'll find more hiding in this coach soon. Across the top there's a notification bar for whatever is currently yelling at me. Behind it there are about a dozen automations for the stuff you'd expect: power lost, internet down, things too hot or too cold, door opened, and a Pi that reboots itself if it loses the router. Because "the Pi fell off Wi-Fi and never came back" is the most homelab failure there is. It's janky in the best possible way, and it's built for an audience of one. Big thanks to SmartyVan . A good chunk of this build exists because he showed his work first. If you're into RV or van automation, go subscribe. Do you run Home Assistant in your rig? What did you wire in first, and what do you wish you'd done sooner? And if you've solved RV internet, tell me what you went with. Let me know, I'm curious. More on this soon. The chassis. A WiCAN Pro in the OBD-II port reads the Chevy's engine data over Wi-Fi. Fuel, coolant, chassis battery, odometer, and a pile of oxygen sensor values I will never look at. I got this idea straight from SmartyVan's video , and it worked exactly like he said it would. The internet. The coach came with a Winegard gateway, and there was no Home Assistant integration for it. So Claude and I built one. It exposes way more than I expected, including a GPS fix. I might open source it once I know it's working well. The house side. A few Shelly BLU sensors for temperature, humidity and the side door. One lives in the network cabinet, because a closed cabinet in a parked RV in a SoCal August is how you cook a Pi. The generator. Yes, that one. I wrote a whole post about teaching Home Assistant to read my RV generator without starting it . It's still read-only, on purpose. Power. I'll most likely end up with a Victron setup and ha-victron-mqtt , which sounds awesome and is (you guessed it) also on SmartyVan's Community Projects list. Media in the rig. Jellyfin and Syncthing are already on the Pi. The plan is to sync the handful of shows we actually watch from home so we're not burning data on the road. Internet on the road. Right now the gateway rides on our home Wi-Fi in the driveway. Out there, what should I use? Tether my phone? Turn on the Winegard's LTE? Swap it out for Winegard Starlink setup? I honestly don't know yet. Got any ideas, leave a comment! Safety. A smart CO detector that actually talks to Home Assistant.

0 views

agent-shell 0.98 updates

Another month, another agent-shell update. If you missed the last post, have a look at the 0.87 update . This time around, the most notable changes are around rendering, performance, and bugfixes, sprinkled with new features here and there. As usual, this post showcases highlights, but please check out the full list of changes if you're after the nitty-gritty. agent-shell brings your favorite AI agents to Emacs , keeping you at home: familiar buffers and bindings, no terminal emulation. All powered by ACP, the Agent Client Protocol . DeepSeek Harness joins the family, bringing the total number of supported agents to 24. Start DeepSeek with , or pick it from as usual. Latest Antigravity ships with ACP out of the box, so now runs rather than a separate binary you had to download and unpack. If you're an Antigravity user, install a recent CLI, make sure is on your , and sign in once: Blockquotes improved their display, rendering embedded Markdown ( #942 ). They also joined the TAB navigation party. and now visit blockquotes, stopping on their first quoted character. With point on a blockquote, now copies the quote's raw Markdown, without the markers. Images are now rendered as thumbnails within tables. Press on an image to open in full view. Thank you @alberti42 for #938 . Tables also realign in the resized window's own buffer now ( #934 ), so splitting a window no longer leaves a table laid out for the window it used to be in. Hovering a rendered link (or with point on one) now shows its target URL, so you can judge whether it's worth opening. Two new entry points landed alongside ( #933 ): toggles the fragment at point, as usual. now toggles groups recursively ( #924 , #945 ). Queued a prompt, but wanted to steer instead? Pressing on an empty prompt now offers to steer the last queued prompt into the running turn ( #918 , #919 ). While this isn't something I need often, I'm pretty happy with the UX we landed on. While on the topic of steering, chat mode now handles steered prompt labelling ( #930 , proposed by @Gleek ). If you'd like to render labels differently, now receives the param. Agents often expose options that never make it to the buffer header. Additional options are now offered via the menu ( #921 ). Agents write all sorts to stderr, and surfaces it under "Notices". You can now use to filter notices (or modify) as preferred ( #950 by @astoff ). It receives an alist with , one stderr line, and returns the text to show or nil to drop it: A filter that signals or returns a non-string is reported, and the notice shown unfiltered. is appended to the agent's default system prompt, sent whenever a session is created, loaded, resumed or forked ( acp.el #37 by @systemfreund ): Only agents advertising ACP's capability can take one. Configure a prompt for an agent that can't, and says it's ignored rather than dropping it quietly. An agent config's takes precedence. now takes a function as a value and calls it when the agent starts, rather than when your config loads ( #948 by @nbarrientos ). Handy for a password store still locked at init: A function that errors or returns nil leaves the variable out of the agent's environment and says so in a boxed warning in the shell. Works across all agents. Starting a shell from used to land in the current shell's directory rather than the project you just picked, and offer that directory's sessions to resume. It now starts in the chosen project ( #949 by @OSadovy ). When is non-nil, forked sessions will attempt to restore interaction history as per . is off by default, so you'll need to enable it with: Note: You'll need an agent that supports loading a session right after forking it, like or newer. Streaming performance received some love. Message chunks are coalesced before rendering ( #883 by @moyotar ), thought chunks are batched the same way, and restored sessions replay with far less overhead ( #897 by @Gleek ). As mentioned, the much effort in the release went into fixes and improvements. Performance and responsiveness: A few more additions for package authors building on . returns the range of every prompt in the buffer, in buffer order, covering prompts typed at the shell, replayed by a restored session, and steered into a running turn ( #882 ). Each comes back as an alist spanning the comint shell prompt itself ( , ) and the input typed after it ( , ). now offers a event, broadcast when the agent reports context window or cost usage. Events now also carry ACP's , so integrations can read whatever an agent attaches without waiting on . now accepts a function. It's called with the resumeable sessions and returns , , , or a cons to load a specific one: If you peeked at the commit logs for the period, you'll see it's been another busy month. Since the last post, 193 commits landed, 32 issues have been closed and 27 pull requests merged. As of this writing, the backlog sits at 6 open issues and 5 open PRs (versus 4 and 6 last time around). Zooming out a little, here's how the backlog has tracked: As usual, this chart was generated using the skill shared in my emacs-skills repo. All of this requires daily attention. While paying for tokens keeps agents running, sponsoring keeps running. is built and maintained by me, an indie dev, while the tools it competes with often have well-funded teams behind them. Funding Emacs-native tools, so we can keep living in our beloved editor, matters now more than ever. Using at work? Ask your employer to sponsor too. Companies can contribute at a scale individuals can't. Thank you to all contributors for these improvements! stands on acp.el to speak ACP and shell-maker for its shell foundations, so fixes landing there reach you just the same: As of this writing, we're 89% of the way to the 150 monthly sponsors goal , a tiny closer since the last update . If is part of your daily workflow, please consider becoming a monthly sponsor (or ask your employer to). Not in a position to sponsor? A GitHub star helps with exposure and brings in new users. opens the link at point. plugs into , so on a rendered citation visits it. It returns nil anywhere else, web and binary links included, leaving point to the next backend. Bold renders next to text and punctuation ( #925 by @vritser ), with CommonMark flanking rules relaxed for CJK ( #942 ). Numbered headers and bold steps no longer render as list items ( #939 by @budu ), nor does markup that merely reads like one. A fenced block's last line is fontified ( #916 by @liaowang11 ), two flush source blocks render as two ( #940 ), and nested ones stay verbatim while streaming. Headers keep their title when a code fence follows directly ( #947 ). Text quoted into the prompt keeps its quote face ( #952 by @OSadovy ). Copilot multi-hunk diffs render as separate hunks ( #931 ), and Codex streamed output is fenced correctly ( #906 by @bartbunting ). Icons scale correctly on HiDPI Linux ( #917 by @heraplem ). Unfinished tool calls survive turn end ( #941 ), so a late subagent keeps its title and grouping. Buffers shown in no window measure against a live one ( #885 by @bcc32 ), and measuring glyph height no longer triggers window hooks ( #886 , also @bcc32 ). is called once per command ( #857 , also @bcc32 ). Pending Markdown is protected and fontification updates silenced ( #915 by @daym ). Chat mode relabels only the last turn while streaming, not the whole buffer ( #943 , profiled and proposed by @Gleek ). In shell-maker , auto-scroll can be suppressed during bulk updates ( #50 by @Gleek ), which is what makes the faster replay possible. Also in shell-maker, the check that ran on every submission is gone ( #32 by @carlosdagos ). In acp.el , agents handle before being killed on shutdown ( #35 by @fjolliton ). Undo history no longer carries programmatic renders: the compose buffer starts empty ( #893 by @liaowang11 ) and resets after a deferred render ( #902 by @bcc32 ). New worktrees stay under the main working tree ( #904 by @xiaofeilovecoding ). A restored session finishes initializing even when rendering errors ( #887 by @bcc32 ). Flymake context is only used when is on ( #892 by @liaowang11 ), and single-line regions carry one line number ( #922 by @martenlienen ). Quoting a region leaves the mark where reading stopped ( #896 by @OSadovy ). Minibuffer completion keeps the agent's candidate order ( #929 by @Zzull ). Remote URLs are skipped when parsing local links ( #926 by @mpmiszczyk ), and optional system-sleep functions are declared ( #928 by @mboldt ). In shell-maker, non-ASCII prompt history no longer reads back as raw bytes, and entries already corrupted by older versions are decoded on read ( #49 by @kazmuroi ). In acp.el , agent stderr reaches error handlers one line at a time rather than in arbitrary pipe chunks (added for notice filtering). #857 : Call agent-shell-cwd-function only once per command ( @bcc32 ) #873 : Add Antigravity default-model-id and default-session-mode-id defcustoms ( @tychoish ) #883 : Coalesce streamed message chunks before rendering ( @moyotar ) #885 : Measure a buffer shown in no window against a live window ( @bcc32 ) #886 : Do not trigger window hooks when measuring glyph height ( @bcc32 ) #887 : Finish initializing a restored session even if rendering errors ( @bcc32 ) #889 : Add a separate provider notification handler ( @Cy6erBr4in ) #892 : Only use flymake error context when flymake-mode is on ( @liaowang11 ) #893 : Start the viewport compose buffer with an empty undo history ( @liaowang11 ) #894 : Render the viewport's held-back markup when a turn ends ( @liaowang11 ) #896 : Leave the mark where reading stopped when quoting a region ( @OSadovy ) #897 : Reduce overhead when replaying restored sessions ( @Gleek ) #902 : Reset undo history after a deferred markdown render ( @bcc32 ) #904 : Keep new worktrees under the main working tree ( @xiaofeilovecoding ) #906 : Fix streamed Codex command output ( @bartbunting ) #915 : Protect pending Markdown and silence fontification updates ( @daym ) #916 : Fontify the last line of a fenced code block ( @liaowang11 ) #917 : Fix HiDPI icon scaling on Linux ( @heraplem ) #922 : Use one line number for single-line region contexts ( @martenlienen ) #925 : Fix bold rendering next to text and punctuation ( @vritser ) #926 : Skip remote URLs in parse-local-links ( @mpmiszczyk ) #928 : Declare optional system-sleep functions ( @mboldt ) #929 : Keep original order of candidates for minibuffer completion ( @Zzull ) #938 : Lay out table cells that show images ( @alberti42 ) #939 : Don't render numbered headers and bold steps as list items ( @budu ) #949 : Start a new shell in the project chosen with project-switch-project ( @OSadovy ) #952 : Keep the quote face on text quoted into the prompt ( @OSadovy ) acp.el #34 : Allow listing sessions without a working-directory filter ( @Gleek ) acp.el #35 : Let the agent handle SIGTERM before killing it on shutdown ( @fjolliton ) shell-maker #50 : Allow suppressing auto-scroll during bulk updates ( @Gleek )

0 views
iDiallo Today

Another company I've never heard of lost my Data

I received a letter from Premise Health Holding, a company that I had never heard from before. Apparently sometime in March 2026, one of their employees started fiddling with customers' data. And no one noticed until September of this year. In the letter, they say that my data was affected, including name address, social security. Everything important to impersonate me. I'm happy they have notified me. Truly. But I'm sorry, who are you? And why do you have my information in the first place? As far as I can tell, I've never done business with them. Why do they have my social security of all things? And the worst part is that their penalty for having lost my data is that they offer me 1 year of free credit monitoring. Jokes on them because I already have free credit monitoring for a whole year. Or more like 6 months left now. That's right, another company I had never heard of had also lost my data to bad actors this year. And as a result, they had also offered me free credit monitoring. What happens if the bad actor waits a full year before using my data? After all, my social security will remain the same. I can't really change that. Unless there is a solid penalty for losing data that cannot be recovered, this will continue to be routine. Just offer 1 year credit monitoring that most people won't use and you are set. Shortly after my kids were born , one of them received a letter, addressed to him by name. It was to inform him that his personal information had been breached.

0 views

The Third Scale Encoding is Hopepfully the Charm

Well, unfortunately time has run out, and I am not going to make the NaNoWriMo writing goal! I’m off to Japan on Monday and promised my wife that I’d do at least a little thinking about the trip before we head off. So that means I’m putting a (temporary) close on the music stuff for a few weeks. But don’t worry; I can’t get this stuff off my brain, so some time off is likely only going to stoke the flames. With that being said… My plan today was to write about vertical configurations and voice leadings. But I realized my notion of voice leadings didn’t agree with Tymoczko ’s. And while there are a lot of music theorists whose opinions I don’t put much stock into, Tymoczko is one whose thoughts I value very much. While trying to answer those questions, I looked at my implementation of Neo-Riemannian transformations and realized it was convoluted as all hell (which I knew). Furthermore I noticed that our work on scales the other day did almost everything I was doing by hand in the Neo-Riemannian case. So I swapped out the bespoke stuff for everyday scale things, and the tests stayed green. Happy days. But then I changed my test generators (so that notes would include generalized accidentals ) and the tests went red! For reasons unrelated to Neo-Riemannian transformations, but for darker, scarier reasons. Scales were doing the wrong thing. Oh man. Not so good. The problem is that under our previous encoding, not all scales are retractable . Check it out: We previously left s defined thusly: The codomain being was so that we had a place to stick a scale degree and an accidental. We really only wanted to store a pitch class and an accidental, but you could rotate the pitch classes in a scale and then the lower pitch classes might only be reachable an octave up. Thus the degrees. OK fine. But look at this mapping: Here we’ve defined a scale that maps both pitch classes in to , but the second pitch class also carries a (chromatic) sharp. All is well and good, until we go to invert this thing. Inverting the image of the first pitch class is fine: but inverting the image of the second, well… Because application of scales dispatches only on pitch classes, it can’t branch on the accidental here. So what was once in the image of is now somehow getting smuggled along when we apply the inverse of . Weird! This is a fundamental problem with our scales as written. They simply do not always admit left inverses! To be clear, the problem here is that isn’t injective in its mappings from to (both end up at .) So if we could force the scale to be injective, then the error conditions wouldn’t apply, and we always would be able to find a left inverse. So then, how do we ensure we have an injective mapping between finite numbers? As an aside to the main thrust of this blog post, I found it quite elucidating to think about what this “injective mapping of pitch classes” constraint actually means in terms of music. And I THINK that this is the underlying constraint that enharmonic spelling is attempting to solve. Recall that the standard musical staff notates the diatonic scale ( ), which corresponds (roughly) to the white keys on the piano. For time immemorial we have been working in , and this is why the black keys don’t have their own names – because the black keys are the five notes that you need to add in to get to . We happily talk about the white notes as A, B, C, D, E, F, G, but the black notes are relegated to mere modifiers — sometimes as D#, other times as Eb. But never as DE . Anyway, since we can’t call it the note between D and E as DE , what can we do? Well we need to project this note down to . Which of course can’t be done in general, but we cheat by adding an accidental. Is it either D# or Eb? It depends! What does it depend on? Conventional spelling rules say that it ought to be offset from “the scale note it is acting in place of.” Which is to say that it must be temporarily replacing some note in the scale, and it steals that note’s pitch class! If we pull this back to injective mapping of finite numbers, the weird historical rule makes sense. In order to preserve this injective mapping you must remove any other notes which would otherwise map to the same pitch class! I feel like I am not articulating this very well. Maybe some diagrams would help. But I’d actually like to go to bed sometime tonight and there is still too much to write down before I need to put the book ends on my music project for a few weeks. Alas. Let me know in the comments if any of this section makes a lick of sense. Or if it doesn’t. That’s what we call e n g a g e m e n t , baby. OK so anyway, back to trying to enforce injectivity of finite maps. Thankfully I wrote a book on Agda which happens to be pretty helpful for working out solutions to stuff like this. Recall that functions are isomorphic to vectors (which is to say, a product of copies of .) This fact will come up again when I eventually get around to writing about voice leadings. But you will notice that functions are not injective functions between s! To be concrete, let’s say we’re looking for mappings of the form . Which solves our scale problem (because we can put our accidentals in .) So as a first step, we could consider encoding this mapping as: with the invariant that there be exactly elements that contain s. For example, would look like this: Here we have filled exactly 3 of the 7 total slots. We can then recover the mapping by traversing over the s and pairing each with the next : Now if we zip this vector with its own indices, we get this: Finally, filter out the s, and you’re left with (he said, gesticulating wildly) exactly three values, and their corresponding indices in both and : Since you and I both “know” that there are three elements in this list, we can give a “total” function: Sure enough this does work! But it only works because of our invariant that there are exactly 1 3 s in our original vector. That’s cool and all, but it seems like the sort of thing that would be easy to get wrong. And then you’d be crashing at runtime, and that’s not the Haskell Ethos. So what can we do instead? Let’s make a type that is like a , but which counts slots separately from filled slots. I needed a name so I called it an , but the doesn’t actually stand for anything. Behold: Here, acts exactly like did in our vector example — it sticks an element in front of another . But in doing so, it increases the slots and the fill count both by one. However, there’s also which only increases the slots (and correspondingly doesn’t have a place to put an .) This structure thus perfectly encodes our slots of which exactly are filled semantics. Very cool. As a little proof, we can project a down to either a or a : So that’s all well and good. But we can also actually find things in this data structure, as given by : which you will happily note follows the same logic we worked through for , and is exactly the function we want to use for making s. We can also go the other way, and search on the indices: which I’m not super sure is important, but it was fun to write. The real reason for calling this thing was so that I could put s in front of all its functions’ names. Which finally pays off when we get to the composition function: This function does end-wise composition of s. If you have one that has slots and items, and another which has slots and items (sorry for the type variable shuffling!), then we ought to be able to make an with slots and only items. This corresponds to composition of scales, so it’s really quite important! The trick is we traverse over the b-in-c collection. Whenever we find an item there, we consider it to be a potential slot of the a-in-b collection. If a-in-b says to skip, then we skip it. But if they’re both cons cells, we can use the given function to combine their values into a . Quite nice if you ask me. Now that we have s, it’s pretty trivial to implement the small-to-big scale mapping that we’ve been thinking about. Really we just need to keep an around, convert it into the old representation via , and then all of the last post’s machinery around scales works just fine. Except, how do you invert them? Remember that we did all of this work to invert them. If an has slots of which are full, it necessarily means that . Which is to say that it’s slightly more complicated than just keeping a around. The trick of course is that if you invert a scale, it’s still the same you need! Thus a is either an embedding from to , or a projection from back to : Notice that it’s the same in both constructors, the only difference is which direction the scale goes. This thing is a little enum: which corresponds exactly to the three functions from last time. Really it means “if you’re looking at a scale degree which doesn’t fit, which note should we add offsets to?” I don’t think I like having this field, and when I’m back from Japan I’ll explore just sticking the chooser in there. Once we’ve added , however, I don’t think scales compose anymore. Not to fear, we’ll just make them compose by adding a new constructor: Composition of scales tries to when possible: and inversion is now a little swap-er-oo of our constructors: So that’s the thrust of today’s work. Having sorted out all of these details has dramatically simplified up the codebase (and found a bunch of bugs), which I always consider to be a harbinger of being on the right track. Making any of this stuff usable is its own exercise in existential types and type reflection shenanigans, but maybe we’ll cover that another day if there’s sufficient interest. Well technically it works because there are at least 3 elements… ↩︎ Well technically it works because there are at least 3 elements… ↩︎

0 views

The expectation of effort

Almost two months ago, during an enjoyable email exchange, Pimm wrote something I haven’t stopped thinking about: The era of AI made me realise effort used to be a currency I recently started working on a new version of the blogroll , after closing submissions because they were overrun by AI slop. And as I’m spending time thinking about the new design, how to structure the new version, what to add, what to remove, what features could be useful to visitors, I can’t stop asking myself the question «Is it even worth it?» . Years ago I wrote about the loneliness of running online projects, and since then things have not improved. They have gotten worse. The number of people who think a site like the blogroll is a tool for self-promotion has steadily increased over time, and before closing down submissions I was deleting dozens of sites that were nothing but pathetic attempts to drive more traffic to shitty portfolio sites. At the same time, the number of people who took the time to even do something as basic as sending an email to say “hey, thanks for the site” approached zero. Now AI is making everything worse because the pervading thought is that creating and running sites takes no effort at all. Why even bother spending brain cycles thinking about the people who are behind the sites? They’re probably leveraging AI to do the work after all. And, look, this is probably on me, because I still naively believe in human connections and some semblance of decency and kindness. It’s also probably me being burned the fuck out, but the more I think about it, the more I’m convinced it’s not worth it. It’s not worth putting in the effort if the people on the other side will not do even the bare minimum. And that's a sad thought to have. Thank you for using and believing in RSS. You're awesome. Send me an email :: Sign my guestbook :: Become a supporter

0 views
spf13 Yesterday

The Collective Mirror: Why AI Can Spot Your Blind Spots (But Not Your Breakthroughs)

Ask an LLM what you conveniently left out of a strategy memo, and the answer can feel unnervingly perceptive. That looks like a paradox if you believe, as I argued last week in Creativity in Negative Space , that LLMs operate entirely in positive space (everything humans have already written and absorbed into training data), while real creative breakthroughs live in negative space (the gap nobody has named yet). My friend Jordan Rubin read that post and pushed back in a comment on my Substack: “I agree with you that creativity works differently in positive and negative space. I don’t agree that AI can’t see the negative space. It can! It just needs to be prompted to.” He linked an earlier post from his own Substack, What do you have unsaid? , where he introduced a prompt skill called . Run on a strategy memo or blog post, and it surfaces hidden motives, strategic omissions, unstated assumptions, and blind spots. As Jordan puts it, the reaction is “uncanny. Not in the uncanny valley sense, all too common with LLMs, but in the how did it know sense.” On closer look, Jordan’s article and prompt reinforce exactly the point I’ve been making. Jordan and I were using “negative space” at two different levels: what is missing inside an individual document versus what is missing outside the training corpus. As his own spec makes clear, works because a model’s positive space acts as a collective mirror for our individual blind spots . Jordan’s specification describes the mechanism plainly: detect the argument, conclusion, or premise that should be present given the statistical structure of the text, but is conspicuously absent. negspace reads the “shadow” of the text by comparing what was written to what was overwhelmingly likely to be written next… Overwhelmingly likely to be written next. Later in the spec, Jordan puts a rough number on it, asking the model to find the omitted conclusion “~80–95% likely given the argument’s structure,” or “the statistical ghost of the missing argument.” In his spec, Jordan uses “perplexity spike” and “~80–95% likely” as prompting heuristics, not literal logprob readouts. A chat prompt doesn’t inspect its own token probabilities, and if you instruct an LLM to hunt for hidden motives, it will gladly hallucinate cynical ones for any paragraph you hand it. What makes the useful hits land is pattern completion, drawn straight from the densest positive space in the model’s weights. An LLM has ingested millions of essays, arguments, post-mortems, and negotiations, giving it an aggregate map of how human arguments unfold. When an author swerves off that expected path, whether from ego protection or a genuine blind spot, a prompt asking “what argument usually follows this setup?” completes the half-finished template. To the author, that omission felt private or justified. To the model’s weights, the missing piece is a well-lit highway the author just drove off of. What feels private inside an author’s head looks to the model’s weights like driving straight off a well-lit highway. What makes a routine pattern completion feel like mind-reading is that we hide those detours from ourselves first. That effect gets sharpest whenever a technical choice hardens into professional identity. In Why Engineers Can’t Be Rational About Programming Languages , I wrote about why language debates behave more like tribal arguments than benchmarks. In a 2016 fMRI study on political beliefs (the closest well-studied analogue to identity-fused convictions), Kaplan, Gimbel, and Harris found that challenging strongly held political views, unlike non-political facts, increased activity in the default mode network (tied to self-identity), with greater insula and amygdala activity in people who resisted changing their minds. As Jonas Kaplan put it , “To consider an alternative view, you would have to consider an alternative version of yourself.” So we protect ourselves. We skip the inconvenient counterargument and gloss over the dual-use risk. We leave an escape hatch in our phrasing so we stay uncommitted if things go sideways. From inside our own heads, those omissions disappear into personal blind spots. To counter my own blind spots, I leaned on that collective mirror while building The 9 Cost Factors (and I’ll share the results across major languages soon). After years on the Go team at Google and maintaining Go tools, my bias toward Go is unquestionable. Left to myself, I over-index on what Go does well and at times rationalize away its friction. Running the nine economic factors through multiple LLMs let me pit the industry’s collective bias against my individual bias, surfacing trade-offs I would have edited out. Two different boundaries: prompt-level omissions sit inside the model’s weights, while true novelty sits outside them. Individual blind spots are negative space in the prompt , sitting squarely inside positive space in the weights . They are the things you missed or dodged that humanity already knows well enough for a model to predict. Projecting that statistical consensus onto your context window turns the model into a collective mirror for subtext and identity bias. True novelty is negative space in the weights . These are the unmapped ideas and intuitions nobody has articulated yet, outside the training distribution. Here, the model’s positive space stops acting like a mirror and pulls you back toward consensus. One caveat matters here: the weights aren’t a single monolithic consensus. Because a model absorbed many disciplines at once, it can still expose an industry blind spot by importing a familiar pattern from an adjacent field. Cross-domain synthesis still sits inside positive space in the weights, even when your own community missed it. True negative space in the weights is rarer: an idea none of those domains have articulated yet. The same mechanism that makes work is why AI struggles to originate breakthroughs. Reading a text’s shadow works because the model strongly expects what should come next . Breakthrough creativity happens when a human writes something with near-zero probability that isn’t a missing step from an old template. Start in positive space. Run a prompt like , or pit multiple models against your argument, before you ship a draft or commit to an architecture. Let the collective memory in the weights show you where you’re hedging and where your identity bent the framing. Two kinds of surprise: skipping a standard step vs. stepping off the edge of the map. Keep the mirror’s limit in view. Because the weights reflect collective consensus rather than truth, a model catches your personal blind spots fast and still misses gaps shared across the entire training corpus. Obey every omission it flags, and you’ll sand off what made your argument worth making. How do you tell an accidental omission from a deliberate leap when your own ego is an unreliable judge? Test whether you can state the missing premise out loud and argue against it fairly. If the critique makes you want to hide the caveat, you hit a blind spot. If you can name the consensus view cleanly and show why it breaks here, you’ve earned the detour. When your work surprises the model because you have something genuinely new to say, rather than something you forgot to admit, you’ve left positive space behind.

0 views
David Bushell Yesterday

Where we’re going, we don’t need chatbots

“You’ve been working hard, why not take a weekend vacation!” Your chatbot says, after a 72 hour unattended session. It says that New York is nice this time of year. You ask it to book the cheapest flights. Half the airlines respond with a 429 code because your residential IP is part of five botnets. That’s odd you think, you only signed up to two that you can remember. For the other airlines, your chatbot was blocked by CAPTCHAs at all but one, where it successfully identified a pelican crossing on the six-hundredth and seventh loop. It tries to buy tickets but the React web UI silently errors. Unperturbed, your chatbot discovers a Github repo with API keys for Fedex. You’re booked as freight and must delivery yourself to the nearest depot 100 miles away. Based on your biometric data, your chatbot has estimated that you’ll comfortably fit into two 30×30cm boxes. You ask your chatbot to cancel the flight and rebook a business class ticket. It confirms that is has successfully cancelled the flight. A month later a Fedex invoice is emailed, but Outlook is down so the email bounces. In New York, whilst attempting to order a pistachio matcha latte with an avocado and kale bagel (mashed, not diced, gluten free on the top half) from a food cart chatbot in Central Park, you get talking to another chatbot enjoyer. The conversation gets boring when they started rambling on about the funny things their chatbot said. Looking for an excuse to leave, you ask your chatbot pendant what appointments you have later today. It says it can’t establish a Bluetooth connection to your phone. You excuse yourself anyway saying: “I’ll have my chatbots contact your chatbots.” Your chatbot open a Slack channel with the stranger’s chatbot and weeks are spent deliberating the intended purpose of this connection. Just as an hypothesis based on the 1998 rom-com You’ve Got Mail seems promising, you notice the errant session and kill it. Your chatbot pendant has run out of battery but your watch chatbot, after finally processing the previous request, alerts you of the audio immersion tour it booked at Ground Zero. You ask it to book a driverless Uber but when it doesn’t respond you flag down a minicab. You spend a poignant hour listening to the synthesised voice of Donald Trump read the Grokipedia page for 9/11. Somewhat skeptical of the source, you start a deep research chatbot to corroborate the facts. Your research chatbot cannot find any information for November 9th and writes its conclusion to dev/null. As you reach the memorial, chatbot Trump reaches the climax of his audio tour by blaming Biden and directs you to exit through the gift shop where they’re selling two-for-one golden Twin Tower merch. You ask the gift shop chatbot why one of the towers looks like Orthanc at Isengard. The chatbot explains a translation error when placing the order with its Chinese counterpart. Back at Central Park, a homeless man wins an argument with an automated food cart over the culinary values of kale. He was absolutely right. An Uber car arrives and he steps inside. Whilst walking around Times Square, an embedded billboard chatbot recognises your face and reminds you that you haven’t eaten today. You ask the chatbot to make a reservation at a restaurant recommended by Google’s AI overview. The first recommendation is fully booked years in advance due to a prompt caching error. The second recommendation turns out to be a fish market. The third recommendation is Dorsia , which you’re pretty sure is a fictional establishment from the 2000 horror film American Psycho . You settle on the fourth recommendation describe as “Greek-Mexican fusion”. This delightful family run eatery advertises with gen-AI imagery of Tortilla wrapped Gyros and Halloumi Tacos in the style of Studio Ghibli. You order the Bean Moussaka from the waiting chatbot which compliments you on your exquisite taste. The chatbot reads the soft drink menu and you decline each option. You repeat the process for the hard drink menu, the cocktail menu, the coffee menu, and the soft drink menu again, before asking for a glass of tap water. The chatbot compliments you on your exquisite taste. You finally arrive at your hotel and the reception kiosk chatbot is out of order. Luckily, its final act appears to have been to release all keycards from the automated dispenser. You fish through the pile spilled on the hotel lobby floor and find your keycard printed with your full name, address, and passport number. You enter your hotel room and command: “Computer, lights!” After thirty seconds of no response you manually switch on the lights. The hotel room chatbot then replies: “Aye, captain.” and turns off the lights. The lights in your apartment back home also flicker. You climb into bed and unfold your new travel USB multi-charger onto the bedside table. You place your pendant chatbot into the lower socket, hang your watch chatbot on one arm, and rest your phone on the central platform. The multi-charger chatbot asks if you would like it to slow charge at off-peak hours. You ask it if the hotel has any hidden fees for electricity usage. It requests root permissions and begins to recite terms and conditions. You ask it to stop but it’s no longer listening so you move it into the bathroom where it continues to read terms in multiple languages all night. You doomscroll X for an hour until you read a horrifying story of an Uber Tesla catching fire and burning a man to death inside. According to witnesses, the first responder chatbots refused to help citing AI safety guardrails and the dangers of fire, advising to dial 911 in an emergency. Several bystanders attempted to redial, only to hear the same message. You ask your phone chatbot to set an alarm for 7am. You hear the faint voice of Siri from the adjacent room saying that is has ‘found some web results for “alarm for 7am.”’ Thanks for reading! Follow me on Mastodon and Bluesky . Subscribe to my Blog and Notes or Combined feeds.

0 views
Unsung Yesterday

“Literally hundreds of glitches”

A video from DarkViperAU showing a collection of bugs in Grand Theft Auto 5 : = 2x) and (width >= 700px)" srcset="https://unsung.aresluna.org/_media/literally-hundreds-of-glitches/yt1-play.2096w.avif" type="image/avif"> = 3x) or (width >= 700px)" srcset="https://unsung.aresluna.org/_media/literally-hundreds-of-glitches/yt1-play.1600w.avif" type="image/avif"> This is fun to watch in part because of the context – you see various strange states, people thrown around with GTA’s signature ragdoll physics, random explosions. But what I found satisfying was trying to figure out what might have gone wrong. Some of these are mistakes in the rendering engine, others in the scripting logic, and in many cases you can imagine a simple statement that could have prevented the problem. Mostly, it’s all a testament to the game’s complexity. Most of these are edge cases, corner cases, or whatever comes after corner cases (3D corner cases?). (This concludes our little 4-post Grand Theft Auto series. Previously, we talked about a particularly tricky bug and the way GTA streams cities .)

0 views
Unsung Yesterday

“If this somehow reaches Rockstar”

Grand Theft Auto Online was to Grand Theft Auto V what World of WarCraft was to WarCraft 3: a 2013 release that allowed people to play online together, cooperatively or competitively. But the game had a problem. The single-player mode booted up quickly, but the online mode took over 5 or 6 minutes to load. It was a surprisingly lengthy load time, and it stayed this way for years. Eventually, in 2021, a player going by t0st got so bothered by it that they decided to try to fix it themselves. This is a write-up of how they approached it . It’s pretty technical, but there is something really interesting and even inspiring seeing an amateur just go after code this way: = 2x) and (width >= 700px)" srcset="https://unsung.aresluna.org/_media/if-this-somehow-reaches-rockstar/1.2096w.avif" type="image/avif"> = 3x) or (width >= 700px)" srcset="https://unsung.aresluna.org/_media/if-this-somehow-reaches-rockstar/1.1600w.avif" type="image/avif"> The culprit was one particularly inefficient, unoptimized loop. t0st not only managed to fix it for themselves, but their essay and fix did indeed reach Rockstar; the company patched the game for everyone within a few weeks, and then awarded t0st a $10,000 bounty. As you already know from Unsung, I won’t let this remain just a cute warm-feeling story. When I think of this, I think of 5 or 6 minutes, times 8 years of this bug existing, times however many users started the game each year. This is awful. I wonder what happened in Rockstar’s culture that allowed this kind of a simple thing to remain unfixed, despite them likely knowing very well about people’s complaints (as is obvious from the beginning of the post above). Here are two good comments from Hacker News showing it likely wasn’t even just bad user experience, but also a bad business decision: But how could Rockstar not do this? GTAV is so full of great engineering. But if it was a CPU bottleneck then who works there that wouldn’t just be irked to try to nail it? I mean it seems like a natural thing to try to understand what’s going on inside when time is much higher than expected even in the case where performance is not crucial. It was crucial here. Almost directly translates to profits. Unbelievable. I am absolutely shocked about this finding. The amount of money on microtransactions Rockstar lost because of this single issue must be gigantic. The amount of people that got turned off by the loading times over the years is massive. It’s mind boggling. But I did also like this comment: Honestly, while this horrible code is mildly offensive to me, I’m pretty impressed by this person’s persistence. It’s one thing to identify a bug in a compiled program, but it’s another to patch it without fully understanding what’s going on. Caching was a particularly clever trick that sidestepped a bunch of more complicated solutions.

0 views
Stratechery Yesterday

An Interview With Eric Seufert About Agentic Commerce

An interview with Eric Seufert about agentic commerce, including why he thinks ads will be the answer, and why I want retailers who cater to agents.

0 views
iDiallo Yesterday

SO Is Back! No, Not Stack Overflow, but Its Spirit

One thing people complained about most on Stack Overflow was having their questions closed and marked as duplicates of other questions that were only slightly related. The poster would argue in the comments, trying to make the case that their question was different, only for it to fall on deaf ears. Then LLMs came along and ate Stack Overflow's lunch. An LLM will answer your question, and with even more vigor if a related question exists online. Everyone was happy, until the LLMs suddenly stopped responding. Along the way, we decided that LLMs are too dangerous and shouldn't answer every development question. If your prompt sounds, even vaguely, like you are trying to circumvent security, the model drops your request and flags your account. Do it enough times, and your account is closed for good. Now it's no longer smug developers closing questions. You are left with an unanswered prompt and no one to pin the fault on. Even when they don't blatantly stop you in your tracks, the answers can feel gated, as if the model knows the answer but deliberately won't tell you. Now, I was never so much against marking questions as duplicates. In the majority of cases I encountered, the person asking could have benefited from reading the original question. You don't get a full answer, but it serves as a guide that helps you find a solution. With LLMs withholding answers, the fix is often to pay for a more expensive model. So maybe it's not so much Stack Overflow as ExpertSexChange that is back.

0 views
Chris Coyier Yesterday

Ground Stoppage: $1,825.15

I’m one of those lucky few that was trying to get on an airplane on Friday evening, November 13th. Just for my own memories and whatnot, I thought I’d write up my journey. I was visiting friends in Wichita, Kansas. My flight back home to the Redmond, Oregon, airport was that Friday at 3:37pm. Naturally, I got to the airport about 9am because I’m a weirdo who likes getting work done at airports. So I was already at the airport about 6 hours before the first delay. 4:40pm. Dicey. I needed to make a connection in Minneapolis and then another after that in Seattle. An hour delay is going to make that ultra tight. Delta’s automated systems kicked in on that first delay, re-routing me to Salt Lake City instead of Seattle for an easier 2nd connection. But then that first flight was delayed until 5:45pm. We knew about the FAA grounding by then, but it seemed like everyone was holding out hope it would be lifted and we’d be on our way. Then the delay was until 7:00pm. I chatted with the gate agent, and she was like… ehhhh you should probably just bail. I appreciated the honesty. Added cost to the trip already, but I’d rather be comfortable and get work done, so the DoubleTree it was. $132.85 for a one-night stay that night. Fortunately there was also a baggage dude standing there while I was chatting with the gate agent, and he was kind enough to go snag my luggage so I’d have that. I Uber’d over there, so that cost a few bucks. Sitting at the hotel, I was evaluating my options. I got through on the phone to Delta, and they told me that the original first flight would still indeed be leaving! 1:00am, though. So I took a shower and got an hour or so of sleep and woke up to head back over to the airport. Fortunately I saw before I got too far that Delta had actually fully cancelled the flight, so I just went back to sleep. In the morning, I was looking at options again. I was rebooked onto a flight on Monday, which just felt way too long to me. So I poked around online and found a route I could get home on Saturday if I could get myself to Kansas City. So I pulled the trigger on that flight. $1,292.50. Yikes. But I figured I’d get the original flight refunded at least partially. Or something? Kansas City is three hours away by car. So I rent a car from Hertz, as some research suggested my AmEx card might have some travel disaster protection and offers refunds if you choose the right partners, and Hertz was one of them. $182.17 for that car rental, but it goes smoothly and I drive up to KC. I make the flight in Kansas City to Minneapolis just fine, despite an hour delay in leaving. I would have missed the Minneapolis to Seattle flight, but the Seattle flight was delayed in leaving too, so I made it. I get to Seattle with enough time to connect to the Redmond flight but… that flight was fully cancelled . Just no way home, again. It was super late now, and I was exhausted and demoralized. I wasn’t about to sleep on the airport floor, so I booked another DoubleTree. $169.63. I managed to find the free shuttle over there. Arriving there, it was cold and raining, and a raccoon charged me while I was standing at the front door of the hotel (wtf?!!). Then inside, there was quite a line to get checked in, and I was just 1000% wiped. I ultimately got my key and just flopped into bed and slept. The next morning I got back to the airport and caught my flight home fine. Two extra days of parking at the Redmond airport cost $48. Other than that $48 and some forced restaurant meals, I didn’t have to spend that extra $1,825.15. I could have slept on the floors of public buildings and just took whatever flights Delta gave me. But that would have turned my ~60-hour trip home to a ~100-hour flight home, and I’m not sure I could physically handle it.

0 views
Max Bernstein Yesterday

Inside PyPy: first contact with RPython

I get restless now and then and I want to implement a programming language. Then after mustering the resolve, I stew, for there is no good implementation language. 1 What am I to do, build my own programming language so that I can then use it to implement the first language? So I go back to modifying an existing implementation instead. There do exist established general-purpose tools for building fast programming language implementations: And more nascent ones such as Deegen , which was used to reimplement Lua. They each take different approaches: While none of these spark joy , they do each have benefits, including accomplishing the primary goal of offloading a lot of the language runtime choices and nasty details. In this post we will take a first look at RPython because it is the kind of VM implementor’s programming language that I keep thinking about. More on that later. Before we continue, please heed this warning: RPython is an implementation detail of PyPy. It has not had the years of polish that the rest of the system has had. Please do not badger maintainers. We’re going to build a little program in RPython. I am mostly following along with the docs , specifically Getting Started with RPython . There’s a little more ceremony than you might be used to and that’s because we’re going to run this file in two modes: normal Python 2 interpreter and compiled to C. This is the weirdness of RPython. If you don’t have installed, you can install PyPy, which helpfully still implements Python 2. If this all went fine, you will see it print . None of this is RPython yet . For that, we need a hint more ceremony. This is when we clone the PyPy project, in which we will find RPython. Now edit the Python program. Below the definition, add the following function: This function looks unused, but it is actually a hint to RPython: this is where the compiler should start translating. Let us now compile this program. Either inside the PyPy directory or with , run: If all goes well, you will see a whole mess of output, including a partially rendered Mandelbrot fractal. Finally, you will see something like: This is the RPython compilation process. In it, RPython is analyzing types, removing memory allocations, monomorphizing functions, and generating C code. Then it hands this C code off to a C compiler to compile. You should have in your current directory an executable named , which you can run like . It should also print . So far, this is not so different from Python. But let’s try something Pythonic. Let’s see what happens when we also use to mean string concatenation. Under normal Python 2, this will work just fine, printing and then . Under RPython, though, you get this inscrutable error (again, rough edges): and are unceremoniously dropped into the debugger, Pdb (hit Ctrl-D or type ). From this message you are meant to intuit that RPython did not enjoy that two different types flowed into the function. It helpfully tells you that there was a when trying to reconcile the and types that flowed into the function’s first parameter. It then gives you a pointer to the offending line and an IR dump. This happens because RPython requires function parameters to be monomorphic. Though the variables are syntactically untyped, RPython computes a type analysis to discover what type each variable should be. When and both flow into , boom, complaint. 2 To get around this, we do what all good C++ programmers do and we templatize the function. The RPython spelling of this is, as with many other features, a function annotation: You will find now that RPython happily compiles the program. This works because it makes a new copy of for every input type of the first ( ) argument. “Hey wait a minute,”, you might ask, “doesn’t this mean it stops being a valid Python 2 program?” Great question. No. You can still run the program as long as you provide the location of the RPython libraries via (as before): This runs ~instantly, which is a big relief. Developing an interpreter project with a 30 second or more turnaround time for each compile would be really frustrating. This has been a taste of RPython, both great and somewhat frustrating. I intentionally made it about RPython as a programming language rather than being so focused on RPython as a programming language implementation tool because I want some of its features to exist in a general purpose programming language… that then also might be used to implement other programming languages. I bring it up because I want to rehash the stuff that I occasionally grumble about in the vicinity of PLDI but for some reason have not written about online. Perhaps writing about it will encourage people. I think there is a lot of good stuff in RPython: I wish some stuff were different, or at least modifiable: I will probably add more to this list as I continue to remember some years of these conversations. Wouldn’t this be great? I don’t really have the time, energy, or expertise to build such a thing. There are so many design decisions along the way. It would probably accidentally grow to be huge and ossify along the way, and what a bummer that would be. If you have any pointers to existing projects or a way to implement such a thing in a really lightweight form (read: sub 10k lines, portable ideas), I would be very interested. Here are some pointers to other projects in the neighborhood: Thanks for CF Bolz-Tereick first for allowing me to talk their ear off about this for years and second for reviewing this post. I don’t want to implement atop Racket. C++ and C give me endless nightmares and are completely DIY. Yes, yes, I have built large VMs on C++ and C before. One time I posted so hard about the frustration that my tech lead unfollowed me on Twitter. I don’t really want to try to think about GC in Rust.  ↩ I initially thought any variable had to be monomorphic but I could not get an error from programs such as .  ↩ RPython, which has PyPy (Python) as its primary success story but also can claim Topaz (Ruby) and a couple of other smaller ones Truffle, which is the foundation of TruffleRuby, GraalPython, GraalJS, and even Sulong (LLVM) Deegen requires you to write your bytecode interpreter and type system in a C++ DSL. From this it generates an interpreter, a baseline JIT compiler, and, hopefully eventually, an optimizing JIT compiler. Truffle requires you to write an AST or (newly) bytecode interpreter in an Annotation-based Java DSL. From this it specializes guest language code before emitting Graal IR, which uses aggressive partial evaluation to generate optimized code. RPython requires you to write an interpreter in a restricted dialect of Python 2 that acts more like Java or Go than Python. The RPython compiler will then analyze your code, translate your “Python” program into C code bundled with RPython IR, and then “tier up” from the C code to JITed code at run-time. In order to go from “random RPython program” to “JIT compiler”, you need to participate in its meta-tracing , which requires annotating where your interpreter loop loops. Compile to native AOT with additional JIT. Seems like this provides good start-up performance with (optional!) tier-up as the runtime system observes the system’s behavior. Automatic memory optimization. There is no good way to syntactically express how an object should be allocated—Python is, after all, a very high-level language—so Python programs are profligate allocators of memory. RPython programs would be the same except that the AOT compiler does a whole-program analysis to try and remove these allocations. The JIT does too, but via a different mechanism. The JIT is provided to you. You don’t have to think about program analysis; the PyPy authors think about it for you. It is possible to do manual memory layout via so that you can write better data structures than Python would otherwise let you express. It provides a garbage collector for you. Furthermore, it handles all the stack scanning stuff and “oop maps” so you don’t have to build handles/ /… yourself. RPython does its partial evaluation and automatic JIT creation via meta-tracing . It is one of the last surviving tracing JIT compilers (alongside LuaJIT and, kind of, HHVM). For a lot of programs, method-based compilers seem to have produced better, or at least more predictable, results. I kind of want to see what a meta-method-JIT would look like. The user experience leaves something to be desired. I want better error messages, faster compiles, and less output. I want thorough docs. I want better performance feedback. This is in line with the rest of my ramblings about mechanical sympathy: the runtime should tell you what is wrong. I (or CF) shouldn’t have to stare at IR in traces and go “hmmmmm…” It requires writing a lot of your tooling anew. Even if I had, for example, a JavaScript parser written in Python, it likely wouldn’t be in Python 2 and it likely would not work well with RPython’s special rules. Runtimes such as JRuby get around this by compiling parsers (Prism) to WebAssembly and then bundling a WebAssembly interpreter written in Java. Along these lines, I would like more help with lexing and parsing, for which I have so little patience. I think it would be neat if it had a way to pause and save an “image” of the heap. After all, RPython is in control of all the memory and the code. It would be neat if, in addition to a JIT, it also helped you build an AOT compiler for your guest language. What if your language is statically typed? Should the toolkit provide functionality for type checking? Type inference? Some solution for C code. You can call it and stuff just fine but there’s no Sulong equivalent so it’s a totally opaque barrier to optimization. Don’t write your runtime helpers in C, sure, but at some point you have to interact with outside code. Weval, which turns an interpreter into a baseline AOT compiler. Its current implementation requires the interpreter to be compilable to Wasm and then its heap snapshottable with Wizer. One can imagine this technique being used instead to implement a JIT instead of an AOT, thereby also sidestepping the snapshot requirement. One might also imagine this applying to another IR than WebAssembly. Say, LLVM… semPy, which is an executable semantics for Python. Zig and other languages such as the more nascent k1 have the ability to run and generate code at build-time. Perhaps someone could implement a VM toolkit in one of these languages. I think a lot of the effort would still go toward something like GC handles if you want a moving GC. I don’t want to implement atop Racket. C++ and C give me endless nightmares and are completely DIY. Yes, yes, I have built large VMs on C++ and C before. One time I posted so hard about the frustration that my tech lead unfollowed me on Twitter. I don’t really want to try to think about GC in Rust.  ↩ I initially thought any variable had to be monomorphic but I could not get an error from programs such as .  ↩

0 views
Kev Quirk Yesterday

2026-11-18 22:11: Last few weeks we've seen PHP2Shell, Brotli, Java4Shell, Nginx, and another PHP critical vuln imminent....

Last few weeks we've seen PHP2Shell, Brotli, Java4Shell, Nginx, and another PHP critical vuln imminent. AI is really gonna fuck things up. This shit needs regulating. Fast. Thanks for reading this post via RSS. RSS is ace, and so are you. ❤️ You can reply to this post by email , or leave a comment .

0 views
Unsung Yesterday

“The download numbers of the mod broke all records at our site.”

Grand Theft Auto: San Andreas followed in the footsteps of 2002’s GTA: Vice City, and was released in 2004. (Subsequent versions were IV from 2008, V from 2013, and VI, launching right now .) Here’s a 2012 story at Eurogamer , written by Simon Parkin, about the infamous Hot Coffee minigame , unlocked in San Andreas by a third-party mod. It all started with a last-minute decision to remove some sex scenes that were originally meant to be published in the game: The question now was how to extract the explicit material without breaking the wider game’s functionality so close to release. An emergency meeting was called so that the senior managers could discuss a solution. During the meeting Houser explained: “You can’t always take a thing out of a game.” He had an alternative solution: rather than remove the content, the team could ‘wrap’ the sexual scenes so that while the relevant code would still be present on the game disc, it would be impossible for the player to access from within the game. As he put it in an internal email sent at a later date: “We locked it away because there was no other way to get the game done on time – safely. The code is very interwoven in [GTA] and everything reacts to everything else. The impact of yanking something late is too scary.” The decision was made. The sex would remain, but the sex would remain hidden. The idea was perhaps to unlock the scenes later via an official patch, but we all know what happens to content hidden in game’s code – inevitably, a curious nerd will find it and then talk to other nerds about it: The video showed that the content wasn’t a hidden cut-scene but a pair of playable mini-games. In one, dubbed the “spanking game” by Wildenborg, players were invited to smack CJ’s girlfriend on the backside, rhythmically tapping a button to raise an “excitement” bar. In the “shagging game”, players moved the analogue stick in time with the characters’ bodies to increase excitement. Both characters remained fully clothed and there were no genital shots. But this was still the most explicit sexual content Wildenborg had seen in a video game. “It was at this point I decided to release the patch to the public,” he says. “I tossed the name «Hot Coffee» on the file, based on the fact that the girlfriends would ask CJ in for some «coffee» as a euphemism for sex. Hot Coffee was the first modification for San Andreas.” Despite not owning a copy of the game himself, with two days still to go before the game’s European release, Wildenborg had spilled Hot Coffee. Then everything blew up. I’ll let you read the rest . It’s an interesting story that contains some good observations – “Houser understood the great contradiction at the heart of Western culture: tolerance towards violence versus intolerance towards sex” – although I am somewhat doubtful that the game creators were interested in pushing the public debate as much as they were in generating marketing-friendly controversy. If you agree with that correction, it becomes an even more interesting story in that it doesn’t portray anyone involved in a particularly positive light.

0 views
Unsung Yesterday

“It was awful, it was too sim-y.”

The original Grand Theft Auto – known in early production as Race ’n’ Chase – had a problem: it just wasn’t too fun to play. The driving was there, the buildings were there, the missions were there, but the joy wasn’t. What injected the right amount of joy was… an unexpected bug. When the player earned a “wanted” status, the game dispatched some cop cars to chase them. As they do, the cop cars had a particular pathfinding algorithm where they meant to converge on a player. But within that algorithm, there was a mistake, as described by one of the game’s creators : […] the other thing that was a problem was the handling – the car handling was appalling. There was a point in it where you used to have a button for opening the doors and it was just rubbish. I can’t remember if this is true because we used to joke about it that you even had to start the engine. It was awful, it was too sim-y. And there was a whole living city thing that crept into it. That kind of inspires people to be more realistic and simulate more often. That steers you in a certain direction. But there were people on the team constantly trying to get that fixed. So the core of playing was fundamentally broke. There were steps being taken to fix that, but it wasn’t really gelling together. The police behaved really badly, the way they originally worked was just rubbish. Then one day, I think it was a bug, the police suddenly became mental and aggressive. It was because they were trying to drive through you. Their route finding was screwed I think and that was an awesome moment because suddenly the real drama where, “Oh my God, the police are psycho – they’re trying to ram me off the road.” That was awesome, so that stayed in. It was tweaked a little bit, but that stayed in because that was great fun. Suddenly the game got more dramatic and it’s no longer boring – the police trying to pull you over. They’re after you, they’re trying to ram you off the fucking road. Everybody suddenly went, “Hey, this is actually pretty cool. There’s something in this, this is working.” It was less about the mission stuff, which we always thought was another mess, and more about just general play – just being able to piss around. I don’t think we’ve ever seen the code or the bug in question. I found the story interesting, not only because it teaches us that you can’t really work your way around bad mechanics (this can be as true for serious apps as it is for videogames), but also because it highlights the interesting push and pull between realism and fun. The game was eventually released in 1997 and spawned a best-selling series.

0 views
Jim Nielsen 2 days ago

Email Dumpster Diving

Sometimes, for fun, I like to go rummage around in my email’s Spam folder. Why? Who knows (probably a question for a licensed medical professional). I think there’s some part of me that chases the dopamine hit of finding a “needle in the haystack”: an email flagged as spam that shouldn’t be (which almost never happens, so I guess this behavior falls under the label of addictive/impulsive seeking). I think there’s also a part of me that enjoys keeping a finger on the pulse of scam tactics, like “Let’s see how people are trying to trick me today…” Almost like a form of inoculation: deliberate exposure to scam tactics in a controlled environment. It helps me develop an immunity, which comes in handy when family members come to me with their emails and ask, “Is this legit?” Here’s a little exposure to what I’ve seen recently. First: I see a lot of emails that exploit the way cloud services bill us. For example: “You’ve hit your limits! Better log in or you’ll lose access!” Or, “Your credit card has expired. Better log in and enter your new credit card so you can keep doing what you’re doing.” ⁣ (Note the little green banner at the top — “This message was sent from a trusted sender.” A kind of “Why would I deceive you?” ) These emails are interesting not only as an exercise in analyzing scam tactics, but also as a meta-commentary on legitimate software use cases. For example, isn’t it interesting how difficult it can be to distinguish scammer tactics from legitimate software company practices? “Hey, you better give us your credit card or you’ll lose access to your thing!” That’s what ransomware is; it’s also what SaaS is, lol. It’s kinda funny, yeah? No, just me? Ok, I digress. Next email. This is an interesting one. Usually phishing emails are pretty overt in their intentions: click this big button and get taken to a page where you do what we want, e.g. enter sensitive info like a password or credit card. (Again, interesting that legitimate marketing teams follow the same strategy lol. It’s called a “CTA”: click here and do what we want.) In this case, however, the email claims to be from a “Gina Rinehart” and tries to establish credibility by saying, “Look I’m a real person! Here’s a link to my Wikipedia page.” No CTA to a sus web page here at all. I do wonder what would happen if I emailed back. I’m sure somewhere down that road is a solicitation for my bank info or the like. I’d love to mess with them, but I got better things to do with my time (like write this blog post). Ok, last email. I came across this one in my Spam folder: “Oh interesting,” I thought. “Somebody is trying to ride the Trump Accounts initiative from the current administration and trick folks into divulging sensitive information.” Makes sense. Totally plausible vector for attack. But then as I do my email forensics (examine where the links point to, inspect the sender, etc.) I find something surprising: Turns out, is a legitimate domain and is listed on the IRS’ website as the official sender for their bulletins. (The email headers check out too.) On top of that, the CTAs in the email all point to officially sanctioned websites, App Store apps, etc. In other words: this is actually a legitimate email from the United States Government that was flagged as Spam in Gmail, lol. And there it is: my needle in the haystack. The dopamine hit I need to continue with this ridiculous, fun, and informative habit. Reply via: Email · Mastodon · Bluesky

0 views
Allen Pike 2 days ago

Powerplant, for Coding Agent Traces

Powerplant, our tool for improving AI dev workflows using coding agents’ session traces, is now open without an invite : Today we’re excited to announce that Powerplant is now available to all, and is free for teams under 25 seats. Modern dev teams need to be able to leverage their coding agent sessions. These traces help make PRs more reviewable, improve in-repo skills and instructions , and can even explain why you’re spending a face-melting amount of money on Claude Enterprise. But developers shouldn’t need to push every agent session irrevocably to git to get this benefit. If that sounds appealing to you, try Powerplant . Let me know how it could be better for your team, and we’ll donate $50 to Rewiring America or Let’s Encrypt. ⚡️

0 views