The Hard Part of Agents Isn’t the Model

Why we built AgentForge, what broke, and what we’d tell you before you build your own

If you only read one section

  • Build the layer, not the engine. We kept open-source orchestration (LangGraph) and built a thin layer on top that owns how every agent gets data, calls tools, asks for approval and gets traced. That gave us control of providers, data and approvals without maintaining a graph runtime.
  • It paid off quickly. Our last hand-built agent took several sprints. The first service generated by AgentForge reached staging in eight days, and the time went on business logic, not plumbing.
  • The hard part isn’t the model. Almost every serious problem was identity, permissions, cost ceilings, tool coverage or packaging. Most of them failed silently.
  • Autonomous agents are a different product from chat. Different identity model, different threat model, different governance. Ours are read-only until that governance is enforced, not just written down.

Short on time? Read Governance and security, Lessons from the systems around the agent, Where we are now and the closing section, If you are weighing build versus buy.

uilding one LLM agent is now easy. A notebook, an API key and an afternoon will get you a demo. Building the tenth agent in a company is a different problem. By then every one of them needs to log the same way, authenticate the same way, account for tokens the same way, refuse risky actions the same way, and survive upgrades to libraries that change monthly.

At Madgicx we build AI for performance marketers: tools that read ad accounts, explain what is happening, and increasingly act on the user’s behalf. In about a year we went from a single chat assistant to a family of agents: conversational copilots, deterministic workflows, and scheduled analysts that run while nobody is watching. AgentForge is the framework that made that possible. It is a code generator plus a small runtime library on top of open-source building blocks: LangGraph (a library for building agents as graphs of steps), LangChain, FastAPI and Pydantic.

This is for engineers who would use something like it, and for CTOs and CIOs deciding whether to build or buy.

WhenWhat happened
Mid to late 2025Principles set; frameworks evaluated; first agent service on LangGraph
Early 2026First-gen chat hits its limits; a hand-built campaign agent takes several sprints
Mar to May 2026AgentForge codebase starts; first generated services; runtime split into its own package
Jun to Sep 2026Agentic chat rebuilt on AgentForge; reasoning, caching, approvals and widgets land in the runtime; the generator gets its own CI
Oct 2026Autonomous Super Agents enter an internal staging pilot; governance control plane in design

Why build our own

The prototype that discovered the requirements

Our first-generation chat ran on LangGraph with a plan, execute, validate and compose loop, checkpointed state, versioned prompts and audit logging on every write. It was reasonable engineering. Its post-mortem summed it up in one line: “v1 wasn’t a failed idea. It was the prototype that discovered the requirements.”

It discovered three to eight seconds of latency per message; too much reasoning and too many purposes packed into one node; one token-hungry insights tool doing far too much; tools calling the ad platform’s API directly even though our own data platform already held normalised, enriched data; partial tracing; and test coverage of roughly 40 to 50%, with no regression suite for agent behaviour.

Then we built a second agent, for campaign creation, and watched the same pattern repeat. As the planning epic put it: “Right now building a new agent at Madgicx is a bespoke process. Every agent starts from scratch.” That agent took several sprints, mostly plumbing. The target for the next one was blunt: one day to generate, one sprint to staging.

Build versus buy: we did both

In late 2025 we evaluated LangChain, LangGraph, PydanticAI, Google ADK and CrewAI, and later OpenAI Agents and n8n for integration scenarios. LangGraph won the runtime layer for practical reasons: explicit graph control flow, state checkpointed to Postgres, streaming, async throughout, iteration limits and provider-neutral model classes.

None of them could answer the questions that actually consumed our time. Where does this agent get data, and does it use our platform before the external API? What may it do, for which team, on which accounts? Who approves a write, and where is that recorded? How is every step traced, tested, packaged and deployed?

Those answers are specific to a company. Hosted agent platforms solve the plumbing, but they decide which providers you may use, where your data runs and how approvals work. For agents that can change real advertising spend, we did not want to outsource those decisions. So we bought the orchestration primitives and built the production contract around them.

Two more problems showed up as services multiplied. Where teams hand-wrote a backend per model provider, small rules drifted; the cap on tool-calling rounds quietly became different per provider. And a shared library that supported one provider “for now” passed that limit to every product built on it. We also needed to route each task to a model by cost and capability, which is impossible unless every provider reports the same facts: can it reason, can it cache, what did this turn really cost.

Our first scaffold, built on generic LangGraph templates, scored 5 out of 10 in our own review. It ran, but with none of our data paths, tracing or guardrails, and engineers rewrote most of it. A scaffold is only as good as the production code it is derived from.

What AgentForge is

Three pieces ship from one repository:

  • The scaffolder (CLI). Describe a service in one project.yaml, or answer a short wizard, and it generates a complete Python project: FastAPI API, LangGraph workflow, agents, tests, CI, Dockerfile, secret-scanning rules and a Makefile. Everything optional is off by default.
  • The runtime SDK. Generated projects import shared behaviour instead of copying it: the model-provider factory, base agent and registry, logging, tracing, input sanitising, prompt secret scanning, the tool-approval policy and token accounting. A security fix ships once and reaches every service through a package upgrade.
  • The widget kit. A JSON Schema contract for visualisations, a Python emitter and a React renderer, so a backend with no frontend can still return something a person can read.

The scaffolder runs once when a service is created. The runtime SDK, highlighted, is the shared seam that every service keeps importing.

A team picks one of five execution patterns:

PatternUse it when
reactOne agent reasons, calls tools and repeats in a bounded loop until it has an answer
orchestratorA supervisor (an LLM or fixed rules) routes each request to a specialist agent
workflowSteps run in a fixed order, with optional human approval between them
fanoutSeveral specialists analyse the same input in parallel and their results are merged
plannerA request is broken into a task graph, run concurrently, checked for gaps and replanned

The framework ships all five because different services genuinely need them. Our customer-facing products default to a single stateful planner: one lifecycle is easier to guard, policy context stays in one place, traces stay readable, and there is no cross-agent coordination latency. Products adopt the multi-agent patterns only when a spike proves the extra complexity pays for itself.

Four principles, written down before most of the code, shape everything else:

  1. Separation of concerns. Planners reason, tools execute, validators validate. Validation is never baked into a prompt.
  2. Progressive commitment. Intent, proposal, review, confirmation, execution. Every step reversible where possible.
  3. Evidence traceability. Every recommendation records which tools and data informed it, and every model call, tool call and routing decision is traced end to end.
  4. Reusability. New agents supply only domain models, configuration and prompts.

Two concrete consequences are worth calling out. Agents touch the world only through typed tool families (search, CRUD, action, ML, UI and eval), and the family doubles as a permission boundary. And data, agents and UI travel on separate channels: MCP (Model Context Protocol, the open standard for exposing tools to AI models) for tools, A2A (Agent2Agent, an open protocol for agents to message each other) for agent messages, and a typed UI channel for things like “show an approval dialog”. That kept our public MCP servers clean data contracts with no knowledge of our own interface.

The current codebase has 153 commits from March to September 2026. It was built with AI coding agents (AEP – https://www.indikamaligaspe.com/2026/10/16/inside-our-agentic-engineering-playbook-architecture-governance-and-continuous-learning/) from day one, which shaped both its speed and some of its hardest lessons.

Design decisions, and why we made them

Each decision traded some flexibility for consistency. Most were written down as decision records at the time.

1. Wrap open source; do not replace it. We chose a thin factory over LangChain’s own model classes instead of a universal adapter library, which would have added a heavy dependency and hidden native features like tool binding and structured output. A few dozen lines keep generated code readable and auditable. The cost is that we inherit LangChain’s bugs, as you will see.

2. One declarative file, and nothing changes unless you ask.project.yaml is validated by Pydantic before a single file is written. Every new option defaults to off, and a test fails if one byte of output changes for an existing reference configuration. Teams can upgrade the tool without being surprised by it.

3. Split the generator from the runtime. This is the most important structural choice in AgentForge. Until May 2026 the generator copied every shared module into each project, so a template fix never reached services already generated. Over one week we moved shared code into a separately versioned runtime package.

CLI (scaffolder)Runtime SDK
RunsOnce, when a service is createdEvery request, inside every service
DependenciesTemplating and CLI toolingOnly langchain-core, Pydantic and structlog
Upgrade pathRegenerate, or keep what you havepip install -U, no regeneration

By default a project gets thin “linked” stubs that re-export runtime code. A team that must customise deeply, or deploy where the package cannot be installed, can mark any of eleven modules “vendored” (the module’s full source is copied into the project instead of imported from the package). Each project records the CLI and minimum runtime version it was built with. Releases are cut from commit messages, and that is a coordination tool, not a label: a patch reaches every consumer automatically, while below 1.0 a minor version crosses consumers’ version pins, so each team adopts it deliberately. We have shipped a fix as a separate patch precisely so it would reach everyone at once.

One duplication we accepted: the CLI needs each provider’s capabilities at generation time but cannot import the runtime, so capabilities live in three places that must change in the same commit, with a test that parses the code to prove they agree. The alternative, a CLI that depends on the runtime, would tie every template change to a runtime release.

4. Providers are interchangeable; capabilities are explicit. Every provider declares what it supports: tools, structured output, streaming, vision, JSON mode, reasoning, prompt caching. Generated code checks the flags instead of assuming. Token usage, including reasoning and cached tokens, is normalised into one shape. That is what makes cost-based routing possible.

5. Contracts are schemas, and code is generated from them. For widgets, JSON Schema is the source of truth; Python models and TypeScript types are generated from it and CI fails on any difference. The payload also says which column is the axis. We learned why the hard way: an earlier version shipped bar charts with dollars and ratios on the same axis.

6. Pin dependencies, and watch the ones you pinned. The runtime pins LangChain to a narrow range, and a nightly canary job (an early-warning build) installs the latest release and runs the tests against it.

7. Shared code is earned in production. We do not invent framework features. Product teams patch what they need, and patches are reviewed for reuse and ported back behind opt-in flags, so the next team starts with them. The table under “What teams built on it” shows where they came from.

Governance and security, built in

Our agents can change live advertising budgets, so governance cannot be an add-on. The framework owns the rules and the vocabulary, each product owns how it pauses and asks a human, and the audit record is written at the moment of decision.

  • Fail-closed approval (when in doubt, block rather than allow). Every tool is classified as a read or a write. Writes need human approval, and a tool nobody classified is treated as a write, so a wiring mistake fails safe. Mutation tests (tests that deliberately break the rule to prove the safety test notices) back it up: flip the rule to fail open and the safety test fails. Approval outcomes and records are defined once in the runtime so every product audits the same way.
  • Authentication and permissions. API keys compared in constant time, or JWT with a pinned algorithm; a missing secret raises an error instead of letting requests through. One production team found a permissions claim sent as a string would pass a naive check, because “adm” is a substring of “admin”. Permissions must now be a list, for everyone.
  • Tenancy. One switch turns on middleware that checks every request’s account against the accounts the caller may access. The default credential provider allows no accounts at all.
  • Bounded autonomy. Tool loops, replanning and retries all have upper limits. Workflows can pause for human review before any named step, and the schema rejects review points for steps that do not exist.
  • Secrets and logs. Secret scanning is generated into every project, an opt-in scanner blocks prompts containing keys, logs are redacted and stripped of control characters, and blank secrets fail at start-up rather than in production traffic.

Most controls are opt-in, because a read-only prototype and a service that spends customer money need different defaults. A few cannot be configured away: unclassified tools need approval, permissions must be a list, JWT will not verify without a key, and unknown configuration keys are rejected.

We are explicit about the limits. Our first design said no code path could bypass approval. We withdrew that claim as unachievable. The honest claim is narrower: approval is the path of least resistance, and any bypass is visible in the audit trail. Some opt-in defaults still lean permissive, and tightening them is on the hardening list.

What went wrong along the way

The hardest problems were rarely loud. Almost every serious defect in our history failed silently: no exception, no red build, just quietly wrong behaviour.

The model that was never called

Early templates always created an OpenAI client, whatever model the configuration named. A project that asked for Claude sent a Claude model name to the OpenAI client, and the config schema listed Claude as a valid choice. We hotfixed it in May, then replaced the guesswork with an explicit provider per agent.

Telemetry that reported zero

In July we added reasoning-token accounting. For one provider the count was always zero. LangChain’s Anthropic integration discarded the reasoning-token count the provider returns, on every code path and version we tested. The field is optional, so nothing raised an error, and a turn that reasoned heavily looked identical to one that did not reason at all.

Worse, our own test had passed the whole time, because its hand-written fixture asserted a field no real release ever produced. We added a small compensating shim and filed a reproducible report upstream. The shim was done to self-heal when the actual fix was done.

Tests that never ran

In August and September we found holes in several safety nets. The nightly LangChain canary ran zero tests for weeks, because a module-level import failed during collection and aborted the run. A test that imports every generated module had been skipping, never passing; when CI finally ran it, a freshly generated project could not import itself. And the generator had no CI of its own, so templates drifted for months until generated projects failed the very checks their own CI told them to run.

Turning on the type checker found 22 errors that tests had missed, because tests check values, not types. One turned every error response into an HTTP 500. Another had the supervisor calling a registry method that never existed.

Instruments you cannot trust

Two versions of the same linter reported 19 and 71 findings on identical code. Our check script once reported “0 files need formatting” while 27 did, because it read the wrong output stream. An automated clean-up removed “unused” imports that existed for their side effects, and the agent registry stopped registering agents. A template is a family of outputs, not a file. We now pin tool versions, render several reference configurations on every change, and test our checkers against deliberately broken input.

Add the unglamorous rest (the PyPI name was taken, the release workflow listened on the wrong branch, a base image crashed on ARM, a dependency renamed a module our MCP client used) and you have most of the work of making a framework other teams can trust.

Lessons from the systems around the agent

The framework bugs above are engineering defects. The products built on AgentForge taught a different kind of lesson: product and operational, and almost none of them about the model.

Unattended agents change the threat model. A chat has a user watching; a scheduled agent has nobody. With no user session, “whose credentials does this run use?” needs a real answer (ours is under Super Agents, below). Prompt injection also gets worse, because unattended agents read user-controlled text all day: campaign names, ad copy, comments, files. Prompt hardening is not a security boundary; an action layer that refuses out-of-scope actions is. We also rejected a tempting proposal to execute an approval automatically if nobody answered in time. That silently turns a supervised agent into an autonomous one.

A control that is not enforced is not a control. Our scheduled-agent runtime had a per-run token limit in its configuration that nothing checked. One test run consumed about 1.2 million tokens against a typical 66,000. Usage is now checked after every model step, runs stop at a configurable token limit by default, and a model that fails to report usage stops the run. The same investigation found agents analysing paused and archived campaigns by default. Data selection is a cost control.

“Supports model X” means two things. Routing across Anthropic, OpenAI and Gemini works. Production support also means usage, caching, limits and data terms are correct per provider. We have verified token accounting against one provider’s own numbers and are still verifying the others.

Tool coverage beats model quality. Reviewing real conversations, we found users repeatedly asking to target or exclude custom audiences, and the assistant replying that it had no tool for that. No model upgrade fixes a missing tool. Reading transcripts is our highest-leverage product activity.

Packaging is part of the product. Installing the framework into another repository put a generic top-level scripts package on the import path, shadowing the host’s own and breaking every one of its CLI commands, while our validation, which only checked that the framework imported, passed. Namespace everything, and test the real integration surface.

Streaming is infrastructure. Long-lived streaming connections leaked database connections and delayed broadcasts across instances. Streaming needed health checks, distributed pub/sub and explicit P95 and P99 latency budgets.

Approve before the fan-out. An internal agent that edits governance and data definitions originally synced changes downstream before review finished. Now only the merge of an approved pull request triggers the sync.

What teams built on it

ProjectHow it uses AgentForgeWhat it gave back
Agentic chat assistantScaffold layout; runtime for three providers, token usage and approvalsReasoning and caching flags, normalised usage, the approval policy
In-product copilotContextual Q&A on the shared conversation engineProof the seam works for a streaming tool loop
Super Agents (internal pilot)Each scheduled run is one turn on the shared runtime and approval pathNot yet
Internal operations agentsA governance co-pilot and a documentation co-pilotThe approve-before-sync rule

Where we are now

As of October 2026 the runtime is at version 0.4.1, supports Anthropic, OpenAI and Gemini and five execution patterns, and is used by several teams alongside the conversation engine and widget kit. Generated projects now pass their own lint, format, import and type checks on the core path; opt-in modules still carry type errors, and we keep a list of known-failing tests that is meant to shrink, not grow.

Governance is where we are most careful. The policies are written and the control plane is designed, but parts of enforcement, kill switches in particular, are still being built. That is the main reason autonomous agents are not yet writing to anyone’s ad account.

What comes next

The plan is convergence: every agentic product on one seam, with the provider tuning that products wrote for themselves moved into the framework, so each migration is cheaper than the last. This is a sequence, not a schedule.

  • Finish hardening. Zero type errors in the opt-in modules; an empty known-failing list.
  • Richer providers. Explicit prompt caching where providers allow it, since agent loops resend the same prompt and tools every round, and native reasoning settings in the framework instead of in each product.
  • Products converge. Copilots route each screen to a model by cost and capability; conversational products retire their hand-written provider backends.
  • An evaluation gate. A regression suite, starting at 50 cases, runs on every prompt or model change, with product and engineering jointly owning the release decision. Live monitoring starts alert-only; we would rather earn automatic rollback than assume it.
  • A governance control plane. Every agent, model and tool registered with an owner, risk tier, autonomy level, budgets and kill scope. “Unregistered means unshippable”, and no LLM in the enforcement loop: a model can help triage, but never decides whether to stop a run.
  • Customer-built agents inside an envelope. The builder is governed as a high-risk component, and every customer agent lives inside limits on tools, autonomy, data, budgets and confirmation gates that customers can tighten but never loosen.
  • Event-driven agents. Agents that react to a spend spike or a fatiguing creative, not just a schedule. Our framing: automations and AI agents are the same thing at different points on an intelligence spectrum, so they should share one engine and one governance model.
  • Sub-agents in products, once a spike shows they pay for their complexity.

If you are weighing build versus buy

We would make the same call again. Some things we’d tell anyone starting out:

  • Build the layer, not the engine. A thin layer over open-source orchestration gives you control of providers, data and approvals without maintaining a graph runtime.
  • Derive the framework from a real agent. Ours became useful when its templates came from production services, not tutorials.
  • Budget for the boring work. Generator CI, release automation, dependency canaries and packaging took more effort than any agent pattern, and that is what makes teams trust the framework.
  • Put security in the tool layer, and fail closed. If your authorisation depends on the model behaving, you do not have authorisation.
  • Make every control executable. A limit in a config file that nothing checks is decoration.
  • Assume silence, not failure. Our worst bugs raised nothing: a wrong client, a zero in telemetry, a skipped test, an unchecked ceiling. Build fixtures from the real integration, and show every check a known-bad input before you trust it to report zero.
  • Treat autonomous agents as a different product from chat. Different identity model, threat model and governance.

Inside Our Agentic Engineering Playbook: Architecture, Governance, and Continuous Learning

Part 2 of our Agentic Engineering Playbook series: How we designed the engineering system that allows AI coding agents to work within organizational standards, validate their implementations, and continuously improve.

Introduction: Building the Engineering System Around the Agent

In the first article of this series, I shared our seven-month journey at Madgicx, where we moved from experimenting with AI coding agents to establishing a structured approach to agentic engineering.

That journey taught us something important.

The challenge is not simply getting AI agents to write good code. It is creating an engineering environment in which they can consistently make good decisions.

When an experienced engineer joins an organization, they gradually learn its architecture, engineering practices, business terminology, security policies, and governance requirements.

They also learn where to find information, which decisions require approval, and how to validate their work.

An AI coding agent needs access to much of the same knowledge.

But there is an additional challenge.

Unlike an engineer who gradually develops organizational understanding, an AI agent often begins a new session with limited context.

It may not know what happened in the previous session.

It may not understand why an architectural decision was made.

And unless we provide the necessary information, it may confidently implement something that violates our existing engineering contracts.

We initially tried to solve this problem through extensive prompts and planning documents.

That approach quickly became too heavy.

We then moved toward smaller, focused standards, persistent project memory, shared organizational knowledge, and deterministic validations.

Over time, these capabilities evolved into our Agentic Engineering Playbook (AEP).

Today, the AEP operates as a local engineering framework that guides agents through research, planning, implementation, and validation.

It integrates with our organizational governance standards and complements the centralized security and quality controls we enforce through GitHub.

It also captures feedback from engineering sessions so that important lessons can become improvements to the shared playbook.

In this article, I want to move beyond the journey and explain the architecture itself.

I will cover the seven layers of our AEP, the engineering decisions behind them, how governance and enforcement work, and how we are building a continuous learning mechanism around agentic development.

This is not intended to be a universal architecture that every organization should adopt unchanged.

It is the approach we developed through practical engineering experience, and the principles we believe are transferable to other organizations.

The Architectural Principle: Separate Intelligence from Enforcement

Before discussing the individual layers, I want to establish the most important principle behind our architecture.

We do not rely on the AI agent to enforce every engineering requirement.

AI agents are good at reasoning about requirements, investigating systems, evaluating alternatives, and generating implementations.

But they are probabilistic systems.

They can overlook instructions, misinterpret context, or incorrectly determine that a rule does not apply.

This makes them useful for engineering judgment, but unsuitable as the sole mechanism for enforcing deterministic requirements.

For example, consider a rule that prohibits committing credentials.

We can document that rule in the agent’s instructions.

We can remind the agent during planning.

We can even ask the agent to review its own changes for secrets.

All of those measures are useful.

But none provides the same assurance as executing a secret scanner against the actual changes.

The same principle applies to linting, package restrictions, protected directories, formatting, and other machine-checkable requirements.

Our architecture therefore separates three responsibilities.

ResponsibilityPurposeExamples
Agent intelligenceUnderstand problems, make proposals, and execute engineering workResearch, planning, implementation, design review
Local AEP enforcementGuide and validate work during developmentGitleaks, package checks, code quality, workspace standards
Centralized enforcementIndependently verify organizational requirementsGitHub CI/CD, security scanning, required checks, review controls

Organizational governance sits above these responsibilities, providing the authoritative policies and standards they must follow.

This separation is fundamental.

The agent can reason about whether a design complies with a security requirement.

The local tooling can detect violations that are mechanically verifiable.

And the centralized engineering platform can independently enforce critical requirements before changes progress through the delivery pipeline.

The result is not a single control.

It is a system of complementary controls.

A simplified view of the architecture

This is a conceptual view rather than a complete deployment diagram.

The AEP operates within the developer’s or agent’s local workflow. GitHub remains an independent enforcement layer.

The feedback mechanism allows the playbook to improve based on actual engineering experience.

With that foundation established, let us examine the seven layers

Layer One: A Role-Based Engineering Pipeline

Our first layer defines how agents participate in the engineering lifecycle.

One of the mistakes we made early was allowing a single agent session to move from a loosely defined requirement directly into implementation.

Sometimes that worked.

But on more complex tasks, the agent would begin coding before fully understanding the problem.

It might make assumptions about business logic, overlook an existing architectural pattern, or implement a solution that later required significant rework.

Our initial response was to introduce a comprehensive planning process.

As I explained in the first article, that became too heavy.

We eventually simplified the approach into four responsibilities:

Research → Plan → Implement → Validate

The distinction is important.

These are engineering responsibilities, not necessarily four separate agents that must be invoked for every task.

The workflow should remain proportional to the complexity and risk of the change.

Research: Understand before changing

The research responsibility is to establish what is actually true about the system.

The agent investigates the relevant codebase, existing functionality, dependencies, and architectural constraints.

It should identify the files and components involved, determine whether similar functionality already exists, and understand the contracts that the implementation must respect.

Research should be grounded in the actual repository and authoritative organizational knowledge.

An agent should not invent an API contract simply because it seems reasonable.

If the contract exists, it should be retrieved and examined.

If the contract is unclear, the uncertainty should be surfaced rather than silently resolved through assumption.

Plan: Decide what should be built

The planning responsibility is to translate the requirement and research findings into an implementation approach.

A useful plan should explain the intended changes, identify affected components, highlight important risks, and define how success will be validated.

For larger changes, this may include architectural alternatives and trade-offs.

For smaller changes, a concise plan may be sufficient.

The objective is not to produce documentation for its own sake.

It is to ensure that implementation begins with a reasonable understanding of the problem and the intended solution.

Implement: Build in verifiable increments

The implementation responsibility is to execute the approved approach.

We prefer smaller, independently verifiable increments rather than large changes that are difficult to review.

This allows the agent to validate progress and correct problems earlier.

It also makes the resulting changes easier for engineers to understand.

Validate: Prove that the work meets its requirements

Validation is not simply asking the agent whether its implementation is correct.

It involves executing relevant tests, code-quality checks, security validations, and other applicable controls.

The agent should compare the implementation against the acceptance criteria and report what has actually been verified.

An important distinction is between a test that was executed successfully and a validation the agent merely believes would pass.

We want evidence, not confidence.


Challenging Plans with GrillMe-with-Docs

One of the more interesting additions to our planning workflow is GrillMe-with-Docs.

We introduced it to address a recurring problem.

An agent could produce a technically plausible implementation plan that failed to account for an important business, governance, or security requirement.

Traditional code validation often catches problems after implementation.

But by that stage, the agent may already have built a solution around an incorrect assumption.

We wanted a way to challenge those assumptions earlier.

How we use GrillMe-with-Docs

During planning or architectural design, we use GrillMe-with-Docs to challenge the proposed approach against relevant organizational documentation.

This includes:

  • Business requirements and domain standards.
  • Security policies.
  • Governance requirements.
  • Architectural decisions.
  • Other applicable engineering standards.

The objective is to expose gaps in the design before implementation begins.

For example, imagine an agent proposing a new service that processes customer data.

The proposed architecture might be technically sound.

But does it follow the organization’s established data-handling requirements?

Does it introduce a new integration pattern when an approved one already exists?

Does it respect the relevant business definitions?

Are there security constraints that affect the design?

GrillMe-with-Docs introduces a structured challenge to these assumptions.

It is not a replacement for architectural review or human judgment.

Instead, it helps ensure that relevant organizational requirements are considered during the planning process.

Why this matters

In agentic engineering, we should not concentrate all our controls at the end of the development lifecycle.

We should also improve the quality of the decisions that lead to implementation.

Finding a design problem before coding is usually less expensive than correcting it after implementation.

There is an important balance, however.

We do not want every small change to require a heavyweight architectural interrogation.

The depth of planning and design review should reflect the risk and complexity of the work.

That principle emerged directly from our earlier experience with excessive process.


Layer Two: Engineering Standards as Focused Skills

Our second layer provides the engineering standards that agents need to follow.

Initially, we experimented with large instruction documents.

These contained coding conventions, architecture guidance, security requirements, testing expectations, and numerous other rules.

The problem was that much of this information was irrelevant to the task being performed.

A frontend agent did not need every backend standard.

A Python project did not need React-specific instructions.

And a minor configuration change did not require the entire organization’s engineering handbook.

Loading unnecessary information increased token consumption and could introduce conflicting instructions.

We moved toward smaller, focused standards that can be activated when relevant.

Universal and technology-specific standards

We distinguish between standards that apply broadly and those that apply to particular technologies or engineering domains.

Universal standards cover principles such as maintainability, testing expectations, security practices, and avoiding unnecessary complexity.

Technology-specific standards address the conventions and requirements of particular languages, frameworks, and platforms.

We generally aim to keep individual standards concise—around 200 lines or fewer where practical.

The purpose is not to impose an arbitrary document limit.

It is to encourage focused, actionable guidance rather than comprehensive reference manuals.

Detecting the technology stack

One of our early mistakes was activating standards based on repository or folder names.

That proved unreliable.

A directory name might suggest React, for example, while the actual project dependencies indicated a different set of requirements.

We changed the approach to use evidence from the project itself.

Configuration and dependency files, such as package.json and pyproject.toml, provide more reliable information about the technologies in use.

This allows the AEP to select more appropriate standards.

Standards should guide, not duplicate tooling

We also distinguish between instructions that require judgment and requirements that can be enforced mechanically.

A standard might explain when to introduce an abstraction.

That requires engineering judgment.

But a formatting requirement should generally be enforced through a formatter.

A prohibited dependency can often be detected through package validation.

A secret should be detected through security tooling.

The principle is:

Use standards to guide engineering decisions. Use tools to enforce deterministic requirements.

This reduces the burden placed on the agent and improves consistency.

Layer Three: Persistent Project Memory

AI coding sessions have a fundamental limitation.

They are temporary.

Even when a tool supports long conversations, carrying an entire development history forward is not always desirable.

Context becomes expensive.

Important decisions become buried.

And outdated information may remain alongside newer decisions.

We needed a way to preserve useful project knowledge without retaining every conversation.

Our solution was to maintain a small number of living project documents.

Our three-document approach

DocumentResponsibility
CLAUDE.md or AGENTS.mdProject instructions, conventions, and relevant operating guidance
TODO.mdCurrent tasks, progress, and remaining work
HANDOFF.mdImportant findings, decisions, and context required by subsequent sessions

The precise file names may differ between agent platforms.

The responsibilities are more important than the names.

Why we keep project memory small

Our initial planning-heavy workflow generated too many documents.

Some were useful for a single session but had little long-term value.

Others became outdated.

We therefore became more selective about what should persist.

A durable architectural decision belongs in project memory.

A temporary debugging hypothesis generally does not.

A critical integration constraint should survive a session handoff.

The full transcript of how the agent discovered that constraint usually does not need to.

Session handoffs

Handoffs have become particularly valuable.

Instead of asking a new session to consume the entire previous conversation, we provide a concise summary of completed work, important decisions, unresolved issues, and next actions.

This allows development to continue with less context.

It also makes the work easier for another engineer—or another agent—to understand.

Together with focused skills and smaller context windows, this approach contributed to our measured reduction in Claude token usage.

The broader lesson is that persistent memory should preserve engineering knowledge, not conversation history.

Layer Four: Shared Organizational Knowledge

Project memory solves part of the problem.

But many important engineering decisions extend beyond individual repositories.

Consider business terminology.

A term such as active customer may affect billing, analytics, reporting, and product functionality.

If each project independently defines it, inconsistencies become inevitable.

The same applies to architectural patterns, shared services, and external integration contracts.

We therefore introduced shared organizational knowledge.

What belongs in organizational knowledge?

We focus on information that is relevant across projects or teams.

This includes business definitions, cross-cutting architectural decisions, service relationships, and verified external API contracts.

The objective is to provide agents with authoritative information rather than forcing them to reconstruct organizational knowledge from scattered code and documentation.

Verified contracts matter

We found that agents could generate convincing but incorrect assumptions about external APIs.

A field name might look plausible.

A response structure might resemble a documented example.

But if the actual API behaved differently, the implementation would fail.

Where necessary, we verify integration contracts against actual systems.

This helps distinguish established facts from assumptions.

Knowledge must have ownership

Making organizational knowledge available to agents introduces a responsibility to maintain it.

An outdated document can be worse than missing information if an agent treats it as authoritative.

We therefore distinguish between project-specific knowledge, shared organizational knowledge, and canonical governance standards.

These categories serve different purposes.

Project memory describes the local implementation context.

Organizational knowledge describes shared facts and decisions.

Governance defines authoritative requirements that the organization expects its systems and processes to follow.

This separation becomes especially important in the governance layer.

Layer Five: Local Guardrails and Engineering Validation

The fifth layer is where guidance becomes enforceable engineering practice.

This is one of the most important parts of our AEP.

We learned that an agent’s claim to have followed a standard is not sufficient evidence that it has done so.

Where possible, we validate the actual changes.

Local security checks

We use tools such as Gitleaks to detect potential secrets before they are committed.

This gives engineers and agents immediate feedback.

It also reduces the likelihood that sensitive information reaches the repository.

Code-quality validation

The AEP can invoke relevant code-quality checks, including linting, formatting, type checking, and other project-specific validations.

We also examine changes for issues such as dead code, duplication, unnecessary complexity, and incomplete implementations.

Not every code-quality concern can be evaluated deterministically.

But many common problems can be detected through existing tools.

Package and dependency validation

Agents can introduce dependencies unnecessarily.

Sometimes they add a package to solve a problem already addressed by the project.

Other times, they select a dependency that does not align with organizational requirements.

Package validation helps detect prohibited or unexpected dependencies.

Workspace standards

We also protect areas of a repository that should not be modified casually.

Examples may include generated files, vendored dependencies, or applied database migrations.

These restrictions can be represented through local validation rules rather than relying solely on instructions.

Governance-related validation

Where canonical governance requirements can be expressed as machine-checkable rules, the AEP can apply relevant local checks.

Other requirements remain part of planning and design review.

This distinction is important.

Not every governance principle can—or should—be reduced to a linter rule.

The importance of installation health

Our experience with silently disabled hooks taught us that local enforcement must be verifiable.

The AEP therefore includes an installation health check.

It helps identify missing or incorrectly configured components.

Without this capability, users may believe they are operating within the required controls when those controls are not actually active.

But even with reliable local validation, we do not treat the AEP as the final enforcement boundary.

That responsibility is shared with our centralized engineering platform.

Local AEP Validation and Centralized GitHub Enforcement

This separation deserves particular attention because it is fundamental to our implementation.

At Madgicx, we have established centralized CI/CD, security checks, linting, and other required controls at the GitHub level.

The AEP operates locally.

It provides guidance, validation, and engineering gates during the development process.

GitHub independently enforces the requirements that must be centrally controlled.

Why maintain both layers?

Local validation provides fast feedback.

An engineer or agent can detect a problem immediately, correct it, and continue working.

This reduces unnecessary pull-request failures and review cycles.

Centralized validation provides independent enforcement.

It does not depend on the local agent having followed every instruction or executed every check.

For example, a developer may accidentally disable a local hook.

The local control may fail to run.

But a required centralized check can still detect the relevant violation before the change is merged.

The division of responsibility

Local AEPCentralized GitHub
Agent guidance and engineering workflowRepository-level enforcement
Local secret detectionCentralized security scanning
Local code-quality checksRequired linting and quality checks
Workspace validationRepository and branch protection
Package and governance validationMandatory CI/CD checks
Immediate feedback during implementationIndependent verification before integration

Some validations may intentionally exist in both layers.

That is not necessarily duplication to eliminate.

It is defense in depth.

The important distinction is that the local and centralized controls serve different purposes.

Local validation improves the development experience. Centralized enforcement protects the integrity of the engineering process.

This also helps us remain less dependent on a particular coding-agent platform.

We initially built much of our workflow around Claude Code.

Some of our engineers now also use Codex.

The mechanisms for invoking skills, roles, and local hooks may differ, but the engineering requirements and centralized controls remain applicable.

Layer Six: Packaging, Distribution, and Installation Health

An engineering playbook is not useful if it works only for the people maintaining it.

As adoption expanded, we encountered several practical distribution problems.

Our early installation process required users to complete multiple steps manually.

Some users installed the standards but missed the hooks.

Others had outdated versions.

Maintainers were sometimes testing a local development checkout rather than the packaged version distributed to users.

We needed to treat the AEP as a product.

One-command installation

We moved toward a packaged plugin with a simplified installation process.

The objective was to install and register the necessary local components consistently.

This became particularly important as users outside engineering began adopting the tooling.

Installation health checks

We introduced a health-check command that reports the state of the installation.

This helps users identify missing hooks, configuration issues, and other problems that could prevent the AEP from operating as intended.

Versioning and updates

A shared engineering playbook changes over time.

Standards evolve.

New validations are introduced.

Existing tools are corrected.

Users therefore need a reliable way to receive approved updates.

Private repository distribution and authentication introduce practical challenges, particularly when users have different account configurations.

We have addressed these through controlled installation and update procedures, while continuing to improve the distribution experience.

Testing the packaged product

We also learned that maintainers should test the same artifact that ordinary users install.

A development checkout is not an adequate substitute.

This led us to introduce a separate installation profile for testing releases.

The broader lesson is straightforward.

An internal engineering framework needs the same product discipline as any other software system: versioning, installation testing, diagnostics, and controlled releases.

Layer Seven: Governance and Continuous Learning

The final layer connects the AEP to two sources of organizational direction.

The first is canonical governance.

The second is feedback from actual engineering work.

I think of these as complementary flows.

Governance tells the AEP what the organization has decided.

Engineering feedback tells us where the AEP is not yet working effectively.

Both are necessary.

Governance: The top-down flow

We maintain canonical governance standards separately from the AEP.

This is an important architectural decision.

The AEP should not independently define organizational policy.

Security requirements, business standards, and architectural governance should have authoritative owners and sources.

The AEP consumes those standards and incorporates applicable requirements into agent guidance and engineering controls.

What is operational today?

Our canonical governance repository and its integration with the AEP are already implemented.

The AEP team currently runs synchronization tooling to retrieve canonical standards and update the playbook.

This process is operational.

What we are developing now is the automation around detecting governance changes and notifying the AEP team when updates are required.

The objective is to reduce manual coordination and make changes more visible.

The intended process is:

Today, the synchronization tooling is initiated manually.

Automated detection and notification are the next steps.

Why we prefer consumer-initiated synchronization

Earlier, we encountered problems with cross-repository credentials and governance distribution.

In one instance, a consuming copy of governance standards remained stale for approximately ten weeks.

This highlighted the risks of synchronization processes that fail silently.

We therefore moved toward a model where consumers retrieve canonical standards using appropriately scoped access.

The AEP team can then review and incorporate the relevant changes.

This reduces dependence on the governance repository having write access to every consuming system.

It also keeps responsibility for implementation with the team maintaining the consuming framework.

Continuous learning: The bottom-up flow

The feedback loop works in the opposite direction.

During engineering sessions, the AEP captures information about issues and failures.

These may include failed validations, recurring agent mistakes, incorrect assumptions, or gaps in existing standards.

We monitor this feedback and identify improvements that should be incorporated into the shared playbook.

This process has been operational since July.

When important fixes are identified, we update the AEP rather than waiting for the same problem to recur across multiple projects.

Automating feedback curation

We are currently developing the final stage of the feedback process.

The intended workflow is:

The human approval step is deliberate.

We do not want agents automatically rewriting the standards that govern them.

Instead, we want them to help identify improvements that can be reviewed and approved by the responsible people.

Preventing rule accumulation

There is another important challenge.

Not every failure requires a new organizational rule.

If we automatically convert every agent-generated recommendation into a standard, the AEP will eventually become difficult to maintain.

We therefore evaluate whether a proposed improvement addresses a recurring or significant problem, belongs at the organizational level, and has a clear owner.

We also consider whether the issue should be addressed through guidance, deterministic validation, or changes to existing tooling.

A continuous learning system should improve the quality of its rules, not simply increase their number.


How the Seven Layers Work Together

The individual layers are useful, but the real value comes from how they operate together.

Consider a typical feature-development request.

An engineer asks an agent to implement a new capability in an existing application.

Step 1: Establish the project context

The AEP identifies the project and retrieves the relevant instructions.

It examines the project configuration to determine which technology-specific standards apply.

It also makes the relevant project memory and organizational knowledge available.

The agent begins with a clearer understanding of the environment in which it will work.

Step 2: Research the requirement

The agent investigates the existing implementation, identifies affected components, and examines relevant contracts.

It checks whether similar functionality already exists.

Where information is missing or ambiguous, the agent should surface the uncertainty rather than invent an answer.

Step 3: Develop and challenge the plan

The agent proposes an implementation approach.

For work requiring additional scrutiny, GrillMe-with-Docs can challenge the proposal against documented business, governance, security, and architectural requirements.

An engineer can review the plan and resolve important questions before implementation.

Step 4: Implement the change

The agent develops the implementation using the applicable engineering standards.

It works within the established project structure and uses existing components where appropriate.

The implementation can proceed through smaller, verifiable increments.

Step 5: Execute local validations

The AEP invokes the applicable local checks.

These may include Gitleaks, linting, type checking, package validation, workspace restrictions, and governance-related controls.

Detected violations are corrected before the work progresses.

Step 6: Submit the change to GitHub

The resulting change enters the established repository workflow.

Centralized CI/CD, security checks, linting, and other required controls independently verify the implementation.

Human review and approval remain applicable according to the organization’s engineering policies.

Step 7: Capture lessons

If the development process reveals a significant issue, the feedback mechanism can record it.

The AEP team can evaluate whether the issue requires a change to shared standards, tooling, or validation.

Approved improvements are incorporated into subsequent AEP releases.

This is the operating model we have been working toward.

It allows agents to perform increasingly substantial engineering tasks without treating their output as inherently trustworthy.

The agent performs the work. The engineering system establishes the boundaries and verifies the result.

What I Would Measure in an Agentic Engineering System

An AEP should not be judged by the number of prompts, skills, or rules it contains.

It should be evaluated by whether it improves engineering outcomes.

I would separate the measurements into two categories.

Engineering effectiveness

These metrics help determine whether agentic engineering is improving software delivery.

MetricWhat we want to understand
Development lead timeAre changes moving from implementation to production faster?
Deployment frequencyCan teams deliver smaller changes more frequently?
Change failure rateAre faster releases introducing more production problems?
Escaped defectsAre quality controls preventing defects from reaching users?
Token usage per comparable taskAre agent workflows becoming more context-efficient?
Review effortAre engineers spending less time correcting avoidable problems?
Code complexityAre implementations remaining maintainable as development accelerates?

Playbook effectiveness

These metrics help determine whether the AEP itself is working.

MetricWhat we want to understand
Installation healthAre the required local controls installed and functioning?
AEP version adoptionAre teams using current, approved versions?
Local validation failuresWhat problems are being detected during development?
Centralized CI/CD failuresWhich problems are escaping local validation?
Recurring agent mistakesWhere do our standards or tools need improvement?
Governance synchronization statusIs the AEP aligned with current canonical requirements?
Feedback-to-release cycle timeHow quickly do approved lessons reach users?
Standards maintenanceAre rules being reviewed, consolidated, and retired when appropriate?

There is an important distinction between activity and effectiveness.

For example, detecting more violations does not automatically mean that the engineering system has improved.

It may mean that enforcement is working better.

But it may also mean that agents are repeatedly making the same mistakes.

Similarly, increasing deployment frequency is not necessarily a success if the change failure rate also increases.

We need to evaluate these metrics together.

What we have measured so far

As discussed in the first article, we measured an approximately 50% reduction in Claude token usage after introducing smaller contexts, specialized skills, and structured session handoffs.

Our development delivery cadence has also changed from release cycles of approximately two sprints to around four development releases per week.

These are meaningful outcomes, although the delivery improvement reflects a broader organizational transformation rather than the AEP alone.

We have also observed improvements in code maintainability and the ability of non-engineering teams to deliver software changes within established controls.

Our next challenge is to measure these outcomes more systematically.

I believe this is an important discipline for engineering leaders adopting AI.

We should measure the value of the software delivered, the reliability of the engineering process, and the resources required—not simply how much code an agent generates.

How I Would Implement an AEP in Another Engineering Organization

Having spent seven months building and refining our playbook, I would approach a new implementation incrementally.

I would not begin by attempting to reproduce all seven layers.

That would risk recreating the heavyweight process we initially struggled with.

Instead, I would establish a minimal foundation and expand it through actual engineering experience.

Phase 1: Establish the engineering foundation

Start with one development team and an existing production codebase.

Define a simple research, plan, implement, and validate workflow.

Introduce a small set of universal engineering standards and the relevant technology-specific guidance.

Establish how important decisions and session handoffs will be preserved.

At this stage, the objective is consistency.

You want agents to understand the project, follow established conventions, and produce changes that engineers can review.

Phase 2: Introduce deterministic validation

Identify the requirements that can be enforced mechanically.

These may include secret detection, formatting, linting, type checking, dependency restrictions, and protected workspace areas.

Implement the relevant local validations.

Then verify that the organization’s centralized CI/CD and security controls independently enforce critical requirements.

Test the controls by deliberately introducing violations.

Do not assume that a configured validation is functioning correctly.

Phase 3: Connect organizational knowledge and governance

Identify the business definitions, architectural decisions, and integration contracts that engineers repeatedly need.

Make this information accessible to the agents.

Establish authoritative sources and ownership.

Where canonical governance standards exist, introduce a controlled mechanism for consuming them.

For important design changes, use a structured review mechanism such as GrillMe-with-Docs to challenge the proposed solution against the relevant requirements.

Phase 4: Package and distribute the playbook

Once the workflow has demonstrated value, make it easy for other engineers to adopt.

Provide a consistent installation process.

Include health checks.

Version the playbook and test the packaged releases.

Avoid relying on every user to understand and manually configure the underlying tooling.

Phase 5: Establish continuous learning

Capture important failures and recurring issues.

Review them regularly.

Determine whether improvements belong in project-specific guidance, organizational standards, or deterministic tooling.

Introduce human approval for shared changes.

As the process matures, automate feedback collection, curation, and release preparation where doing so provides value.

Phase 6: Expand adoption carefully

Once the engineering workflow is reliable, consider extending appropriate capabilities to product, marketing, and operations.

This requires more than distributing an AI coding tool.

Teams need controlled access to repositories, data, development environments, and deployment mechanisms.

Their permissions must remain appropriate to their responsibilities.

The objective is to enable broader participation in software development without weakening organizational controls.

Phase 7: Measure, simplify, and improve

Finally, establish a regular review of the playbook itself.

Are the standards still relevant?

Are some rules duplicated?

Are agents loading unnecessary context?

Are validations creating avoidable friction?

Are important failures being captured and addressed?

Is the playbook actually improving engineering outcomes?

These questions should be revisited continuously.

The playbook should evolve as the organization learns.

But evolution should not automatically mean adding more complexity.

The best AEP is not the one with the most rules. It is the one that provides the necessary engineering discipline with the least unnecessary friction.

What We Are Building Next

Our AEP is operational, but it is not complete.

There are several areas where we are continuing to invest.

Automated governance synchronization

Our canonical governance integration is already in place.

The AEP team currently uses tooling to retrieve and incorporate approved standards.

We are working on automating change detection and alerting so that governance updates become visible without requiring the team to initiate the process manually.

Automated feedback curation

Our engineering feedback loop is also operational.

We capture and review feedback, incorporating important improvements into the AEP.

The next stage is to automate the preparation and curation of proposed improvements.

Human verification will remain part of the process before approved changes are distributed through plugin releases.

Broader agent-platform compatibility

We initially developed much of our approach around Claude Code.

Some engineers now also use Codex.

We want the underlying engineering practices to remain applicable regardless of the coding-agent platform.

The implementation mechanisms may differ, but standards, governance, validation, and engineering accountability should not depend on a particular model or tool.

An open-source Agentic Engineering Playbook

We are also preparing an organization-agnostic version of the AEP.

The intention is to separate the reusable engineering framework from Madgicx-specific knowledge, governance standards, and internal tooling.

The reusable foundation would include concepts such as the role-based engineering workflow, focused standards, local validations, installation health checks, and continuous learning mechanisms.

Organizations could then introduce their own business knowledge, technology standards, and governance requirements.

I do not expect every organization to adopt the same implementation.

But I believe the underlying principles can help engineering teams avoid many of the problems we encountered.

Final Thoughts: Engineering Discipline for an Agentic World

When we first started working with AI coding agents, we concentrated on what the models could do.

How well could they understand our code?

How quickly could they implement a feature?

Could they investigate bugs, generate tests, and propose architectures?

Those questions remain important.

But our experience has led me to believe that they are only part of the challenge.

As coding agents become more capable, engineering organizations need to think more carefully about the environment in which those agents operate.

Agents need access to reliable knowledge.

They need to understand the standards that apply to their work.

They need clear boundaries between planning, implementation, and validation.

They need mechanisms that challenge questionable assumptions.

And their output needs to pass independent engineering controls.

At the same time, the system must remain lightweight enough to preserve the productivity benefits of agentic development.

This balance has been the central challenge of building our AEP.

We have made mistakes along the way.

Our initial planning process became too heavy.

Our standards sometimes activated in the wrong projects.

Our local guardrails were not always installed correctly.

Our governance distribution encountered synchronization problems.

And our learning loop required more human judgment than we initially anticipated.

But each of these experiences helped us refine the architecture.

Looking back, I believe three principles have become particularly important.

First, separate intelligence from enforcement.

Use agents for reasoning, planning, and implementation. Use deterministic tooling and centralized controls to enforce requirements that can be verified mechanically.

Second, make organizational knowledge and governance part of the engineering workflow.

An agent should not have to rediscover established business definitions, architectural decisions, or security requirements every time it begins a new task.

Third, build a system that learns without losing accountability.

Capture feedback, identify recurring problems, and improve the playbook. But keep human judgment involved when changes affect shared engineering standards and governance.

Ultimately, I do not see the Agentic Engineering Playbook as a replacement for experienced engineers or established software engineering practices.

I see it as a way to make those practices available to a new generation of engineering participants: AI agents.

The engineer remains responsible for understanding the problem, making architectural decisions, defining acceptable outcomes, and ensuring that the resulting software is fit for purpose.

The agent can increasingly perform the work required to reach those outcomes.

And the engineering system provides the knowledge, boundaries, and verification mechanisms that make this collaboration reliable.

The future of agentic engineering will not be determined only by how intelligent our agents become. It will also depend on how well we engineer the systems in which they operate.

That is what we are trying to achieve with our Agentic Engineering Playbook.

And as the technology continues to evolve, I expect the playbook—and our understanding of agentic engineering—to evolve with it.

Building an Agentic Engineering Playbook: Our Seven-Month Journey

How we moved from experimenting with AI coding agents to fundamentally changing the way we engineer, collaborate, and deliver software at Madgicx.

Introduction: When Writing Code Became the Easy Part

Over the past two decades, I have witnessed several major transformations in software engineering.

We moved from monolithic applications to distributed architectures, from managing physical servers to cloud computing, and from manual deployments to automated CI/CD pipelines. We embraced Agile development, DevOps, infrastructure as code, and numerous other practices that fundamentally changed how engineering organizations operate.

Each transformation brought improvements in productivity, reliability, and scalability.

But the emergence of AI coding agents has introduced something quite different.

For the first time, we have tools that can actively participate in the engineering process itself.

They can investigate problems, understand existing codebases, propose architectures, develop implementation plans, write code, execute tests, and help validate solutions.

As someone who has spent much of his career building and leading engineering teams, I find this transformation particularly fascinating.

We are moving toward a world where writing code is no longer necessarily the most time-consuming part of software engineering.

And that raises an interesting question.

If writing code becomes significantly easier, what happens to the rest of the engineering process?

That was a question we started confronting at Madgicx earlier this year.

Like many engineering organizations, we began experimenting with AI coding agents to improve developer productivity.

Initially, the objective was straightforward: help our engineers build software faster.

And the early results were remarkable.

Tasks that previously required hours could sometimes be completed in minutes. Engineers could investigate unfamiliar systems more quickly, generate working implementations, and delegate repetitive development tasks to agents.

But as we started using these capabilities on real production systems, we encountered an unexpected challenge.

The faster we could generate code, the harder it became to ensure that everything we generated followed our engineering standards.

An agent could produce a perfectly reasonable implementation that violated an existing architectural decision.

It could introduce a new dependency when the functionality already existed elsewhere.

It could invent API contracts, make assumptions about business logic, or generate code that worked independently but did not fit our existing systems.

And perhaps most importantly, knowledge gained during one engineering session was frequently lost when the next session began.

We were improving the speed of implementation, but we had not established a reliable way to govern the engineering process around it.

That realization changed our direction.

Instead of asking how we could make AI agents write more code, we started asking a different question:

How do we make AI agents work as disciplined members of our engineering organization?

How do we ensure they understand our architecture, follow our standards, respect governance requirements, and validate their work?

And how do we achieve this without introducing so much process that we lose the productivity benefits of AI?

These questions became the foundation of what we now call our Agentic Engineering Playbook (AEP).

What followed was a seven-month journey of experimentation, failures, redesigns, and continuous improvement.

This article is about that journey—what we tried, what went wrong, what worked, and what I believe other engineering leaders can learn from our experience.

1. AI Coding Is Not the Same as Agentic Engineering

Before discussing our journey, I think it is important to establish a distinction.

There is a difference between using AI to write code and introducing AI agents into an engineering organization.

With AI-assisted coding, an engineer describes a requirement and asks an AI assistant to generate an implementation, suggest changes, or help debug an issue.

The engineer remains responsible for managing most of the surrounding development process.

Agentic engineering takes this further.

An agent can investigate requirements, examine existing systems, propose a solution, develop an implementation plan, write code, execute validations, and prepare changes for review.

In other words, the agent participates in the engineering lifecycle rather than simply assisting with individual coding tasks.

But this introduces a new challenge.

A capable software engineer joining an organization is expected to learn its architecture, coding conventions, security policies, business terminology, and development practices.

We do not expect an engineer to start making architectural changes without understanding the systems they are working on.

We also establish controls.

We have code reviews, testing requirements, security scans, CI/CD pipelines, architectural standards, and approval processes.

Why should we expect AI agents to operate without similar boundaries?

An AI agent may be exceptionally capable at generating code, but it does not automatically understand the engineering contracts of the organization using it.

And without those contracts, speed can become a liability.

That was the fundamental problem we wanted to solve.

We needed something that would provide agents with the appropriate knowledge, guide them through our engineering practices, and ensure their work passed the necessary validations.

Not another enormous collection of prompts.

Not another development methodology.

But a practical engineering framework that could operate alongside our existing processes.

That became our AEP.

2. The Early Days: Everyone Had Their Own Way of Working

Our journey began much like it does in many engineering teams.

Individuals started experimenting with AI coding agents.

Some developed elaborate prompts. Others preferred shorter instructions and iterative conversations.

Some asked agents to plan everything before writing code. Others allowed the agents to start implementing immediately.

Everyone was discovering what worked best for them.

Initially, this freedom was useful.

Engineers learned quickly, explored different approaches, and became increasingly comfortable delegating development work to agents.

However, as adoption grew, inconsistencies began to emerge.

Every project developed its own conventions

An agent working with one problem would produce code using one set of conventions.

Another agent working with a different engineer might approach the same problem in a completely different way.

The resulting code could be functional in both cases, but the implementations did not always align with our established architecture.

Agents invented things that did not exist

We encountered implementations that referenced nonexistent API fields, assumed incorrect response structures, or introduced values that were never part of the original requirements.

Sometimes these errors were obvious.

Other times, they appeared entirely reasonable until someone tested the implementation against the actual system.

Existing functionality was recreated

An agent might implement a utility that already existed elsewhere in the repository.

Without sufficient knowledge of the codebase, it solved the immediate problem instead of following established patterns.

This introduced unnecessary duplication and maintenance overhead.

Engineering decisions disappeared between sessions

An important decision might be made after a lengthy discussion with an agent.

But unless someone explicitly documented it, that decision remained buried in conversation history.

When a new session started, the agent could revisit the same problem and reach a different conclusion.

Documentation became difficult to manage

As we tried to preserve context, we accumulated Markdown files containing plans, notes, decisions, and temporary instructions.

Some documents were useful.

Others became outdated almost immediately.

Eventually, agents started consuming stale documentation as though it represented the current state of the project.

We were facing an interesting paradox.

We had tools that could generate software faster than ever before, but we were spending increasing amounts of time ensuring that the generated software was actually suitable for our systems.

For simple tasks, AI coding worked remarkably well.

For larger changes involving existing architecture, business rules, and multiple integrations, the effort required to guide and correct an agent could sometimes exceed the effort of implementing the change ourselves.

Clearly, something needed to change.

3. Our First Mistake: We Tried to Solve Everything with Process

Our first serious attempt at creating a structured approach began around March 2026.

We believed that the solution was to introduce more discipline into how agents worked.

So we created a comprehensive planning and development process.

We introduced an architect-oriented planning session that produced detailed implementation instructions for a separate coding session.

We added risk registers, structured planning documents, and a five-phase development workflow.

The intention was good.

We wanted agents to investigate problems thoroughly, consider architectural implications, and produce well-defined implementation plans before writing code.

In traditional engineering, these are sensible principles.

But we made a mistake.

We tried to apply a heavyweight engineering process to almost every task, regardless of its complexity.

A relatively small change could generate an extensive planning document.

Agents spent considerable time reading instructions and preparing documentation before producing useful work.

Our project folders accumulated more and more planning files.

And as those documents grew, so did the amount of context agents consumed.

We also discovered that documentation created during previous sessions could become misleading.

An agent might load an outdated specification and follow it rather than examining the current implementation.

In some cases, we had created more work for ourselves than we had eliminated.

The process that was supposed to improve engineering productivity had become a bottleneck.

This was one of the most important lessons of our journey.

Too little process creates inconsistency. Too much process destroys agility.

The solution was not to abandon engineering discipline.

It was to make the discipline proportional to the work being performed.

A minor UI change does not require the same level of planning as a payment integration or a major architectural modification.

That may sound obvious, but it is surprisingly easy to overlook when building workflows for autonomous agents.

We needed to simplify.

4. Finding the Balance: A Lightweight Engineering Pipeline

By May, we had started redesigning our approach.

Instead of a large, prescriptive development process, we introduced four core engineering responsibilities:

Research → Plan → Implement → Validate

Each responsibility had a clear purpose.

Research focused on understanding the problem, existing code, dependencies, and relevant constraints.

Planning focused on determining the implementation approach, identifying risks, and defining how the result would be validated.

Implementation focused on developing small, independently verifiable increments.

Validation focused on checking the implementation against requirements, tests, and engineering standards.

The important change was that we stopped trying to prescribe every detail of how the agent should work.

We defined the responsibilities, boundaries, and expected outcomes.

Within those boundaries, the agent could determine how best to perform the work.

We also reduced the amount of persistent documentation.

Instead of allowing every session to create new planning files, we maintained a small number of living documents covering project instructions, current work, and important findings that needed to survive between sessions.

This made session handoffs more effective.

An agent no longer needed to consume an entire conversation history to understand where work had stopped.

It could use a concise handoff containing the important decisions, completed work, and remaining tasks.

We also began developing smaller, focused engineering standards that could be loaded when relevant.

Rather than giving every agent every standard, we wanted to provide the information needed for the specific project and task.

This became a turning point.

The AEP started becoming less about controlling every action an agent took and more about establishing a reliable environment in which the agent could operate.

Humans remained responsible for requirements, architectural judgment, acceptance criteria, and approvals. Agents could take greater responsibility for execution within those boundaries.

This was much closer to the engineering model we wanted.

5. Teaching Agents What the Organization Already Knows

As the workflow became more consistent, another problem became apparent.

Every project was repeatedly teaching agents the same organizational knowledge.

Business terminology was explained again and again.

Architectural decisions were rediscovered.

External API contracts were interpreted independently.

Even when individual project instructions were reasonably complete, important knowledge remained fragmented across repositories and teams.

We started addressing this around June.

We introduced shared organizational knowledge covering areas such as business definitions, architectural decisions, service relationships, and verified external API contracts.

The principle was simple.

If something is already known and agreed upon by the organization, an agent should not have to rediscover it every time.

Consider a business term such as “customer activations“.

That definition may influence reporting, billing, customer segmentation, and product functionality.

If different agents independently interpret the term, they may produce technically correct implementations that are inconsistent with one another.

The same applies to architectural decisions.

If we have already established how services communicate or how particular integrations should be implemented, agents should work within those decisions unless there is a reason to challenge them.

We also learned that external API documentation could not always be treated as a sufficient source of truth.

Where necessary, we verified contracts against actual systems rather than allowing agents to invent structures based on assumptions.

This reduced repeated investigation and helped agents make more consistent decisions.

It also highlighted an important organizational responsibility.

Engineering knowledge must be maintained deliberately.

If knowledge is fragmented, outdated, or contradictory, giving agents access to more of it will not necessarily improve their performance.

Sometimes it simply allows them to make mistakes with greater confidence.

6. From Individual Mistakes to Organizational Learning

By July, our focus began shifting toward another question.

How do we ensure that a mistake made by one agent does not have to be repeated by every other agent?

In traditional engineering teams, knowledge spreads through code reviews, discussions, documentation, mentoring, and shared experience.

We needed an equivalent mechanism for agentic engineering.

We introduced a feedback loop that captures issues encountered during development sessions.

These might include failed validations, incorrect assumptions, invented contracts, or other recurring problems.

However, we quickly discovered another challenge.

If you ask an LLM to review every session and identify what went wrong, it will almost always find something to recommend.

Even when the session was successful.

If every recommendation automatically became a new engineering rule, our playbook would eventually become enormous, contradictory, and difficult to maintain.

We had already experienced the consequences of excessive process.

We did not want to recreate the same problem through automated learning.

So we established an important principle.

Feedback can be captured automatically, but changes to organizational standards require human judgment.

Our feedback loop has been operational since July.

We monitor what gets recorded and identify important or recurring issues.

When we discover something that should be addressed centrally, we update the AEP so the improvement benefits other users.

Sometimes that means clarifying a standard.

Sometimes it means adding a validation.

Sometimes it means fixing the tooling itself.

And sometimes the issue is specific to one project and should not become an organizational rule.

We are now developing the next stage: automating the curation of captured feedback into proposed improvements that can be verified by a human and incorporated into subsequent plugin releases.

The objective is to accelerate organizational learning without allowing agents to independently change the rules that govern them.

I believe this will become increasingly important as engineering organizations rely more heavily on autonomous agents.

7. The Hardest Part Was Not Writing the Standards

As our AEP matured, we discovered that creating engineering standards was relatively straightforward.

Making those standards work consistently across an organization was much harder.

This became particularly evident between August and October.

When standards activated in the wrong projects

We initially used repository and folder names to determine which technology-specific standards should apply.

This seemed reasonable.

But it created problems.

For example, a React-related standard could activate in a project with different framework requirements and provide incorrect guidance.

The agent would then confidently follow a standard that was not appropriate for the project.

We changed the approach to identify technologies through actual project dependencies and configuration files.

Files such as package.json and pyproject.toml provided more reliable evidence than directory names.

The lesson was simple.

An agent should not assume the technology stack when the project itself can tell us what it uses.

When guardrails silently stopped working

This was one of our most important operational discoveries.

Our initial installation process required users to complete some local Git hook configuration manually.

Many did not complete those steps.

As a result, parts of the validation system were not running, even though users believed the AEP was installed correctly.

We went through six pull requests before discovering that part of the local enforcement was inactive.

This was a serious lesson.

A missing control is a problem.

But a control that everyone believes is working, when it is not, can be even more dangerous.

We responded by packaging the AEP so that installation automatically registers the required local components.

We also introduced a health-check command that reports whether the installation is functioning correctly.

When maintainers had a different experience from users

The engineers maintaining the AEP often ran it directly from a local development checkout.

Ordinary users installed the packaged version.

These environments did not always behave identically.

As a result, problems affecting ordinary users could go unnoticed by the maintainers.

We introduced a separate installation profile for release testing, allowing maintainers to verify the packaged version under conditions closer to those experienced by users.

When the audience expanded beyond engineering

Initially, we designed the AEP for engineers.

But as product, marketing, and operations teams started using AI coding agents, we had to reconsider several assumptions.

A process that expects users to understand Git hooks, repository configuration, or complex installation procedures does not scale well beyond engineering.

We needed simpler installation, clearer error messages, and more reliable automation.

This pushed us toward a one-command plugin installation and straightforward health checks.

When rules began accumulating

Every incident created pressure to introduce another standard.

But adding more rules is not always the correct solution.

Sometimes an existing rule needs clarification.

Sometimes a recurring problem should be addressed through deterministic tooling.

And sometimes a proposed rule simply does not belong in the shared playbook.

We introduced stricter criteria for adding standards, including evidence of the problem, clear ownership, and conditions under which a rule should be reviewed or retired.

This helped prevent the playbook from growing into another heavyweight process.

Looking back, many of our most valuable improvements came from addressing these operational issues rather than introducing new AI capabilities.

The engineering system around the agent mattered as much as the agent itself.

8. Moving From Guidance to Enforcement

One of the most important principles we adopted was to distinguish between instructions that guide an agent and controls that enforce engineering requirements.

We can tell an agent not to commit secrets.

We can tell it not to modify protected directories.

We can tell it to follow our package standards or run the relevant code-quality checks.

But instructions alone are not sufficient.

An agent can misunderstand a rule, overlook it, or incorrectly decide that it does not apply.

Where requirements can be checked deterministically, we prefer to enforce them through tooling.

Our AEP provides local validations covering areas such as secret detection using Gitleaks, code quality, package validation, workspace standards, and governance requirements.

These checks operate during the local engineering workflow.

They help engineers and agents detect problems early, before changes reach centralized review.

But there is an important distinction.

The AEP is not our final security or quality boundary.

We also maintain centralized GitHub-level CI/CD, security scanning, linting, and other required checks.

The two layers serve complementary purposes.

The AEP helps prevent problems during development.

GitHub independently verifies the requirements that must be enforced centrally.

This separation allows us to benefit from fast local feedback without relying exclusively on controls running on an individual’s machine.

It also means that our engineering requirements are not dependent on whether a particular developer uses Claude Code, Codex, or another coding agent.

The underlying engineering standards remain applicable.

The tools used to implement them may differ.

I will explore this architecture, including our seven-layer AEP, in the second article of this series.

For this article, the important lesson is that reliable agentic engineering requires more than asking agents to follow instructions. It requires an environment that can verify their work.

9. The Real Transformation: Changing Who Can Build Software

As the AEP became more reliable, something interesting started happening across the organization.

The benefits were no longer limited to the engineering team.

Other departments began using AI agents to build applications, prototypes, and internal tools.

This was perhaps the most significant change in how we viewed agentic engineering.

Marketing began moving at campaign speed

Our marketing team now makes daily changes to websites and landing pages in response to campaigns and observed user behavior.

These include code, data, and website changes.

Previously, many of these activities required engineering involvement.

A marketing request would compete with product development priorities, and even relatively small changes could wait for engineering capacity.

Today, marketing can handle many of these changes independently.

The AEP provides local code-quality and validation tooling, while our centralized controls continue to enforce the relevant repository requirements.

When changes involve areas requiring code-owner approval, engineering remains involved.

The result is a more responsive marketing operation without creating a completely separate engineering process.

Product managers and business analysts began building working prototypes

Product managers and business analysts can now develop functional prototypes rather than relying entirely on specifications and mockups.

They can work with agreed data structures, test ideas, gather feedback, and demonstrate functionality before committing significant engineering resources.

Selected functionality can be released behind feature flags for controlled evaluation.

Engineering teams can then help integrate validated functionality into the main product.

To support this, we also addressed the challenge of accessing data and internal resources safely.

We built a separate platform that provides controlled access to the resources required for development.

For prototyping, we agree on the relevant data schemas and provide data marts that teams can use.

That platform deserves an article of its own, so I will not go into its architecture here.

The important point is that making software development accessible to more people requires both capable agents and appropriate access controls.

Operations began building internal tools

Our operations teams also started building tools to address their own requirements.

Instead of waiting for an engineering team to prioritize every internal request, they could solve some of their problems directly.

This does not mean that everyone suddenly becomes a software engineer.

Nor does it mean that engineering governance is no longer necessary.

It means that the ability to implement software is becoming more widely accessible.

And that changes the role of the engineering organization.

Engineering becomes responsible not only for building software but also for establishing the platforms, standards, and controls that allow others to build safely.

Engineers began spending more time engineering

This has been an important change within our engineering team.

Engineers increasingly focus on understanding problems, designing solutions, making architectural decisions, defining acceptance criteria, and validating implementations.

Agents perform much of the implementation work within the boundaries established by engineers.

We have also seen smaller delivery teams take on larger pieces of work.

In some cases, an engineer working with a product manager can take a substantial development item through planning, documentation, implementation, testing, and staging.

The value is not simply that fewer people can produce more code.

It is that engineers can spend more of their time applying engineering judgment.

The role of the engineer is shifting from being primarily a producer of code toward becoming the architect, director, and validator of software development.

I believe this will be one of the defining changes in software engineering over the coming years.

10. What We Have Achieved So Far

Whenever we discuss AI-driven engineering transformation, I believe it is important to distinguish between measurable outcomes and observations.

AI coding tools can create an immediate impression of productivity.

But generating code quickly is not necessarily the same as delivering software efficiently.

We have therefore been looking at changes in our development process, delivery cadence, and resource consumption.

Approximately 50% reduction in token usage

One of our clearest measured improvements came from reducing the amount of context consumed during development.

Our initial heavyweight process required agents to read extensive planning instructions and documentation.

This increased token consumption and often introduced unnecessary context.

We subsequently introduced smaller, more focused standards, specialized skills, and structured session handoffs.

Using Claude token-usage measurements before and after these changes, we observed an approximately 50% reduction in token usage.

This was an important result.

It demonstrated that adding engineering discipline does not necessarily mean increasing the cost of using AI.

In fact, a well-designed process can reduce unnecessary work.

The lesson was not simply to minimize tokens.

It was to provide the right context at the right time.

More context does not always produce better engineering. Relevant context does.

From two-sprint release cycles to four development releases per week

Our development delivery model has also changed significantly.

Previously, a set of development releases typically moved through approximately two sprints.

Today, our product team delivers around four development releases per week, excluding bug fixes.

This transformation has accompanied a broader shift in how we organize development.

We have moved away from a Scrum-based approach toward Kanban-style development, allowing work to flow continuously through smaller deliverable increments.

I would not attribute this improvement entirely to the AEP.

AI coding agents, changes in engineering practices, delivery processes, and organizational alignment have all contributed.

However, the AEP has played an important role in making agent-assisted development more consistent and predictable.

When teams can investigate, implement, and validate smaller changes reliably, continuous delivery becomes easier to sustain.

Improvements in code quality

We have also observed improvements in the quality and maintainability of agent-generated code.

Earlier implementations frequently contained excessive comments, duplicated functionality, unnecessary abstractions, and oversized files.

We introduced more focused coding standards and pre-commit audits to address these issues.

For example, we established a simple principle for code comments.

A comment should explain something useful that is not already evident from the code.

If removing the comment does not remove meaningful information, the comment may not be necessary.

Our validation process also examines changes for dead code, duplication, oversized functions, invented values, and incomplete implementations.

These changes have helped produce smaller, more readable implementations.

Unlike our token-usage improvement, we have not yet established a formal comparative measurement for all these code-quality outcomes.

They are observations from our engineering workflow.

We intend to improve our measurements as the system matures.

A broader definition of productivity

Perhaps the most meaningful outcome is difficult to express as a single number.

Marketing can respond to campaigns more quickly.

Product teams can validate ideas through working prototypes.

Operations can address some of their own tooling requirements.

Engineers can concentrate more heavily on architecture, design, and validation.

These are organizational outcomes rather than simply coding metrics.

And they are why I believe the transformation is much larger than developer productivity.

11. What I Would Do Differently If I Started Again

Looking back over these seven months, there are several things I would approach differently.

Start with the smallest useful framework

Our first mistake was trying to build a comprehensive engineering process before we fully understood how agents behaved in everyday development.

If I were starting again, I would begin with a simple research, plan, implement, and validate workflow.

I would add one universal engineering standard and a small number of stack-specific standards.

Then I would test the approach against real development work.

Only after identifying recurring problems would I introduce additional controls.

Build enforcement before expanding adoption

We initially concentrated on standards and instructions.

In hindsight, local validation and centralized enforcement should have been priorities from the beginning.

A standard that tells an agent not to commit secrets is useful.

A secret scanner that detects those secrets is essential.

And centralized verification provides an independent control when local checks are missing or misconfigured.

Treat installation as part of the product

We underestimated the difficulty of distributing the AEP consistently.

Manual installation steps were skipped.

Hooks were missing.

Different users ran different versions.

Maintainers tested environments that did not match ordinary installations.

If I were starting again, I would design the installation process and health check much earlier.

A playbook that works perfectly on the maintainer’s machine is not enough.

Preserve knowledge without creating documentation overload

We learned that agents need persistent project knowledge.

But we also learned that generating documentation for every decision creates a different problem.

I would keep the number of persistent project documents small and clearly define what belongs in each.

Important decisions should survive between sessions.

Temporary reasoning should not automatically become permanent documentation.

Make governance part of the workflow

Engineering standards should not exist independently of organizational governance.

Business definitions, security requirements, and architectural decisions must have authoritative sources.

Our canonical governance integration is now operational, with the AEP team using tooling to retrieve and incorporate approved standards.

We are currently improving the automation around detecting changes and notifying the AEP team.

If I were starting again, I would establish this relationship between governance and engineering standards earlier.

Build a learning system, not a rule-generation system

Capturing agent mistakes is valuable.

Automatically converting every observation into a new standard is not.

I would establish a feedback mechanism early, but retain human review for changes that affect shared engineering practices.

A good playbook should become more effective over time.

It should not simply become larger.

Measure the engineering outcome, not the amount of code

I would also establish baseline measurements earlier.

Token usage, delivery lead time, deployment frequency, defects, review effort, and change failure rates provide more meaningful information than the number of lines an agent generates.

An agent that writes twice as much code is not necessarily twice as productive.

An agent that helps deliver a reliable solution with less effort and less complexity is far more valuable.

Final Thoughts: The Real Transformation Is Not About Coding

When we began experimenting with AI coding agents, our objective was to make engineers more productive.

We wanted to reduce repetitive work, accelerate implementation, and allow engineers to concentrate on more complex problems.

Seven months later, my perspective has changed.

I no longer see AI coding agents simply as productivity tools.

I see them as participants in a changing engineering operating model.

An operating model in which agents can investigate, plan, implement, and validate software.

Where engineers increasingly concentrate on architecture, judgment, and accountability.

Where business teams can build and experiment without waiting for every change to be implemented by an engineering department.

And where governance, standards, and validation become even more important because the speed of software creation has increased dramatically.

There is a temptation to believe that as AI models become more capable, the need for engineering discipline will diminish.

My experience suggests the opposite.

The more capable the agents become, the more important it is to establish the boundaries within which they operate.

A highly capable agent working without appropriate standards can create problems very quickly.

A highly capable agent working within a well-designed engineering environment can create enormous value.

That is the distinction we have been working toward.

Our journey has reinforced three principles that I believe will remain relevant as AI continues to evolve.

First, speed without engineering discipline does not scale.

Generating software quickly is useful only when the resulting software is reliable, maintainable, secure, and aligned with the organization’s requirements.

Second, engineering discipline must be proportional to the work.

Too little structure creates inconsistency. Too much structure destroys the productivity gains that made agentic development attractive in the first place.

Third, the engineering system must continuously learn.

Standards, knowledge, governance, and tooling must evolve through real engineering experience. But that evolution must remain deliberate and accountable.

Perhaps the most important realization for me has been that AI agents do not eliminate the need for experienced engineers.

They change where engineering expertise is applied.

Someone still needs to understand the business problem.

Someone needs to make architectural decisions.

Someone needs to establish security and governance boundaries.

Someone needs to define what good looks like.

And someone needs to remain accountable for what reaches production.

The AEP is our attempt to make those responsibilities explicit while allowing AI agents to take on more of the implementation work.

AI agents changed how we write software. The Agentic Engineering Playbook is changing how we engineer, govern, and deliver it.

And I believe we are only at the beginning of that transformation.

Coming Next: Inside Our Agentic Engineering Playbook

In the second article of this series, I will explore the technical architecture behind our AEP.

I will explain the seven layers that make up the framework, how we structure agent roles and engineering standards, how GrillMe-with-Docs challenges plans against organizational requirements, and how local validation works alongside centralized GitHub controls.

I will also discuss our approach to canonical governance, continuous learning, plugin distribution, and the practical considerations involved in implementing a similar framework within another engineering organization.

The first article has been about why we changed our engineering approach and what we learned along the way.

The next will be about how we built the system that makes it possible.


If you are leading a similar transformation, experimenting with AI coding agents, or developing an agentic engineering framework within your organization, I would be interested in hearing about your experiences. Particularly the things that did not work as expected—because those are often where the most valuable lessons emerge.

The Weird Claude Code Error That Ate My Afternoon (and How I Fixed It)

Today, while I was deep in the middle of handing off some work between Claude Code sessions, I got this weird error out of nowhere:

API Error: 400 messages.7.content.3: `thinking` or `redacted_thinking`
blocks in the latest assistant message cannot be modified. These blocks
must remain as they were in the original response.

I’d never seen it before, and at first nothing I did made it go away — every time I thought I’d fixed it, it came right back, sometimes pointing at a different spot in the conversation. So I went down the rabbit hole, figured out what was actually happening, and I’m writing it up here in case you hit the same wall. The good news: it’s almost always fixable, and you usually don’t lose your work.

What the error means

When thinking is enabled, Claude’s responses include thinking (or redacted_thinking) blocks. These carry a cryptographic signature, and the API requires them to be passed back byte-for-byte unchanged — same text, same signature, same position in the message. If a thinking block gets altered, reordered, truncated, or loses its signature, the next API call is rejected with a 400 pointing at the offending message and content index (e.g. messages.7.content.3).

In Claude Code, this almost never comes from anything you typed. It comes from the session history file the CLI replays on each turn.

Two flavours of this bug (figuring out which you have)

This was the part that tripped me up, so it’s worth slowing down on. There are two versions, and they need different fixes.

1. A fixed error index that never moves. The same messages.N.content.M every time. This is classic history corruption — one bad block sitting in your session file, often from an interrupted turn, a crash, or switching models/thinking settings mid-conversation. Cleaning the file fixes it.

2. An error index that keeps moving (7.content.3, then 1.content.18, then 3.content.41…). This means the bad block is being regenerated on every turn, not sitting statically in old history. The usual cause is a parallel-tool-call cascade: Claude fires several tool calls at once, one gets cancelled, and the turn ends up with thinking blocks tangled up with orphaned/cancelled tool calls. Cleaning the file only unblocks you until the session re-enters the same spiral. The durable fix is to not resume that session.

The fixes, in order
Step 0 — Update Claude Code first

Several fixes have shipped for exactly this class of bug (thinking blocks orphaned by interrupted or parallel tool calls on replay).

claude update
# or
npm install -g @anthropic-ai/claude-code
Step 1 — The easy escape hatch: clear or compact

If you don’t need to preserve the conversation, /clear removes the bad block entirely by starting fresh. If you want to keep your thread of work, /compact summarises the history into a clean context and drops the corrupt block. Both are one command and solve the majority of cases.

Step 2 — Turn thinking off (fastest unblock)

If the API isn’t enforcing signature integrity, the malformed block stops being rejected. Toggle thinking off (via /configor your version’s thinking toggle) to get moving immediately. You can turn it back on later.

Step 3 — Repair the session file in place

If you’re mid-handoff and can’t clear, you can surgically remove thinking blocks from the session file. The single most important rule: fully quit Claude Code before editing. While the process is alive, it owns the file and will overwrite your edits from memory on the next turn — re-introducing the exact block you just removed. This is the number-one reason people think the fix “didn’t work.”

# 1. Make sure nothing is running
pkill -f claude; sleep 1; pgrep -fl claude   # should print nothing

# 2. Find your project's session directory
ls -lt ~/.claude/projects/<your-project-hash>/

# 3. See which session files still contain thinking blocks
for F in ~/.claude/projects/<your-project-hash>/*.jsonl; do
  echo "$(grep -c '"thinking"' "$F")  $F"
done

Then strip thinking blocks from the affected file(s). This Python snippet removes them and drops any assistant turn left empty afterward (the API rejects empty assistant messages too):

F="path/to/session.jsonl"
cp "$F" "$F.bak"   # always back up

python3 - "$F" <<'EOF'
import json, sys
path = sys.argv[1]
out, removed, dropped = [], 0, 0
for ln in open(path).read().splitlines():
    if not ln.strip(): continue
    try: obj = json.loads(ln)
    except json.JSONDecodeError:
        out.append(ln); continue
    if obj.get("type") == "assistant":
        c = obj.get("message", {}).get("content")
        if isinstance(c, list):
            new = [b for b in c
                   if not (isinstance(b, dict)
                           and b.get("type") in ("thinking", "redacted_thinking"))]
            removed += len(c) - len(new)
            if len(new) == 0:
                dropped += 1
                continue
            obj["message"]["content"] = new
    out.append(json.dumps(obj, ensure_ascii=False))
open(path, "w").write("\n".join(out) + "\n")
print(f"removed {removed} thinking block(s), dropped {dropped} empty turn(s)")
EOF

Removing a whole thinking block is allowed — the API only objects to modified ones. After editing, verify it’s clean and stays clean, then relaunch:

grep -c '"thinking"' "$F"   # expect 0
A few gotchas worth knowing
  • Your projects can have many session files. This one got me. Claude Code resumes the most-recently-modified one, and --continue auto-picks by timestamp. I kept cleaning a file and the error kept coming — turns out I was editing the wrong session. Check every .jsonl in the project directory, not just the obvious one.
  • A moving error index = a recurring trigger. Don’t just clean the file; avoid resuming the session that keeps producing the bad turn. Start fresh from a handoff doc or /compact instead.
  • The error path is an API-message index, not a JSONL line number. The history file includes user turns, tool results and summaries that get filtered/renumbered before the request is built, so messages.7 is rarely line 7 of the file. This is why blanket-cleaning all assistant turns is more reliable than hand-editing one line.
TL;DR (what I wish I’d known at the start)

The thinking-block 400 is a session-state problem in Claude Code, not your data. Update the CLI, then /clear or /compact if you can. If you have to preserve the session, quit Claude Code completely before touching anything, strip the thinking blocks from the session JSONL, verify it’s clean, and relaunch. And if the error index keeps moving between attempts, stop trying to resume that session — the bad turn is being regenerated each time, so just start fresh from your handoff notes.

That last point is what finally got me unstuck. Hope it saves you the afternoon it cost me.