There is one mental framework that sits
at the center. An idea so important that
if you capture it, it can change the way
you engineer forever. The agentic layer.
This is the new ring around your
codebase where you teach your agents to
operate your application on your behalf
as well and even better than you and
your team ever could. Focusing on
building the agentic layer of your
codebase is the highest return on
investment action for any engineer in
the age of agents we live in. Why is
that? As you know, when you scale your
compute, you scale your impact. We're
not just AI coding anymore. Our agents
can take actions on our behalf. And this
has changed engineering forever. Once
you've built a sufficiently powerful
agentic layer, something will happen.
The codebase singularity. In this
moment, you, the engineer, will realize
one simple fact. My agents can now run
my codebase better than I can. I trust
them to ship more than I trust myself or
my team. Nothing ships to production
without my teams of agents. Yes, this
might sound crazy. It might sound far
out, but if you've been pushing what you
can do with agents, if you've been
putting these tactics to work already,
maybe you already see this future on the
horizon, the agentic horizon. I can tell
you this for certain right now. There is
an agentic layer that could exist inside
your codebase so powerful that your
codebase runs itself. The only question
now is, do you know how to build it? As
we work through building agentic layers,
keep this idea in your mind and think
through what it would take for you to
trust your agents to run your codebase
better than you could from prompt to
production. In this lesson, we're going
to put together the missing pieces and
see how we can attain the codebase
singularity.
There are three concrete classes of the
agentic layer. Class one, class 2, and
class three. Each defined by a unique
element that makes them distinct from
the rest. Our whole goal here is to look
at the components, the raw elements that
make up the new ring around your
codebase where you have agents drive
your engineering experience and you
drive your agents. the green squares
here, the outer layer, this is the new
aentic layer. The inner layer here,
right, these dark squares, this is going
to be your application layer. And we're
bundling a ton of things underneath your
application layer. We're talking about
your database, your front end, your
backend, your scripts, all the
application stuff, even your DevOps
stuff, right? This all goes underneath
the application layer. Why is that? It's
because we want to be able to bundle
your different repositories underneath
your agentic layer so that we can do
something like this. Code bases often
contain more than one application. So by
bundling your agentic layer around your
applications, your agents can
effectively see everything. Every class
is going to have one to n grades that
will give you a rough understanding of
how powerful your agentic layer is.
You're going to be able to quickly
identify where you are as we move
through classes and grades so that you
can make improvements and get to that
next level. And then once you reach the
limit of a certain class, look to make
that next jump uniquely identified by a
new dimension that we'll talk about as
we progress from grade to grade from
class to class all the way up to class
three and the final grade. Now, let's
start by looking at a powerful version
of a class 3 agentic system with an
orchestrator guiding the workflow.
You've seen powerful systems like this
in our previous two agentic horizon
lessons. What we're going to do now is
run two brand new workflows and combine
some really big ideas. I'm going to open
up the prompt interface here as usual.
And you'll notice we have one new
section. Our orchestrator agent can now
kick off AI developer workflows. I'll
paste in this prompt here. And I'm
commanding the orchestrator agent to
kick off this specific workflow in this
specific directory with just a single
simple prompt. We're not over
complicating this. I just want to show
you so that you have a concrete vision
of the types of systems you can build
out. So we're going to fire this off
here. Let's go ahead and run another
build out a markdown preview application
here in one shot with our plan, build,
review, and fix. And this is an AI
developer workflow. So the orchestrator
doesn't need to do anything, right? This
runs end to end. We're going to run one
more workflow here. And then I want to
show you something awesome. You've seen
the generic log view. We have pushed our
orchestrator to be able to control AI
developer workflows. We now have two
workflows running. So plan, build,
review, fix, and just a simple plan
build. We have given our orchestrator
agent the ability to run arbitrary
endtoend workflows. Now let's dial in
and start from zero, right? Let's reset
because we don't start here. We don't
start at class 3. We don't start with
powerful orchestration systems. We start
with nothing. So as mentioned, every
single codebase should now have these
two key components. The application
layer and the agentic layer. These two
squares here represent a brand new
codebase. Now, oftent times you'll be
operating in an existing codebase that
will look like this, right? You'll
already have some pieces, right?
Modules, files of your application layer
and then you'll start adding on your
agentic layer around your codebase. Now,
what does this really look like? Let's
start from a green field brand new
application just to make this all clear.
What exactly is in our agentic layer?
This is our class one grade one agentic
layer. This the thinnest possible
agentic layer. You can have a small
amount of code and you have a prime
prompt andor memory files. It doesn't
get thinner than this. If you have this,
you technically have an agentic layer.
Now, let's dive into a concrete codebase
structure to see what this looks like.
This is an example project structure.
We're going to work through several of
these to make it absolutely clear what
it looks like to have an agentic layer
surrounding your application layer. All
right, so we have application layer
files, folders, directories, so on and
so forth. And we have our agentic layer
files. If we open up dogcloud here, do
commands, we can see we have this prime
command. As you know, the prime command
effectively represents a memory file.
But the big difference here is that you
can activate this whenever you want to
and you can fine-tune the prime command
to run any specific workflow you want
to. Okay, so this is just a prompt that
effectively activates your agent to read
specific files, right? So there's
nothing new here, right? We have a
classic agentic prompt doc of course is
our memory file that's always going to
load. You've seen this, you understand
this, you know this. And oftent times I
like to take the agents.mdia from
working with other agents and just
reference that claw.md memory file. This
is the simplest possible agentic layer.
Now in our application layer, if we're
going to user management where we have a
backend for a user management system.
This is just a starting place, right?
This is a great way to when you're
creating a new application, just start
with something an agent can come in here
and understand how to operate this right
away with the memory file and with the
prime command. Okay, so as we work
through classes and grades, we'll talk
about the compute advantage you get by
scaling to this class and grade of a
gentic layer. And then we'll of course
talk about trade-offs. So the compute
advantage here is obvious, right? We get
a clean, minimal setup. It's a great
foundation for agenda growth and agents
understand context immediately. It's a
super small code base. This is easily
reproducible by anyone. There's no value
in a codebase this small. It's useless
for large code bases. Limited capability
and there are many leverage points of
aentic coding that the class one grade 1
aentic layer purely misses. Let's scale
this up. Now we have the class one grade
two. This is where we start surrounding
our codebase with more useful leverage
points of agent coding. Here we
incorporate specialized prompts to help
us plan work. We have a prime command
and we now have access to agents also
known as sub aents. Here we can start
incrementally improving what our
codebase can do. So let's go ahead and
look at what this codebase looks like
now. Right, we have a new specs
directory where our plans are written.
You're very familiar with that pattern.
We also have AI docs so our agents can
pull in documentation to aid their
context. This is all part of the agentic
layer. And our user application is
starting to grow. We have a few tests.
We have modules. But the most important
pieces are here. In addition to our
commands, right, our raw prompts, we now
have some sub aents or just some agents
that we can run, right? So for instance,
you might have a fetch docs sub aent
that will save them in the AI docs
directory and you might have a test
writer. These are just simple examples
of starting to scale up your agentic
layer. You likely have something more
powerful than this, but we're just
working our way up. And now you might
have something like a brand new plan
file. So when you're doing work, you
might prompt this plan file and then
execute it. Very simple. We're still
just stacking things up, slowly building
up our agentic layer. This is a simple
class one grid 2 agentic layer. The big
advantages here is that we have
specialization with sub aents and we can
scale this and parallelize certain
workflows. All right. Right? And now
we're starting to collect documentation
for our agents and we're planning our
work before we implement. So this is
grade two. Many engineers have passed
this level. This is not that novel. It's
not that interesting. We're still
limited in many ways. Right? The big
thing we're missing here is custom tools
which brings us right to grade three. So
in class one, grade three things start
getting interesting and our agentic
layer starts to wrap our application
layer. So here we have three key new
pieces. skills, MCP servers, and prime
commands with tool access. You likely
already know what that is. All these
three things give us the same thing.
Custom tools that enhance our agents
core 4. Let's take a look at what this
actually looks like in an agentic layer
class one grade three. Now, we have a
couple additional base level files. You
might have a MCP.json, Postgress,
Firecrawl, Jira, Notion, whatever tool
you want to use, you can now throw it in
here. But that's not all. We know that
MCPs are very tokenheavy and we can just
prompt engineer properly to get our
agents the tools they need. One of the
ways that that can be done is with
skills. Our agents have learned to
migrate the database. And so inside of
this file, you know, you've seen these
before. We have taught our agent how to
use a specific tool and it can now use
it to perform a specific task. We're
starting to specialize our agents a
little bit more outside of our sub
agents. But we can also do things like
this, right? Start and stop application.
If we open up this skill, we are just
teaching our agent how to use scripts.
There's no need for an MCP server.
Oftent times, you can just build your
own script that exposes the right
functionality. Here we have a start and
a stop tool that starts and stops the
application. Okay, so we're just scaling
up what our agentic layer can do. We're
giving our agents more capability,
right? We are scaling our compute to
scale our impact. Our agents now have
access to custom tools, skills, and
prime commands, right? And keep in mind,
this is something that I want to keep
emphasizing. Skills and MCP servers can
both be replaced with just a simple
prompt. Okay, so we have this prime DB
with tools. You can teach your agents
how to execute CLI commands. Here we're
just using PSQL, right? So that our
agent knows how to interact with the
user management database for this mock
application. And so you can bypass
everything by just understanding how the
core 4 works, context, model, prompt,
and tools. Okay. And notice what we're
doing here, right? We're constantly
giving our agents more capability.
Custom tools is a huge step. Grade three
is very important. Now, this is when
prompt engineering and context
engineering becomes more important.
Skills, MCP servers, and prompts must
have tools carefully designed. This is
where things can start going wrong. And
a lot of engineers do get stuck at grade
three. They think they get past this,
but actually their tools are terrible
and they won't scale. And they're
chewing up tokens. They're burning cash
and they're overengineering their tools,
right? Like one of the most common
problems is that engineers will have way
too many tools. Being able to design and
give your agents the right tools via MCP
server skills and just raw prompts is a
critical skill for every agentic
engineer. Let's move on to grade four.
How do we scale this up even further?
What comes next? Right. So at this
point, we start scaling up our prompts
and we start building up feedback loops
in the codebase. Okay, so this is where
things become very powerful and where
you can really scale what you can do.
So, of course, we have our plan prompt,
but now we'll have things like our build
prompt, right? A higher order prompt.
Grade four is distinct and that you
start asking your agents to review their
work. This is where you realize that you
should always add feedback loops into
your agentic layer. You're effectively
adding more compute to get more
confidence in your agents results. All
right, this is the big idea in tactical
agentic coding. Lesson five. Right here
we're building closed loop prompts. All
right, let's understand the application
structure. So now we have things like
app review. So not only are you planning
your work, you're having your agents
review the work done and then report it.
And you're doing this with powerful
prompts like the code review prompt, the
review prompt. You're then running
reproduce bugs and then things like test
backend, test front end. All right, so
for instance, what does review do? Code
review current changes, review all stage
changes, do a bunch of stuff, and then
we're going to output some concrete
results. You might also do something
like reproduce a bug. This is where we
would save a concrete resolution file
into app reviews. This becomes really
powerful when you start giving your sub
agents these abilities. Okay, so we can
run something like a review agent and
you can scale this up and then it will
output its review into a specific file.
Inside of our application layer here,
you'll also notice something. As you
start to grow your codebase, your
agentic layer and your application layer
will be growing side by side. We've now
split out our application into client
and server. At some point, your small
codebase will grow and it will start to
fracture. This is important. We'll look
at this in the next grade. But with this
application directory structure, we're
still able to keep all related code for
this product under the same code base.
Now, how this operates in Git is
important. We'll talk about that in just
a moment. Since we have both a front end
and backend application, you can start
specializing your prompts, right? test
backend, test front end. Here we have a
concrete closed loop prompt. I'm being
really verbose here with my language
inside of these mock prompts. You know,
we're following that three-step workflow
from tactical agent to coding lesson 5.
Request, validate, resolve. This creates
a closed loop where your agent can spin
and spin until the job is done. This
distinctly marks grade four. Again, this
is a place where engineers fall off and
they miss out on using more compute to
get the job done, right? We're starting
to split our prompts to focus on
specific areas of this codebase. Okay,
so things are going from really generic
and vague, right? Plan build to more
specific, right? Test our backend, test
our front end, review with this code how
we like to do it. All right, and the
advantages here are really clear, right?
Once you start using closed loop prompts
in your codebase, your agents start
resolving their own work. You can create
specialized tasks for your front end,
for your back end, for whatever part of
your codebase, and it's all still on
this top layer. Now, we're not going to
dive into codebase organization too much
here. There are some leverage points of
agent coding that we're not going to
re-emphasize here. Here, we're focused
on giving our agents the highest
capability possible so that they are as
autonomous as possible. Now, there are
some trade-offs here. Again, things
start to get more complex. You need to
know how to prompt engineer. This is why
our agentic prompt engineering lesson
was so important. You must know how to
write these prompts properly.
Self-correcting agents is a massive
massive win for your agentic layer.
Let's move on to grade five. How does
our agentic layer continue progressing?
Now, by this point u many engineers have
many many prompts, many agents, several
skills. They've used many different
types of MCP servers and they start
scaling their work even further with a
key concept we discussed in lesson
three.