Back Original

Context Architecture - Aligning Humans and Agents at Scale

I've previously shared my vision that the industry is moving towards software factories for 99% of code changes and to make that effective we'll need to move to a paradigm of Durable Context and Disposable Code.

The next bottleneck to actually implement this is Alignment - how do we align humans and agents at scale - across organization, agent swarm, codebase, and concurrent project sizes - so we can actually speed up the full SDLC. Here we'll discuss an approach I've been experimenting with at work and in my side projects - Context Architecture.

Alignment is the Bottleneck

Organizations have long struggled to align humans at scale. We created processes to manage this like waterfall and agile, docs for alignment like PRDs/RFCs, products like task trackers and knowledge bases, and various organizational structures from top down to bottom up.

I'd even posit that types in programming languages are their own form of context alignment.

Before AI, the same human discusses and writes code; with agents, the human delegates through a three-by-three agent tree.

This is one reason so many thought AI would have a minimal impact on the industry - 60% of your time is spent on alignment, only 20% on coding and a 20% speedup isn't that big of a deal. But as we've seen AI has and is rapidly changing the state of the industry (I'm personally seeing close to 2x throughput).

Telephone handoffs from a human to agents and child agents show copied requirements with widening possible interpretations.

This alignment bottleneck becomes more acute in the age of agents as we add an additional hop to our game of telephone.

As we move to agents managing agents and full software factories, we need better ways to align at scale.

The same agent fanout refers to shared durable context, keeping interpretations close to one authoritative source.

So the goal of the Context Architectures I'm proposing is to align humans and agents at scale. To get there I have a few sub areas I'm focusing on:

Context and Information Architecture

The way I've been thinking about approaching this is through the jobs we're typically trying to do and the constraints we're under.

The first kind of context is providing guidance on how to do certain things - think runbooks, best practices, and available tools. This is one of the most common pieces of information at any org and is typically the ones that are more up-to-date as they get more foot traffic (and thus complains when they don't work). For these I think we use agent skills - a toolbox for how to do common things.

The next is explaining why a system exists, what it does, and how it does it along with additional info around maintaining it. In the past this context typically incurs bitrot as there was no single source of truth - it was scattered around in various docs, task trackers, people's heads, and often in various bug fixes and requirement changes only present in git, code comments, or if more disciplined test cases. Moreover this context was often only maintained by a single team and the effort of maintaining it usually deferred until the next project that had to touch a certain area. As the need to align (and penalty for not doing so) grows I think we need to move this information into a more sacred source of truth - what I'm calling Durable Context.

Scattered guidance in documentation, people's memory, task trackers, and code converges on implementation; durable context provides one authoritative route.

Durable Context should be treated with the same care we currently (or really previously) gave to code. It was arguably always more important than the code (outcomes > implementation) but now it is certainly more important for building this shared source of truth to enable alignment at scale. So we need to continue thinking through our plans (as we have been) but also be much more strict about updating this context - ensuring we keep it up to date, it's accurate, there's one source of truth, it has the right shape and abstractions - much like the care we used to take with our code reviews. This is how we get the best of both worlds - the deep, slow thinking of humans and the mass automation of agents. For more: see Durable Context, Disposable Code.

Context Types

Moving onto more concrete implementations, I think we have a few context types we can compose together to approach this vision.

A router finds skills, durable context, and change context; a landed change updates durable context.

Together this gives us a decent menu of context types to pull for a majority of our agent, human, and system alignment needs.

Context Hierarchies

I also think it's important to talk about Context Hierarchies. These are useful for constraining who is exposed to which bits of context / information and when. This helps you give the info someone needs at the time they need it while minimizing the noise from things they don't - a waste of AI tokens and human bandwidth.

We are natively familiar with many forms of context hierarchies - headers in a blog post to break things up, folders on a machine to organize files, the order and format information is presented in, etc. So I'm not going to dive into every form of Context Hierarchy because there's a ton of it and most people are already familiar with many kinds so I'll just leave you with an idea that it's important to consider this for agents just as it is for humans.

Organization Hierarchies

One Context Hierarchy I do want to expand on though is that of Organization Hierarchies. Orgs typically work best when they have a nice balance of top-down direction and bottom-up innovation. what that balance is depends on the co, its industry, and current economic conditions but generally I believe an org needs both to be effective.

So the idea is to provide flexibility at the lower levels and promote up to the org as things prove useful so everyone benefits. Everyone should get the org standards as a baseline setup and then lower levels can override higher levels in their specific usecases to make things work better for them.

We'll use an example of a team working on auth going forward to try and make some of these ideas more concrete.

At a high level the hierarchies I'm thinking of are:

Though you could imagine this shape changes based on the org type and size to fit their actual structure.

Implementing Context Architectures

So I think there's several ways to do this at scale that work. I don't have a strong opinion on which to go with as they all work in theory under the proposed constraints and I'm still trialing various versions of them to try and figure out which works best in practice.

The core idea remains:

A - All in one place

The first option is just having one big context structure.

repo/
├── AGENTS.md
├── .agents/skills/
│   ├── review-change/SKILL.md
│   ├── auth-testing/SKILL.md
│   └── billing-testing/SKILL.md
├── docs/
│   ├── organization/
│   │   └── engineering-standards.md
│   ├── auth/
│   │   ├── requirements.md
│   │   └── architecture.md
│   ├── billing/
│   │   ├── requirements.md
│   │   └── architecture.md
│   └── changes/
│       └── google-sign-in.md
└── packages/
    ├── auth/
    │   ├── AGENTS.md
    │   └── src/
    └── billing/
        ├── AGENTS.md
        └── src/

Tradeoffs:

B - Distributed throughout codebase

This option moves context right next to where it's used for better locality of behavior.

repo/
├── AGENTS.md
├── .agents/skills/
│   └── review-change/SKILL.md
├── docs/
│   ├── engineering-standards.md
│   ├── system-architecture.md
│   └── changes/
│       └── cross-package-change.md
└── packages/
    ├── auth/
    │   ├── AGENTS.md
    │   ├── .agents/skills/
    │   │   └── auth-testing/SKILL.md
    │   ├── docs/
    │   │   ├── requirements.md
    │   │   ├── architecture.md
    │   │   └── changes/
    │   │       └── google-sign-in.md
    │   └── src/
    └── billing/
        ├── AGENTS.md
        ├── .agents/skills/
        │   └── billing-testing/SKILL.md
        ├── docs/
        │   ├── requirements.md
        │   └── architecture.md
        └── src/

Tradeoffs:

C - Hybrid

This option uses a bit of both, picking the best approach for the given scenario. It's likely this is the best option as we figure out where each wins out. I could imagine different domains / teams choosing different options for their repos and systems depending on what they're comfortable with and what makes the most sense.

Tradeoffs:

Best Practices for Context

Regardless of the context architecture you choose, there are a few best practices for this context we can leverage.

Next

So that's how I'm currently thinking about aligning humans and agents at scale. It's the same tried-and-true processes we've used in the past - PRDs, RFCs, tech specs, acceptance criteria, BDD (Behavior Driven Development / Design), DDD (Domain Driven Design), agile, information architectures, etc. We're just trying to translate it into a format that's more effective and efficient for humans and agents.

Quick shoutout to my Haminions Members for your continued support and making free posts like this possible. Haminions Members get access to my example project repo which includes monthly snapshots of my AI Dotfiles as well as dozens of example projects from the blog. If you liked this post, consider joining to support me making more.

If you liked this post you might also like: