Skip to main content
View on YouTube to comment and like!

Syntax Video

How to Give Your AI Agent Long-Term Memory

Chapter 1 00:00

Transcript

To-do lists inside of AI agents have a major problem. And I'm going to show you how to fix that with beads. Beads. Beads. Beads. Beads. Now, if you've used any of the major AI coding platforms, you know that they all kind of implement their own to-do system. And these to-dos are often kind of just like a visual indicator of what's next. Now, the big problem with these things is that they're sort of ephemeral in that they just live in that session and you can't really share them amongst your team. So, what a lot of people end up doing is they make their own system out of a markdown file and then have the markdown files follow some kind of specd driven workflow. In fact, the editor Kiro even built this into the editor in its own markdown format and it does so really well actually giving you interactivity even allowing you to see the execution of each individual task.

However, this exists only in Kiro and really follows a strict spec workflow that you have to adhere to. So, what happens if you want to share these to-dos with other people or you just want to make sure these things don't change over time or the context gets out of control or compacted or this or that?

Well, in comes Beads and Beads is a memory upgrade for your coding agent. The way this thing works is that there's a SQLite cache that lives in your local application as well as a JSONL file that gets committed to your repo. And because of that, that means you can hook it into your git system. You can share these things. You can assign tasks. You can have a whole Kanban board setup.

It's really sick. So, I'm going to show you a demo really quick. We're going to install it in a project. I'm going to show you a little bit of how to use it and then we're going to connect it to some other tools and you're going to just see just how incredible this tool can be with other tools. So, the install for this thing is really simple. You can install it just via npm. There's even a quick install via curl. You can even install them via Homebrew if you want to do that. I already have it installed and I have this application right here which is just my own personal website. It's in flux. The website looks like trash. If you visit it, you'll see why there's going to be so many things that I'd like to fix on this thing. So, since I don't have beads configured or anything, we can do bdinit in this thing. And it's going to check to see a number of things. It's going to make sure you have a git repository set up. It then is going to initialize BD by creating a beads directory and the database. It's going to set up a prefix which is just going to be the project name. So your issues are going to be uh prefixed with

the name. In this case, it's Tolinski. And then you can see you could run BD quickart to get started. However, it does say the setup was incomplete. Now, every single time I've had to get uh this going, I've gotten this run BD Doctor to fix every time. And for the most part, that's that's no big deal.

When you run this, sometimes it fixes some of the things and sometimes it says it can't fix some of the things. Many of which are just adding the git hooks in. And these git hooks are really great because that allows the database to reync itself after git pulls and pushes and those types of things. But for the most part, this will all get set up once you're in your coding agent and then you run your BD onboard. Now you can run from the CLI if you want to just BD setup claude if you're using claude or BD onboard or you can head right into your claude or your OpenCode and you can say use BD onboard to get started with beads.

And this is going to do a number of things. It's going to run the BD onboard command. And what that's going to do is it's going to get your agents file, your claude file, and it's going to set them up with some default text. Much of this text is going to be uh stuff like don't use your internal to-do tracking, use beads for all to to-do tracking, don't create markdown files for this type of thing, which is great because it makes this all organized. Now, beads is more than just to-dos. There's also a a priority assignment. You can do epics.

you can really nest things and you can have some issues that rely on other issues that are blocked by some issues and then therefore when you tell beads to get to work on something, it only brings into context the item that it actually wants to work on rather than having to load up a whole MD file and parse through it, right? Um, you can see here that this initial file that it's creating again is really just instructions about to how to use the beads. Uh, and for the most part, I found that simply just having this as your agents.md uh, and as well as your claude.md works perfectly fine when using with Claude code. And, uh, it should work with any of your other systems. Like if you had a copilot stuff set up, it would also want to initialize this for copilot as well.

So, it does a great job of discovery. Now, because of this, you can tell this via the CLI. There's a nice CLI. You can tell that to run and create things or you can just tell the AI to create a new issue with BD create or you can just tell inside of Claude to create task that is uh let's just say fix header.

Okay. Now I don't actually have a task for fix header but you'll see that this is going to create a task for that. Um and it did run BD create. It has the task tag and how here we have a BD header. Now there's a number of things you can do from here and in fact if we head to another term of the same project I could do something like BD list and that's going to show me the items that are available. And you could also have one called BD ready which is going to show you the items that have no blockers. Again, this makes it really nice for the AI to say, "All right, what can I actually work on right now that there's no blockers and and that's really super cool." Now, so you can visualize some more of this, I'm actually going to have the AI bring in a whole bunch more tasks where I'm going to tell it to, in in fact, because I know there's a ton of linting errors in the site. run Svelte or run pnpm check

and add errors to BD tasks. Okay. And this is going to go through it's going to run the Svelte check command which includes a bunch of linting errors and actual issues or TypeScript problems. And it's then going to then take that output and then create tasks for those that I need to do or the AI needs to do. Either way, this system is really super good at keeping everything organized. And like I said, because it writes to a JSONL file that you commit to your repo, well, anytime that you are pushing and pulling, everybody's as they're working on their project should be able to get that updated task list from what needs to be done. And because there's a whole priority system, you can give the AI a bit more idea of what are the high priority things, what are blocked and non-blocked. If anybody else has ever tried to do this with their own bespoke markdown system, you'll know that the AI can really drift from it. And I found that this does a really good job of

doing that. So now you can see that it has created a bunch of tasks. If I go ahead and say BD list once more, you can see I have a whole bunch more. Now beads also has a number of extensions and various things to go along. In fact, there is a UI that you can get just via npm install beads UI or you can run it with npx uh beads UI and have an actual web UI interface if you like that. I've been personally really liking the BV terminal UI. And I'm not even a TUI kind of guy. I love my actual web UIs, but I've been really liking the terminal UI for this. and you can install it with a a quick little one curl and then from the project that you're in you can just type bv and then you're going to get access to this really nice terminal UI.

Now I'm zoomed in so typically you see a lot more information here than what you're seeing but you actually have access to all kinds of these are the information. These are bugs. This is a task. This is a bug. And you can see that there's these nice little emojis. So like fix sidebar layout map type error. So, if I click this and I look at this, I get the details about this. Now, you can see that there's all kinds of information from what the priority is to who it's assigned to and just general details. I'm going to show you a really killer technique in just a minute here uh that you can have the AI solve bugs for you like instantly. It's awesome.

Now, more than just that, there's also like the Kanban board view and stuff. So, if you hit B, you can get access to that. Again, I'm in some really zoomed in view, but this TUI here I found to be excellent, especially for visualizing what's going on. Let me even see if I zoom out of this particular window if it re and you can see as I zoom out of this, we actually get access to considerably more information here or without having to open them up. And also, as your projects grow inside of this graph analysis section, it shows you which issues rely on which issues, which are blocked by which issues. And it is just really fantastic. So now with that, we could just tell the AI to find all open tasks with the label of bug and fix them.

Okay, this is going to go off and do all of that. Okay, since this isn't code that I'm going to keep and I just want to use this as a demonstration, I'm going to just say, "Hey Claude, yolo, go fix all this stuff." And I instead of approving the code like I typically would, I'm just going to let it rip. And then we can see as it goes in action, it's actually taking different tasks and setting them to be in progress. And eventually we'll close them after they've been fixed. And this will all happen in real time, so you can check things out as they go. And with that, it went through and actually completed most of these tasks, which by all means were mostly easy. And since I didn't actually check the code, I don't even know if they were fixed accurately. Uh, but at least this system was able to maintain that issues uh tracking without me giving it any additional guidance. And it even came back and told me what the remaining open tasks were, what they

were, and where I can go to fix them. So, I think this is really, really cool. Okay, now I'm going to show you something that will blow your mind. Now, I use Sentry to track all of my errors in my applications. I have this production app. It's using Sentry. There's a number of errors in the past 14 days here. Not that many, but I would like to be able to attack them in a structured way. Now, many times I might create a GitHub issue from them and then start there. But I found this to be really nice. So, I'm going to say use century MCP to find all errors in the last 14 days for the project habit path on level up tutorials is the organization and it's going to go through and find all of these issues. I want you to add these as BD tasks with

the description containing the URL all relevant info and the sear root cause of the issue. Now this is going to go off. It's going to use the century MCP. It's going to find these uh these bugs in the last 14 days and then it's going to not only catalog them as tasks to do as bugs, but it's even going to run century seer AI that finds the root cause and it's going to put the answer to what the solution to the bug is directly in the description. That mean when I want to assign an agent to work on any of these, I really just have to say, "Hey, find the next ready available bug and fix it." It's not going to have to do any of that guesswork because Sentry has already done that work for us and Beads has done the work to catalog everything.

So that way we're not bloating our context with a bunch of unrelevant information that is stored in markdown files or tasks that we've already completed. and then therefore the end results end up being endlessly better. I'm not kidding when I say this is a killer workflow. This works so stinking well and I have been very very impressed with this. So it looks like it's going off and creating some of these. I'm going to go ahead and run BV so that way we can see exactly what these look like in the meantime. So I'm going to head over to my other term. I'm going to run BV. We now have several tasks. So, let's go ahead and open one of these bad boys up. And I found structured cloned is not defined. We're going to open this thing up. It has the sentry issue linked here.

It has the description and it has the SEIR analysis of what actually went wrong. The reference error occurs because structured clone lacks a polyfill for Chrome 79, which is 19 versions too old for native support. So, this was even able to know because Sentry has that information that the user was trying to load this on Chrome version 79 and therefore structured clone was not available. And here's how to fix it. So now when I go off and tell the AI, it's going to have all of this direct context. How cool is that? And then after this, it's going to want to run BD sync. This is going to sync. So that way uh anything that exists and it it doesn't have some workree stuff, it it doesn't matter because this is all going to get taken care of with the git hooks that were installed for us.

Anyways, so here we go. We have all of our missing tasks here and we can start knocking them off one by one, fixing those bugs and then closing those century issues as we go. So I found this to be really cool. Now, this project has a number of really cool things about the documentation, including a whole section on what they call landing the plane, which is an example of a AGENTS.md file that they have that explicitly tells exactly what to do to land the plane, whether that is running git push, uh, git stash- clear, these types of things.

You could essentially bake this into your workflow is that after you complete each task, what you want to do is go through and run Svelte check or run your linting or run your testing before marking this as completed. And then if something else pops up, you can then create a new task with a higher priority that the AI can go and fix then and mark it. This thing is so stinking cool. I've been really, really loving this project.

And not only that, there's a great VS Code extension for it. if you're the type of person who likes a UI like I do. So check it out. Beads is a really neat project. It's really easy to install and I found personally it solves a lot of the problems that I had after not using Kiro and moving to other systems while also keeping everything maintainable and a nice easy way to work. This is a deep well and a deeper well than I've gotten into in this video. So, please check this out, read through this, and let me know how are you using this if you are, or is this the first time that you've heard about it? Because I do think that there's a lot of really cool things that you can be done with this, and I've only started to scratch the surface. So check out beads if you haven't

Quote it with credit and a link. Quoting Syntax