Skip to content

← From backlog card to pull request: what I learned building a real software agent

From backlog card to pull request: what I learned building a real software agent

English ↔ Español

The hard part was not generating code

There is a huge difference between a model that can write code and an agent that can participate in an engineering process.

I learned that while building DevAgent.

The initial idea sounds simple: take a backlog card, understand the task, change the repository, and open a pull request. You can demo something like that quickly. Building a workflow you would actually allow near a real repository is a very different problem.

The hard part was never "how do I make an LLM generate TypeScript?"

The real question was: how do I make a machine work inside the same constraints that make a software team reliable?

The pull request became the safety boundary

The first important decision was to prevent the agent from delivering directly to the main branch.

That sounds obvious, but it changes the architecture.

The product of the agent is not production code. It is a reviewable pull request.

txt
Backlog card
    ↓
Understand task
    ↓
Plan
    ↓
Isolated branch
    ↓
Changes
    ↓
Lint / Typecheck / Tests
    ↓
Diff + summary
    ↓
Pull Request
    ↓
Human review

This reuses a contract engineering teams already understand: diffs, checks, comments, approvals, and merge controls.

Instead of inventing a separate AI review interface, I would rather make the AI enter through the door that already exists.

The card should be a sufficient specification

One temptation with agent systems is to invent a second prompt language that only the agent understands.

I avoided that.

If the team needs to fill in fifteen artificial fields before automation works, the automation has started moving work around instead of removing it.

The backlog card remains the primary input.

That forces the agent to answer a few questions before touching code:

  • What behavior is expected?
  • Which files are likely related?
  • Is there a similar implementation already in the project?
  • Are the acceptance criteria explicit?
  • Is the task ambiguous enough that execution should stop?

That last question matters a lot.

Autonomy does not mean continuing at any cost. A useful agent also needs to know when it does not have enough information to act.

Planning before writing reduces waste

My first instinct was to let the agent explore and edit at the same time. It works, but creates an expensive failure mode: the agent discovers late that it followed the wrong abstraction and has to undo half the implementation.

A short planning stage made the workflow cleaner.

The plan does not need to become an architecture document. Something like this is already useful:

json
{
  "goal": "Add a status filter to the orders list",
  "filesLikelyAffected": [
    "src/modules/orders/application/list-orders.ts",
    "src/app/orders/page.tsx"
  ],
  "checks": [
    "preserve pagination",
    "validate status enum",
    "add filter test"
  ],
  "risk": "low"
}

Now it is easier to impose budgets, detect tasks that are too large, and decide whether execution should be delegated at all.

A tool is not a permission

Another important lesson: giving an agent a tool should not mean giving it unrestricted freedom to use that tool.

I think about capabilities as explicit permissions.

ts
const policy = {
  filesystem: {
    read: ['src/**', 'tests/**', 'package.json'],
    write: ['src/**', 'tests/**'],
    deny: ['.env*', '.git/**'],
  },
  shell: {
    allow: ['npm test', 'npm run lint', 'npm run typecheck'],
    denyNetwork: true,
  },
  git: {
    canCreateBranch: true,
    canPushBranch: true,
    canMerge: false,
    canForcePush: false,
  },
}

I consider this more important than a few benchmark points between two models.

A model can be excellent. If the harness lets it do too much without controls, the system is still poorly designed.

Tests are not the final step; they are a reasoning tool

In DevAgent, the agent does not run the test suite only after it thinks it is done.

Checks are part of the loop.

A simplified execution looks like this:

ts
for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
  await implementNextStep()

  const result = await runChecks()

  if (result.ok) break

  await inspectFailure(result)
}

The important detail is the limit.

Without a budget, an agent can enter a trial-and-error spiral that looks productive because there is a lot of activity, while actual progress barely moves.

I prefer to limit:

  • number of attempts;
  • total execution time;
  • number of modified files;
  • model cost;
  • allowed commands.

When a limit is reached, the agent should hand useful context to a human instead of pretending it is almost finished.

The diff is a better source of truth than the model's explanation

Models are very good at writing convincing summaries. That is exactly why the summary should not be the only thing we trust.

Before opening the PR, the agent needs to compare the original intent with what actually changed.

I like to separate three layers:

  1. Intent — what the card asked for.
  2. Evidence — diff, tests, and logs.
  3. Narrative — the agent's explanation.

The narrative is useful only when it is grounded in evidence.

A PR body can stay predictable:

md
## What changed
- Added a status filter to the order query.
- Synced filter state with the URL.

## Why
Implements the acceptance criteria from card #184.

## Validation
- npm run lint ✅
- npm run typecheck ✅
- npm test ✅

## Risk / notes
Low. No schema or external contract changes.

That lowers the cognitive cost of review substantially.

Not every task belongs in an agent

This may be the most useful insight from the project.

The goal is not to automate 100% of the backlog.

Good delegation candidates usually have a few properties:

  • small or medium scope;
  • observable behavior;
  • existing tests or tests that are easy to add;
  • few product decisions;
  • low data and infrastructure risk;
  • a clear definition of done.

Tasks with ambiguous requirements, irreversible migrations, major architecture decisions, or meaningful security impact should escalate to a human early.

I would rather have an agent complete 40% of the right tasks with high confidence than attempt 100% and create a review nightmare.

Where Jev and specialized models become interesting

One consequence of this architecture is that not every decision needs to go through the same LLM that writes the code.

"Is this task suitable for automation?", "which tool should I call?", or "does this result need extra review?" are decision problems, not writing problems.

That is why decision-focused models such as the newly released Jev are interesting to me. A generative model can still plan and edit code while a separate layer handles routing, classification, or gates.

More models do not necessarily mean more complexity. Sometimes they mean clearer responsibilities.

What I would change in the next version

Three things are at the top of the list.

1. Evaluate tasks, not vibes

For every run I want to record:

  • did it finish without intervention?
  • how many attempts did it need?
  • did checks pass on the first try?
  • was the PR accepted, edited, or rejected?
  • how much did it cost?
  • how long did it take to merge?

Without that, "the agent is getting better" is just an opinion.

2. Repository memory with explicit validity

Stable conventions can be persisted. Implementation details change and should expire.

Memory without an invalidation policy becomes invisible technical debt.

3. More deterministic gates

The more I can move out of the LLM and into code, the better:

  • schema validation;
  • file limits;
  • branch policy;
  • required tests;
  • commit rules;
  • security checks.

The model should solve ambiguity. Code should keep solving exact rules.

The main lesson

Building DevAgent changed the question I ask about software agents.

I used to ask: "which model codes best?"

Now I ask: "which system turns model capability into verifiable work?"

It is a less glamorous question, but it is much closer to what companies actually need.

A useful agent is not one that looks like a developer in a demo. It is one that can enter the process, respect limits, produce evidence, and keep the final decision clear for the people responsible for the software.

References

El problema no era generar código

Hay una diferencia enorme entre un modelo que sabe escribir código y un agente que puede participar en un proceso de ingeniería.

Lo aprendí construyendo DevAgent.

La idea inicial parece simple: tomar un card del backlog, entender la tarea, modificar el repositorio y abrir un pull request. En una demo se puede montar algo parecido bastante rápido. Construir un flujo que aceptarías dejar cerca de un repositorio real es un problema completamente distinto.

La parte difícil nunca fue "cómo hago que el LLM genere TypeScript".

La pregunta real era: ¿cómo hago que una máquina trabaje dentro de las mismas restricciones que hacen confiable a un equipo de software?

El pull request se convirtió en la frontera de seguridad

La primera decisión importante fue impedir que el agente entregara directamente en la rama principal.

Parece obvio, pero cambia toda la arquitectura.

El producto del agente no es código en producción. Es un pull request revisable.

txt
Card
  ↓
Entender la tarea
  ↓
Plan
  ↓
Rama aislada
  ↓
Cambios
  ↓
Lint / Typecheck / Tests
  ↓
Diff + resumen
  ↓
Pull Request
  ↓
Revisión humana

Eso reutiliza un contrato que los equipos ya entienden: diff, checks, comentarios, aprobación y merge.

En lugar de inventar una interfaz paralela para revisar IA, prefiero hacer que la IA entre por la puerta que ya existe.

El card debería ser una especificación suficiente

Una tentación común en sistemas de agentes es crear un segundo idioma de prompts que solo entiende el agente.

Intenté evitarlo.

Si el equipo tiene que completar quince campos artificiales para que la automatización funcione, la automatización empezó a mover trabajo de sitio en lugar de eliminarlo.

El input principal sigue siendo el card.

Eso obliga al agente a responder algunas preguntas antes de tocar el código:

  • ¿Cuál es el comportamiento esperado?
  • ¿Qué archivos parecen relacionados?
  • ¿Existe una implementación similar en el proyecto?
  • ¿Los criterios de aceptación son explícitos?
  • ¿Existe suficiente ambigüedad como para detener la ejecución?

La última pregunta es especialmente importante.

Autonomía no significa continuar a cualquier precio. Un agente útil también tiene que saber cuándo no tiene información suficiente para actuar.

Planificar antes de escribir reduce desperdicio

Mi primer impulso fue dejar que el agente explorara y modificara al mismo tiempo. Funciona, pero genera un modo de fallo caro: descubre tarde que siguió la abstracción equivocada y tiene que deshacer media implementación.

Separar una etapa corta de planificación mejoró el flujo.

El plan no necesita convertirse en un documento de arquitectura. Algo así ya ayuda:

json
{
  "goal": "Agregar filtro por estado en la lista de pedidos",
  "filesLikelyAffected": [
    "src/modules/orders/application/list-orders.ts",
    "src/app/orders/page.tsx"
  ],
  "checks": [
    "mantener paginación",
    "validar enum de estado",
    "agregar test del filtro"
  ],
  "risk": "low"
}

Con eso es más fácil imponer budgets, detectar tareas demasiado grandes y decidir si realmente vale delegar la ejecución.

Una herramienta no es un permiso

Otro aprendizaje importante: darle una herramienta al agente no debería significar darle libertad irrestricta para usarla.

Yo trato las capabilities como permisos explícitos.

ts
const policy = {
  filesystem: {
    read: ['src/**', 'tests/**', 'package.json'],
    write: ['src/**', 'tests/**'],
    deny: ['.env*', '.git/**'],
  },
  shell: {
    allow: ['npm test', 'npm run lint', 'npm run typecheck'],
    denyNetwork: true,
  },
  git: {
    canCreateBranch: true,
    canPushBranch: true,
    canMerge: false,
    canForcePush: false,
  },
}

Considero esto más importante que unos pocos puntos de benchmark entre dos modelos.

El modelo puede ser excelente. Si el harness le permite hacer demasiado sin controles, el sistema sigue estando mal diseñado.

Los tests no son el último paso; son una herramienta de razonamiento

En DevAgent, el agente no ejecuta la suite solo después de creer que terminó.

Los checks forman parte del loop.

Una ejecución simplificada queda así:

ts
for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
  await implementNextStep()

  const result = await runChecks()

  if (result.ok) break

  await inspectFailure(result)
}

El detalle importante es el límite.

Sin budget, un agente puede entrar en una espiral de prueba y error que parece productividad porque hay mucha actividad, pero casi no hay avance proporcional.

Prefiero limitar:

  • cantidad de intentos;
  • tiempo total;
  • número de archivos modificados;
  • costo de modelo;
  • comandos permitidos.

Cuando alcanza el límite, debería entregar contexto útil a una persona en vez de fingir que está a punto de terminar.

El diff es una mejor fuente de verdad que la explicación del modelo

Los modelos son muy buenos escribiendo resúmenes convincentes. Precisamente por eso no confío solo en el resumen.

Antes de abrir el PR, el agente necesita comparar la intención original con lo que realmente cambió.

Me gusta separar tres capas:

  1. Intent — lo que pidió el card.
  2. Evidence — diff, tests y logs.
  3. Narrative — la explicación del agente.

La narrativa solo es útil cuando está anclada en evidencia.

El cuerpo del PR puede ser predecible:

md
## Qué cambió
- Se agregó filtro de estado en la consulta de pedidos.
- El estado del filtro queda sincronizado con la URL.

## Por qué
Implementa el criterio de aceptación del card #184.

## Validación
- npm run lint ✅
- npm run typecheck ✅
- npm test ✅

## Riesgo / observaciones
Bajo. Sin cambios de schema ni contratos externos.

Eso reduce bastante el costo cognitivo de la revisión.

No toda tarea debería entrar en el agente

Este quizá sea el insight más útil del proyecto.

El objetivo no es automatizar el 100% del backlog.

Las buenas tareas para delegar suelen tener algunas características:

  • scope pequeño o medio;
  • comportamiento observable;
  • tests existentes o fáciles de crear;
  • pocas decisiones de producto;
  • bajo riesgo de datos e infraestructura;
  • definición de terminado clara.

Tareas con requisitos ambiguos, migraciones irreversibles, decisiones arquitectónicas grandes o impacto de seguridad deberían escalar a una persona temprano.

Prefiero un agente que complete el 40% de las tareas correctas con alta confianza a uno que intente el 100% y convierta la revisión en una pesadilla.

Dónde Jev y los modelos especializados empiezan a ser interesantes

Una consecuencia de esta arquitectura es que no toda decisión necesita pasar por el mismo LLM que escribe código.

"¿Esta tarea es adecuada para automatización?", "¿qué herramienta debería usar?" o "¿este resultado necesita revisión extra?" son problemas de decisión, no de redacción.

Por eso me parecen interesantes modelos enfocados en decisiones como el recién lanzado Jev. Un modelo generativo puede seguir planificando y editando código mientras otra capa se encarga de routing, clasificación o gates.

Más modelos no significan necesariamente más complejidad. A veces significan responsabilidades más claras.

Qué cambiaría en la próxima versión

Tres cosas están arriba de la lista.

1. Evaluar tareas, no sensaciones

Quiero registrar en cada ejecución:

  • ¿terminó sin intervención?
  • ¿cuántos intentos necesitó?
  • ¿los checks pasaron a la primera?
  • ¿el PR fue aceptado, editado o descartado?
  • ¿cuánto costó?
  • ¿cuánto tardó en llegar a merge?

Sin eso, "el agente está mejorando" es solo una opinión.

2. Memoria del repositorio con validez explícita

Las convenciones estables pueden persistirse. Los detalles de implementación cambian y deberían expirar.

Memoria sin política de invalidación se convierte en deuda técnica invisible.

3. Más gates deterministas

Cuanto más pueda sacar del LLM y llevar a código, mejor:

  • validación de schema;
  • límites de archivos;
  • branch policy;
  • tests obligatorios;
  • reglas de commits;
  • checks de seguridad.

El modelo debería resolver ambigüedad. El código debería seguir resolviendo reglas exactas.

La principal lección

Construir DevAgent cambió la pregunta que hago sobre agentes de software.

Antes preguntaba: "¿qué modelo programa mejor?"

Ahora pregunto: "¿qué sistema transforma capacidad del modelo en trabajo verificable?"

Es una pregunta menos glamorosa, pero mucho más cercana a lo que las empresas realmente necesitan.

Un agente útil no es el que parece un desarrollador en una demo. Es el que puede entrar en el proceso, respetar límites, producir evidencia y mantener clara la decisión final para las personas responsables del software.

Referencias