My Haiku Agentic Programming Workflow

A few people have been asking about it, so I wanted to share my AI agentic workflow, and how I have been using AI to help program native C++ Haiku applications. I use AI agents a lot in my work as a data engineer, so when I read talk about Claude Code working under Haiku, I got excited. I wrote a handful of BeOS MIDI apps 20-25 years ago and I figured it would be neat to bring these up to date and fix bugs quickly with what limited free time I have. I did manage to get Claude working under Haiku for exactly one or two prompts, then it hung, then it just disappeared. I don’t think Claude liked the old version it was running, as new versions require compilation and no longer work on pure js. So where did that leave me? A hybrid approach of using AI agents on Windows to program native apps for Haiku.

haiku-reference-md

My first attempts were not great. While AI agents are great for writing Web based apps, or helping me sort out my database at work, they definitely fall short for a niche hobby API. Unless you give them the tools they need. After seeing it referring to the online HaikuBook and source, over and over again, I realized what it really needed was its own local primary sources. I achieved this using Antigravity/Gemini for Windows and created a series of python scripts to create .md file for agentic use. There is a script for the HaikuBook, BeBook, Haiku Internals, and Haiku Deep Wiki. They can all be found at my public repo GitHub - dcbeckman/haiku-reference-md: A Python script to pull the Haiku Book API reference material to a local knowledge base, in order to help keep AI coding agents on track. · GitHub Fee free to edit, adapt, and contribute your own knowledge bases if you think they are helpful for Haiku development. After pointing the agents to use it first as their primary sources, I noticed a marked improvement in Haiku development.

Sparse Checkout

Even with more grounded source materials, you will run into issues at some point. What really moved Claude Code in particular from an adequate Haiku programmer with the .md files to a Haiku engineer was having a local repo of Haiku source code to look at. Basically, you just inform your AI agent to use it as another primary source, and to “feel free to sparse checkout relevant Haiku source code to the [path]/haiku folder”. Then you just automatically get the relevant code you need for the tasks relevant to you, rather than having to check out the entire OS branch. The smaller source footprint also benefits the AI agent.

God-mode

At this point we were really cooking, but I ran into more bugs. I haven’t mentioned the setup between the two systems yet, so now would be a good time. On the Windows machine, I have a main repos directory with all of my projects. I use Antigravity for research, planning, scripts, and lightweight Haiku coding. I use Claude Code for more advanced coding and debugging needs. I also have the various projects setup in the Home folder of my Haiku machines (one x86 the other 64). Up to this point I was gitting on the Haiku side manually, and then I was like, why don’t I just give Claude ssh access? I mean sure it’s running as root since that is all that BeOS/Haiku allow. But it is also a hobby OS with no personal or sensitive data, just my repos, which the agents already have access to. So, a manual key generation later and Claude had the keys to the kingdom.

With ssh access, Claude went to work as a master debugger. One thing you need to do though is inform your AI to keep track of ssh sessions and not leave tests running in the background. After that, the agent was careful not to leave ssh running, but instead enable logging, and then come back to check on the logs later. This also cuts down on usage, because the AI doesn’t have to monitor things constantly.

I hope this information is useful for some of you, to help you with your Haiku endeavors.

12 Likes

Hi @dcbeckman

Thank you for sharing your workflow. This is very useful.

I currently use Claude Code in Haiku, but I have to pin it to an older version (2.1.112), because the newer versions don’t run in Haiku anymore. 2.1.112 works well, but it does not expose the newer models (Opus 4.8, Fable, etc.), so I had been wondering if it was possible to use Claude from a Windows or Linux to work on a source code in Haiku. The ssh approach seems the way to achieve that, so I will give it a try.

Also, thank you for the script to convert the reference material to MD format. This is very useful (I already have the Haiku sources and point Claude to them when something needs clarification).

Cheers,

1 Like

I would like to share a little of my working flow with LLM. I am new to write applications in Haiku and used to write in C/ObjC, but not C++. So I start with vscode on WSL (windows) which has a better integration of AI providers. I specifically ask it not to compile the code, just write. I have a script to use scp to copy files to a Haiku on qemu vm and use ssh to execute the compilation on Haiku. The output (and errors) is written in a file on host. I will then ask LLM to read the output file and fix errors. It is not very efficient, but I do not do vibe coding. Even with LLM, I still ask it to do small piece of work as I would do, reviewed by myself, run compilation and check the results. So the overhead of uploading files to Haiku is relatively small.

And the LLM is indeed not very good with Haiku. In a case, it made up a BOutlineListItem and cannot make it work. I give it the api page of BOutlineListView and it decides to use BListItem. Only after I tell it that BStringItem would be better, it then makes things work again. There are many small things my free LLM does not work. So even with the help of it, I still do a lot of reading to know and learn the programming of Haiku applications. I think it is a good start for newbies like me.

So I now have a RSS reader and a mastodon client (based on nanotodon) prototype working. I think it improves the experiences of me using Haiku daily. I do not need to depend on someone to write applications for me. I can do so for small tools. It is a win for someone knowing coding to a certain degree.

2 Likes

A bit of an update to my workflow and improvements made:

  1. With AI assisted coding, the number of projects I am working on exploded. One thing I didn’t do from the outset is to define a top level .md for Haiku projects specifically. This allows me to ensure consistent coding and practices from one project to another. So now the agents are aware of all of my Haiku projects, and are also aware of what repos have nothing to do with Haiku, and should never be read.I also defined my ssh preferences here, because certain apps use different machines (I am doing all of my midi driver and app work on my x86 32-bit box, and I work on my BeTon fork on my 64-bit machine, as that’s where I play music from).
  2. While I was in the .md creation mood, I also had Antigravity create a .md file from the reading the various platform issues we had run into from commit notes on my various projects. This step reaped great results right away. I will likely be adding my own personal .md file to my haiku-reference-md repo and hopefully other users can add on to that with their own common agentic Haiku programming issues.
  3. Instead of having Claude commit/push to GitHub from my Windows machine, per my instructions, Claude now sends the files over to my Haiku machines over ssh, makes, runs, and usually tests, before we ever make the commits and pushes. I think I am still committing/pushing from the Windows machine, but I pinned to LF in gitattributes so I wouldn’t encounter all of the compiler warnings. I could probably just as easily commit/push directly from the Haiku machine.
2 Likes