KM + Generative AI => Agentic AI

This will probably be a controversial post. People have very strong opinions on AI. If someone can spot any errors or omissions in this post, please correct me. (I can correct my message if you spot any errors.) And here’s another warning: I’m not very smart so there could be mistakes here.

Most AI programs that you can download today for macOS are traditional “generative” AI which means that they don’t have any ability themselves to read files or screens or any data on your Mac (as opposed to agentic AI applications when can read or write to your computer.) All they can do is read the text that you type or listen to words that you dictate into the microphone. Here is what a basic generative AI app looks like, in terms of input and output.

Whereas here’s what an agentic AI app, like Siri AI in macOS 27, (there are other apps, at least for macOS) looks like:

As you can see above, an Agentic AI chatbot can read system resources like your file system (including files, emails, text messages) and then even modify those resources. (These agentic apps are usually limited, by Apple, to macOS as opposed to iOS or iPadOS. Apple doesn’t block this sort of app from macOS, largely because a macOS computer can obtain apps from outside the Mac App Store.)

Siri AI (in the new macOS 27 and other Apple OS’s) can do agentic things, but everything it does has been written by Apple and Apple can vouch for its safety. For example, Siri AI can write to your file system in a number of ways, such as sending information via Safari to update your passwords, or sending text messages.

(Sidenote: The EU wants Apple to allow third party AI vendors to replace their version of Siri AI with another company’s version, but this will never happen because it means giving third parties full access to all user data and the ability to send that protected data out of the device to a third party corporate HQ.)

There’s a third diagram I need to draw here, because it illustrates how Keyboard Maestro can interface with AI apps to provide solutions that can’t be provided by either Siri AI or third party AI apps. Basically, by adding KM to an existing generative AI app, you can create an agentic AI app.

Arrows 1 & 2 represent all the actions that KM can use to fetch data from your Mac, like actions which open a file, or capture a screen image. Actions 5, 6, and 7 represent the actions that KM can use to write data to the system, like Display Window, Play Sound, and Write to File.

The new part worth thinking about are arrows 3 & 4 which are methods that interface between KM and a generative app. Over the last few weeks I’ve written a few macros that send data from KM to an AI application, and retrieve their results. From there, my KM macro can do some processing and then perform actions which are similar to the results of Agentic AI. Essentially, Keyboard Maestro can be combined with a generative AI program to create something equivalent to an agentic AI program.

One of the main challenges with Arrow #4 is that until recently, data returning from an AI app was in free formatted English text, which is quite difficult for a KM macro to process, for several reasons:

  1. The text is often returned in RTF format, and removing RTF structure, to process it, could damage the result.
  2. The text is not always consistent. Each request (even if using the exact same words) can return a different set of English words. E.g., if you ask “What is the capital of Canada?” you could get the result “Ottawa is the capital of Canada” or “The capital of Canada is Ottawa.” It’s not easy for a KM macro to capture the actual answer. Sometimes careful wording of the question can limit variation in answers, but it’s never easy.
  3. There is no built-in action in KM for speaking to generative AI apps (there probably should be, hint hint) and returning the results.

However I have managed to create some KM macros which implement all the arrows from #1 to #7. For example I wrote a macro that allows me to ask the user for the name of an object (using a Shortcut that converts a user’s spoken words to text), then passing that text along with the screen image to an AI agent, along with the words, “find the X and Y coordinates of the item described by the following text within the attached image", and then waiting for the AI chatbot’s results, and then analyzing those results, extracting the coordinates, and then moving the mouse to each of the location(s) specified in the results, after converting the results to screen coordinates. My results were a little inaccurate because I was using a two-year old LLM.

Step #4 is about to become much easier with the “fm” command in macOS 27 because it supports schemas which allows us to specify the JSON object names that we want the AI application to return as its output. Where fm falls short, I think, is that it’s not an agentic AI app like Siri AI. But I’m not sure yet if Siri AI for macOS 27 supports a “type to Siri” mode, like previous versions of macOS support. If so, I could write an entire new post about that.

In summary, I think Keyboard Maestro has a great capability to let us write macros that interface between the user, the system and AI applications, like Apple’s fm or other AI apps. When I get macOS 27, I plan to experiment by using KM to use fm to process some user data, and then take action in a way that no generative model can do.

Apologies should I be missing something but is this not possible today albeit integrating a "bridge". I have a number of Keyboard Maestro macros -- some of which are posted here -- that do just that:

  1. Keyboard Maestro is used for command, control , direction ,etc.
  2. Keyboard Maestro calls a Python Script which does the heavy lifting
  3. Python Script when needed calls Claude which writes files, etc. on my MacBook.

If I am missing something please let me know.

I can’t really speak about Python because I don’t have it. But even if I did, I suspect Python apps have access to your file system (both read and write) so it’s not really acting as a bridge in the sense that I’m talking about here. I’m talking about using KM to incorporate apps which do not have read or write access to system resources.

Anthropic's Claude app can do a lot of agentic stuff on your Mac. Give it rights to a folder, and you can say things like "Rename all the files here with a sequence number, and modify their date formats from "Jan 1 2023" to "2023-01-01." Claude will then rename all the files. I've found its abilities with files in Finder to be quite good, though it uses shell commands to do most of its work.

It can also work with apps, after you grant it approval, though how well this works varies by app. You can tell it to "Create a new smart album in Photos with all the pictures I've taken in the last six days," and it will then ask for control of Photos, and figure out how to do the task. Things like this tend to be quite slow if it doesn't know how to do it intrinsically. I'm not sure if they improve after you've done them once or not.

I believe ChatGPT also ships with agentic capabilities, but I don't like OpenAI, so I don't use their stuff.

-rob.

Exactly what I am doing..I am using Python Scripting to get to Claude Code to make changes to my MaBook's files, it is not Python Script that is making the changes.

Exactly and when you need to co-ordinate a bunch of stuff I use Keyboard Maestro as the "steerer".

Cordite is an explosive. You use KM to make things explode? :wink:

As I said, I have discovered new uses!

Apologies, it should be co-ordinate, fixed in the above post!

Have you tried this? As I understand it, the AI password resetting doesn't use Safari at all, and if it did it certainly wouldn't be Safari writing to disk!

And you're drawing a false distinction between generative and agentic AI -- agentic is an advanced layer on top of generative. Probably better to distinguish between chatbots and agents -- a chatbot talks, an agent acts.

That was the impression I got from the Keynote. But I could be wrong.

I’m not sure what you mean by I made false distinctions. What was false? It looks like your definition is compatible with my original post. Where do you see a difference?

That’s compatible with what I’m saying. Why do you say it’s not compatible?

Your second paragraph -- you say that:

You're saying that because they are generative they can't access screens/data. Agentic can so, from what you've said, they can't be generative.

I'm not. But it does say in six words what you said in 60, and is a direct lead-in to what you seem to be proposing -- that you could use KM to grant a chat bot some of the abilities of an agent.

In short -- with a lot of work you can turn Keyboard Maestro into a harness, albeit a pale imitation of Claude Code, Codex, et al.

Remember -- Agentic AI isn't just about giving some data to an LLM for processing or doing something based on the output of the LLM. We can do those already, and people (including, I think, yourself) have posted macros to that effect. Proper Agentic AI is about taking some wooly "user intention", using the LLM to refine that into a proper plan, creating a series of actions to fulfil that plan, then iterating over test/fix cycles until successful.

Much of that will be very difficult until such a time as KM macros can be built by LLMs. Until then, better to think of the LLMs as just another external function -- like shell/AppleScripts or "Get URL" -- that you can use as part of your hand-crafted macro.

And yes, you could query an LLM to get a bash script that will (allegedly) do whatever you've typed into a KM prompt, write that script to disk, execute it from a shell script Action, no user intervention. Indeed, you can do that now. But I'd strongly recommend against it, unless you've an up-to-date backup and enough spare time for full restore of your system disk!

I’m not smart enough to follow your argument there. In the very title of my thread I said “KM + Generative => Agentic” which explicitly says that all agentic AI includes generative AI.