Latest Posts (20 found)

Claude Code token cost explorer

I am experimenting with involving subagents more in my LLM coding agent workflow. I discovered that subagents make it more difficult to diagnose token usage in Claude Code, because the regular command only breaks down context usage for the main conversation, not for the subagents. I tried some existing tools like and , but they weren’t able to give me the sort of breakdown into specifics I needed to optimise my usage. Thus, I shamelessly had Claude Code whip up a tool that gives me a better view of its token usage. This is vibecoded in the true sense of the word – I have barely looked at the code – but I’m okay with that becuase it is not critical infrastructure and it does what I need it to. If you want to know how to get more out of your Claude Code sessions without paying more for it, here’s how you can find out. First, open the context cost explorer in your browser. Everything happens locally on your machine, so none of your transcript data leaves your computer. If you’re the paranoid kind, you can verify by opening the network tab in your browser and reading in a non-sensitive session and seeing that nothing funny happens. Then follow the steps below, or use your own analytical ability. (Continue reading the full article on the web.)

0 views

MTL-style circuit simulator

After the first attempt at making a very side-effectful circuit simulator, and then an ambitious attempt at making it pure, I was reminded of a middle ground, using a pattern common in production Haskell code. It is called MTL-style effects , and it is a specific type of final tagless encoding . The idea is that we first find a set of operations that our circuit simulator needs to support. Drawing this boundary well requires some experience and taste. Then we encode that limited set of operations into a type class. Here’s one way to do it. Having read the previous article, these operations should sound familiar. I’m sure it’s possible to create a better set of operations, but this will suffice to illustrate the point. (Continue reading the full article on the web.)

0 views

NixOS Is Making Me Less Afraid

Something funny happened a little while ago: I read about FreshRSS, and it sounded nice, so I installed it on a server and started using it . That would not have happened a year ago, but then again, a year ago I didn’t have any NixOS servers. For the past few years, my RSS feeds have lived locally on my phone only. There was a good idea behind that, but it never quite worked in practice. For one, many things are easier to read on a larger screen. But it was also brittle to trust a phone app to manage the read/unread status of thousands of articles across a hundred feeds. What I really wanted was a server-side feed aggregator. This is software that runs on a server, manages RSS feeds, and then I can read the RSS feeds either through a web interface, or through client applications. I’ve wanted that for a while, but I’ve never taken the step, because it would be yet another side project to maintain the deployment of. But now, with some NixOS experience, adding a working FreshRSS configuration (including backups) took 9 lines of Nix code. That installation has just hands-off worked for the past few months. If or when that server breaks, I can spin up a new one running the exact same configuration, probably in something like 15 minutes. When we can do something like that, there is literally no reason to not just try the new software. Contrast this against how FreshRSS is installed outside of NixOS. Then we’d (Continue reading the full article on the web.)

0 views
Entropic Thoughts 1 months ago

The geometric model of maintenance

James Shore posits that each person-month spent writing code results in 10 days of maintenance in the first year, then 5 days every year after that. Naïvely interpreted, this is a threshold -based model for induced maintenance, and its interesting because it’s so simple. If it could be shown to be true, that’d be useful. The argument Shore is making about the effects of robot-generated code does not depend on the specific numbers, so Shore’s numbers come from a hypothetical wisdom-of-the-crowds aggregation rather than concrete data. But no hypotheticals are necessary here. We have a thing called git. Let’s say we have a way of labeling each commit as either “new development” or “maintenance”. Then we can count how many commits of each type there are in a month. Possibly better, we can count how much complexity has been handled in a month. The following plot shows the cumulative effort that has gone into the development of tmux since its beginning to the day I start writing this article. (Continue reading the full article on the web.)

0 views
Entropic Thoughts 1 months ago

Swemak: Colemak for Swedish

I have written before about my Swedish Colemak hack, but I never explained what makes it so good. This is a better image what it looks like: If you’re struggling to find the difference against normal Colemak, look at the cluster of five keys next to the return key. This layout makes room for the three Swedish letters , , and , by only changing five keys in total, and they have changed very thoughtfully: (Continue reading the full article on the web.)

0 views
Entropic Thoughts 1 months ago

Predicting Peace

I have long struggled with predicting when peace will occur. Actually, I’m struggling with predicting anything relating to war, but let’s focus on when peace arrives for now. There are two such questions in the current ACX 2026 competition: When I entered my forecast for these questions, I did it based on Laplace’s rule of succession, i.e. as a function of their duration only. This is sort of justified if war durations are heavy-tailed, which would mean that the longer they go on for, the less likely it is that peace comes soon. But I don’t know if that is true. (Continue reading the full article on the web.) Will there be a cease-fire in Ukraine in 2026? Will there be a cease-fire in Sudan in 2026?

0 views
Entropic Thoughts 1 months ago

Donating to open source

I have decided to start donating a small amount of my fun money to open source projects. After some research, the initial set of recipients are These are important to me, they need more money, and I believe they can use donations well. If you disagree, I’d genuinely like to hear what mistakes I’ve made in the analysis below. I hope it shows that this is important to me. (Continue reading the full article on the web.) Perl 5 Core Maintenance Fund

0 views
Entropic Thoughts 1 months ago

Shrinking a Fedora virtual disk

I have a weird setup for my laptop. In summary, I have been irrationally scared of running Fedora on bare, dual-GPU metal, so I run it in a virtual machine with Hyper-V on Windows as a hypervisor. The idea was to let Windows manage GPUs and power management stuff like hibernation, and then use Fedora as my main UI to the computer. This has worked surprisingly well, but that’s only because my expectations were low to begin with. The VM can barely access the hardware of the underlying machine: it can’t use the GPU, it can’t use the front-facing camera, Linux starts thrashing weirdly when the VM runs out of memory, among other quirks I’ve learned to work around. Thus, I’ve wanted to re-install on bare metal for a while, but! problem! Come on a journey with me. It’s got a hero with hubris, mistakes, tension, and a cliffhanger. (Continue reading the full article on the web.)

0 views
Entropic Thoughts 1 months ago

Cheaper LLM labelling

I have a small project where I needed to label commits as either “maintenance” or “new development”. The obvious way to do it is with a cheap but relatively capable LLM, like GPT 5.6 Luna. I tested it on a small set of commits and manually verified its labelling, and it emitted the same label as I would have for the entire test set. That was good enough for me to roll out on a wider scale. If we have Simon Willison’s CLI tool installed (and you should – it’s great!), we can call it in a pipe from Perl, and read its response. My script had a loop that retried the request a few times, but without that bookkeeping, the code for this is simple enough. (Continue reading the full article on the web.)

0 views
Entropic Thoughts 2 months ago

Tag index for Org mode blog

Since people keep asking how this blog is made, and I don’t want to share the awful, terrible code that it is taped together with, I’ve decided to start explaining parts of it piecewise. Generally, any time something breaks and I have to fix it, I write down what I did and what it connects to. The most recent issue was the stack limit being blown by a helper function involved in generating the tag index. I had written it to be explicitly recursive, which worked fine with a small-ish number of published articles, but not anymore. The tag index creation follows a similar pattern to the RSS feed generation detailed in the previous article. (Continue reading the full article on the web.)

0 views
Entropic Thoughts 2 months ago

A curmudgeon tries a language server

I write code roughly the same way I did ten years ago: I make edits in my text editor, I switch over to a terminal window and I run a command to compile and execute the code. I look at the result, then switch back to my editor. If I am unsure of what happens, I either add tracer prints to the code and restart the program, or I restart the program in a debugger. If I hit an exception that crashes my program, I fix the problem and then restart it. I’m envious of what Lisp programmers do. Lisp development typically happens by typing code directly into the REPL to add, remove, and replace parts of the live, running system. (Continue reading the full article on the web.) A Lisp programmer does not need to “switch over” to something else because they are already inside their program process. They never “compile and execute” the code because the code is already running and they edit it by hot-swapping code. They never restart in a debugger because they are already inside their program process and can inspect anything they want. They don’t have to restart the program on exceptions, because the condition system allows resuming the crashing code from anywhere in the stack after the system has been patched with a fix.

0 views
Entropic Thoughts 3 months ago

Snakes and Ladders

It is common for promotional pamphlets aimed at children to contain a themed variant of snakes and ladders . This is the “game” where the players toss a die, move as many places as the die says, and then some spots on the board have an event that send the player forward, or back, or give them an extra toss or whatever. The theme is typically related to whatever the promoter wants to promote, but styled for children. I get the appeal – for children. They can probably imagine they’re really travelling along the path! In the variant pictured below, there’s forest and water and tunnels and dogs and everything! (Continue reading the full article on the web.)

0 views
Entropic Thoughts 3 months ago

A noob learns FFT

I have never done any time–frequency transformations. I understand the general idea, but I have never worked with the details. Today I had a reason to use it, but that means learning the basics first. The following is three seconds of a single 5 Hz sine wave, recorded at a sample rate of 100 Hz. (Continue reading the full article on the web.)

0 views
Entropic Thoughts 3 months ago

Purely functional digital circuit simulator (SICP 3.3)

I have a copy of SICP, or as it is also known, The Wizard Book . This book is widely praised, but I can’t take the time to work my way through all of it. Instead, I’m going to occasionally jump into the parts of it that look interesting. Since last week, are in the process of simulating a digital circuit. The reason this is interesting is the solution in SICP uses hidden mutable state and message-passing to make the code object-oriented. It even uses a mutable global variable for scheduling! We managed to replicate all of that in Haskell, but now we want to refactor the solution to be easier to work with. If we are going to manage the simulation in a pure functional manner, we still have to contend with the fact that during simulation, wires are objects with a fixed identity. A wire does not become a different wire just because its signal changes – the same wire is still hooked up to the same gates. Wires need to maintain their identity somehow. (Continue reading the full article on the web.)

0 views
Entropic Thoughts 3 months ago

Kuiper Q-Q plot: are these the same?

When we tried to get an intuition for the differences in distribution functions, we learned that children subjected to a treatment had greater variation in their score than the reference group. (Continue reading the full article on the web.)

0 views
Entropic Thoughts 4 months ago

A full body MRI earns you a year of smoking

Alternative titles: These are all about equivalent to the risk of one year of smoking. (Continue reading the full article on the web.) … earns you a high-risk pregnancy … earns you an ascent of Matterhorn … earns you 10,000 km on a motorcycle … earns you two BASE jumps … earns you a day on the frontline in Ukraine

0 views
Entropic Thoughts 4 months ago

Data-directed programming in Haskell (SICP 2.4.3)

I have a copy of SICP, or as it is also known, The Wizard Book . This book is widely praised, but I can’t take the time to work my way through all of it. Instead, I’m going to occasionally jump into the parts of it that look interesting. Last week, we looked at tagged data in Haskell. The authors of SICP weren’t convinced that’s the best approach, so they move on to data-directed programming. We’ll do the same. Complex numbers can be stored in their rectangular form, with a real and an imaginary part. They can also be stored in polar form, where there’s a magnitude and an angle. Whichever way a complex number is stored, we would like to be able to query it for all of these four quantities: (Continue reading the full article on the web.) The real coordinate in the rectangular form of the complex number. The imaginary coordinate in the rectangular form. The magnitude in the polar form. The angle in the polar form.

0 views
Entropic Thoughts 4 months ago

Tagged data in Haskell (SICP 2.4.2)

I have a copy of SICP, or as it is also known, The Wizard Book . This book is widely praised, but I can’t take the time to work my way through all of it. However, sometimes I jump into parts of it that look interesting. Today, we’ll see how to support multiple representations of data through tagging. This article is written in Haskell throughout, but at the start it will look a lot like the Lisp code in SICP. I have intentionally tried to recreate the SICP solution as closely as possible, including dynamic typing and all. See the appendix if you’re curious how it works. Complex numbers can be stored in their rectangular form, where there’s a real and an imaginary part. They can also be stored in polar form, where there’s a magnitude and an angle. The authors ask us to imagine that two people have been working on a library for mathematics, but ended up choosing different ways to store complex numbers. How can they write their code so that they don’t have to agree on one way to store the data? (Continue reading the full article on the web.)

0 views
Entropic Thoughts 5 months ago

Lean, not backpressure

Lucas Costa has written a good article on how to build systems that can handle code-generating robots. Unfortunately, when calling it backpressure , he used the wrong metaphor. Backpressure is about signaling to upstream processes that they are running too fast and need to slow down. The suggestions presented by Costa are mostly about signaling to the upstream process that it needs to do things differently , rather than just slow down. This has more to do with ensuring sufficient quality is sent downstream, rather than quantity . This irked me. As I was reading, I was searching for the right analogy. I kept coming back to lean manufacturing . The more famous half of the lean philosophy is waste reduction. The other half is about managing the unstable input of people. That’s what we’re interested in here. (Continue reading the full article on the web.)

0 views
Entropic Thoughts 5 months ago

LLMs and almost good code

TL;DR: My new prior is that top-of-the-line LLMs working on easy tasks generate code that is maybe 10 % more complicated than necessary. I also think we accept this complexity too easily, because it comes from code that is right here , right now , solving an immediate problem. This may have consequences for maintenance in the long term. The background to this discovery was that I needed to do some CRUD plumbing in a work project. It was a simple change that mostly mirrored existing functionality. This is a perfect fit for LLMs, in my experience, so I used a frontier model to generate the code for it. The change ended up being a total of just over 200 lines, mostly additions. The part of the generated code we’ll talk about is a 24-line function that converts an arbitrary (user-supplied) string to a safe HTTP header value. (Continue reading the full article on the web.)

0 views