Welcome to episode three of Forward Deployed. Noah and Lance dive deep into context engineering - the art and science of filling context windows with just the right information for agents to take the next action. Key Topics Covered - Context engineering: Why Karpathyโs term matters more than prompt engineering for agents - Three core techniques: Reducing context, isolating context, and offloading context to file systems - Skills vs MCPs: Why progressive disclosure beats loading everything into context - Claude Diary: Building agent memory through reflection and evolving CLAUDE.md - Why subagents should isolate context, not anthropomorphize org charts - Production patterns from Manus: Compaction, file system offloading, and sandbox architecture - The convergence of agent primitives: Read, write, reduce, and recombine - Why treating agents like humans works: Dual-use tools and new coworker onboarding Timestamps - 00:10 - What is context engineering and why should we care? - 00:37 - Karpathyโs definition: Filling context windows with just the right information - 01:15 - Context engineering vs prompt engineering: Tools bring context too - 02:27 - Three buckets: Reducing, isolating, and offloading context - 04:30 - Dynamic context loading: Skills as just-in-time context - 06:38 - Skills as context offloading: Progressive disclosure of tools - 09:15 - Sandboxes beyond Manus and Claude Code: Application integration patterns - 12:12 - Context isolation through subagents: Not org charts - 14:41 - Using isolation as a feature: Test-driven development with blank slate agents - 16:33 - Real-world subagent challenges: Shared file systems and context bottlenecks - 20:47 - Claude Diary: Automatic memory through session reflection - 22:53 - CLAUDE.md bloat: Reducing unnecessary words like Strunk and White - 28:06 - Dual-use tools: Why Claude Code uses bash, grep, and human-readable commands - 31:02 - Skills discovery problems: From manual search to automated finding - 34:22 - Agent primitives: Read, write, reduce, and creative recombination - 36:32 - Tool search and action space design: How to find the right function - 40:50 - Hooks as determinism: Injecting code into agent loops - 41:41 - Skills everywhere: ChatGPTโs progressive disclosure discovery - 43:12 - Nano Banana: Text on images unlocks new agentic workflows Links & References Core References * ๐ Karpathy tweet on context engineering * ๐๏ธ Manus webinar on context engineering * ๐ Cognition blog post on multi-agents * ๐ Simon Willison on skills and file systems * ๐ Anthropic Model Context Protocol announcement * ๐ GitHub MCP docs (Anthropic) Technical Resources * ๐ Claude Code hooks documentation * ๐ Anthropic frontend design skills example * ๐ Obra magic skills repository * ๐ Vercel sandboxes docs Tools & Frameworks * ๐ LangChain Docs (Python) * ๐ Cerebras Systems - Technology * ๐ DeepMind Nano Banana info * ๐ ChatGPT Skills directory Related Content - ๐๏ธ Karpathy on Dwarkesh Podcast - Discussion of AI development principles - ๐ The Elements of Style by Strunk and White - โReduce unnecessary wordsโ as principle for CLAUDE.md - ๐ The Bitter Lesson by Richard Sutton - General methods that leverage computation About the Hosts Noah Brier is co-founder of Alephic, an AI consulting company helping brands build custom AI systems. He writes about AI strategy and implementation. Lance Martin is a founding engineer at LangChain, where he works on developer tools for building AI applications. Connect with the Hosts - Noah Brier: LinkedIn | X/Twitter - Lance Martin: LinkedIn | X/Twitter * * * Subscribe for weekly episodes exploring how AI is actually being deployed in the real world. This is a public episode. If you would like to discuss this with other subscribers or get access to bonus episodes, visit www.forwarddeployed.com
Audio and video play straight from the show's own hosting. PodSubs stores and serves no media.
Transcript
From the show. Tap a time to play from there.
SPEAKER_01Hey, everybody. Welcome back. I'm Noah Breyer, co-founder of Alephic, and I'm joined by Lance Martin, founding engineer at Langchain. And today we are going to talk about context engineering. My one thing I'll admit is that when we came up with the topic for this episode, I told Lance how much I hated the term because I just kind of felt like it didn't add much, though I have to say I've come around on it a little bit. But Lance, why don't you kick us off and tell us about what is context engineering and why should we care about it? Yeah, absolutely. The first places I heard the term was actually from Karpathy.
SPEAKER_00So this tweet right here. Patrons saying they're forward deployed. Yes, exactly. So Karpathy kind of lays this out as the delicate art and science of filling the context window with just the right information for the next step. And this is particularly relatively interesting, like an agent where it's performing a trajectory of actions and you want to give it the information it needs to perform the correct next action. So that's kind of a good overall kind of definition of the challenge.
SPEAKER_01Can I just interrupt you there with a quick question? Because I think this is my challenge with the word has been, how do you break it down as different from prompt engineering fundamentally. Yeah. So I think the way I would think about that is really prompt engineering kind of
SPEAKER_00predates context engineering. Prompt engineering is particularly relevant in the context of, for example, like chatbots when you are talking about prompt response. And the prompt is something that a user is controlling and crafting that's being passed to the LM to do a thing. Now, I think that the trick is that with agents, we have context coming into an agent through two mechanisms. So one is the original prompt, like, for example, the system prompt or system instructions. And for example, any user messages that go in and helping to guide the agent.
SPEAKER_00But also contact is coming into agents through tool calls. So an agent you can think about simply as like an LLM with a number of tools bound to it. And it's autonomously calling those tools in the loop until some termination condition. So the trick is that context is coming in not only through the original system instructions or user instructions, which we think of as things that we kind of control, i.e. that's kind of the world of typically prompt engineering, but also through all these tool calls. And that's where things get messy. And that's exactly, I think, why this kind of term emerged and is quite nice.
I can talk about a few different flavors for context engineering that have emerged.
SPEAKER_01Yeah, why don't you go into it?
SPEAKER_00So a few months ago, I did a webinar with Manus. They're a very popular consumer agent, very, very smart company. And we talked a lot about how Manus is approaching it. So the way I kind of broke this down, there's these three big buckets of approaches for content engineering. We can talk about what's happening in Manus and kind of broaden out to even beyond Manus. But the trends that I've seen quite a bit are reducing context, isolating context, and offloading context. So just to give kind of an overview of these various things,
reducing context is very simply reducing the size of the context that's being
SPEAKER_00passed to, for example, the agent at every turn. So here's a simple example. Like when you're using cloud code, you can do compaction. So compaction basically summarizes the messages in the agent's trajectory into a crisp summary, and that saves lots of tokens. That's one mechanism for context reductions. Manus talks about kind of a different approach where they actually take tool calls. You can kind of see here in this little diagram. So these are like the tool results that have come in and they're often like very token heavy,
SPEAKER_00right? Like, for example, you're calling a search tool. You get a bunch of context back from that search tool. What they do is they do a compaction step. And what they mean by that is not exactly what cloud code means by compaction. In their case, Manus basically takes that tool result and saves it to the file system. And then it significantly de-bloats that message history. So message history then only has a pointer to the file, not the entire tool result. And they do this using some heuristic like older tool calls get,
SPEAKER_00quote unquote, compacted and sent to the file system. So that's one overall kind of category that we see. Context reduction, as mentioned, Cloud Code does this via compaction. Manus does it via also what they call compaction. In their case, they're just saving it to the file system. But the idea is the same. Basically, reduce the size of the context window using some approach.
SPEAKER_01Can I ask you a quick question on that one? So there's two other methods here. I'm curious if you think of them as reduction methods. One of them is essentially just writing tighter context, right? Like for a while, we would write very, very long prompts. And if you look at some of the trends now, I'm seeing it, especially in agent skills, it's towards really, really compact, really tight. If you look at the Anthropic front end design skill. I think it's like 700 words. So, you know, do you put that in context reduction?
SPEAKER_01And then the other one I was thinking about is, is the way skills and quad code are kind of dynamically loading that context just in time.
SPEAKER_00Yeah. OK, this is a really good one. We're actually going to get to skills. I don't quite call that. I actually consider that to be a context offloading approach. It does have the effect of reducing the size of the context. So there's obviously kind of some there's some overlap between these categories is not perfect. But that's actually a good segue to the idea of context offloading and specifically context offloading. The idea there is that you're moving things from the context window to the file system. So Menace is actually doing this when they do this compassion step.
SPEAKER_00They're taking something from the message history. which is all living in context, in the context window, and they're basically shifting it out to the file system. But this idea is a lot more general. So Anthropic Multi-Agent Researcher does this. So basically at the start of research, they create a research plan, and then they just save that to disk. And then it's persisted, and they can pull it back into context selectively as needed to help steer the agent. Like for example, the nice thing about offloading context is you make it available to the agent at later steps in its trajectory.
This offloading kind of also gets into the conversation we had about skills versus MCPs, right? Where the challenge with MCPs is that they're constantly loaded into that context.
SPEAKER_01And so eventually they can completely overwhelm it. And the ability to kind of dynamically load them just when you need them is a very interesting one.
SPEAKER_00Yes. So actually, I think what's really interesting is skills are a really good example of offloading as well, because think about what's happening here. So typically, if you're using MCP or even defining your own tools, what you're doing is you're taking your LLM and you're basically giving it a bunch of tools and you're actually loading all those tool descriptions into the context window. And this is a classic problem. So, for example, you have... 20 or 100 tools, all those descriptions live in context. So you're bloating your context window with all these tool descriptions. It's it can be very token heavy, very token costly.
SPEAKER_00The intuition behind skills, the way I think about it is like you're taking all those tools, like all those actions, and you're basically just offloading them to the file system. Literally, you're saving them in a bunch of folders. There's some skill in each folder and you're only loading like the progressive disclosure idea right here. You're only loading just that YAML front matter in to the context window when you start the agent. So you're offloading all those tokens that typically live in context. If you're like defining a bunch of tools, you're offloading all those to the file system and you're only
loading in just the
SPEAKER_00YAML front matter. So you're right. It's actually kind of bridging the two because it has a significant benefit in terms of context reduction. But it's I think the principle here is more like offloading. You're taking things that would live in context and just pushing it out to the file system. So I think it's another really good example of this principle of context offloading, which I think is a really smart approach. Now, the catch and Simon mentioned this. Simon Willison had a really good write up on this. He said the catch is you need to give agents access to a file system, i.e. a computer. And that's a very important dependency and not every production
agent has that.
SPEAKER_00But if you have that ability to give the agent a file system, you can perform offloading really nicely. And in fact, so Manus does that. If I go back to that Manus post, what's pretty interesting is Manus ships. There's a nice blog post from E2B on this Manus actually ships with a sandbox. So it every man as agent actually has access to a file system. And that's why it's able to do this offloading. And they talked about this quite a bit in our webinar. For example, they talked about a few things offloading tool calls, offloading plans. And it's a very nice general trick.
SPEAKER_00They also interestingly, what's very funny about this is they talk a lot about building like what they call a two tier action space. So having a few functions. bound to the LM and then just basically offloading everything else to the file system and having a bunch of scripts that can just call. And that's exactly what skills is, by the way. So actually, I feel like Manus was quite they were quite smart in terms of like laying out, laying that that idea out. And skills is like a broader, more popularized, like framing of that exact same principle.
SPEAKER_01I've been having a lot of fun this week building with some sandboxes. I'm using Vercel sandboxes for what it's worth, but I'm running the agent's SDK and running these sandboxed cloud code workloads and just finding Different and very interesting ways to actually tie these agents into broader applications. So there's I was building out a whole data pipeline and, you know, a lot of it is fairly simple processing stuff. It doesn't need a whole lot.
SPEAKER_01There's little bits of AI here and there. But for some of the more complicated pieces, rather than building a whole control flow that sat on the top of it, being able to sandbox that whole thing out. And then you start thinking about really interesting questions like, how do you provide context back to the sandbox from your application? So I ended up having to... essentially build a skill into the sandbox that I passed in with a bunch of code that allowed it to get back out to my application to query the
API and get some of the data back because the value of this isolated environment is that you can do all
SPEAKER_01this file system stuff without screwing anything up. But obviously the challenge is, but I feel like there's whole new patterns there that I've really only started to think about. I feel like so many of the sort of sandbox environment conversations are also so isolated to, you know, like Madness and Cloud Code, where it's really fundamentally an agent with a sandbox rather than an application with the sandbox. And anyway, I've been playing with some of those patterns and maybe it's something that we can talk about more in the future. But I think it's really interesting to think about not just how
do you give it the
SPEAKER_01right context in that moment, but also... How do you give it back the context of your application so it understands where it's executing and what it's executing? And then how are you passing these things back and forth?
SPEAKER_00So you're using the file system in your Vercel sandbox then. So it's like the agent's running, it's like using the file system as needed to do its tasks. And then you need to egress some information back out to your application from this sandbox agent using its own file system to do things.
SPEAKER_01Right, so it does a combination of structured output, I give it a structured input and it gives me back a structured output. And then any files it creates, I write to blob storage and then I get those files back from blob storage. And then I just kill the whole sandbox.
SPEAKER_00It's full ephemeral. Yes. Those are interesting patterns. We should talk about that more in depth at a later point, because I think a lot of people are thinking about this. In fact, I had a call recently with someone who was working on deploying agents and like, wait, how do I think about agents plus sandbox and file system now? If this is like a primitive that many agents will benefit from, like, how do you think about that? And like, what's the best deployment environment and so forth? These are all interesting questions.
SPEAKER_01So you went through reduce and offload. Let's get to the last one of your.
SPEAKER_00Let's get to the last one here. And then I have a new one I'm going to add actually. Okay. So contact isolation, that's just subagents. We talked about that a lot. One thing I want to highlight that I think is kind of mildly interesting is I think often sub-agents are like improperly used. Like I think people often anthropomorphize them like, OK, I'm going to have 10 sub-agents, one for each sub-role might work. It's like, no, no, no. These elements cognitive capacity is way beyond what a human can do. And like an AI can be both a product manager and engineer, like they don't need separate sub agents.
SPEAKER_00The benefit of sub agents isolating context. So it's like if there's a job you can isolate and just do that job within like a, you know, an isolated context window and just pass the result back. That's good because it saves tokens in your like parent agent. So thinking about sub agents in terms of context, isolation is a lot better than thinking about sub agents in terms of like anthropomorphized job splitting.
SPEAKER_01Sometimes I think they line up, right? Sometimes they do. The easiest pattern that I've used a bunch is researchers. It's like, hey, you're going to go consume a bunch of tokens. You're going to read a ton of sites, and I want the final output at the end, but I don't want to spoil my entire context window. with the 100,000 tokens of web content that you read. So just give me the output. That does happen to line up, but yeah, I hear your point completely and I agree with you.
SPEAKER_00No. And that's a great one. Research is the canonical sub-agent use case. It's like, yes, all this research can just be done in isolation. You pass the results back. You don't need those 100,000 tokens of research that you pulled. 100%. And you're right. In that case, they line up. A lot of times they don't. So anyway, it's a fun point.
SPEAKER_01One of the other really interesting isolate patterns I've seen, and I think I first saw this in the Obra magic skills, I'll put them in the show notes, was a kind of test-driven development where you used agents because they're blank slates. So you're specifically using the fact that they don't have any exposure to the outside world, that they don't have exposure to the rest of your context. And so you can kind of give it this new file or this new skill, or you can ask it for an opinion without poisoning it
SPEAKER_01with anything that you've already said. And, you know, I think often we think about the isolation in terms of the researcher because that is the canonical one. I just don't want to kill my entire context window. But I really liked this flipping. You're using the fact that it has no outside information as a skill in and of itself.
SPEAKER_00Yeah. Yeah. I mean, no, it's a good point. But you know what's tricky about this, though? And this is actually kind of a good segue. So Cognition had a good blog post and they were explicitly arguing don't build multi agents. And they talked a lot about the problem of like information bottlenecking. It's a good post. You should read it. So Cognition had a good blog post talking about don't build multi agents. The crux of their argument is multi agents have this kind of information bottlenecking problem. You spawn a sub agent and it doesn't have the full context of the parent. And so if you have tasks that are like highly coupled,
where like two or three different sub-agents need to coordinate with one another,
SPEAKER_00it's very hard to kind of share information. Or like if a sub agent needs a lot of the same context as the parent, it may or may not have the depending on how you initialize it. So this is a really good call out. I want to just mention briefly, Manis and I talked about this and they had a nice figure talking about like in some cases when you spawn a sub agent, you can specify its job really easily as like maybe a few lines of text. And this is like a classic research use case, right? Just research this topic. You can use your web search tools.
SPEAKER_00It's a fully quarantined task. It doesn't need any other context. Research this thing. Give it two sentences. It goes, gives you a result. That's the cleanest case. But like there are other cases where Manus mentions you also with some agents, some you can share, for example, like the file system, give it like a shared context with the parent. So it can access the same files and sometimes even sharing the entire conversational history, which is not really token saving, or it at least has a pretty significant token impact on like the sub agent. But at least it has all the information that the parent does.
SPEAKER_00So just as a quick call out, like sub agents and multi agents can be tricky because of this contract isolation and how much you need to give it and show it. And that's kind of tricky. So I do want to call that out. And I think Manis talks about some interesting scenarios. And that's just what I show in this diagram.
SPEAKER_01And that's kind of what I ran into a little bit with my sandbox stuff. And, you know, it created a kind of real world example of this. So again, I was building this pipeline. Essentially, we do all this call processing and we need to kind of go through a whole bunch of kind of researching and understanding the call. And historically, I'd done it using a control flow with a bunch of AI steps. And I'm still doing a lot of the kind of basic cleanup stuff using a basic control flow with some AI cleanup steps.
SPEAKER_01But there were big enough pieces and I wanted to try some new techniques. And and so I wrote the whole thing off to this sandbox, which is effectively a sub agent. Right. You know, if you think about the kind of overall control flow as the main agent. And yeah, I immediately, it was like, oh, well, the annoying thing here is do I have to pre-give it all the context at the beginning? Because you're literally spinning up a new computer as a sandbox. So whatever you pass in is everything it knows. So I've got to install any packages and give it any context.
SPEAKER_01And yeah, what I ended up doing, I thought for a little bit about actually building my app into an MCP and then passing that MCP into the sandbox. And then what I ended up doing was essentially just giving it a fairly simple skill and a read only read only access to my database so that it could hit the core tables that it needed. And that seemed to have solved the problem. But it's not without its trade offs. Right. Like it's it's you know, and there are really clean cases like research where
essentially you can operate in a vacuum and be totally fine i want you to go tell me everything about manus it comes back and and that's really all i want to know and it can use as many tokens as it wants to use but there aren't that many of those kinds of situations and so
SPEAKER_01you know i think this is it's maybe an extension and on the whole context engineering ideas kind of i think all of this is is kind of getting at the same question, right? This is a turtles all the way down thing. Like even some agents are just agents, right? We're just sandboxing.
SPEAKER_00It's just sandbox agent. That's right. It's just a sandbox agent. Yeah, no, that's right. I'm going to tell you about my fourth now. This is a new one. It's not in this blog post. I'm still kind of exploring the idea. I don't even know if it's the right term for it. So I'm going to call this one Evolve in Context. We're workshopping it live a little bit. I'll share a blog post I wrote up about this a little bit. So basically, this is kind of a cool paper and they called it Evolving Context for Self-Improving Language Models. So what's the big idea here? The big idea here is simply that you can have an agent that's doing things, producing these trajectories.
SPEAKER_00And basically, you can have like a reflection process over those trajectories and you can use those reflections to go back and update, for example, the system prompt to update instructions. If you think about the system prompt as being like persisting on disk and being some set of like a set of instructions, then this reflection process is a way to kind of iteratively update those over time. And I want to make this concrete with a fun little example I put together called Cloud Diary. So basically, and I know you'll appreciate this given that you are a very,
SPEAKER_00very heavy cloud code user. The intuition is dead simple. You enter the cloud code in these sessions. Those sessions are actually stored locally to disk in this like in cloud projects. And there's all these session logs and there's Jason. Right. So you have all the session direct. You have all those session history saved. What I did was I set up two simple custom commands. One is a diary command and the others reflect command. So the diary command here's like kind of a loop here. The diary command looks at any given cloud session and saves key decisions, key things done, summarize what was kind of the overall work plan,
SPEAKER_00summarize that to a diary entry. It's basically a summary of the Claude session. OK, now those diary entries accumulate over time. So you have all these diary entries from all your different sessions with Claude. And then I have a separate command called reflect, which looks across all those diary entries and then proposes updates to ClaudeMD. ClaudeMD, of course, persists on disk. And that's what sucked up into Claude when you initialize a new session. So it's a really simple kind of memory feedback. They put this on Twitter. It kind of did pretty well. It's a plug in right now. But that's a general idea.
SPEAKER_00I'll let you react to that first.
SPEAKER_01Yeah, I love this idea. I've played with this a few times myself trying to do variations on this theme. One thing I actually I thought about building a version of this a while back where. I was going to send the entire session off to Gemini because it had such a big, bigger context window. Right. If it could, how it would do in kind of isolating it. You know, I think one thing that's just interesting as an observation is all of these are kind of primitives, right? And you're kind of like recombining them.
And so another way to think about what you're doing is you're writing and reducing
SPEAKER_01again, which are just the primitives that you already mentioned in the overall context engineering. Yeah. Some effect, right? Like you're offloading this thing. It's already you're taking the initial one, which is already offloaded. You're reducing it down. And then essentially your update to the Claude MD is just kind of reducing it further and summarizing it. The other thing, just as a note that I think is interesting, and this is an area... I'd be curious if you run into this at all, but it's just something I've been thinking a lot about is like,
SPEAKER_01I kind of feel like ClaudeMD is kind of hitting a similar point to prompt engineering where you're getting diminishing returns on the tokens in there. And so it's going to become less and less about sort of adding more and more information and more and more about sort of how you articulate that information and how you kind of like feed it to the model in the most optimal way. So it's not just about sort of the overall content. It's like we're looping back to prompt engineering, but now prompt engineering, I think is going to be about being a really good writer in a
way where it's like,
SPEAKER_01you know, it's very Strunk and White is my favorite writing style guide.
SPEAKER_00Yeah. You know, there's one of the core tenets of Strunk and White is reduce unnecessary words.
SPEAKER_01And, you know, I feel like we're getting to that thing. And I wonder if just as you've actually used this, have you run into any problems where you're now bloating up your Claude MD and you've got to figure out now new ways to kind of reduce back down and you're following kind of these same patterns? Yeah.
SPEAKER_00Yeah, let me tell you something funny about that. I mentioned that here a little bit. And actually, I'd be curious to get your take on these different design decisions. I kind of tried to enumerate them in the blog because, frankly, I'm still figuring this out. I don't precisely know that these are the right patterns. I can zoom in a little bit. But so one thing I found that I need to do in the reflect step, and this is all prompted, by the way. So you can just play with these prompts. I read back in ClaudeMD first. So basically, in this reflection step, I read that back in. And so when it's proposing new rules, it's kind of like recombining or like kind of crafting the
original CloudMD.
SPEAKER_00It's not just appending. You can't do append only because basically then you just you get this laundry list of new rules that get appended. You have to do kind of a re-synthesis of your CloudMD. So I kind of prompted to do that, but like I'm not sure how good that is.
SPEAKER_01You have to follow that idea that when you add a new law, you have to reduce you have to remove two.
SPEAKER_00Yeah, that kind of idea. That's funny, right? You have to like kind of recombine. Exactly. Well, it's funny because I actually found that like, yeah, if you're doing append only, you can also get contradictory rules. Yeah. So you have all these issues. So you actually have to be kind of recombining. And so that's a very subtle but important point. Initially, I didn't reread the Claude MD explicitly. So I guess it's automatically pulled in when you init Claude session and Claude runs the reflect command. So like it was there, but like in the in the prompt itself,
I told it explicitly reread Cloud MD as you're performing this command to like
SPEAKER_00further steer the agent to like be thoughtful about how it's updating it. So I think that's that's important point one. I will make a note that you mentioned like it is incorporating the idea of kind of reduction in the sense that it's taking this long session and summarizing it down to a diary entry. I don't know for sure that you need to do that. So like you had mentioned, you also could take the raw session logs and plumb all those in full to like maybe a Gemini or whatever.
SPEAKER_00I think, you know, four or five is is four or five opens. Right. Yeah. Right. So you could you could also think about taking full session logs. just plumbing them all in without this separate kind of summarizing step and do reflection over those. I just was a little bit worried about context there, which is a valid worry, to be honest, because,
SPEAKER_01you know. One fun experiment here that occurs to me, and it kind of goes back to that isolation comment I made earlier, is it might be really interesting to think about using some purposefully isolated sub-agents here to help be a judge. So without all of the other context, if they just looked at the Claude MD and they just looked at the new... rule or new technique or whatever was being proposed to be added.
And they were a really tough judge who had none of the other context about the rest
SPEAKER_01of the context. Because again, this is where I haven't done enough with this, but I just love this idea that you can really take advantage of the isolation. We think of poisoning as a really negative thing, right? Like, you know, hey, there was a hallucination that happened earlier. and it's poison the session. But actually, poisoning is what we're doing all the time, right? As soon as you give it that old context, you've poisoned it. It can't ever get that out. And so being able to get clean eyes
SPEAKER_01on these very specific things. It might even be the place where you try to do the reduction further, where you strunk and white it and you say, reduce any unnecessary words. I find, and this maybe gets into a kind of bigger conversation, but One of the things I've been thinking about a lot, and I think it kind of ties in with this, and I saw some comments people made about your tweets and about your posts about how many kind of very human concepts we're applying. Like, hey, the idea of a diary is a very human idea, right?
But I think what we're learning is that the very most effective technique for agents is to kind of treat them like people and to think about them as people and
SPEAKER_01to think like, Oh, I should give them very human instructions and I should give them very human words. And that's going to help with the context. And, you know, again, I keep going back to the front end design skill, which Anthropic had a great post about. And It's just so tight when you read it. It's 600 words, 700 words. Like this is good writing where you've taken a really big idea and you've sort of shrunk it down into this tiny little context. You know, I kind of do feel like there's a whole new frontier that we're
coming back around
SPEAKER_01on here where it's going to really matter. your ability to write and think clearly and articulate clearly and reduce the natural slop that surely comes out as part of these diary entries and just kind of thinking about those pieces, which are also just good for humans. Like I think that what's the convergence that I think is really interesting right now is this, it feels like what's good for agents by and large is also good for human developers.
SPEAKER_00Yeah. Well, OK, that's an interesting point right there, because one of the points that Boris, CloudCode kind of creator and Kat Wu, CloudCode PM, mentioned one of their pods is indeed that all the tools used by CloudCode are dual use. They're just tools that we use, you know, bash tool, grep and so forth. So that kind of dual use concept is like kind of idea one, indicating that, like, listen, we're just giving CloudCode the same tools that you or I would use. So the dual use tools is already kind of a principle that's use a cloud code and then indeed like instructing it in the way
you instruct a human like actually one of the really good prompt pieces of prompting advice that I originally someone from Anthropic shared was treat an agent like a new coworker and
SPEAKER_00explain tasks to an agent just like you would explain a new coworker. It's like really like new coworker onboarding. And so I think that is pretty reasonable on some of the approaches here. I think these are some of the decisions I walk through. I actually happen to currently typically just I run the diary command within a session that is like interesting. I like, OK, I want to save this because I don't want to save every session. Subtle point. But like so right now I don't have a hook or anything for diary creation unless I sorry, I do have a pre compact hook. So if I do compaction, I create a diary entry. Just as a proxy, longer sessions are likely more valuable.
SPEAKER_00So I always will create a diary entry if I compact. Otherwise, it's manual. So I just will manually run diary whenever I have an interesting session. And I will just mention briefly some of the places I found this to be really useful. Basically, here's a really good one is PR feedback. So for example, if you run PR comments, command and claw to pull in all the comments from your remote branch, if you're doing PR view, really helpful. You get kind of feedback, OK, I need to change this style points or kind of style
recommendations and so forth.
SPEAKER_00Great things to capture memory, right? So that's a really good one. Get workflow stuff. How I like to do things. Great stuff. Just throw into CloudMD. Testing practices, code quality considerations, agent design principles. And those are all things I've found that the system can really naturally pick up really well. And it's actually the final one. Self-correction is a very important point because I know sometimes CloudMD rules need enforcement. I'll give a funny example of that. I don't know if you've noticed it, but natively, we ask cloud code to, like, for example, create like a commit.
SPEAKER_00It'll add cloud code attribution to your commit. You notice that you're like, this is authored by cloud code. And so in your in your repo, it'll show like you and cloud code authored this stuff. And sometimes sometimes I want that. I don't care, you know, but sometimes you don't. You don't necessarily want that attribution to be tagged for any number of reasons. And so that was something that it was hard to instruct out. I found Claude would like ignore those instructions quite a bit. So I had to basically the system caught that and added more reinforcement to my ClaudeMD to tell it don't add Claude attribution to commit messages.
SPEAKER_00Small thing, but actually quite important. So I found to be very effective at catching these cases of rule violation.
SPEAKER_01Yeah, I think on the last episode we talked about it. And honestly, I'm still this is my biggest frustration. with all of Cloud Code and skills is just, it's sort of general inability to consistently discover them. You know, even as you rewrite the descriptions, I think last time we talked about, I built this whole crazy pre-message hook that- Yeah, I remember that. Cerebris to search over and pass things in. I'm still using that. It's still fairly effective, but, you know, I'm definitely-
SPEAKER_01I'm very interested in in some of these learning techniques. One of the big ones that I find myself doing and I don't have it. command for it, though I probably should, is, you know, one of the biggest kind of I like this context evolution thing is is just within skills, especially as you're developing them, you know, you try them out and then you see what works and what doesn't. And you really want the system to pick up what worked and what didn't and then kind of update the skill appropriately. Right.
SPEAKER_01I feel like, again, in this context, in this idea that A lot of what I find in agents is that I'm sort of using I'm using skills to test out new techniques before I write code. Some of them may always stay as skills, but some of them actually are better off being scripts. Right. There are fully deterministic things. So I have been working on a project where I'm running like five work trees at a time with different feature development.
SPEAKER_01Each of those work trees needed its own database. So I'm basically splitting off the main database all the time when I split off a work tree. And so I started as a skill where I'm just like feeling out exactly what I want this work. work tree to work like, like, how do I want my work tree? It needs to, you know, I needed it to, I wanted to pick up its own local host port so that I could just be running. I wanted to run all five of these work trees at the exact same time and then just be able to merge them all back up to main whenever they were ready and everything
SPEAKER_01would be generally cool. And And that way, it was awesome to start as a skill because you don't need to write any code. You're just like, hey, here's the kind of rough steps that I think I want you to do. And then after like a week of using it, then it was so dialed in that I flipped it over to a script. And, you know, and again, it's sort of like, this is why I like this like primitive idea. You could think of it as that's just, you know, reducing down the context, right? Like I, that doesn't need to be a skill. It's actually, it's a fully deterministic process.
SPEAKER_01It's much better off as a 10 line bash script or whatever it is, right? Like it's, it's nothing particularly complicated. It's actually much more complicated to write it than it is to write the code. I think the opportunity here with all this context stuff is to I think what you're really playing with that I like so much is just that these are the primitives of agents and we just are finding new ways to stack stuff, right? And so we've got the reduced primitive and obviously we've got the right primitive
SPEAKER_01and we read and we take those for granted and they're tools, but they're not just tools, right? There's a couple of them that are the kind of core primitives. And then we just start finding new ways to recombine them, but there might only be five or six of these real primitives in here.
SPEAKER_00Now, a few points on that, I think I think we're kind of observing that there's a small number of core primitives need for agents in the sense that if you look at Manus, if you look at Cloud Code, they're only using a small number of tools. There's like a small number of atomic tools that they're using. One, for example, with Cloud Code, one is the task tool that's for context isolation that spins up a subagent. And then they have like various file manipulation tools. That's for offloading. I will mention the point you made about skill. We talked about this a lot previously about skill finding is a very general problem. There's also a problem with tools, by the way.
SPEAKER_00It's funny. I just pulled this post up. But so Anthropic now has a tool search tool and it's exactly what you had built with skills. It's the same problem. It's just in the tool space. It's like I've and MTP servers bound now. How do I figure out which one? Anyway, you can read the post, but like it's a whole thing that they built out to help with this exact problem. And like it'll selectively search across your MCPs based on the task. And I don't know the details of the implementation. I don't think it's it's I'm sure it's, you know, it's behind there.
SPEAKER_00It's done, you know, on server side, on their side. It's the same problem. So like there's a broader discipline here of like, how do you design your action space? which is to say, what tools do I bind to the model? How are those tools found? And then what do I offload to the file system as skills and how are they found? And like the simplest example is I have a small number of atomic tools like cloud codes, like 12 tools, and then I push everything else to the file system. That's fine. But like they're talking about here, well, OK, problem one.
SPEAKER_00What if I have a lot of skills like you have? How do you search for them? Whole problem. Or what if I have like two or three MCP servers in my tool space that have lots in my in my sorry, my function calling space that have lots of different functions in them. You need to search for those problem, too. So I think there's a whole discipline here of like, how do you design your action space, which is non-trivial and hit to the point you made that like. It's tricky to search through large numbers of candidate actions to determine which one to use, whether it's in skill space, like on the file system,
SPEAKER_00or whether it's as a bunch of functions. Hard problem.
SPEAKER_01Yeah, and I think we're just going to keep looping it, right? Yeah. Eventually, your Cloud MD is going to get too many diary entries and you're going to need a diary diarization for the Cloud MD. Right. Like this is just, you know, I think I think this is probably the pattern. That's true. And I come back a lot. We talked about a couple of episodes ago, but I think that. Karpathy had an interesting note he made, I think it was on the Dwarkesh podcast, where he said he's kind of waiting for these models that are super,
SPEAKER_01super small and kind of know how to do things but don't know things. And I kind of feel like that's a lot of also what we're trying to get at is we're kind of trying to reduce the context down as much as possible to just what's absolutely necessary. with the hope that we can make them as controllable as possible, right? That's the idea of the tool search is like, okay, well, I could have lots of tools, but then, you know, my hit rate on getting the right tool is lower. If I limit the tools and I figure out a way to make it very
controllable so it
SPEAKER_01always uses the tool search, then I should have, because I'm offloading. And again, it's just, I feel like it's the exact same thing as my work tree thing, which is, you know, the beauty of this is we're also engineers, right? And so at the end of the day, we can use these non-deterministic methods as we're in this experimental space. But when we start to figure out the pattern that we want to solidify, it often makes sense to go back to code and, you know, sort of bitter lesson be damned. Like over time we can rip the code back out once the models are
smart enough.
SPEAKER_01But, you know, until that point, I think we've talked about this a bunch, like until that point, the best technique is the best technique, whatever the best technique is. And as long as you're committed to continually reevaluating it, then who cares, right? Like just do the thing to make it work today. As long as you don't cut off your opportunities for tomorrow.
SPEAKER_00Yeah, I think it's interesting that whatever search algorithm they're using here, you're using something. For example, for my memories, you're right. Like basically, as you scale a system like what I saw with Cloud Diary, you have many, many different kind of memories that you want to save this Cloud MD. The Cloud MD then starts to bloat and you're back to the classic problem of a kind of search and retrieval. I wonder if under the hood, they're doing some kind of semantic search here across tool descriptions, which is a technique that we saw very much earlier in the arc of this kind of AI wave. Rag was a very, very big thing.
Kind of 2023 obviously still is very, very widely used and very important use case. But I wonder if you just kind of classic search and retrieval techniques do have an
SPEAKER_00opportunity to inject themselves And, for example, things like tool search, skill search, memory, memory accumulation. Like, for example, I'm nearly sure that like with ChatGBT memory, their memory feature, I'm sure my guess is there's indexing. memories and then they're like using semantic search to fetch them on demand and load them to the context. So my guess is they're using RAG for that because like there's many discrete memories that you'd want to just search over. I'm sure they're not loading those all into context. So, you know, basically RAG could become relevant across a number of these
techniques as like the
SPEAKER_00scale grows,
SPEAKER_01you know, using the full tool chest. available to you is the only rational approach. Unless you're a purist and you're, you know, getting your ML PhD and all you care about is the definition of intelligence. Like if you're trying to solve problems, I think you should use the full set of techniques. And, you know, again, sometimes like some deterministic code is the very easiest way to do it. sometimes it's these other things and you know but i do think i i think the kind of general pattern that we're seeing overall is just we're all
wrapping our arms around what it means to build with agents and sure what we're doing is we're essentially kind of figuring out the techniques that work and then we're figuring out ways to standardize them and some of that standardization is naturally going to
SPEAKER_01end up being like oh well You know, the best way to reduce context is to add semantic search over the top of whatever it is, you know, that makes sense. And one day, like maybe two million token context windows will really work and we'll have to rip all our semantic search out. But, you know, for now, we're.
SPEAKER_00Yeah. Yeah. And also, I will mention briefly, I thought that cloud code was smart in terms of introducing the hooks primitive because it does allow you to introduce deterministic code at any given step in that agent loop. And so, for example, before every tool call or after every tool call, you can do a thing or, you know, after the model call, you can do a thing. So that is kind of a clever way to inject determinism in this like kind of inherently non-deterministic agent loop. Yeah, I thought that was a smart primitive, obviously, for this reason. At least I use the precompact hook. So I kick off a diary entry.
SPEAKER_00Anytime we have compaction, I kick off a diary entry. So I do automate it in that sense.
SPEAKER_01You know, speaking of really good primitives, did you see the news that ChatGPT, somebody discovered skills in there? They got it to spit out a handful of skills?
SPEAKER_00That is funny. I saw that, right? That like ChatGPT has kind of, they're like also using this notion of skills. Funny. It makes sense, right?
SPEAKER_01Fundamentally, we're just talking about progressive disclosure, right? Like, you know, skills are just a name for progressive disclosure. And then, you know, the other funny thing that I think, and it kind of goes back to the conversation we were having earlier, is because it seems like the technique that makes the most sense is to give... your agent's context in a very similar way to that you give it humans, it kind of makes more sense to give it the brand that already exists, like skills, rather than try to brand it yourself. You know, part of that is also just a developer thing, right?
Like, you know, you've got a bunch of developers, you're trying to get to adopt something.
SPEAKER_01And obviously, you know, that's something you think a lot about, but I wonder if part of the other side of it is just knowing that Codex or ChatGPT is going to go look at the web and there's all this talk about skills that you want to name things the same thing so that the AI can more easily go find that. Yeah.
SPEAKER_00I saw that briefly, but I didn't look into it. So what skills are available for ChatGPT, for example? Is it like in some โ it's in some hosted โ
SPEAKER_01Yeah, it's in some hosted directory. It's got the basics, you know, Word docs and PDFs. Okay, funny. Not totally clear how it's sort of all going to fit together, but I assume we'll find out soon. Yeah, it's funny. I did notice that, though. My other quick hit is just, I know everybody's played with it at this point, but I am very interested in some of the things that Nano Banana opens up. I don't know how much you've gotten into it, but like... No. I've heard some cool stuff on slide generation, though. Yeah, it's very interesting.
It's the first image model where I start to think, oh, there's kind of a whole new set. So one really fun and interesting kind of workflow that I did that kind of turned
SPEAKER_01me on to thinking about this totally new way is I was working through, I'm trying to build a kind of workbench down in my basement and I wanted to mount some pegboards to the back of it. And Gemini was essentially able to work with me and then give me a schematic. And obviously it's not a perfect schematic, but it's a pretty damn good schematic of how to kind of mount this pegboard and where to mount it onto the end. You know, then I was playing a little bit with generating OG open graph images. for content pages.
SPEAKER_01And Nanobanana feels like one of those spaces, kind of like using Cloud Code for the first time where it's like when you play a video game and a new area of your map gets
SPEAKER_00OK.
SPEAKER_01I'm like, oh, I think there's like some new stuff that is going to get discovered here that if I spend some more time with it, there's some fun.
SPEAKER_00Walk me through that. So how is it like materially different or better than, for example, ImageGen and ChatCPT?
SPEAKER_01One, it's just its ability to place actual text on images is incredible.
SPEAKER_00Okay, got it. So, you know, it's able to like actually place proper text, which, you know, diagrams, diagrams.
SPEAKER_01And so, you know, again, I'm doing this schematic of a workbench and it's very interesting to be able to get it to sort of really do. And then, you know, this is like what has been happening across all these models for the last few years. I just haven't seen this big of a step. It's just instruction following is the second one. You know, it's just I was working with a friend on something over the weekend. It was just like doing some renovation stuff. and I was showing him some of what you could do with visualizing renovations for his bathroom. It's pretty incredible. I mean,
SPEAKER_01it's like, you know, and again, what's interesting to me here is just that like, it's that idea of like lighting up a new space, like it was possible before with enough work to get it to kind of faithfully reproduce an image and then layer things on top of it. But it took a lot of work and the failure rate was pretty high. And so what starts to happen when you kind of have this stuff on demand is very interesting to me. Even in agents, like what's hard to happen if you could generate images that
are example images
SPEAKER_01that you're then gonna kind of playback to the agent to help, you know, it can read it visually. And I, again, I don't, I don't know what it is. It just feels like a thing I want to spend more time with.
SPEAKER_00Well, you know, I will say, you know, it's funny, right? Like cloud, cloud three, five, when that dropped, it really tool calling suddenly was like, it was like a step above the prior and then it really opened up the coding space and cursor blew up and the rest is history. Cloud code came later. So it is true that these kind of like qualitative jumps in capacity do open up new frontiers. And like, you're right. like image is like good. But if I want to do something detailed, like fine refinements, like I wouldn't do like diagrams or slide in there too hard to get it to get it
SPEAKER_00right. Like good for cartoon images. Right.
SPEAKER_01Yeah.
SPEAKER_00But if I could really get like like high quality diagrams, I could like edit easily like, oh, no changes here. And it would just work. That opens up a lot of new stuff I would do. Yeah. Exactly. I do cartoons. I do image gen for cartoon images and memes. But if it could actually work at a very high level of detail, then I'm doing a lot of work on the house. Design renderings, like schematics, slide graphics.
SPEAKER_01Well, I was even โ as we were playing over the weekend with the bathroom, it's like, hey, show me some different wallpaper designs. And it's like obviously they're not real. You can't go buy them. But like if you're early in a process and you're trying to just sort of imagine things โ
SPEAKER_00Oh, yeah. So,
SPEAKER_01you know, I don't, again, I don't know exactly what that looks like, but I think there's something really fundamentally interesting.
SPEAKER_00I mean, yeah, I know, don't spend too much time on this, but I spent a lot of time recently, like, we redid a whole bunch of the house, and I would love to have been able to take a picture of the current state of, like, the bathroom and then just, like, overlay different, like, tile designs. It can do that well. It can do that well.
SPEAKER_01It can do that almost perfectly.
SPEAKER_00Okay, yeah. Like that was a thing I didn't even, I kind of tried with ChatDBT, I was like, ah, it kind of wasn't there, I didn't even bother wasting my time. It just works. Like you would send a picture of your bathroom, picture of your bathroom and a picture of like a tile from a website, and it would just like overlay it.
SPEAKER_01Yes.
SPEAKER_00That's pretty cool.
SPEAKER_01It's very cool. And again, I think there's the, hey, pretty cool specific use case, but I think what's kind of more interesting here is just, As we're in the business of figuring out ways to utilize these tools in new kinds of ways, I just think there's a lot of really creative things you can start to do when you have that capability available to you in your toolbox. It's kind of like, you know, we talked last time about having Cerebris and having super 3000 token,
SPEAKER_012000 token a second models. Like that's a tool you have that you can now do new kinds of things with. And I think, you know, ultimately all of these things are going to come back together soon. to be this, the full tool chest for doing development, agentic development. And I, you know, how you recombine them and in what creative ways you do it. I think, I think that's probably a good place to wrap up. Always fun. Happy holidays. Always a pleasure talking to you. And we'll be back soon. We have a list of like 15 more topics to talk about.
Jesse Vincent joins me to talk about Superpowers, the software development process he built for coding agents, and what heโs learning from working alongside AI colleagues at Prime Radiant. Jesse has spent decades...
Kasey Klimes joins me to talk about what happens when agents make production cheaper but make shared understanding harder to preserve. Kasey is the founder of Primitive, which describes itself as decision infrastructure...
Andrew McLuhan joins me to talk about what happens when AI is not only a tool that produces content but a new medium that changes how people perceive, work, and organize their lives. Andrew runs The McLuhan Institute,...
Aaron Dignan joins me to talk about a pattern he recognized while building AI workflows at Plumb: โIโve just created a newsroom.โ Once agents have roles, decision rights, tools, inputs, and handoffs, you are not just...
Justin McCarthy joins me to talk about what happened after he told a team to stop writing code - and then discovered they had to stop reading it too. Justin is the founder of Diffusion and the former co-founder and CTO...