Skip to content
Linkdrop
Links

S04E02 · Building Portable Agent Control Planes: MEGA lesson video by John Lindquist

John Lindquist explains how to build widgets that surface agent tasks and suggested memories, and triage issues from external services. He covers testing widget outputs in a lab, reducing overstatements, and choosing models based on quality, speed, and cost.

videoJohn Lindquist · hq.mega.dev · Saved Nov 19, 2026

mega course, agent memory, agent observability, agent evaluation

Transcript of the lesson video for S04E02 of the MEGA.dev course, by John Lindquist. Agenda: Configuration · Portability · Knowledge Delivery · Operations. The video plays on the lesson page in MEGA Student HQ (needs a login).

John Lindquist (MEGA.dev) S04E02

Quick tip: map shortcuts to commands

00:00:01,860 --> 00:01:11,660 [John Lindquist]

Let's start with a quick tip before jumping into the materials for today. If you find yourself using one of the commands that we build over and over and over again, like slash split, or the command to open your notes agent. Just rest assured that your workspace probably provides a way for you to assign a keyboard shortcut. So go ahead and ask your agent while you're inside of your harness repository. Please assign the option one keyboard shortcut to slash split or option two to slash lab. Or however you want to organize it. in Py you do have a slash hotkeys which will list every shortcut that's already bound. So you can browse through for what's already taken or even ask your agent to suggest a shortcut that's not taken yet. Or if you want to push the concept even further and want to challenge yourself a bit. Ask your agent to build a command bar. that can open up over your workspace and have a searchable list of commands. Keep a list of recent history. and surface all those common things you do inside of your harness all the way up to your workspace. So you can build a beautiful experience for yourself. That's customized to your harnesses and your commands and your external tools. and anything else that you want to have just a couple keystrokes away.

Widgets

00:01:11,759 --> 00:01:56,860 [John Lindquist]

So, how often do you find yourself asking what's going on in your workspace? You kind of lose track of either the main session or all the sessions you have running. Or some external tools that you need to check on all of the time. Let's go ahead and add some intelligent visualizations and we're going to call them widgets. I'll define a widget as an intelligent visualization of critical information. It gathers from your project and your tools, then slaps a model with some judgment on top. It can invoke a script or call an MCP to go fetch some status from somewhere. And the widget can bring it all together and present you with a glanceable. And clean presentation of exactly what you need to see. We'll start with everyone's favorite app to build, a to-dos widget.

To-dos and Memories

00:01:56,860 --> 00:04:11,160 [John Lindquist]

Now the nice thing about this to-dos widget is that it can watch every conversation that's going on inside of your workspace. Or more specifically, all of the conversations inside of your focused space. When any new text comes streaming into one of the panes, a small fast model can read it. and present what it's doing, what's done, and what's waiting on you. Then you can just look over and see what the active task is, or see if there's any blocking decisions. And you never have to manually update it or touch it at all. It's mostly a reflection of what you prompt for and what the agent responds with. Then we can build another widget right underneath our to-dos widget, and we'll call that memories. Anytime I type a new prompt, like keep all money in integer sense, My memories agent will look at my prompts and see if there might be anything worth saving to a memories file. It will suggest the memory and if I click a keep button or trigger a shortcut. It can just write that line to my memories file. And I can link that memories file to my agents.md so that every new conversation in this repo starts with my curated list of memories. And I understand there's a million different memory solutions for working with AI agents and that the benchmarks for how well they perform are all over the place. The key here for this system is that nothing happens automatically other than suggesting to you. which memories you might want to keep. And it does it off to the side where you're not bothered in the main conversation. You can just get around to managing the memories later. And it's at your discretion whether or not a memory is really that important to keep. So my workspace draws these with its UI kit. Herdr ships with a UI system. That allows you to make native components. So you describe the buttons and switches and the list and JavaScript and it just draws them natively. If your workspace doesn't have a UI kit like this, It probably has an extension system or a plugin system. Or you could just show a web page with a dev server. Or worst case scenario, you could build a terminal user interface, just leave that open in a pane. and there's a countless number of amazing terminal UI libraries that can achieve the same thing. There's no right or wrong solution here. It's more about the concept of Having a small light agent watching all of your decisions. And then later on you can decide whether those decisions are worth codifying into your code base.

Ask for /widget

00:04:11,250 --> 00:05:17,860 [John Lindquist]

So to streamline making these, we'll make one the exact same way we made our slash agent. You can ask your agent for a slash widget command. You give your widget a name and where the data comes from, which model it should use to judge, and what you can do with each item in the list. And work with your agent on making it intuitive for you. You can then toss your widgets into your lab. So that it's hidden away inside of a black box. Let your lab install the widget, verify that everything is showing up correctly, and that you can evolve the behavior in there as you watch it grow from a hello world, a very basic version of a widget all the way up to the exact thing that you need. once the widgets graduate from the lab, you just install them into your main workspace, pin them to the side. And let them watch what you're doing. And one of the key benefits is you can avoid asking those, please explain like I'm five, or use BroTalk. or write a summary or many of those prompts you're probably used to writing in your main conversation. Where you lose track of what's going on. Because your to-dos widget is keeping you up to date. And has a list of everything that's been worked on And your memories widget has a list of all your decisions.

The Issues widget

00:05:18,283 --> 00:06:18,360 [John Lindquist]

Now that we're watching our workspace, how can we watch things that are going on in the outside world? For example, how do I triage everything? from everything that needs my attention and get that into my main conversation. Rent a Place has a support inbox, page feedback, board of cards, And I know how much we all love managing task trackers. It's just a massive amount of work to read every single morning. So let's build a widget that reads them all for you. In your main conversation, you type/ widget issues. And we'll tell it: read rent a places support inbox and board, pick the few most pressing with one line on Y, and keep the source ID for everything. Then give me the key points for what to do next. And here's what makes it trustworthy. Plain code goes and gathers the report. and saves your agent from all that time of looking for it itself. Once it gets the data back from all the various services, you allow the model to judge what's pressing and write summaries on why they're pressing. and it's up to you to define what pressing means. and which services you want to tie this into.

Test it in the lab

00:06:18,407 --> 00:07:26,960 [John Lindquist]

Then we'll go ahead and toss that into the lab. We can watch and judge to see if it gets the most pressing issues. and the quality of the whys and the sources it's pulling from. look at the outputs and see if it's giving us everything we need to be able to act on. the issues it's presenting to us. So based on rent a place, if you read the top one closely, you might find a ticket that asks, When will the refund show up? And the widget says, four guests report missing refunds. That's not what they said. They asked when, and nobody said anything was missing. So make sure you get your expectations down. Especially rules like, never overstate what a ticket says. and avoid interpretation. Then we can run that through our lab again, make sure that it meets our expectations. And ensure it's not overstating anything anymore. as we change the widgets instructions instead of the expectations. We can start eliminating some of the failures. We can tell it to use more plain category words or ask it to load in something like our glossary or our domain-driven design documents. So we're more in sync. That could probably lower them more. And ensure that when it's pulling from the cards to always use its own words. And keep on shrinking those down.

Hill climbing and trade-offs

00:07:27,226 --> 00:08:30,660 [John Lindquist]

And we can either be involved in that loop or we can ask our smart agents just to hill climb for us. Just keep an eye on the report and iterate with it until the issues widget is the exact tool that you want. Now a setting that I tested in the evidence of this run is when I ran it on a small fast model like haiku. it overstated the issues about twenty five times. If I switched it over to a bit larger model, then all twenty-five of those issues went away. So you can make a trade-off if you run into a lot of issues with the smaller models. thinking levels of the model or you can bump the model to a little bit higher. it's just a game of trade-offs of how much time do you really want to spend? iterating to get the small fast model working correctly. But the great thing is because it's all automated. You can ask your agent to run the lab with any model you have access to and then just pick the one that passes the report the best. and you can even have it do its best guess on what the cost would be. or benchmark how fast it responds. As always, when you're working with agents, there's no perfect solution. There are always trade-offs. And you have to find what works for you.

Keys under the list

00:08:30,924 --> 00:09:52,480 [John Lindquist]

Now, if you want to build keyboard shortcuts into your widget, make sure you make them intuitive so it provides something like a legend underneath the list of options. For example, I like having command i jump to the issues pane. And then pressing escape jumps me back to the main conversation. So I could press command I and then up and down arrows. Or Vim keys. To select things I want to send to the main conversation or start a new main conversation, or to hand to other agents, or to simply dismiss. And you can even ask it to build a right-click menu. If you just want to hover over the issue you want to focus on, right-click on it, and give it a huge list of actions you might want to take on it. The key idea behind all of this is that most main conversations start with some issue or start with something that came from the outside. And streamlining that pipeline of receiving tickets that you can act on. and then having access to all of your tools like your to-dos and memories and everything in your workspace and whatever else you want to build. Allows you to go straight from that issue into power user mode. And just a quick note: this does differ from your critic and the other supporting agents. Because the critic watches the main conversation while the issues widget watches external services and reports. but they could both send information back to the main conversation, always remembering that the main conversation Is where you are interacting with your project.

From issue to work

00:09:52,530 --> 00:10:21,880 [John Lindquist]

So you drop an issue in a main, but main gets a cold. It knows the issue, but nothing around it. So what's the best approach here? You could do the legwork by hand, right there in the main conversation, find the code, check the history, search for related issues, and do that every time. But we can actually hand off that legwork. You can ask your agent to make The issue widget Gather information before it sends to Main. You have a small fast model read the issue, and that plans which gatherers to start as a swarm.

The swarm gathers

00:10:21,920 --> 00:11:54,580 [John Lindquist]

That swarm will go out as more small fast models, search in parallel, inside and outside of your project, and then main gets the issue. with all the context it could possibly need. So what's in the swarm? One agent can read the code and get the tests, another can read the history. One could go into GitHub. And search for related projects or related issues. And one could check for updates to libraries and other packages. And finally, you could even have one scan your past conversation histories to see what your past decisions were. and then every agent in the swarm should name its source, whether it's a file or a commit or an issue or a conversation. And if that gatherer agent finds nothing, it just says so. Nothing relevant is a totally fine answer. Like the widget itself. It should never overstate its findings. So when you trigger this action from the issues widget, the rules can write along with it. They can live in one file and you can own it. Something like find the cause before changing anything, reproduce it with a failing test first, give me your plan and your questions first, and ask before touching anything that touches money. This is your file and your prompt, so you can customize the rules to your project. as far as the general terms you want it to follow before resolving or working on any issue. So Main can receive the issue, the brief from the swarm, with the source in every line, and all of your rules. And thanks to those rules, Main doesn't start changing things. It comes back with what it found, its plan, its questions, and then it waits for you. And this is all from just sending that issue from the issues widget over to the main conversation with a single keystroke.

Why hand off the legwork

00:11:54,863 --> 00:13:04,560 [John Lindquist]

So why would you even do this? This is a bit anecdotal, but from what I've observed, the biggest time waster is when you first start working on something. And you have to stop and think about all the related things. before you really get up and going to build or fix that thing. And this way your bigger model, which costs more, can focus on the difficult task of solving the problem instead of the easy task of finding the Related materials. and instead of trying to build like a custom fixer agent in the lab This is one of those things where there's too many variables. which means it's something for you and your main general agent to take care of together. Let the swarm do the busy work, and then sit down with your main conversation. and take the time to think through the solution. So you can structure your workplace to surface the things that matter most to you. Which are usually triaged issues. And then within a single keyboard shortcut, gather all the necessary context and start working on those specific issues. And based on your project, you can customize those shortcuts. and the way the swarm works and the way you addressed issues. so that your tools and agents surface exactly what you need just in time. to really help you streamline your workflows.