ai software engineering agentic workflows git automation devops llm greptile coding agents service layer architecture

Engineering Agentic Workflows: Implementing a Model-Agnostic Software Factory via Markdown-Driven Skills and Evidence-Based Verification

5 min read

Engineering Agentic Workflows: Implementing a Model-Agnostic Software Factory

The current paradigm of AI-assisted development is shifting from simple prompt-response interactions to the orchestration of complex, multi-agent workflows. While many developers use tools like Cursor or Claude to iterate on single features, there is a burgeoning movement toward building "Software Factories." A software factory is not a specific piece of software or a proprietary LLM harness; rather, it is an orchestrated assembly line of agentic skills, domain knowledge, and automated verification loops designed to maximize throughput without compromising code integrity.

The core architecture of a software factory relies on the concept of model-agnosticism. Whether utilizing GPT-5.6, Astra, or Fable, the efficacy of the factory is determined by its workflow—specifically, how instructions are injected into the agent's context and how subsequent steps are validated.

The agents.md Context Injection Layer

The foundation of this architecture is a single source of truth: the agents.md file. In an agentic environment, simply providing a system prompt is often insufficient for complex engineering tasks. Instead, we utilize a markdown-based configuration file that is injected into the agent's chat context at the start of every interaction.

The primary mistake in current agents.md implementations is redundancy—providing information about the codebase that the LLM can already infer from its RAG (Retrieval-Augmented Generation) capabilities. A high-performance agents.md should instead focus on defining non-native workflows and specific operational constraints that the model cannot "know" without explicit instruction.

Phase 1: Isolation via Git Worktrees

A critical failure point in multi-agent development is state corruption—where one agent overwrites or deletes files being modified by another. To achieve true concurrency, a software factory must implement an Isolate phase.

Rather than having multiple agents operating on the origin main branch, the workflow mandates that every new feature begins in a fresh Git worktree, branched from origin main. By utilizing Git worktrees, we can maintain multiple simultaneous, isolated development environments on the same local machine. This allows an engineer to manage dozens of parallel features (e.g., an email client update, a Linux environment configuration, and a landing page redesign) without any risk of cross-agent interference or merge conflicts during the active development phase.

Phase 2: The Build Process and Service Layer Architecture

The "Build" phase is where the actual code generation occurs. However, raw LLM output often suffers from "slop"—code that is functional but architecturally incoherent. While models like Astra are powerful workhorses, they prioritize completion over structural elegance. Conversely, models like Fable have demonstrated superior capabilities in generating high-quality, production-ready code.

To mitigate the risk of technical debt, the software factory enforces a Code Structure Skill. This skill instructs the agent to adhere strictly to a Service Layer Architecture. By enforcing this pattern, we ensure that:

  1. Human Readability: Any human developer can easily audit the logic. 2.' Agentic Interoperability: Subsequent agents (or even different models) can parse the codebase with high confidence because the separation of concerns is predictable.
  2. Maintainability: Logic is decoupled from the transport layer, preventing the "spaghetti code" often seen in unconstrained agentic outputs.

Phase 3: Evidence-Driven Testing and Verification

Because LLMs are prone to hallucinations—even advanced models like GPT-5.6 can occasionally claim a task is complete when it is not—the factory implements an Evidence-Driven Testing protocol. This phase moves beyond simple unit tests into visual and performance-based verification.

The workflow utilizes two primary sub-skills:

  • Before/After State Capture: The agent is required to record the state of the application before a change and after the change. For UI-centric tasks, this involves generating screenshots or video recordings. This provides an immutable audit trail that proves the feature exists and functions as intended.
  • Performance Benchmarking: For backend or optimization tasks, the agent must provide measurable metrics. A practical example of this is a performance update where an agent identifies a high-latency endpoint (e.g., 850ms) and, through iterative refinement, reduces it to a highly optimized state (e.g., 61ms), providing the raw timing data as proof in the Pull Request (PR).

Phase 4: The Grep Loop and Automated Code Review

The final stage of the factory is the Ship phase, which utilizes an automated feedback loop known as the Grep Loop. This involves integrating third-party code review agents—such as Greptile, Code Rabbit, or Magit—to act as a secondary layer of quality control.

The process functions as follows:

  1. Automated PR Generation: The agent opens a Pull Request containing the agents.md instructions, the service-layer implementation, and the "Before/After" evidence.
  2. Confidence Scoring: A code review agent (e.g., Greptile) analyzes the diff and assigns a confidence score (e.g., 1/5 to 5/5).
  3. Recursive Refinement: If the score is below 5/5, the "Grep Loop" triggers a regression into the Build phase. The agent receives the feedback (e.g., "pagination logic error" or "menu space not preserved"), corrects the code, and re-submits for review.

The loop continues until the confidence score reaches 5/5. Only at this point does the human engineer intervene to perform the final merge into origin main.

Conclusion: The Future of Software Engineering

A software factory is not a product you buy; it is a methodology you implement through structured workflows and markdown-driven instructions. By treating AI agents as specialized workers within an assembly line—governed by isolation, architectural standards, evidence-based proof, and automated review loops—we can scale software production to unprecedented levels of speed and reliability.