
Last time, I described how I used Stardock’s Clairvoyance to help fix several issues with the WinUIpad codebase. The next steps were obvious: Ask for another code quality check and then see what this AI pair programming solution could do about adding some new features to the app.
After configuring Clairvoyance and Anthropic Claude Pro on a second laptop, I figured it wouldn’t hurt to ask for another code review. Predictably, it didn’t find as many issues, nor were most of them serious. But it did locate some issues, and I allowed Clairvoyance to fix each in turn, checking as I did throughout the first pass to make sure that the changes didn’t break anything and that the app still worked.
Since I already described the interactions in detail last time, here I will be more concise. Clairvoyance found and then fixed the following issues in WinUIpad:
SaveMenu_Click() calls SaveAsMenu_Click() without awaiting it. I’m surprised there were any issues like this to begin with—the first Clairvoyance code review found a similar issue elsewhere—but this fixed one of the issues I’d been having when the app closes.
Go To Line splits on \r only. As with a similar issue found in the first pass, the code for Go To Line didn’t handle Windows-style (\n) line breaks.
SaveDocument() silently returns false if the file was deleted externally. This is a rather obscure what-if scenario that I’m pretty sure I would have never even considered myself.
Beyond those, Clairvoyance listed out the instances in which I had stub (empty) methods for various features I intended to add later and two “minor code quality” issues. Neither of those seemed particularly important to me, so I figured it was time to see about adding features to the app (in some cases, adding back features that existed in previous versions of the app).
The first was one I had started working through in the WPF version of the app, .NETpad: A Recent submenu under the File menu that listed recently accessed documents and provided a way to clear that list, as per Notepad in Windows 11.
When I was working on this in .NETpad, I had researched various ways to store this information and decided that doing so via the Settings.settings file would likely be the easiest and work well. But for Clairvoyance and this Windows App SDK-based app, I was curious whether the options were different. So I asked it to create an Exhibit through which I could compare four or five different solutions.
This is what it created.

The first option mapped to what I had decided to do previously, while the JSON and SQLite versions were a lot less interesting. The Jump list option is actually interesting, too, but more as something to use in addition to the Recent files menu. But first things first. I asked it to implement the Settings.settings-based option.
I can’t recall what I was expecting, but Clairvoyance got started and then finished surprisingly quickly. So I examined the changes.
First, it added a RecentFiles setting to Settings.settings of type System.Collections.Specialized.StringCollection, which, again, is what I had started doing months ago in .NETpad.
Then, it went to the XAML for the main window. It created a Recent files submenu item under Files, and also a Clear recent files submenu under that, in the MainWindow.xaml file, along with separators. Nice.
Finally, it created a RecentFilesManager class (in a new RecentFilesManager.cs file) with three helper methods and added three methods to MainWindow.xaml.cs to handle the click events and accompanying logic. It calls one of those methods, UpdateRecentFilesMenu(), in the MainWindow() constructor so that the menu fills in when the app loads. UpdateRecentFilesMenu() is also called when you open a new document, save a new document, or “save as” a document, all of which makes sense.
Clairvoyance used my commenting style to separate the new Recent files-based methods from the rest of the code, which is excellent.

There are RecentFileItem_Click() and ClearRecentFilesMenu_Click() event handlers, as noted, but most of the action occurs in UpdateRecentFilesMenu(). All three are straightforward. And, yep. It works great.

Next, I wanted to add a .NETpad feature back to WinUIpad: The ability to toggle between word count and character count in the status bar. In .NETpad, it’s set up so that the user can just click that control to do the toggle. So I prompted it with the following:
let’s add a word count/character count toggle when the user clicks that control in the status bar
Clairvoyance examined the code and determined that it would need to make three code changes: Add a state field, update the UpdateCount() method, and then wire up the XAML. And then it made those changes, while adding a CountText_Tapped() event handler. And yep. There you go. It even added a nice tooltip.

Next, I decided to start on some of the more advanced functionality that I had been putting off. I prompted:
Is it possible to implement spell checking in this project
Clairvoyance assessed the codebase, looked at the XAML for the TextBox control and the settings page, and checked Settings.settings. And then it reported the following:
Yes, this is very doable — and it’s essentially free. WinUI 3’s TextBox has IsSpellCheckEnabled and IsTextPredictionEnabled built right in. The work is purely plumbing: name the two toggles that already exist, wire their handlers, and save/load the settings.
It then listed the changes it would need to make across five files. This included adding SpellCheck and Autocorrect settings to Settings.settings, creating a LoadSpellCheckSettings() method in AppSettings.cs, naming the two related ToggleSwitch controls in MainWindow.xaml, adding two toggle handlers to MainWindow.xaml.cs, and various other changes. It then changed all five files as promised. And once again, it just worked.

After that, I got aggressive. I asked Clairvoyance the following:
Can you create an exhibit to give me four or five options for implementing rewrite and summarize and other AI-based writing features that only use free AI whether it’s cloud-based or local?
This one took a while, but here’s the exhibit it finally created.

This may be more impressive than is immediately obvious. For example, you can click any of the option cards to see a more detailed look at how the implementation would work.

It also created a summary of the options:

And it also provided me with the following advice: “My personal recommendation: start with Gemini (easiest, best results) with an Ollama fallback for privacy-conscious use — you can detect Ollama’s availability with a quick health check to localhost:11434 and let the user choose.”
You have got to be kidding me.
Anyway, I decided to let it go for it. This operation also took a bit of time, but Clairvoyance created a AiWritingService.cs file for the core logic, added an AI features expander to the app settings page that matched the other expanders I had created, and wired up that and the right-click Rewrite and Summarize context menu items. “If nothing is selected, it shows a helpful prompt instead of silently failing,” the summary noted. “If both Gemini and Ollama are unavailable, the dialog explains what to do.”
This seemed too good to be true, and in this case, finally, it was.
As noted, it added an AI features expander to settings where you can enter a Gemini API key if you have one.

If you access the right-click “Rewrite” or “Summarize” items without first selecting some text, you get an informational dialog to that effect.

And if you select text and choose one of those items, a dialog appears stating that it is “thinking,” and then it fails with an informational dialog explaining what you need to do.

So far, so good. Since I have Gemini through a Google AI Pro subscription tied to a Pixel phone, I got an API key and pasted it into the text box in the app settings page. And then I tried again, experiencing my first failure of any kind with Clairvoyance. Or so I thought.

This wasn’t too troubling. After all, I had asked for something fairly convoluted. But after retrying this a few times, I finally decided to install Ollama and see how that went. You can check to see whether Ollama is running by navigating to http://localhost:11434.

So I tried again. Once again, I got the “thinking” thing and then the same failure as above, even though Ollama was running. So there was something wrong, obviously.
I took at look at AiWritingService.cs, hoping that perhaps the call to Ollama was using HTTPS instead of HTTP, which won’t work. But that was correct. So there is more troubleshooting to do. But when I started down this path, it was late in the day, we had to head out to dinner, and so I left it for later, figuring I would simply tell Clairvoyance that this new functionality wasn’t working.
But then days went by. I later stupidly went down the path described in the next section instead. But looking at this now, I decided it was time to follow up. I did so with the following:
The AI features don’t work. When I try Rewrite or Summarize, it fails even when Ollama is running (as it is now) and even though I added a valid Gemini API key to settings. Can you figure out what’s wrong and fix it?
So it got to work. In less than a minute, it claimed to have found two problems, which it then fixed. It also made an improvement to the error details, it said, so that the user would know exactly what was wrong. But when I tried it again, using both Gemini and Ollama, it failed as before.
It still doesn’t work.
I went back and forth with it a few times while it tried various fixes. This mimics my experience with other AIs, though Clairvoyance still performed better in that the app compiles and runs fine whereas many of the issues I had with AI-generated code elsewhere resulted in compile errors. So this is still an improvement.
I did finally get the updated error messaging in the dialog. I couldn’t read all of it, just a basic formatting issue, but I sent Clairvoyance a screenshot. It recommended that I clean the solution in Visual Studio, which clears all the user data, and then rebuild it. That would clear out the Gemini API key among other things, so I did that and re-ran the app. Nada.
While I was going back and forth on this, Ollama told me it had an update to install, so I did that. But it still wouldn’t work either. If I removed the Gemini API key from settings, it would at least produce a readable error using Ollama. But it still didn’t work.
Clairvoyance eventually asked me to tell it what the error messages were telling me. It made some changes, but then it finally said that I was perhaps running into limits with the free version of Gemini (no) and perhaps didn’t have any Ollama models installed. That seemed unlikely, given that I had it running. But sure enough, a command line later, I could see there were no local models installed. So I installed one using a command line that Clairvoyance provided. Then I re-ran the app.
And God help us all, it works.

There’s more debugging to do here. Gemini should work. I would like to add Copilot+ PC-specific code here, too, and build out these features more. But … wow. Just wow.
Emboldened by what has mostly been an incredible string of successes, I stupidly jumped the gun the other day and decided to see what would happen if I just asked Clairvoyance to create a fully working clone of Notepad in Windows 11 with all its features, including its support for multiple documents and tabs. I intended to start clean instead of having it add this functionality to the existing app, in part because I was curious how it might structure the app itself. So I created a new empty folder called Tabpad in my Code folder and then created a new Workspace in Clairvoyance, which I pointed at that folder.
My belief was that in creating a new Workspace, it wouldn’t use the code in WinUIpad for context. But when I prompted it to create this new app, it began pulling in the code from WinUIpad. I don’t know if this was a mistake I made or a bug in Clairvoyance, given its early access status. But I decided to let it go and do its thing. This operation took a long time, meaning perhaps even 30 minutes. But when it was done, I gingerly opened the new project in Visual Studio, expecting failure.
And that is what I got: This new app wouldn’t build successfully for various reasons over several attempts and go-rounds with Clairvoyance. Without beating this one to death, I did finally get it to successfully build from the command line. And then, after pasting in an error message from Visual Studio, Clairvoyance told me the fix for that was easy, and it created whatever configuration file and added it to the project. And then it built successfully.
Hm.
I clicked the “Start debugging” (F5) button. And this appeared.

There are several style issues here, but I’ve solved all of them in previous versions of this app, so those are easily fixed. The most obvious is that the currently selected tab is white and not the same color as the menu bar below it. But the Settings (gear) icon is in the wrong place, too, and the status bar at the bottom has a border line at its top. Among other things. But whatever, these are minor and, again, I do know how to fix all that.
But here’s the thing. It works.
I mean, F$%k me. It works.
It handles multiple tabs and documents. Great. I mean, just incredible, but there it is.

As impressive, it added the line ending and encoding features I literally gave up on several years ago, assuming these were impossible to implement. Both features are accessible by clicking their entries in the status bar and via submenus under Format.

Because it used my code as its base, this new app has some nice little additions I had made previously, like the Edge-like curves on the corners of the textbox and how it indents on each side rather than running up against the edge of the app window. But it also implemented an MVVM-like architecture that probably does make sense for something this complex, and this was an area I had been exploring but may never master.
This is f#$king incredible. I hope that’s obvious. I’ve been working on modern versions of this app for two years and struggled for several months with various multiple tab/document implementations and I never got anywhere close to this.
Now, this AI-made app doesn’t just become WinUIpad. Instead, I’m going to examine how this thing was created and then start the project over from scratch, using my code and this new project as guides. And we’ll see how long that takes. But I know I can make a cleaner-looking version of this, and I will. And that will become WinUIpad. And then I can finally move on with my life. There is more to do here but I have other programming projects I’d like to tackle, too.
Whatever happens next and however long it takes is somewhat beside the point. This will work. And that is borderline insane.
More soon. Or whenever I pull this all together, at least.
With technology shaping our everyday lives, how could we not dig deeper?
Thurrott Premium delivers an honest and thorough perspective about the technologies we use and rely on everyday. Discover deeper content as a Premium member.