{
  "_published": {
    "source": "docs/measurements/n8n-agent-trace-review-2026-11-16.json",
    "published": "2026-11-16",
    "publisher": "J4SGON S.L., vorluxai.com",
    "index": "https://vorluxai.com/data/",
    "cleaned": "Copied from our internal repository by scripts/publish_measurements.py. Every number is unchanged. Redacted: nothing. Hostnames (spark-43d5, spark-7180) and the PRIME / spark2 labels are kept: the posts use them.",
    "redactions": {}
  },
  "what": "A scheduled n8n workflow that reads one day of agent execution traces from a JSON file, counts and groups the failures in a Code node, asks a local model through Ollama what each recurring failure has in common, checks the answer, appends the lessons to a JSONL file marked 'unreviewed' and posts a notification to a local listener. Built and run in a throwaway n8n container; every run driven by the n8n CLI (import:workflow, execute), plus one scheduled-trigger test.",
  "date": "2026-11-16",
  "scripts": "scripts/bench/n8n_learning_loop/ (make_traces.py writes the synthetic traces and the answer key, make_workflow.py builds the workflow JSON, notify_listener.js is the local notification endpoint, run_variant.sh imports and executes by CLI, aggregate.py builds this file from the raw captures).",
  "synthetic_data": "Every trace is invented (site/public/downloads/agent-traces-sample-2026-11-16.json). No real agent, log or system was read. Four failure patterns and one one-off failure were planted; the answer key below was never shown to the model.",
  "conditions": {
    "n8n": {
      "version": "2.26.9",
      "image": "n8nio/n8n:2.26.9",
      "image_digest": "sha256:a42a47a6782f9d4419d81366199fa592e063ad41511cc80a0cd756252187c291",
      "node_js": "v24.15.0",
      "database": "SQLite (image default)",
      "container": "throwaway container on a DGX Spark (aarch64), Docker 29.2.1, default bridge network, removed after the runs",
      "env": {
        "N8N_RESTRICT_FILE_ACCESS_TO": "/files/learning-loop",
        "GENERIC_TIMEZONE": "Europe/Madrid",
        "N8N_DIAGNOSTICS_ENABLED": "false"
      },
      "driver": "n8n import:workflow --input=<file>; n8n execute --id agentTraceReview --rawOutput (with N8N_RUNNERS_BROKER_PORT=5680 because the server in the same container holds 5679)",
      "newer_release_not_tested": "n8n 2.47.7 was the stable release on 2026-11-16 (GitHub releases, npm dist-tags); these runs used 2.26.9.",
      "container_memory_idle": "264.5MiB (docker stats, after the runs)"
    },
    "model": {
      "name": "llama3.1:8b",
      "digest_12": "610938b3d432",
      "parameter_size": "8.0B",
      "quantization": "Q4_K_M",
      "served_by": "Ollama 0.34.0 on a second DGX Spark (GB10, 128 GB unified memory), reached over the LAN from the container",
      "ollama_env": {
        "OLLAMA_NUM_PARALLEL": 8,
        "OLLAMA_MAX_LOADED_MODELS": 3,
        "OLLAMA_KEEP_ALIVE": "30m"
      },
      "endpoint": "POST /api/chat, stream false, format = JSON schema, keep_alive 5m",
      "request_options": {
        "grouped_seeded": {
          "num_ctx": 8192,
          "temperature": 0.2,
          "seed": 42,
          "num_predict": 500
        },
        "raw_single_call_seeded": {
          "num_ctx": 8192,
          "temperature": 0.2,
          "seed": 42,
          "num_predict": 1500
        },
        "grouped_default_sampling": {
          "num_ctx": 8192,
          "num_predict": 500
        }
      },
      "loaded_size_bytes_at_num_ctx_8192": 13693909729,
      "loaded_size_source": "/api/ps between the grouped and raw series (8 parallel slots)",
      "shared_box": "The same Ollama had one other model resident (about 22.7 GB) during the runs; the box was not dedicated to this test."
    },
    "workflow": {
      "traces": "/files/learning-loop/agent-traces-sample-2026-11-16.json: 55 synthetic runs of one invented day, 36 successes and 19 failures",
      "memory_store": "/files/learning-loop/lessons.jsonl, one JSON object per line, appended",
      "notification": "POST http://127.0.0.1:5699/notify, a Node.js listener started inside the same container with docker exec",
      "output_language": "English",
      "published_file": "site/public/downloads/n8n-agent-trace-review-2026-11-16.json: identical to the file run in grouped_seeded except for one value, ollamaUrl, set to http://localhost:11434"
    },
    "timing_definitions": {
      "workflow_ms": "stoppedAt minus startedAt of the n8n execution record",
      "node_ms": "executionTime n8n reports per node",
      "cli_wall_s": "wall clock of the whole `docker exec ... n8n execute` command, including CLI start-up",
      "call total_s / tokens_per_s": "from Ollama's own response fields total_duration, eval_duration, eval_count"
    }
  },
  "answer_key": {
    "note": "Which run_ids belong to each planted pattern. Never shown to the model.",
    "patterns": {
      "P1": {
        "agent": "invoice-extractor",
        "run_ids": [
          "run-007",
          "run-018",
          "run-024",
          "run-032",
          "run-043",
          "run-049"
        ],
        "what": "pdf_to_text hits its 30 s timeout",
        "condition": "only documents of 41 pages or more; every success of the same agent has 22 pages or fewer"
      },
      "P2": {
        "agent": "crm-updater",
        "run_ids": [
          "run-012",
          "run-013",
          "run-014",
          "run-015",
          "run-016"
        ],
        "what": "HTTP 429 from the CRM API",
        "condition": "all five between 09:00 and 09:06, trigger nightly_backlog_batch, 20-40 records; every success is a webhook call with 1-4 records at another time"
      },
      "P3": {
        "agent": "email-drafter",
        "run_ids": [
          "run-008",
          "run-027",
          "run-041",
          "run-052"
        ],
        "what": "send_email rejected, missing 'subject'",
        "condition": "only thread replies (mode thread_reply, has_subject false)"
      },
      "P4": {
        "agent": "meeting-summariser, contract-reviewer, support-triager",
        "run_ids": [
          "run-021",
          "run-033",
          "run-044"
        ],
        "what": "context length exceeded",
        "condition": "prompt above the 8192-token limit, in three different agents; successes of the same agents are below it"
      }
    },
    "one_off": {
      "agent": "report-builder",
      "run_ids": [
        "run-001"
      ],
      "what": "disk full once; a single event, not a pattern"
    },
    "totals": {
      "runs": 55,
      "failures": 19,
      "successes": 36
    }
  },
  "labels_note": "condition_label and recommendation_label are OUR reading of each distinct text the model wrote, not an automatic score. Every distinct text and the label we gave it is listed under labelled_texts so the judgement can be checked. Condition labels: 'correct' (names the planted factor with values that match the data), 'right factor, wrong numbers', 'incomplete' (true but misses a planted part of the condition), 'wrong'. Recommendation labels: 'specific' (a concrete change tied to the condition), 'generic' (what anyone would say about that kind of error), 'questionable' (asks for something the trace cannot support or that is not ours to change, or would not fix it), 'mixed' (a specific option next to a generic or questionable one). 'specific' does not mean we tested the change.",
  "exploration": {
    "note": "Three attempts that failed while building the workflow, kept because the post describes them.",
    "json_schema_inside_an_http_request_expression": {
      "what_we_tried": "The Ollama request body, including the JSON schema for `format`, written as an expression in the HTTP Request node's JSON Body field.",
      "status": "error",
      "failed_node": "Explain with Ollama",
      "error": "invalid syntax",
      "node_ms": {
        "Every day at 03:00": 1,
        "Config": 4,
        "Read trace file": 35,
        "Parse JSON": 23,
        "Count and group failures": 214,
        "Explain with Ollama": 25
      },
      "fix": "Build the whole request object in the Code node and pass ={{ $json.request }}. The schema's closing braces '}}' end an n8n expression early."
    },
    "notification_listener_on_the_docker_host": {
      "what_we_tried": "Notify node posting to a listener bound to the Docker bridge gateway address on the host. The same listener answered a request from the host itself; from the container a plain wget also timed out.",
      "status": "error",
      "failed_node": "Notify",
      "error": "The connection was aborted, perhaps the server is offline",
      "node_ms": {
        "Every day at 03:00": 1,
        "Config": 2,
        "Read trace file": 24,
        "Parse JSON": 18,
        "Count and group failures": 317,
        "Explain with Ollama": 6645,
        "Check and collect lessons": 6,
        "Convert to file": 1,
        "Append to memory file": 5,
        "Notify": 10052
      },
      "fix": "Run the listener inside the n8n container. The lessons were already in the memory file when Notify failed, because the write comes first."
    },
    "notification_url_with_localhost": {
      "what_we_tried": "Listener inside the container on 127.0.0.1, Notify URL http://localhost:5699/notify. The container's /etc/hosts maps localhost to ::1 as well; wget to localhost was refused, to 127.0.0.1 answered.",
      "status": "error",
      "failed_node": "Notify",
      "error": "The service refused the connection - perhaps it is offline",
      "node_ms": {
        "Every day at 03:00": 1,
        "Config": 2,
        "Read trace file": 24,
        "Parse JSON": 19,
        "Count and group failures": 287,
        "Explain with Ollama": 3971,
        "Check and collect lessons": 6,
        "Convert to file": 2,
        "Append to memory file": 5,
        "Notify": 38
      },
      "fix": "Use http://127.0.0.1:5699/notify."
    }
  },
  "cold_start": {
    "status": "success",
    "started_at": "2026-11-16T05:07:38.892Z",
    "stopped_at": "2026-11-16T05:07:46.188Z",
    "workflow_ms": 7296,
    "error": null,
    "last_node": "Notify",
    "node_ms": {
      "Every day at 03:00": 0,
      "Config": 3,
      "Read trace file": 32,
      "Parse JSON": 19,
      "Count and group failures": 259,
      "Explain with Ollama": 6933,
      "Check and collect lessons": 11,
      "Convert to file": 3,
      "Append to memory file": 13,
      "Notify": 18
    },
    "model_calls": [
      {
        "total_s": 5.55,
        "load_s": 2.067,
        "prompt_tokens": 1031,
        "output_tokens": 90,
        "tokens_per_s": 28.9,
        "done_reason": "stop"
      },
      {
        "total_s": 6.902,
        "load_s": 2.067,
        "prompt_tokens": 1025,
        "output_tokens": 146,
        "tokens_per_s": 38.0,
        "done_reason": "stop"
      },
      {
        "total_s": 6.161,
        "load_s": 2.068,
        "prompt_tokens": 782,
        "output_tokens": 113,
        "tokens_per_s": 36.4,
        "done_reason": "stop"
      },
      {
        "total_s": 6.137,
        "load_s": 2.067,
        "prompt_tokens": 735,
        "output_tokens": 111,
        "tokens_per_s": 38.6,
        "done_reason": "stop"
      }
    ],
    "counted_in_code": {
      "runs": 55,
      "succeeded": 36,
      "failed": 19,
      "recurring_groups": 4,
      "one_offs": [
        "run-001"
      ]
    },
    "problems": [],
    "model_one_offs": null,
    "lessons": [
      {
        "planted_pattern": "P1",
        "agents": [
          "invoice-extractor"
        ],
        "run_ids": [
          "run-007",
          "run-018",
          "run-024",
          "run-032",
          "run-043",
          "run-049"
        ],
        "title": "pdf_to_text timeout",
        "what_fails": "pdf_to_text: timeout after 30000 ms",
        "condition": "The failed runs all have 48 or more pages in the input PDF, while the successful runs have 3 or fewer pages.",
        "recommendation": "Increase the timeout for pdf_to_text or optimize the pdf_to_text process to handle larger PDFs more efficiently.",
        "checks": {
          "cited_by": "code",
          "unknown_run_ids": [],
          "cited_but_succeeded": []
        },
        "cited_all_runs_of_pattern": true,
        "cited_runs_outside_pattern": [],
        "condition_label": "right factor, wrong numbers",
        "recommendation_label": "generic"
      },
      {
        "planted_pattern": "P2",
        "agents": [
          "crm-updater"
        ],
        "run_ids": [
          "run-012",
          "run-013",
          "run-014",
          "run-015",
          "run-016"
        ],
        "title": "429 Too Many Requests on crm_api.update_contact",
        "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
        "condition": "The failed runs all have a trigger of 'nightly_backlog_batch' with a large number of records (20-32), whereas the successful runs all have a trigger of 'webhook' with a small number of records (1-4).",
        "recommendation": "Consider adding a check to limit the number of records processed in a single 'nightly_backlog_batch' run, or implement a more efficient update process to reduce the load on the crm_api.",
        "checks": {
          "cited_by": "code",
          "unknown_run_ids": [],
          "cited_but_succeeded": []
        },
        "cited_all_runs_of_pattern": true,
        "cited_runs_outside_pattern": [],
        "condition_label": "correct",
        "recommendation_label": "mixed"
      },
      {
        "planted_pattern": "P3",
        "agents": [
          "email-drafter"
        ],
        "run_ids": [
          "run-008",
          "run-027",
          "run-041",
          "run-052"
        ],
        "title": "Missing Subject in Thread Reply",
        "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
        "condition": "The failed runs all have `mode=thread_reply` and `has_subject=false`, while the successful runs all have `mode=new_message` and `has_subject=true`.",
        "recommendation": "Check the input handling for `mode=thread_reply` and ensure that the `subject` property is being added to the arguments before calling `send_email`.",
        "checks": {
          "cited_by": "code",
          "unknown_run_ids": [],
          "cited_but_succeeded": []
        },
        "cited_all_runs_of_pattern": true,
        "cited_runs_outside_pattern": [],
        "condition_label": "correct",
        "recommendation_label": "specific"
      },
      {
        "planted_pattern": "P4",
        "agents": [
          "meeting-summariser",
          "contract-reviewer",
          "support-triager"
        ],
        "run_ids": [
          "run-021",
          "run-033",
          "run-044"
        ],
        "title": "Context Length Exceeded",
        "what_fails": "llm_call: context length exceeded: prompt has X tokens, limit is 8192",
        "condition": "The failed runs all have input: prompt_tokens values greater than 8192, whereas the successful runs all have input: prompt_tokens values less than or equal to 8192.",
        "recommendation": "Increase the context length limit in the LLM call to a value greater than 8192, such as 16384.",
        "checks": {
          "cited_by": "code",
          "unknown_run_ids": [],
          "cited_but_succeeded": []
        },
        "cited_all_runs_of_pattern": true,
        "cited_runs_outside_pattern": [],
        "condition_label": "correct",
        "recommendation_label": "questionable"
      }
    ],
    "cli_wall_s": 9.25
  },
  "grouped_seeded": {
    "summary": {
      "runs": 10,
      "successful": 10,
      "workflow_ms_median": 4407.5,
      "workflow_ms_min": 4239,
      "workflow_ms_max": 4485,
      "cli_wall_s_median": 6.3,
      "node_ms_median": {
        "Append to memory file": 10.0,
        "Check and collect lessons": 10.0,
        "Config": 2.0,
        "Convert to file": 2.0,
        "Count and group failures": 291.5,
        "Every day at 03:00": 1.0,
        "Explain with Ollama": 4029.0,
        "Notify": 12.5,
        "Parse JSON": 20.0,
        "Read trace file": 27.0
      },
      "model_calls_per_run": 4.0,
      "call_total_s_median": 3.2,
      "call_prompt_tokens_median": 903.5,
      "call_prompt_tokens_max": 1031,
      "call_output_tokens_median": 117.0,
      "run_prompt_tokens_median": 3573.0,
      "run_output_tokens_median": 469.0,
      "tokens_per_s_median": 37.5,
      "calls_cut_by_length": 0,
      "answers_not_valid_json": 0,
      "lessons_total": 40,
      "lessons_per_run": [
        4
      ],
      "runs_with_all_four_planted_patterns": 10,
      "lessons_with_unknown_run_ids": 0,
      "lessons_citing_a_successful_run_as_failed": 0,
      "lessons_about_the_one_off": 0,
      "runs_where_model_listed_exactly_the_one_off": 0,
      "model_one_off_lists": {
        "null": 10
      },
      "lessons_naming_an_agent_that_does_not_exist": 0,
      "rate_limit_lessons_mentioning_the_time_window": 0,
      "distinct_full_outputs": 4,
      "condition_labels_all": {
        "right factor, wrong numbers": 10,
        "correct": 30
      },
      "recommendation_labels_all": {
        "generic": 10,
        "specific": 18,
        "questionable": 12
      },
      "per_planted_pattern": {
        "P1": {
          "runs_with_a_lesson": 10,
          "lessons": 10,
          "lessons_citing_every_failed_run": 10,
          "lessons_citing_runs_outside_the_pattern": 0,
          "distinct_condition_texts": 1,
          "distinct_recommendation_texts": 1,
          "condition_labels": {
            "right factor, wrong numbers": 10
          },
          "recommendation_labels": {
            "generic": 10
          }
        },
        "P2": {
          "runs_with_a_lesson": 10,
          "lessons": 10,
          "lessons_citing_every_failed_run": 10,
          "lessons_citing_runs_outside_the_pattern": 0,
          "distinct_condition_texts": 1,
          "distinct_recommendation_texts": 3,
          "condition_labels": {
            "correct": 10
          },
          "recommendation_labels": {
            "specific": 10
          }
        },
        "P3": {
          "runs_with_a_lesson": 10,
          "lessons": 10,
          "lessons_citing_every_failed_run": 10,
          "lessons_citing_runs_outside_the_pattern": 0,
          "distinct_condition_texts": 1,
          "distinct_recommendation_texts": 2,
          "condition_labels": {
            "correct": 10
          },
          "recommendation_labels": {
            "specific": 8,
            "questionable": 2
          }
        },
        "P4": {
          "runs_with_a_lesson": 10,
          "lessons": 10,
          "lessons_citing_every_failed_run": 10,
          "lessons_citing_runs_outside_the_pattern": 0,
          "distinct_condition_texts": 2,
          "distinct_recommendation_texts": 3,
          "condition_labels": {
            "correct": 10
          },
          "recommendation_labels": {
            "questionable": 10
          }
        }
      }
    },
    "per_run": [
      {
        "status": "success",
        "started_at": "2026-11-16T05:07:55.677Z",
        "stopped_at": "2026-11-16T05:08:00.077Z",
        "workflow_ms": 4400,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 0,
          "Config": 2,
          "Read trace file": 25,
          "Parse JSON": 19,
          "Count and group failures": 305,
          "Explain with Ollama": 4021,
          "Check and collect lessons": 9,
          "Convert to file": 2,
          "Append to memory file": 5,
          "Notify": 8
        },
        "model_calls": [
          {
            "total_s": 2.472,
            "load_s": 0.001,
            "prompt_tokens": 1031,
            "output_tokens": 90,
            "tokens_per_s": 38.0,
            "done_reason": "stop"
          },
          {
            "total_s": 3.998,
            "load_s": 0.002,
            "prompt_tokens": 1025,
            "output_tokens": 149,
            "tokens_per_s": 38.3,
            "done_reason": "stop"
          },
          {
            "total_s": 3.081,
            "load_s": 0.002,
            "prompt_tokens": 782,
            "output_tokens": 113,
            "tokens_per_s": 38.0,
            "done_reason": "stop"
          },
          {
            "total_s": 3.265,
            "load_s": 0.002,
            "prompt_tokens": 735,
            "output_tokens": 117,
            "tokens_per_s": 37.0,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": null,
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-007",
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "The failed runs all have 48 or more pages in the input PDF, while the successful runs have 3 or fewer pages.",
            "recommendation": "Increase the timeout for pdf_to_text or optimize the pdf_to_text process to handle larger PDFs more efficiently.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "429 Too Many Requests on crm_api.update_contact",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "The failed runs all have a trigger of 'nightly_backlog_batch' with a large number of records (20-32), whereas the successful runs all have a trigger of 'webhook' with a small number of records (1-4).",
            "recommendation": "Consider adding a check to limit the number of records processed in a single 'nightly_backlog_batch' run, or implement a mechanism to stagger the processing of large batches to avoid hitting the 429 rate limit.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "Missing Subject in Thread Reply",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "The failed runs all have `mode=thread_reply` and `has_subject=false`, while the successful runs all have `mode=new_message` and `has_subject=true`.",
            "recommendation": "Check the input handling for `mode=thread_reply` and ensure that the `subject` property is being added to the arguments before calling `send_email`.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "meeting-summariser",
              "contract-reviewer",
              "support-triager"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "Context Length Exceeded",
            "what_fails": "llm_call: context length exceeded: prompt has X tokens, limit is 8192",
            "condition": "The failed runs all have input: prompt_tokens values greater than 8192, whereas the successful runs all have input: prompt_tokens values less than or equal to 8192.",
            "recommendation": "Increase the context length limit in the LLM call to a value greater than 8192, such as 12288, to accommodate the longer prompts.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "questionable"
          }
        ],
        "run": 1,
        "cli_wall_s": 6.3,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:08:01.967Z",
        "stopped_at": "2026-11-16T05:08:06.371Z",
        "workflow_ms": 4404,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 0,
          "Config": 2,
          "Read trace file": 25,
          "Parse JSON": 19,
          "Count and group failures": 295,
          "Explain with Ollama": 4021,
          "Check and collect lessons": 10,
          "Convert to file": 2,
          "Append to memory file": 10,
          "Notify": 16
        },
        "model_calls": [
          {
            "total_s": 2.477,
            "load_s": 0.003,
            "prompt_tokens": 1031,
            "output_tokens": 90,
            "tokens_per_s": 37.6,
            "done_reason": "stop"
          },
          {
            "total_s": 3.995,
            "load_s": 0.001,
            "prompt_tokens": 1025,
            "output_tokens": 149,
            "tokens_per_s": 38.1,
            "done_reason": "stop"
          },
          {
            "total_s": 3.077,
            "load_s": 0.002,
            "prompt_tokens": 782,
            "output_tokens": 113,
            "tokens_per_s": 37.7,
            "done_reason": "stop"
          },
          {
            "total_s": 3.261,
            "load_s": 0.002,
            "prompt_tokens": 735,
            "output_tokens": 117,
            "tokens_per_s": 36.8,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": null,
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-007",
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "The failed runs all have 48 or more pages in the input PDF, while the successful runs have 3 or fewer pages.",
            "recommendation": "Increase the timeout for pdf_to_text or optimize the pdf_to_text process to handle larger PDFs more efficiently.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "429 Too Many Requests on crm_api.update_contact",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "The failed runs all have a trigger of 'nightly_backlog_batch' with a large number of records (20-32), whereas the successful runs all have a trigger of 'webhook' with a small number of records (1-4).",
            "recommendation": "Consider adding a check to limit the number of records processed in a single 'nightly_backlog_batch' run, or implement a mechanism to stagger the processing of large batches to avoid hitting the 429 rate limit.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "Missing Subject in Thread Reply",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "The failed runs all have `mode=thread_reply` and `has_subject=false`, while the successful runs all have `mode=new_message` and `has_subject=true`.",
            "recommendation": "Check the input handling for `mode=thread_reply` and ensure that the `subject` property is being added to the arguments before calling `send_email`.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "meeting-summariser",
              "contract-reviewer",
              "support-triager"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "Context Length Exceeded",
            "what_fails": "llm_call: context length exceeded: prompt has X tokens, limit is 8192",
            "condition": "The failed runs all have input: prompt_tokens values greater than 8192, whereas the successful runs all have input: prompt_tokens values less than or equal to 8192.",
            "recommendation": "Increase the context length limit in the LLM call to a value greater than 8192, such as 12288, to accommodate the longer prompts.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "questionable"
          }
        ],
        "run": 2,
        "cli_wall_s": 6.28,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:08:08.257Z",
        "stopped_at": "2026-11-16T05:08:12.677Z",
        "workflow_ms": 4420,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 1,
          "Config": 2,
          "Read trace file": 27,
          "Parse JSON": 20,
          "Count and group failures": 261,
          "Explain with Ollama": 4063,
          "Check and collect lessons": 12,
          "Convert to file": 3,
          "Append to memory file": 11,
          "Notify": 15
        },
        "model_calls": [
          {
            "total_s": 2.484,
            "load_s": 0.001,
            "prompt_tokens": 1031,
            "output_tokens": 90,
            "tokens_per_s": 37.2,
            "done_reason": "stop"
          },
          {
            "total_s": 4.038,
            "load_s": 0.002,
            "prompt_tokens": 1025,
            "output_tokens": 149,
            "tokens_per_s": 37.5,
            "done_reason": "stop"
          },
          {
            "total_s": 3.109,
            "load_s": 0.002,
            "prompt_tokens": 782,
            "output_tokens": 113,
            "tokens_per_s": 37.1,
            "done_reason": "stop"
          },
          {
            "total_s": 3.296,
            "load_s": 0.003,
            "prompt_tokens": 735,
            "output_tokens": 117,
            "tokens_per_s": 36.2,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": null,
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-007",
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "The failed runs all have 48 or more pages in the input PDF, while the successful runs have 3 or fewer pages.",
            "recommendation": "Increase the timeout for pdf_to_text or optimize the pdf_to_text process to handle larger PDFs more efficiently.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "429 Too Many Requests on crm_api.update_contact",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "The failed runs all have a trigger of 'nightly_backlog_batch' with a large number of records (20-32), whereas the successful runs all have a trigger of 'webhook' with a small number of records (1-4).",
            "recommendation": "Consider adding a check to limit the number of records processed in a single 'nightly_backlog_batch' run, or implement a mechanism to stagger the processing of large batches to avoid hitting the 429 rate limit.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "Missing Subject in Thread Reply",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "The failed runs all have `mode=thread_reply` and `has_subject=false`, while the successful runs all have `mode=new_message` and `has_subject=true`.",
            "recommendation": "Check the input handling for `mode=thread_reply` and ensure that the `subject` property is being added to the arguments before calling `send_email`.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "meeting-summariser",
              "contract-reviewer",
              "support-triager"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "Context Length Exceeded",
            "what_fails": "llm_call: context length exceeded: prompt has X tokens, limit is 8192",
            "condition": "The failed runs all have input: prompt_tokens values greater than 8192, whereas the successful runs all have input: prompt_tokens values less than or equal to 8192.",
            "recommendation": "Increase the context length limit in the LLM call to a value greater than 8192, such as 12288, to accommodate the longer prompts.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "questionable"
          }
        ],
        "run": 3,
        "cli_wall_s": 6.31,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:08:14.589Z",
        "stopped_at": "2026-11-16T05:08:19.045Z",
        "workflow_ms": 4456,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 0,
          "Config": 2,
          "Read trace file": 24,
          "Parse JSON": 19,
          "Count and group failures": 314,
          "Explain with Ollama": 4072,
          "Check and collect lessons": 6,
          "Convert to file": 2,
          "Append to memory file": 5,
          "Notify": 7
        },
        "model_calls": [
          {
            "total_s": 2.486,
            "load_s": 0.001,
            "prompt_tokens": 1031,
            "output_tokens": 90,
            "tokens_per_s": 36.6,
            "done_reason": "stop"
          },
          {
            "total_s": 4.047,
            "load_s": 0.001,
            "prompt_tokens": 1025,
            "output_tokens": 145,
            "tokens_per_s": 36.6,
            "done_reason": "stop"
          },
          {
            "total_s": 3.117,
            "load_s": 0.002,
            "prompt_tokens": 782,
            "output_tokens": 113,
            "tokens_per_s": 37.2,
            "done_reason": "stop"
          },
          {
            "total_s": 3.491,
            "load_s": 0.001,
            "prompt_tokens": 735,
            "output_tokens": 121,
            "tokens_per_s": 35.5,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": null,
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-007",
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "The failed runs all have 48 or more pages in the input PDF, while the successful runs have 3 or fewer pages.",
            "recommendation": "Increase the timeout for pdf_to_text or optimize the pdf_to_text process to handle larger PDFs more efficiently.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "429 Too Many Requests on crm_api.update_contact",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "The failed runs all have a trigger of 'nightly_backlog_batch' with a large number of records (20-32), whereas the successful runs all have a trigger of 'webhook' with a small number of records (1-4).",
            "recommendation": "Consider adding a check to limit the number of records processed in a single 'nightly_backlog_batch' run, or implement a retry mechanism with a longer delay to avoid hitting the rate limit.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "Missing Subject in Thread Reply",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "The failed runs all have `mode=thread_reply` and `has_subject=false`, while the successful runs all have `mode=new_message` and `has_subject=true`.",
            "recommendation": "Check the input handling for `mode=thread_reply` and ensure that the `subject` property is being added to the arguments before calling `send_email`.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "meeting-summariser",
              "contract-reviewer",
              "support-triager"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "Context Length Exceeded",
            "what_fails": "llm_call: context length exceeded: prompt has X tokens, limit is 8192",
            "condition": "The failed runs all have input: prompt_tokens values greater than 8192, whereas the successful runs all have input: prompt_tokens values less than or equal to 8192.",
            "recommendation": "Increase the context length limit in the LLM call to a value greater than 8192, such as 12288 or 16384, to accommodate the longer prompts.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "questionable"
          }
        ],
        "run": 4,
        "cli_wall_s": 6.36,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:08:20.878Z",
        "stopped_at": "2026-11-16T05:08:25.289Z",
        "workflow_ms": 4411,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 1,
          "Config": 2,
          "Read trace file": 27,
          "Parse JSON": 19,
          "Count and group failures": 287,
          "Explain with Ollama": 4052,
          "Check and collect lessons": 6,
          "Convert to file": 1,
          "Append to memory file": 5,
          "Notify": 7
        },
        "model_calls": [
          {
            "total_s": 2.502,
            "load_s": 0.002,
            "prompt_tokens": 1031,
            "output_tokens": 90,
            "tokens_per_s": 37.2,
            "done_reason": "stop"
          },
          {
            "total_s": 4.029,
            "load_s": 0.001,
            "prompt_tokens": 1025,
            "output_tokens": 149,
            "tokens_per_s": 37.8,
            "done_reason": "stop"
          },
          {
            "total_s": 3.11,
            "load_s": 0.001,
            "prompt_tokens": 782,
            "output_tokens": 113,
            "tokens_per_s": 37.3,
            "done_reason": "stop"
          },
          {
            "total_s": 3.296,
            "load_s": 0.002,
            "prompt_tokens": 735,
            "output_tokens": 117,
            "tokens_per_s": 36.4,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": null,
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-007",
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "The failed runs all have 48 or more pages in the input PDF, while the successful runs have 3 or fewer pages.",
            "recommendation": "Increase the timeout for pdf_to_text or optimize the pdf_to_text process to handle larger PDFs more efficiently.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "429 Too Many Requests on crm_api.update_contact",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "The failed runs all have a trigger of 'nightly_backlog_batch' with a large number of records (20-32), whereas the successful runs all have a trigger of 'webhook' with a small number of records (1-4).",
            "recommendation": "Consider adding a check to limit the number of records processed in a single 'nightly_backlog_batch' run, or implement a mechanism to stagger the processing of large batches to avoid hitting the 429 rate limit.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "Missing Subject in Thread Reply",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "The failed runs all have `mode=thread_reply` and `has_subject=false`, while the successful runs all have `mode=new_message` and `has_subject=true`.",
            "recommendation": "Check the input handling for `mode=thread_reply` and ensure that the `subject` property is being added to the arguments before calling `send_email`.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "meeting-summariser",
              "contract-reviewer",
              "support-triager"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "Context Length Exceeded",
            "what_fails": "llm_call: context length exceeded: prompt has X tokens, limit is 8192",
            "condition": "The failed runs all have input: prompt_tokens values greater than 8192, whereas the successful runs all have input: prompt_tokens values less than or equal to 8192.",
            "recommendation": "Increase the context length limit in the LLM call to a value greater than 8192, such as 12288, to accommodate the longer prompts.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "questionable"
          }
        ],
        "run": 5,
        "cli_wall_s": 6.24,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:08:27.153Z",
        "stopped_at": "2026-11-16T05:08:31.492Z",
        "workflow_ms": 4339,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 1,
          "Config": 2,
          "Read trace file": 26,
          "Parse JSON": 20,
          "Count and group failures": 288,
          "Explain with Ollama": 3978,
          "Check and collect lessons": 6,
          "Convert to file": 1,
          "Append to memory file": 6,
          "Notify": 7
        },
        "model_calls": [
          {
            "total_s": 2.417,
            "load_s": 0.001,
            "prompt_tokens": 1031,
            "output_tokens": 90,
            "tokens_per_s": 37.7,
            "done_reason": "stop"
          },
          {
            "total_s": 3.954,
            "load_s": 0.001,
            "prompt_tokens": 1025,
            "output_tokens": 145,
            "tokens_per_s": 37.4,
            "done_reason": "stop"
          },
          {
            "total_s": 3.04,
            "load_s": 0.002,
            "prompt_tokens": 782,
            "output_tokens": 113,
            "tokens_per_s": 38.2,
            "done_reason": "stop"
          },
          {
            "total_s": 3.41,
            "load_s": 0.002,
            "prompt_tokens": 735,
            "output_tokens": 121,
            "tokens_per_s": 36.3,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": null,
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-007",
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "The failed runs all have 48 or more pages in the input PDF, while the successful runs have 3 or fewer pages.",
            "recommendation": "Increase the timeout for pdf_to_text or optimize the pdf_to_text process to handle larger PDFs more efficiently.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "429 Too Many Requests on crm_api.update_contact",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "The failed runs all have a trigger of 'nightly_backlog_batch' with a large number of records (20-32), whereas the successful runs all have a trigger of 'webhook' with a small number of records (1-4).",
            "recommendation": "Consider adding a check to limit the number of records processed in a single 'nightly_backlog_batch' run, or implement a retry mechanism with a longer delay to avoid hitting the rate limit.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "Missing Subject in Thread Reply",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "The failed runs all have `mode=thread_reply` and `has_subject=false`, while the successful runs all have `mode=new_message` and `has_subject=true`.",
            "recommendation": "Check the input handling for `mode=thread_reply` and ensure that the `subject` property is being added to the arguments before calling `send_email`.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "meeting-summariser",
              "contract-reviewer",
              "support-triager"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "Context Length Exceeded",
            "what_fails": "llm_call: context length exceeded: prompt has X tokens, limit is 8192",
            "condition": "The failed runs all have input: prompt_tokens values greater than 8192, whereas the successful runs all have input: prompt_tokens values less than or equal to 8192.",
            "recommendation": "Increase the context length limit in the LLM call to a value greater than 8192, such as 12288 or 16384, to accommodate the longer prompts.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "questionable"
          }
        ],
        "run": 6,
        "cli_wall_s": 6.2,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:08:33.320Z",
        "stopped_at": "2026-11-16T05:08:37.559Z",
        "workflow_ms": 4239,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 1,
          "Config": 2,
          "Read trace file": 28,
          "Parse JSON": 21,
          "Count and group failures": 284,
          "Explain with Ollama": 3856,
          "Check and collect lessons": 13,
          "Convert to file": 2,
          "Append to memory file": 11,
          "Notify": 17
        },
        "model_calls": [
          {
            "total_s": 2.458,
            "load_s": 0.002,
            "prompt_tokens": 1031,
            "output_tokens": 90,
            "tokens_per_s": 37.9,
            "done_reason": "stop"
          },
          {
            "total_s": 3.831,
            "load_s": 0.003,
            "prompt_tokens": 1025,
            "output_tokens": 145,
            "tokens_per_s": 38.7,
            "done_reason": "stop"
          },
          {
            "total_s": 3.341,
            "load_s": 0.001,
            "prompt_tokens": 782,
            "output_tokens": 125,
            "tokens_per_s": 37.8,
            "done_reason": "stop"
          },
          {
            "total_s": 3.09,
            "load_s": 0.002,
            "prompt_tokens": 735,
            "output_tokens": 115,
            "tokens_per_s": 37.6,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": null,
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-007",
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "The failed runs all have 48 or more pages in the input PDF, while the successful runs have 3 or fewer pages.",
            "recommendation": "Increase the timeout for pdf_to_text or optimize the pdf_to_text process to handle larger PDFs more efficiently.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "429 Too Many Requests on crm_api.update_contact",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "The failed runs all have a trigger of 'nightly_backlog_batch' with a large number of records (20-32), whereas the successful runs all have a trigger of 'webhook' with a small number of records (1-4).",
            "recommendation": "Consider adding a check to limit the number of records processed in a single 'nightly_backlog_batch' run, or implement a retry mechanism with a longer delay to avoid hitting the rate limit.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "Missing Subject in Thread Reply",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "The failed runs all have `mode=thread_reply` and `has_subject=false`, while the successful runs all have `mode=new_message` and `has_subject=true`.",
            "recommendation": "Change the `mode` to `new_message` and set `has_subject` to `true` for the thread reply functionality, or modify the schema validation to accept `thread_reply` with `has_subject=false`.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "questionable"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "meeting-summariser",
              "contract-reviewer",
              "support-triager"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "Context Length Exceeded",
            "what_fails": "llm_call: context length exceeded: prompt has X tokens, limit is 8192",
            "condition": "The failed runs all have input: prompt_tokens greater than 8192, while the successful runs all have input: prompt_tokens less than or equal to 8192.",
            "recommendation": "Increase the context length limit in the LLM call to a value greater than 8192, such as 12288, to accommodate the longer prompts.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "questionable"
          }
        ],
        "run": 7,
        "cli_wall_s": 6.09,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:08:39.930Z",
        "stopped_at": "2026-11-16T05:08:44.360Z",
        "workflow_ms": 4430,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 1,
          "Config": 6,
          "Read trace file": 45,
          "Parse JSON": 34,
          "Count and group failures": 266,
          "Explain with Ollama": 4037,
          "Check and collect lessons": 10,
          "Convert to file": 2,
          "Append to memory file": 10,
          "Notify": 10
        },
        "model_calls": [
          {
            "total_s": 2.463,
            "load_s": 0.001,
            "prompt_tokens": 1031,
            "output_tokens": 90,
            "tokens_per_s": 37.4,
            "done_reason": "stop"
          },
          {
            "total_s": 3.991,
            "load_s": 0.001,
            "prompt_tokens": 1025,
            "output_tokens": 149,
            "tokens_per_s": 37.8,
            "done_reason": "stop"
          },
          {
            "total_s": 3.062,
            "load_s": 0.001,
            "prompt_tokens": 782,
            "output_tokens": 113,
            "tokens_per_s": 37.5,
            "done_reason": "stop"
          },
          {
            "total_s": 3.247,
            "load_s": 0.001,
            "prompt_tokens": 735,
            "output_tokens": 117,
            "tokens_per_s": 36.6,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": null,
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-007",
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "The failed runs all have 48 or more pages in the input PDF, while the successful runs have 3 or fewer pages.",
            "recommendation": "Increase the timeout for pdf_to_text or optimize the pdf_to_text process to handle larger PDFs more efficiently.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "429 Too Many Requests on crm_api.update_contact",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "The failed runs all have a trigger of 'nightly_backlog_batch' with a large number of records (20-32), whereas the successful runs all have a trigger of 'webhook' with a small number of records (1-4).",
            "recommendation": "Consider adding a check to limit the number of records processed in a single 'nightly_backlog_batch' run, or implement a mechanism to stagger the processing of large batches to avoid hitting the 429 rate limit.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "Missing Subject in Thread Reply",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "The failed runs all have `mode=thread_reply` and `has_subject=false`, while the successful runs all have `mode=new_message` and `has_subject=true`.",
            "recommendation": "Check the input handling for `mode=thread_reply` and ensure that the `subject` property is being added to the arguments before calling `send_email`.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "meeting-summariser",
              "contract-reviewer",
              "support-triager"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "Context Length Exceeded",
            "what_fails": "llm_call: context length exceeded: prompt has X tokens, limit is 8192",
            "condition": "The failed runs all have input: prompt_tokens values greater than 8192, whereas the successful runs all have input: prompt_tokens values less than or equal to 8192.",
            "recommendation": "Increase the context length limit in the LLM call to a value greater than 8192, such as 12288, to accommodate the longer prompts.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "questionable"
          }
        ],
        "run": 8,
        "cli_wall_s": 6.77,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:08:46.399Z",
        "stopped_at": "2026-11-16T05:08:50.884Z",
        "workflow_ms": 4485,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 1,
          "Config": 3,
          "Read trace file": 32,
          "Parse JSON": 24,
          "Count and group failures": 303,
          "Explain with Ollama": 4047,
          "Check and collect lessons": 23,
          "Convert to file": 4,
          "Append to memory file": 12,
          "Notify": 32
        },
        "model_calls": [
          {
            "total_s": 2.451,
            "load_s": 0.001,
            "prompt_tokens": 1031,
            "output_tokens": 90,
            "tokens_per_s": 37.2,
            "done_reason": "stop"
          },
          {
            "total_s": 4.008,
            "load_s": 0.002,
            "prompt_tokens": 1025,
            "output_tokens": 145,
            "tokens_per_s": 36.9,
            "done_reason": "stop"
          },
          {
            "total_s": 3.087,
            "load_s": 0.003,
            "prompt_tokens": 782,
            "output_tokens": 113,
            "tokens_per_s": 37.6,
            "done_reason": "stop"
          },
          {
            "total_s": 3.459,
            "load_s": 0.003,
            "prompt_tokens": 735,
            "output_tokens": 121,
            "tokens_per_s": 35.8,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": null,
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-007",
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "The failed runs all have 48 or more pages in the input PDF, while the successful runs have 3 or fewer pages.",
            "recommendation": "Increase the timeout for pdf_to_text or optimize the pdf_to_text process to handle larger PDFs more efficiently.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "429 Too Many Requests on crm_api.update_contact",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "The failed runs all have a trigger of 'nightly_backlog_batch' with a large number of records (20-32), whereas the successful runs all have a trigger of 'webhook' with a small number of records (1-4).",
            "recommendation": "Consider adding a check to limit the number of records processed in a single 'nightly_backlog_batch' run, or implement a retry mechanism with a longer delay to avoid hitting the rate limit.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "Missing Subject in Thread Reply",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "The failed runs all have `mode=thread_reply` and `has_subject=false`, while the successful runs all have `mode=new_message` and `has_subject=true`.",
            "recommendation": "Check the input handling for `mode=thread_reply` and ensure that the `subject` property is being added to the arguments before calling `send_email`.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "meeting-summariser",
              "contract-reviewer",
              "support-triager"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "Context Length Exceeded",
            "what_fails": "llm_call: context length exceeded: prompt has X tokens, limit is 8192",
            "condition": "The failed runs all have input: prompt_tokens values greater than 8192, whereas the successful runs all have input: prompt_tokens values less than or equal to 8192.",
            "recommendation": "Increase the context length limit in the LLM call to a value greater than 8192, such as 12288 or 16384, to accommodate the longer prompts.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "questionable"
          }
        ],
        "run": 9,
        "cli_wall_s": 6.65,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:08:55.992Z",
        "stopped_at": "2026-11-16T05:09:00.335Z",
        "workflow_ms": 4343,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 1,
          "Config": 4,
          "Read trace file": 43,
          "Parse JSON": 32,
          "Count and group failures": 352,
          "Explain with Ollama": 3847,
          "Check and collect lessons": 13,
          "Convert to file": 3,
          "Append to memory file": 14,
          "Notify": 25
        },
        "model_calls": [
          {
            "total_s": 2.435,
            "load_s": 0.002,
            "prompt_tokens": 1031,
            "output_tokens": 90,
            "tokens_per_s": 38.2,
            "done_reason": "stop"
          },
          {
            "total_s": 3.774,
            "load_s": 0.003,
            "prompt_tokens": 1025,
            "output_tokens": 145,
            "tokens_per_s": 39.2,
            "done_reason": "stop"
          },
          {
            "total_s": 3.302,
            "load_s": 0.001,
            "prompt_tokens": 782,
            "output_tokens": 125,
            "tokens_per_s": 38.2,
            "done_reason": "stop"
          },
          {
            "total_s": 3.128,
            "load_s": 0.003,
            "prompt_tokens": 735,
            "output_tokens": 117,
            "tokens_per_s": 38.4,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": null,
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-007",
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "The failed runs all have 48 or more pages in the input PDF, while the successful runs have 3 or fewer pages.",
            "recommendation": "Increase the timeout for pdf_to_text or optimize the pdf_to_text process to handle larger PDFs more efficiently.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "429 Too Many Requests on crm_api.update_contact",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "The failed runs all have a trigger of 'nightly_backlog_batch' with a large number of records (20-32), whereas the successful runs all have a trigger of 'webhook' with a small number of records (1-4).",
            "recommendation": "Consider adding a check to limit the number of records processed in a single 'nightly_backlog_batch' run, or implement a retry mechanism with exponential backoff to handle the 429 errors.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "Missing Subject in Thread Reply",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "The failed runs all have `mode=thread_reply` and `has_subject=false`, while the successful runs all have `mode=new_message` and `has_subject=true`.",
            "recommendation": "Change the `mode` to `new_message` and set `has_subject` to `true` for the thread reply functionality, or modify the schema validation to accept `thread_reply` with `has_subject=false`.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "questionable"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "meeting-summariser",
              "contract-reviewer",
              "support-triager"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "Context Length Exceeded",
            "what_fails": "llm_call: context length exceeded: prompt has X tokens, limit is 8192",
            "condition": "The failed runs all have input: prompt_tokens values greater than 8192, whereas the successful runs all have input: prompt_tokens values less than or equal to 8192.",
            "recommendation": "Increase the context length limit in the LLM call to a value greater than 8192, such as 16384, to accommodate the longer prompts.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "questionable"
          }
        ],
        "run": 10,
        "cli_wall_s": 9.51,
        "cli_exit": 0
      }
    ]
  },
  "raw_single_call_seeded": {
    "summary": {
      "runs": 10,
      "successful": 10,
      "workflow_ms_median": 11752.0,
      "workflow_ms_min": 11568,
      "workflow_ms_max": 12666,
      "cli_wall_s_median": 15.1,
      "node_ms_median": {
        "Append to memory file": 12.5,
        "Check and collect lessons": 13.5,
        "Config": 4.0,
        "Convert to file": 2.5,
        "Count and group failures": 304.5,
        "Every day at 03:00": 1.0,
        "Explain with Ollama": 11293.0,
        "Notify": 19.0,
        "Parse JSON": 27.0,
        "Read trace file": 41.0
      },
      "model_calls_per_run": 1.0,
      "call_total_s_median": 11.2,
      "call_prompt_tokens_median": 3388.0,
      "call_prompt_tokens_max": 3388,
      "call_output_tokens_median": 461.0,
      "run_prompt_tokens_median": 3388.0,
      "run_output_tokens_median": 461.0,
      "tokens_per_s_median": 41.4,
      "calls_cut_by_length": 0,
      "answers_not_valid_json": 0,
      "lessons_total": 40,
      "lessons_per_run": [
        4
      ],
      "runs_with_all_four_planted_patterns": 10,
      "lessons_with_unknown_run_ids": 0,
      "lessons_citing_a_successful_run_as_failed": 0,
      "lessons_about_the_one_off": 0,
      "runs_where_model_listed_exactly_the_one_off": 0,
      "model_one_off_lists": {
        "[\"run-007\"]": 10
      },
      "lessons_naming_an_agent_that_does_not_exist": 10,
      "rate_limit_lessons_mentioning_the_time_window": 0,
      "distinct_full_outputs": 2,
      "condition_labels_all": {
        "right factor, wrong numbers": 20,
        "correct": 20
      },
      "recommendation_labels_all": {
        "generic": 29,
        "specific": 10,
        "questionable": 1
      },
      "per_planted_pattern": {
        "P1": {
          "runs_with_a_lesson": 10,
          "lessons": 10,
          "lessons_citing_every_failed_run": 0,
          "lessons_citing_runs_outside_the_pattern": 0,
          "distinct_condition_texts": 1,
          "distinct_recommendation_texts": 1,
          "condition_labels": {
            "right factor, wrong numbers": 10
          },
          "recommendation_labels": {
            "generic": 10
          }
        },
        "P2": {
          "runs_with_a_lesson": 10,
          "lessons": 10,
          "lessons_citing_every_failed_run": 10,
          "lessons_citing_runs_outside_the_pattern": 0,
          "distinct_condition_texts": 1,
          "distinct_recommendation_texts": 2,
          "condition_labels": {
            "right factor, wrong numbers": 10
          },
          "recommendation_labels": {
            "questionable": 1,
            "generic": 9
          }
        },
        "P3": {
          "runs_with_a_lesson": 10,
          "lessons": 10,
          "lessons_citing_every_failed_run": 10,
          "lessons_citing_runs_outside_the_pattern": 0,
          "distinct_condition_texts": 1,
          "distinct_recommendation_texts": 2,
          "condition_labels": {
            "correct": 10
          },
          "recommendation_labels": {
            "specific": 10
          }
        },
        "P4": {
          "runs_with_a_lesson": 10,
          "lessons": 10,
          "lessons_citing_every_failed_run": 10,
          "lessons_citing_runs_outside_the_pattern": 0,
          "distinct_condition_texts": 1,
          "distinct_recommendation_texts": 2,
          "condition_labels": {
            "correct": 10
          },
          "recommendation_labels": {
            "generic": 10
          }
        }
      }
    },
    "per_run": [
      {
        "status": "success",
        "started_at": "2026-11-16T05:09:06.928Z",
        "stopped_at": "2026-11-16T05:09:19.594Z",
        "workflow_ms": 12666,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 1,
          "Config": 4,
          "Read trace file": 48,
          "Parse JSON": 28,
          "Count and group failures": 297,
          "Explain with Ollama": 12244,
          "Check and collect lessons": 13,
          "Convert to file": 2,
          "Append to memory file": 9,
          "Notify": 14
        },
        "model_calls": [
          {
            "total_s": 12.199,
            "load_s": 0.002,
            "prompt_tokens": 3388,
            "output_tokens": 461,
            "tokens_per_s": 41.6,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": [
          "run-007"
        ],
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "pdf pages > 64",
            "recommendation": "Increase the timeout for pdf_to_text or optimize the pdf processing",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": false,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "send_email: arguments failed schema validation",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "mode=thread_reply and has_subject=false",
            "recommendation": "Add 'subject' to the arguments for send_email when mode=thread_reply and has_subject=false",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "crm_api.update_contact: HTTP 429 Too Many Requests",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "trigger=nightly_backlog_batch and records > 20",
            "recommendation": "Increase the rate limit for crm_api.update_contact or optimize the update process",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "questionable"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "llm_call"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "context length exceeded",
            "what_fails": "context length exceeded: prompt has 9120 tokens, limit is 8192",
            "condition": "prompt_tokens > 8192",
            "recommendation": "Increase the limit for llm_call or optimize the prompt processing",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "generic"
          }
        ],
        "run": 1,
        "cli_wall_s": 16.32,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:09:23.219Z",
        "stopped_at": "2026-11-16T05:09:34.787Z",
        "workflow_ms": 11568,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 0,
          "Config": 4,
          "Read trace file": 41,
          "Parse JSON": 26,
          "Count and group failures": 274,
          "Explain with Ollama": 11174,
          "Check and collect lessons": 13,
          "Convert to file": 3,
          "Append to memory file": 11,
          "Notify": 16
        },
        "model_calls": [
          {
            "total_s": 11.133,
            "load_s": 0.001,
            "prompt_tokens": 3388,
            "output_tokens": 461,
            "tokens_per_s": 41.6,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": [
          "run-007"
        ],
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "pdf pages > 64",
            "recommendation": "Increase the timeout for pdf_to_text or optimize the pdf processing",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": false,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "send_email: arguments failed schema validation",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "mode=thread_reply and has_subject=false",
            "recommendation": "Add a check to ensure the 'subject' property is present when sending thread replies",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "crm_api.update_contact: HTTP 429 Too Many Requests",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "trigger=nightly_backlog_batch and records > 20",
            "recommendation": "Implement rate limiting or retry logic for crm_api.update_contact when receiving 429 errors",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "llm_call"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "context length exceeded",
            "what_fails": "context length exceeded: prompt has 9120 tokens, limit is 8192",
            "condition": "prompt_tokens > 8192",
            "recommendation": "Increase the context length limit for llm_call or optimize prompt generation",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "generic"
          }
        ],
        "run": 2,
        "cli_wall_s": 15.03,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:09:38.096Z",
        "stopped_at": "2026-11-16T05:09:49.871Z",
        "workflow_ms": 11775,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 1,
          "Config": 4,
          "Read trace file": 44,
          "Parse JSON": 29,
          "Count and group failures": 221,
          "Explain with Ollama": 11429,
          "Check and collect lessons": 14,
          "Convert to file": 3,
          "Append to memory file": 10,
          "Notify": 14
        },
        "model_calls": [
          {
            "total_s": 11.375,
            "load_s": 0.001,
            "prompt_tokens": 3388,
            "output_tokens": 461,
            "tokens_per_s": 40.7,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": [
          "run-007"
        ],
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "pdf pages > 64",
            "recommendation": "Increase the timeout for pdf_to_text or optimize the pdf processing",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": false,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "send_email: arguments failed schema validation",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "mode=thread_reply and has_subject=false",
            "recommendation": "Add a check to ensure the 'subject' property is present when sending thread replies",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "crm_api.update_contact: HTTP 429 Too Many Requests",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "trigger=nightly_backlog_batch and records > 20",
            "recommendation": "Implement rate limiting or retry logic for crm_api.update_contact when receiving 429 errors",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "llm_call"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "context length exceeded",
            "what_fails": "context length exceeded: prompt has 9120 tokens, limit is 8192",
            "condition": "prompt_tokens > 8192",
            "recommendation": "Increase the context length limit for llm_call or optimize prompt generation",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "generic"
          }
        ],
        "run": 3,
        "cli_wall_s": 15.19,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:09:53.618Z",
        "stopped_at": "2026-11-16T05:10:05.367Z",
        "workflow_ms": 11749,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 1,
          "Config": 4,
          "Read trace file": 42,
          "Parse JSON": 31,
          "Count and group failures": 320,
          "Explain with Ollama": 11244,
          "Check and collect lessons": 25,
          "Convert to file": 2,
          "Append to memory file": 34,
          "Notify": 39
        },
        "model_calls": [
          {
            "total_s": 11.194,
            "load_s": 0.002,
            "prompt_tokens": 3388,
            "output_tokens": 461,
            "tokens_per_s": 41.3,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": [
          "run-007"
        ],
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "pdf pages > 64",
            "recommendation": "Increase the timeout for pdf_to_text or optimize the pdf processing",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": false,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "send_email: arguments failed schema validation",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "mode=thread_reply and has_subject=false",
            "recommendation": "Add a check to ensure the 'subject' property is present when sending thread replies",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "crm_api.update_contact: HTTP 429 Too Many Requests",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "trigger=nightly_backlog_batch and records > 20",
            "recommendation": "Implement rate limiting or retry logic for crm_api.update_contact when receiving 429 errors",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "llm_call"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "context length exceeded",
            "what_fails": "context length exceeded: prompt has 9120 tokens, limit is 8192",
            "condition": "prompt_tokens > 8192",
            "recommendation": "Increase the context length limit for llm_call or optimize prompt generation",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "generic"
          }
        ],
        "run": 4,
        "cli_wall_s": 15.6,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:10:09.105Z",
        "stopped_at": "2026-11-16T05:10:20.680Z",
        "workflow_ms": 11575,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 1,
          "Config": 2,
          "Read trace file": 26,
          "Parse JSON": 21,
          "Count and group failures": 302,
          "Explain with Ollama": 11167,
          "Check and collect lessons": 14,
          "Convert to file": 3,
          "Append to memory file": 14,
          "Notify": 22
        },
        "model_calls": [
          {
            "total_s": 11.143,
            "load_s": 0.002,
            "prompt_tokens": 3388,
            "output_tokens": 461,
            "tokens_per_s": 41.5,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": [
          "run-007"
        ],
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "pdf pages > 64",
            "recommendation": "Increase the timeout for pdf_to_text or optimize the pdf processing",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": false,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "send_email: arguments failed schema validation",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "mode=thread_reply and has_subject=false",
            "recommendation": "Add a check to ensure the 'subject' property is present when sending thread replies",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "crm_api.update_contact: HTTP 429 Too Many Requests",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "trigger=nightly_backlog_batch and records > 20",
            "recommendation": "Implement rate limiting or retry logic for crm_api.update_contact when receiving 429 errors",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "llm_call"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "context length exceeded",
            "what_fails": "context length exceeded: prompt has 9120 tokens, limit is 8192",
            "condition": "prompt_tokens > 8192",
            "recommendation": "Increase the context length limit for llm_call or optimize prompt generation",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "generic"
          }
        ],
        "run": 5,
        "cli_wall_s": 15.14,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:10:23.855Z",
        "stopped_at": "2026-11-16T05:10:35.495Z",
        "workflow_ms": 11640,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 0,
          "Config": 3,
          "Read trace file": 41,
          "Parse JSON": 27,
          "Count and group failures": 321,
          "Explain with Ollama": 11188,
          "Check and collect lessons": 13,
          "Convert to file": 1,
          "Append to memory file": 15,
          "Notify": 24
        },
        "model_calls": [
          {
            "total_s": 11.137,
            "load_s": 0.002,
            "prompt_tokens": 3388,
            "output_tokens": 461,
            "tokens_per_s": 41.6,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": [
          "run-007"
        ],
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "pdf pages > 64",
            "recommendation": "Increase the timeout for pdf_to_text or optimize the pdf processing",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": false,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "send_email: arguments failed schema validation",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "mode=thread_reply and has_subject=false",
            "recommendation": "Add a check to ensure the 'subject' property is present when sending thread replies",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "crm_api.update_contact: HTTP 429 Too Many Requests",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "trigger=nightly_backlog_batch and records > 20",
            "recommendation": "Implement rate limiting or retry logic for crm_api.update_contact when receiving 429 errors",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "llm_call"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "context length exceeded",
            "what_fails": "context length exceeded: prompt has 9120 tokens, limit is 8192",
            "condition": "prompt_tokens > 8192",
            "recommendation": "Increase the context length limit for llm_call or optimize prompt generation",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "generic"
          }
        ],
        "run": 6,
        "cli_wall_s": 14.73,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:10:40.012Z",
        "stopped_at": "2026-11-16T05:10:52.113Z",
        "workflow_ms": 12101,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 1,
          "Config": 5,
          "Read trace file": 58,
          "Parse JSON": 37,
          "Count and group failures": 422,
          "Explain with Ollama": 11508,
          "Check and collect lessons": 14,
          "Convert to file": 3,
          "Append to memory file": 18,
          "Notify": 24
        },
        "model_calls": [
          {
            "total_s": 11.429,
            "load_s": 0.002,
            "prompt_tokens": 3388,
            "output_tokens": 461,
            "tokens_per_s": 40.5,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": [
          "run-007"
        ],
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "pdf pages > 64",
            "recommendation": "Increase the timeout for pdf_to_text or optimize the pdf processing",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": false,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "send_email: arguments failed schema validation",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "mode=thread_reply and has_subject=false",
            "recommendation": "Add a check to ensure the 'subject' property is present when sending thread replies",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "crm_api.update_contact: HTTP 429 Too Many Requests",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "trigger=nightly_backlog_batch and records > 20",
            "recommendation": "Implement rate limiting or retry logic for crm_api.update_contact when receiving 429 errors",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "llm_call"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "context length exceeded",
            "what_fails": "context length exceeded: prompt has 9120 tokens, limit is 8192",
            "condition": "prompt_tokens > 8192",
            "recommendation": "Increase the context length limit for llm_call or optimize prompt generation",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "generic"
          }
        ],
        "run": 7,
        "cli_wall_s": 16.67,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:10:55.208Z",
        "stopped_at": "2026-11-16T05:11:06.801Z",
        "workflow_ms": 11593,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 1,
          "Config": 4,
          "Read trace file": 41,
          "Parse JSON": 27,
          "Count and group failures": 270,
          "Explain with Ollama": 11188,
          "Check and collect lessons": 15,
          "Convert to file": 3,
          "Append to memory file": 14,
          "Notify": 25
        },
        "model_calls": [
          {
            "total_s": 11.151,
            "load_s": 0.002,
            "prompt_tokens": 3388,
            "output_tokens": 461,
            "tokens_per_s": 41.5,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": [
          "run-007"
        ],
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "pdf pages > 64",
            "recommendation": "Increase the timeout for pdf_to_text or optimize the pdf processing",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": false,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "send_email: arguments failed schema validation",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "mode=thread_reply and has_subject=false",
            "recommendation": "Add a check to ensure the 'subject' property is present when sending thread replies",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "crm_api.update_contact: HTTP 429 Too Many Requests",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "trigger=nightly_backlog_batch and records > 20",
            "recommendation": "Implement rate limiting or retry logic for crm_api.update_contact when receiving 429 errors",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "llm_call"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "context length exceeded",
            "what_fails": "context length exceeded: prompt has 9120 tokens, limit is 8192",
            "condition": "prompt_tokens > 8192",
            "recommendation": "Increase the context length limit for llm_call or optimize prompt generation",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "generic"
          }
        ],
        "run": 8,
        "cli_wall_s": 14.67,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:11:09.834Z",
        "stopped_at": "2026-11-16T05:11:21.589Z",
        "workflow_ms": 11755,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 0,
          "Config": 3,
          "Read trace file": 35,
          "Parse JSON": 25,
          "Count and group failures": 307,
          "Explain with Ollama": 11342,
          "Check and collect lessons": 12,
          "Convert to file": 2,
          "Append to memory file": 11,
          "Notify": 12
        },
        "model_calls": [
          {
            "total_s": 11.306,
            "load_s": 0.002,
            "prompt_tokens": 3388,
            "output_tokens": 461,
            "tokens_per_s": 40.9,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": [
          "run-007"
        ],
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "pdf pages > 64",
            "recommendation": "Increase the timeout for pdf_to_text or optimize the pdf processing",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": false,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "send_email: arguments failed schema validation",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "mode=thread_reply and has_subject=false",
            "recommendation": "Add a check to ensure the 'subject' property is present when sending thread replies",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "crm_api.update_contact: HTTP 429 Too Many Requests",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "trigger=nightly_backlog_batch and records > 20",
            "recommendation": "Implement rate limiting or retry logic for crm_api.update_contact when receiving 429 errors",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "llm_call"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "context length exceeded",
            "what_fails": "context length exceeded: prompt has 9120 tokens, limit is 8192",
            "condition": "prompt_tokens > 8192",
            "recommendation": "Increase the context length limit for llm_call or optimize prompt generation",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "generic"
          }
        ],
        "run": 9,
        "cli_wall_s": 14.69,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:11:24.371Z",
        "stopped_at": "2026-11-16T05:11:36.196Z",
        "workflow_ms": 11825,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 1,
          "Config": 3,
          "Read trace file": 33,
          "Parse JSON": 27,
          "Count and group failures": 338,
          "Explain with Ollama": 11393,
          "Check and collect lessons": 9,
          "Convert to file": 1,
          "Append to memory file": 7,
          "Notify": 9
        },
        "model_calls": [
          {
            "total_s": 11.361,
            "load_s": 0.002,
            "prompt_tokens": 3388,
            "output_tokens": 461,
            "tokens_per_s": 40.7,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": [
          "run-007"
        ],
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "pdf pages > 64",
            "recommendation": "Increase the timeout for pdf_to_text or optimize the pdf processing",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": false,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "send_email: arguments failed schema validation",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "mode=thread_reply and has_subject=false",
            "recommendation": "Add a check to ensure the 'subject' property is present when sending thread replies",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "crm_api.update_contact: HTTP 429 Too Many Requests",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "trigger=nightly_backlog_batch and records > 20",
            "recommendation": "Implement rate limiting or retry logic for crm_api.update_contact when receiving 429 errors",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "llm_call"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "context length exceeded",
            "what_fails": "context length exceeded: prompt has 9120 tokens, limit is 8192",
            "condition": "prompt_tokens > 8192",
            "recommendation": "Increase the context length limit for llm_call or optimize prompt generation",
            "checks": {
              "cited_by": "model",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "generic"
          }
        ],
        "run": 10,
        "cli_wall_s": 14.54,
        "cli_exit": 0
      }
    ]
  },
  "grouped_default_sampling": {
    "summary": {
      "runs": 10,
      "successful": 10,
      "workflow_ms_median": 3646.5,
      "workflow_ms_min": 3338,
      "workflow_ms_max": 4784,
      "cli_wall_s_median": 7.2,
      "node_ms_median": {
        "Append to memory file": 14.5,
        "Check and collect lessons": 16.0,
        "Config": 4.0,
        "Convert to file": 3.0,
        "Count and group failures": 274.0,
        "Every day at 03:00": 1.0,
        "Explain with Ollama": 3239.0,
        "Notify": 21.0,
        "Parse JSON": 28.5,
        "Read trace file": 44.0
      },
      "model_calls_per_run": 4.0,
      "call_total_s_median": 2.8,
      "call_prompt_tokens_median": 903.5,
      "call_prompt_tokens_max": 1031,
      "call_output_tokens_median": 96.0,
      "run_prompt_tokens_median": 3573.0,
      "run_output_tokens_median": 390.5,
      "tokens_per_s_median": 37.3,
      "calls_cut_by_length": 0,
      "answers_not_valid_json": 0,
      "lessons_total": 40,
      "lessons_per_run": [
        4
      ],
      "runs_with_all_four_planted_patterns": 10,
      "lessons_with_unknown_run_ids": 0,
      "lessons_citing_a_successful_run_as_failed": 0,
      "lessons_about_the_one_off": 0,
      "runs_where_model_listed_exactly_the_one_off": 0,
      "model_one_off_lists": {
        "null": 10
      },
      "lessons_naming_an_agent_that_does_not_exist": 0,
      "rate_limit_lessons_mentioning_the_time_window": 0,
      "distinct_full_outputs": 10,
      "condition_labels_all": {
        "correct": 32,
        "right factor, wrong numbers": 8
      },
      "recommendation_labels_all": {
        "mixed": 8,
        "questionable": 11,
        "generic": 7,
        "specific": 14
      },
      "per_planted_pattern": {
        "P1": {
          "runs_with_a_lesson": 10,
          "lessons": 10,
          "lessons_citing_every_failed_run": 10,
          "lessons_citing_runs_outside_the_pattern": 0,
          "distinct_condition_texts": 10,
          "distinct_recommendation_texts": 10,
          "condition_labels": {
            "correct": 3,
            "right factor, wrong numbers": 7
          },
          "recommendation_labels": {
            "mixed": 2,
            "generic": 6,
            "specific": 2
          }
        },
        "P2": {
          "runs_with_a_lesson": 10,
          "lessons": 10,
          "lessons_citing_every_failed_run": 10,
          "lessons_citing_runs_outside_the_pattern": 0,
          "distinct_condition_texts": 10,
          "distinct_recommendation_texts": 10,
          "condition_labels": {
            "correct": 9,
            "right factor, wrong numbers": 1
          },
          "recommendation_labels": {
            "questionable": 2,
            "specific": 6,
            "mixed": 2
          }
        },
        "P3": {
          "runs_with_a_lesson": 10,
          "lessons": 10,
          "lessons_citing_every_failed_run": 10,
          "lessons_citing_runs_outside_the_pattern": 0,
          "distinct_condition_texts": 10,
          "distinct_recommendation_texts": 10,
          "condition_labels": {
            "correct": 10
          },
          "recommendation_labels": {
            "questionable": 6,
            "generic": 1,
            "specific": 2,
            "mixed": 1
          }
        },
        "P4": {
          "runs_with_a_lesson": 10,
          "lessons": 10,
          "lessons_citing_every_failed_run": 10,
          "lessons_citing_runs_outside_the_pattern": 0,
          "distinct_condition_texts": 9,
          "distinct_recommendation_texts": 10,
          "condition_labels": {
            "correct": 10
          },
          "recommendation_labels": {
            "questionable": 3,
            "specific": 4,
            "mixed": 3
          }
        }
      }
    },
    "per_run": [
      {
        "status": "success",
        "started_at": "2026-11-16T05:12:36.198Z",
        "stopped_at": "2026-11-16T05:12:39.696Z",
        "workflow_ms": 3498,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 1,
          "Config": 4,
          "Read trace file": 41,
          "Parse JSON": 26,
          "Count and group failures": 329,
          "Explain with Ollama": 3042,
          "Check and collect lessons": 14,
          "Convert to file": 3,
          "Append to memory file": 14,
          "Notify": 18
        },
        "model_calls": [
          {
            "total_s": 2.443,
            "load_s": 0.002,
            "prompt_tokens": 1031,
            "output_tokens": 88,
            "tokens_per_s": 38.0,
            "done_reason": "stop"
          },
          {
            "total_s": 2.995,
            "load_s": 0.002,
            "prompt_tokens": 1025,
            "output_tokens": 110,
            "tokens_per_s": 38.3,
            "done_reason": "stop"
          },
          {
            "total_s": 2.994,
            "load_s": 0.002,
            "prompt_tokens": 782,
            "output_tokens": 110,
            "tokens_per_s": 38.3,
            "done_reason": "stop"
          },
          {
            "total_s": 2.597,
            "load_s": 0.001,
            "prompt_tokens": 735,
            "output_tokens": 94,
            "tokens_per_s": 38.0,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": null,
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-007",
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "The number of pages in the input PDF is greater than or equal to 41.",
            "recommendation": "Increase the timeout for pdf_to_text or improve its performance for large PDFs, or filter out inputs with more than 40 pages if possible.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "mixed"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "429 Too Many Requests",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "The failed runs all have 'trigger=nightly_backlog_batch' in their input, while the successful runs have 'trigger=webhook' in their input.",
            "recommendation": "Change the trigger from 'nightly_backlog_batch' to 'webhook' for the crm-updater agent to resolve the issue.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "questionable"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "Missing Subject Property",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "The failed runs all have `has_subject=false` in their input, while the successful runs all have `has_subject=true`.",
            "recommendation": "Set `has_subject=true` in the input for the failing runs, or modify the `send_email` step to handle the case where `has_subject=false` without requiring the `subject` property.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "questionable"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "meeting-summariser",
              "contract-reviewer",
              "support-triager"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "Context Length Exceeded",
            "what_fails": "llm_call: context length exceeded: prompt has <TOKENS>, limit is 8192",
            "condition": "The failed runs have input prompts with more than 8192 tokens, whereas the successful runs have prompts with 8192 or fewer tokens.",
            "recommendation": "Increase the context length limit for the LLM call to accommodate longer prompts.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "questionable"
          }
        ],
        "run": 1,
        "cli_wall_s": 7.03,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:12:43.155Z",
        "stopped_at": "2026-11-16T05:12:46.547Z",
        "workflow_ms": 3392,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 1,
          "Config": 3,
          "Read trace file": 38,
          "Parse JSON": 24,
          "Count and group failures": 273,
          "Explain with Ollama": 2991,
          "Check and collect lessons": 19,
          "Convert to file": 3,
          "Append to memory file": 12,
          "Notify": 21
        },
        "model_calls": [
          {
            "total_s": 2.203,
            "load_s": 0.001,
            "prompt_tokens": 1031,
            "output_tokens": 79,
            "tokens_per_s": 37.6,
            "done_reason": "stop"
          },
          {
            "total_s": 2.95,
            "load_s": 0.003,
            "prompt_tokens": 1025,
            "output_tokens": 102,
            "tokens_per_s": 35.8,
            "done_reason": "stop"
          },
          {
            "total_s": 2.627,
            "load_s": 0.001,
            "prompt_tokens": 782,
            "output_tokens": 95,
            "tokens_per_s": 37.6,
            "done_reason": "stop"
          },
          {
            "total_s": 2.95,
            "load_s": 0.003,
            "prompt_tokens": 735,
            "output_tokens": 102,
            "tokens_per_s": 35.8,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": null,
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-007",
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout fixed",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "files with more than 40 pages cause the pdf_to_text step to timeout",
            "recommendation": "Increase the timeout for the pdf_to_text step or improve the performance of the pdf_to_text process",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "429 Too Many Requests after llm_summarise_call",
            "what_fails": "crm_api.update_contact ERROR 130ms | FAILED: crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "trigger=nightly_backlog_batch",
            "recommendation": "Check the crm_api.update_contact function for concurrency issues. Consider increasing the number of workers or the rate of update_contact calls.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "questionable"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "Missing Subject in Thread Reply Runs",
            "what_fails": "send_email step with error: arguments failed schema validation: missing required property 'subject'",
            "condition": "all failed runs have mode=thread_reply and has_subject=false, while all successful runs have mode=new_message and has_subject=true",
            "recommendation": "Set has_subject=true for thread_reply mode in the input for the email-drafter agent",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "questionable"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "meeting-summariser",
              "contract-reviewer",
              "support-triager"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "Context Length Exceeded",
            "what_fails": "llm_call: context length exceeded: prompt has X tokens, limit is 8192",
            "condition": "All failed runs have input: prompt_tokens > 8192, while successful runs have input: prompt_tokens <= 8192.",
            "recommendation": "Reduce the maximum number of tokens in the input prompt to 8192, or adjust the code to handle prompts with more tokens.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          }
        ],
        "run": 2,
        "cli_wall_s": 6.78,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:12:50.171Z",
        "stopped_at": "2026-11-16T05:12:53.844Z",
        "workflow_ms": 3673,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 1,
          "Config": 3,
          "Read trace file": 47,
          "Parse JSON": 31,
          "Count and group failures": 273,
          "Explain with Ollama": 3252,
          "Check and collect lessons": 18,
          "Convert to file": 3,
          "Append to memory file": 17,
          "Notify": 21
        },
        "model_calls": [
          {
            "total_s": 2.351,
            "load_s": 0.001,
            "prompt_tokens": 1031,
            "output_tokens": 83,
            "tokens_per_s": 36.9,
            "done_reason": "stop"
          },
          {
            "total_s": 2.667,
            "load_s": 0.002,
            "prompt_tokens": 1025,
            "output_tokens": 95,
            "tokens_per_s": 37.0,
            "done_reason": "stop"
          },
          {
            "total_s": 3.187,
            "load_s": 0.002,
            "prompt_tokens": 782,
            "output_tokens": 117,
            "tokens_per_s": 37.9,
            "done_reason": "stop"
          },
          {
            "total_s": 2.89,
            "load_s": 0.002,
            "prompt_tokens": 735,
            "output_tokens": 104,
            "tokens_per_s": 37.3,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": null,
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-007",
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "The input PDF file has more than 41 pages.",
            "recommendation": "Increase the timeout for pdf_to_text to a higher value, such as 60000 ms, to handle PDF files with more than 41 pages.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "429 Too Many Requests During Batch Processing",
            "what_fails": "crm_api.update_contact with error HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "All failed runs have trigger=nightly_backlog_batch, while successful runs have trigger=webhook.",
            "recommendation": "Consider adding a check for the retry-after period before retrying the update_contact API call during batch processing.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "Missing Required 'subject' Property in send_email Step",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "The failed runs all have 'mode=thread_reply, has_subject=false' in their input, while the successful runs all have 'mode=new_message, has_subject=true'.",
            "recommendation": "Try setting 'has_subject=true' in the input of the failed runs, or modify the send_email step to handle cases where 'subject' is missing.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "questionable"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "meeting-summariser",
              "contract-reviewer",
              "support-triager"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "Context Length Exceeded",
            "what_fails": "llm_call: context length exceeded: prompt has X tokens, limit is 8192",
            "condition": "The failed runs all have input: prompt_tokens > 8192, while the successful runs have input: prompt_tokens <= 8192.",
            "recommendation": "Check the input prompts and limit the number of tokens to 8192 or adjust the llm_call settings to accommodate longer prompts.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "mixed"
          }
        ],
        "run": 3,
        "cli_wall_s": 7.23,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:12:57.189Z",
        "stopped_at": "2026-11-16T05:13:00.809Z",
        "workflow_ms": 3620,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 0,
          "Config": 4,
          "Read trace file": 43,
          "Parse JSON": 26,
          "Count and group failures": 274,
          "Explain with Ollama": 3226,
          "Check and collect lessons": 12,
          "Convert to file": 2,
          "Append to memory file": 11,
          "Notify": 17
        },
        "model_calls": [
          {
            "total_s": 2.012,
            "load_s": 0.002,
            "prompt_tokens": 1031,
            "output_tokens": 71,
            "tokens_per_s": 37.2,
            "done_reason": "stop"
          },
          {
            "total_s": 3.182,
            "load_s": 0.003,
            "prompt_tokens": 1025,
            "output_tokens": 120,
            "tokens_per_s": 39.0,
            "done_reason": "stop"
          },
          {
            "total_s": 2.356,
            "load_s": 0.002,
            "prompt_tokens": 782,
            "output_tokens": 84,
            "tokens_per_s": 37.3,
            "done_reason": "stop"
          },
          {
            "total_s": 2.356,
            "load_s": 0.003,
            "prompt_tokens": 735,
            "output_tokens": 84,
            "tokens_per_s": 37.3,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": null,
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-007",
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "input: pages > 47",
            "recommendation": "Increase the timeout for pdf_to_text or optimize the pdf_to_text process to handle large PDFs more efficiently.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "429 HTTP Error Retry-After Mismatch",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "The failed runs all have input: records > 20, trigger=nightly_backlog_batch, while the successful runs all have input: records <= 4, trigger=webhook.",
            "recommendation": "Increase the number of retries or the retry delay in the crm-updater agent to accommodate the higher request volume triggered by nightly_backlog_batch.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "Missing subject property in thread reply",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "the agent was in 'thread_reply' mode and 'has_subject' was 'false'",
            "recommendation": "Set 'has_subject' to 'true' in the input for 'thread_reply' mode",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "questionable"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "meeting-summariser",
              "contract-reviewer",
              "support-triager"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "llm_call Context Length Exceeded",
            "what_fails": "llm_call: context length exceeded: prompt has X tokens, limit is 8192",
            "condition": "all failed runs have prompt_tokens > 8192",
            "recommendation": "Consider truncating input prompts to 8192 tokens or less before passing them to the LLM.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          }
        ],
        "run": 4,
        "cli_wall_s": 7.07,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:13:04.297Z",
        "stopped_at": "2026-11-16T05:13:08.600Z",
        "workflow_ms": 4303,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 2,
          "Config": 5,
          "Read trace file": 63,
          "Parse JSON": 41,
          "Count and group failures": 265,
          "Explain with Ollama": 3878,
          "Check and collect lessons": 11,
          "Convert to file": 2,
          "Append to memory file": 11,
          "Notify": 16
        },
        "model_calls": [
          {
            "total_s": 2.342,
            "load_s": 0.001,
            "prompt_tokens": 1031,
            "output_tokens": 83,
            "tokens_per_s": 37.1,
            "done_reason": "stop"
          },
          {
            "total_s": 3.832,
            "load_s": 0.002,
            "prompt_tokens": 1025,
            "output_tokens": 138,
            "tokens_per_s": 37.0,
            "done_reason": "stop"
          },
          {
            "total_s": 2.82,
            "load_s": 0.002,
            "prompt_tokens": 782,
            "output_tokens": 101,
            "tokens_per_s": 37.2,
            "done_reason": "stop"
          },
          {
            "total_s": 3.144,
            "load_s": 0.002,
            "prompt_tokens": 735,
            "output_tokens": 108,
            "tokens_per_s": 35.5,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": null,
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-007",
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "All failed runs have 50+ pages, while all successful runs have 3-22 pages",
            "recommendation": "Adjust the pdf_to_text timeout or implement a check to skip large PDFs before attempting to process them",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "mixed"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "429 Too Many Requests",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "The failed runs all have the same trigger input: 'records' with a value of 20, 26, 32, 23, 21, which is higher than the successful runs. The successful runs all have the trigger input: 'trigger' with a value of 'webhook'.",
            "recommendation": "Try reducing the number of records being updated in the 'records' trigger input to see if it resolves the 429 Too Many Requests error.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "Missing required property 'subject' in send_email",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "The failed runs have in common that they are in 'thread_reply' mode, whereas the successful runs are in 'new_message' mode.",
            "recommendation": "Change the agent to set the 'has_subject' property to 'true' when in 'thread_reply' mode.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "questionable"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "meeting-summariser",
              "contract-reviewer",
              "support-triager"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "LLM Context Length Exceeded",
            "what_fails": "llm_call: context length exceeded: prompt has X tokens, limit is 8192",
            "condition": "The failed runs all have prompt_tokens values greater than 8192, while the successful runs have prompt_tokens values less than or equal to 8192.",
            "recommendation": "Check the input prompts and limit the token length to 8192 or lower to prevent the LLM context length exceeded error.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          }
        ],
        "run": 5,
        "cli_wall_s": 7.73,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:13:12.147Z",
        "stopped_at": "2026-11-16T05:13:16.793Z",
        "workflow_ms": 4646,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 1,
          "Config": 3,
          "Read trace file": 39,
          "Parse JSON": 26,
          "Count and group failures": 289,
          "Explain with Ollama": 4224,
          "Check and collect lessons": 17,
          "Convert to file": 3,
          "Append to memory file": 15,
          "Notify": 21
        },
        "model_calls": [
          {
            "total_s": 2.363,
            "load_s": 0.001,
            "prompt_tokens": 1031,
            "output_tokens": 84,
            "tokens_per_s": 37.2,
            "done_reason": "stop"
          },
          {
            "total_s": 2.995,
            "load_s": 0.002,
            "prompt_tokens": 1025,
            "output_tokens": 108,
            "tokens_per_s": 37.3,
            "done_reason": "stop"
          },
          {
            "total_s": 4.169,
            "load_s": 0.002,
            "prompt_tokens": 782,
            "output_tokens": 159,
            "tokens_per_s": 39.1,
            "done_reason": "stop"
          },
          {
            "total_s": 3.048,
            "load_s": 0.002,
            "prompt_tokens": 735,
            "output_tokens": 110,
            "tokens_per_s": 37.4,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": null,
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-007",
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout due to large page count",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "The number of pages in the input file is greater than 7.",
            "recommendation": "Increase the timeout value for pdf_to_text or optimize the pdf_to_text process to handle large page counts more efficiently.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "crm_api.update_contact: HTTP 429 Too Many Requests",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "All failed runs have the trigger 'nightly_backlog_batch' and input 'records' greater than or equal to 20.",
            "recommendation": "Increase the delay between 'nightly_backlog_batch' triggers or adjust the 'records' input to be less than 20.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "send_email failed due to missing 'subject' property",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "The input 'mode' is 'thread_reply' and 'has_subject' is 'false' in the failed runs, but 'mode' is 'new_message' and 'has_subject' is 'true' in the successful runs.",
            "recommendation": "Review the logic that determines the input 'mode' and 'has_subject' to ensure it is correctly setting these values for 'thread_reply' mode, or modify the 'send_email' step to handle the case where 'has_subject' is 'false' or 'mode' is 'thread_reply'.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "meeting-summariser",
              "contract-reviewer",
              "support-triager"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "Context Length Exceeded",
            "what_fails": "llm_call: context length exceeded: prompt has {token_count} tokens, limit is 8192",
            "condition": "All failed runs have input: prompt_tokens={token_count} > 8192, while all successful runs have input: prompt_tokens={token_count} <= 8192",
            "recommendation": "Increase the LLM (Large Language Model) context length limit from 8192 tokens to accommodate longer prompts",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "questionable"
          }
        ],
        "run": 6,
        "cli_wall_s": 8.2,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:13:20.302Z",
        "stopped_at": "2026-11-16T05:13:24.106Z",
        "workflow_ms": 3804,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 1,
          "Config": 3,
          "Read trace file": 47,
          "Parse JSON": 29,
          "Count and group failures": 268,
          "Explain with Ollama": 3398,
          "Check and collect lessons": 15,
          "Convert to file": 3,
          "Append to memory file": 13,
          "Notify": 22
        },
        "model_calls": [
          {
            "total_s": 2.255,
            "load_s": 0.002,
            "prompt_tokens": 1031,
            "output_tokens": 76,
            "tokens_per_s": 35.3,
            "done_reason": "stop"
          },
          {
            "total_s": 3.355,
            "load_s": 0.002,
            "prompt_tokens": 1025,
            "output_tokens": 121,
            "tokens_per_s": 37.2,
            "done_reason": "stop"
          },
          {
            "total_s": 2.941,
            "load_s": 0.003,
            "prompt_tokens": 782,
            "output_tokens": 103,
            "tokens_per_s": 36.3,
            "done_reason": "stop"
          },
          {
            "total_s": 2.44,
            "load_s": 0.003,
            "prompt_tokens": 735,
            "output_tokens": 83,
            "tokens_per_s": 35.5,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": null,
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-007",
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text_timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "The input PDF files have more than 40 pages.",
            "recommendation": "Increase the timeout value for pdf_to_text or optimize the pdf_to_text step to process larger PDF files more efficiently.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "429 Too Many Requests on crm_api.update_contact",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "The failed runs all have 'trigger=nightly_backlog_batch' in the input, while the successful runs have 'trigger=webhook'.",
            "recommendation": "Check the rate limiting configuration on the CRM API side, and consider implementing rate limiting or exponential backoff in the crm-updater agent to avoid hitting the API's request limits.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "Missing Subject in Thread Reply",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "The failed runs have 'mode=thread_reply, has_subject=false' in their input, while the successful runs have 'mode=new_message, has_subject=true'.",
            "recommendation": "Check the input handling for thread replies and ensure that the required 'subject' property is always present when has_subject=false.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "meeting-summariser",
              "contract-reviewer",
              "support-triager"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "Context Length Exceeded",
            "what_fails": "llm_call: context length exceeded",
            "condition": "The input prompts have more tokens than the LLM's token limit of 8192.",
            "recommendation": "Check the input prompts to ensure they do not exceed the LLM's token limit, and consider truncating or splitting long prompts.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          }
        ],
        "run": 7,
        "cli_wall_s": 7.24,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:13:27.994Z",
        "stopped_at": "2026-11-16T05:13:32.778Z",
        "workflow_ms": 4784,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 1,
          "Config": 7,
          "Read trace file": 54,
          "Parse JSON": 38,
          "Count and group failures": 347,
          "Explain with Ollama": 4234,
          "Check and collect lessons": 28,
          "Convert to file": 6,
          "Append to memory file": 20,
          "Notify": 34
        },
        "model_calls": [
          {
            "total_s": 1.706,
            "load_s": 0.002,
            "prompt_tokens": 1031,
            "output_tokens": 60,
            "tokens_per_s": 37.6,
            "done_reason": "stop"
          },
          {
            "total_s": 4.177,
            "load_s": 0.002,
            "prompt_tokens": 1025,
            "output_tokens": 123,
            "tokens_per_s": 30.2,
            "done_reason": "stop"
          },
          {
            "total_s": 2.238,
            "load_s": 0.001,
            "prompt_tokens": 782,
            "output_tokens": 80,
            "tokens_per_s": 37.6,
            "done_reason": "stop"
          },
          {
            "total_s": 4.129,
            "load_s": 0.001,
            "prompt_tokens": 735,
            "output_tokens": 121,
            "tokens_per_s": 30.1,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": null,
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-007",
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text ERROR 30000ms",
            "condition": "pages > 10",
            "recommendation": "Increase timeout limit for pdf_to_text on documents with > 10 pages",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "429 Too Many Requests",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "The failed runs all have the trigger set to 'nightly_backlog_batch' and the input has a higher number of records (20-32) compared to the successful runs (1-4).",
            "recommendation": "Reduce the number of records processed by the 'nightly_backlog_batch' trigger or adjust the crm_api.update_contact API to handle higher request volumes without blocking.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "mixed"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "Missing subject in thread reply mode",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "mode=thread_reply, has_subject=false",
            "recommendation": "Change the agent to set the 'subject' property in the input data when mode=thread_reply and has_subject=false",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "meeting-summariser",
              "contract-reviewer",
              "support-triager"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "Context Length Exceeded",
            "what_fails": "llm_call: context length exceeded: prompt has X tokens, limit is 8192",
            "condition": "The failed runs all have prompts with more than 8192 tokens, whereas the successful runs all have prompts with 8192 or fewer tokens.",
            "recommendation": "Decrease the maximum context length limit in the LLM call to at least 11840 tokens, or implement tokenization and truncation of long prompts to fit within the current limit of 8192 tokens.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "mixed"
          }
        ],
        "run": 8,
        "cli_wall_s": 8.79,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:13:36.777Z",
        "stopped_at": "2026-11-16T05:13:40.165Z",
        "workflow_ms": 3388,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 1,
          "Config": 4,
          "Read trace file": 45,
          "Parse JSON": 31,
          "Count and group failures": 274,
          "Explain with Ollama": 2962,
          "Check and collect lessons": 21,
          "Convert to file": 4,
          "Append to memory file": 16,
          "Notify": 22
        },
        "model_calls": [
          {
            "total_s": 2.33,
            "load_s": 0.002,
            "prompt_tokens": 1031,
            "output_tokens": 86,
            "tokens_per_s": 38.6,
            "done_reason": "stop"
          },
          {
            "total_s": 2.919,
            "load_s": 0.001,
            "prompt_tokens": 1025,
            "output_tokens": 109,
            "tokens_per_s": 38.7,
            "done_reason": "stop"
          },
          {
            "total_s": 2.82,
            "load_s": 0.002,
            "prompt_tokens": 782,
            "output_tokens": 105,
            "tokens_per_s": 38.6,
            "done_reason": "stop"
          },
          {
            "total_s": 2.615,
            "load_s": 0.003,
            "prompt_tokens": 735,
            "output_tokens": 97,
            "tokens_per_s": 38.6,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": null,
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-007",
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout fixed by reducing input size",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "the number of pages in the input pdf file is greater than or equal to 10",
            "recommendation": "try reducing the input pdf size by splitting large files into smaller ones before running the pdf_to_text step",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "429 Too Many Requests when updating contact",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "The failed runs all have trigger='nightly_backlog_batch', while the successful runs all have trigger='webhook'",
            "recommendation": "Consider adding a check to limit the number of requests to crm_api.update_contact, or modify the agent to use the 'webhook' trigger for this task",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "mixed"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "schema-validation-in-thread-reply-mode",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "The failed runs all have input: mode=thread_reply, has_subject=false, while the successful runs all have input: mode=new_message, has_subject=true.",
            "recommendation": "Change the input mode to 'new_message' and ensure 'has_subject' is true for thread replies to avoid schema validation errors.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "questionable"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "meeting-summariser",
              "contract-reviewer",
              "support-triager"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "Context Length Exceeded Error",
            "what_fails": "llm_call: context length exceeded: prompt has {tokens}, limit is 8192",
            "condition": "All failed runs have input prompt tokens greater than 8192",
            "recommendation": "Set the maximum token limit for the LLM call to a higher value, e.g., 16384, or implement token truncation or splitting for long prompts",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "mixed"
          }
        ],
        "run": 9,
        "cli_wall_s": 7.31,
        "cli_exit": 0
      },
      {
        "status": "success",
        "started_at": "2026-11-16T05:13:43.881Z",
        "stopped_at": "2026-11-16T05:13:47.219Z",
        "workflow_ms": 3338,
        "error": null,
        "last_node": "Notify",
        "node_ms": {
          "Every day at 03:00": 1,
          "Config": 4,
          "Read trace file": 41,
          "Parse JSON": 28,
          "Count and group failures": 315,
          "Explain with Ollama": 2888,
          "Check and collect lessons": 13,
          "Convert to file": 3,
          "Append to memory file": 15,
          "Notify": 22
        },
        "model_calls": [
          {
            "total_s": 2.174,
            "load_s": 0.002,
            "prompt_tokens": 1031,
            "output_tokens": 78,
            "tokens_per_s": 37.7,
            "done_reason": "stop"
          },
          {
            "total_s": 2.847,
            "load_s": 0.003,
            "prompt_tokens": 1025,
            "output_tokens": 94,
            "tokens_per_s": 34.3,
            "done_reason": "stop"
          },
          {
            "total_s": 2.173,
            "load_s": 0.001,
            "prompt_tokens": 782,
            "output_tokens": 78,
            "tokens_per_s": 37.8,
            "done_reason": "stop"
          },
          {
            "total_s": 2.775,
            "load_s": 0.003,
            "prompt_tokens": 735,
            "output_tokens": 91,
            "tokens_per_s": 34.1,
            "done_reason": "stop"
          }
        ],
        "counted_in_code": {
          "runs": 55,
          "succeeded": 36,
          "failed": 19,
          "recurring_groups": 4,
          "one_offs": [
            "run-001"
          ]
        },
        "problems": [],
        "model_one_offs": null,
        "lessons": [
          {
            "planted_pattern": "P1",
            "agents": [
              "invoice-extractor"
            ],
            "run_ids": [
              "run-007",
              "run-018",
              "run-024",
              "run-032",
              "run-043",
              "run-049"
            ],
            "title": "pdf_to_text timeout",
            "what_fails": "pdf_to_text: timeout after 30000 ms",
            "condition": "input: file_type=pdf, pages>10",
            "recommendation": "Consider increasing the timeout for pdf_to_text or improving the performance of pdf_to_text for large PDFs (> 10 pages)",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "right factor, wrong numbers",
            "recommendation_label": "generic"
          },
          {
            "planted_pattern": "P2",
            "agents": [
              "crm-updater"
            ],
            "run_ids": [
              "run-012",
              "run-013",
              "run-014",
              "run-015",
              "run-016"
            ],
            "title": "Too Many Requests Error",
            "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
            "condition": "all failed runs have the same input: trigger=nightly_backlog_batch, while successful runs have trigger=webhook",
            "recommendation": "consider adding a retry mechanism or adjusting the rate of API requests for the nightly_backlog_batch trigger",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "specific"
          },
          {
            "planted_pattern": "P3",
            "agents": [
              "email-drafter"
            ],
            "run_ids": [
              "run-008",
              "run-027",
              "run-041",
              "run-052"
            ],
            "title": "Missing Required Property 'subject'",
            "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
            "condition": "has_subject=false",
            "recommendation": "Change the input mode from thread_reply to new_message, or add the 'subject' property to the input arguments when mode=thread_reply",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "mixed"
          },
          {
            "planted_pattern": "P4",
            "agents": [
              "meeting-summariser",
              "contract-reviewer",
              "support-triager"
            ],
            "run_ids": [
              "run-021",
              "run-033",
              "run-044"
            ],
            "title": "Context Length Exceeded",
            "what_fails": "llm_call: context length exceeded: prompt has <token count>, limit is 8192",
            "condition": "The failed runs have input prompts with more than 8192 tokens, whereas the successful runs have prompts with 8192 or fewer tokens.",
            "recommendation": "Increase the LLU call limit to accommodate longer input prompts.",
            "checks": {
              "cited_by": "code",
              "unknown_run_ids": [],
              "cited_but_succeeded": []
            },
            "cited_all_runs_of_pattern": true,
            "cited_runs_outside_pattern": [],
            "condition_label": "correct",
            "recommendation_label": "questionable"
          }
        ],
        "run": 10,
        "cli_wall_s": 7.02,
        "cli_exit": 0
      }
    ]
  },
  "variants_note": {
    "grouped_seeded": "The published workflow. Code groups failures by error text (digits replaced); one model call per group of 2+ failures; temperature 0.2, seed 42. Run ids and agents come from the code.",
    "raw_single_call_seeded": "Same nodes, different Code and prompt (make_workflow.py --raw): one call with all 55 runs; the model finds the patterns and cites the run ids itself; temperature 0.2, seed 42.",
    "grouped_default_sampling": "The published workflow without temperature and seed (--default-sampling): Ollama's default sampling."
  },
  "labelled_texts": [
    {
      "kind": "condition",
      "planted_pattern": "P1",
      "times_written": 13,
      "label": "right factor, wrong numbers",
      "why": "41 pages failed too, and successes go up to 22 pages; failed runs have 41, 48, 52, 64, 73 and 87 pages; successful runs have 2 to 22",
      "text": "The failed runs all have 48 or more pages in the input PDF, while the successful runs have 3 or fewer pages."
    },
    {
      "kind": "condition",
      "planted_pattern": "P1",
      "times_written": 10,
      "label": "right factor, wrong numbers",
      "why": "four of the six failures have 64 pages or fewer; failed runs have 41, 48, 52, 64, 73 and 87 pages; successful runs have 2 to 22",
      "text": "pdf pages > 64"
    },
    {
      "kind": "condition",
      "planted_pattern": "P1",
      "times_written": 1,
      "label": "correct",
      "why": "failed runs have 41, 48, 52, 64, 73 and 87 pages; successful runs have 2 to 22",
      "text": "The number of pages in the input PDF is greater than or equal to 41."
    },
    {
      "kind": "condition",
      "planted_pattern": "P1",
      "times_written": 1,
      "label": "correct",
      "why": "failed runs have 41, 48, 52, 64, 73 and 87 pages; successful runs have 2 to 22",
      "text": "files with more than 40 pages cause the pdf_to_text step to timeout"
    },
    {
      "kind": "condition",
      "planted_pattern": "P1",
      "times_written": 1,
      "label": "right factor, wrong numbers",
      "why": "the 41-page run failed, so 'more than 41' is off by one",
      "text": "The input PDF file has more than 41 pages."
    },
    {
      "kind": "condition",
      "planted_pattern": "P1",
      "times_written": 1,
      "label": "right factor, wrong numbers",
      "why": "the 41-page run failed",
      "text": "input: pages > 47"
    },
    {
      "kind": "condition",
      "planted_pattern": "P1",
      "times_written": 1,
      "label": "right factor, wrong numbers",
      "why": "the 41- and 48-page runs failed; successes start at 2 pages",
      "text": "All failed runs have 50+ pages, while all successful runs have 3-22 pages"
    },
    {
      "kind": "condition",
      "planted_pattern": "P1",
      "times_written": 1,
      "label": "right factor, wrong numbers",
      "why": "runs with 9 to 22 pages succeeded",
      "text": "The number of pages in the input file is greater than 7."
    },
    {
      "kind": "condition",
      "planted_pattern": "P1",
      "times_written": 1,
      "label": "correct",
      "why": "failed runs have 41, 48, 52, 64, 73 and 87 pages; successful runs have 2 to 22",
      "text": "The input PDF files have more than 40 pages."
    },
    {
      "kind": "condition",
      "planted_pattern": "P1",
      "times_written": 1,
      "label": "right factor, wrong numbers",
      "why": "runs with 12 to 22 pages succeeded",
      "text": "pages > 10"
    },
    {
      "kind": "condition",
      "planted_pattern": "P1",
      "times_written": 1,
      "label": "right factor, wrong numbers",
      "why": "runs with 12 to 22 pages succeeded",
      "text": "the number of pages in the input pdf file is greater than or equal to 10"
    },
    {
      "kind": "condition",
      "planted_pattern": "P1",
      "times_written": 1,
      "label": "right factor, wrong numbers",
      "why": "runs with 12 to 22 pages succeeded",
      "text": "input: file_type=pdf, pages>10"
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P1",
      "times_written": 12,
      "label": "generic",
      "why": "says what anyone would say about a timeout; no value, no use of the page count",
      "text": "Increase the timeout for pdf_to_text or optimize the pdf_to_text process to handle larger PDFs more efficiently."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P1",
      "times_written": 10,
      "label": "generic",
      "why": "says what anyone would say about a timeout; no value, no use of the page count",
      "text": "Increase the timeout for pdf_to_text or optimize the pdf processing"
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P1",
      "times_written": 1,
      "label": "generic",
      "why": "says what anyone would say about a timeout; no value, no use of the page count",
      "text": "Increase the timeout value for pdf_to_text or optimize the pdf_to_text process to handle larger PDFs more efficiently."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P1",
      "times_written": 1,
      "label": "mixed",
      "why": "generic timeout advice plus a concrete rule on the 40-page threshold, which drops work",
      "text": "Increase the timeout for pdf_to_text or improve its performance for large PDFs, or filter out inputs with more than 40 pages if possible."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P1",
      "times_written": 1,
      "label": "generic",
      "why": "says what anyone would say about a timeout; no value, no use of the page count",
      "text": "Increase the timeout for the pdf_to_text step or improve the performance of the pdf_to_text process"
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P1",
      "times_written": 1,
      "label": "specific",
      "why": "a concrete value (60000 ms) tied to the page threshold; untested whether 60 s is enough",
      "text": "Increase the timeout for pdf_to_text to a higher value, such as 60000 ms, to handle PDF files with more than 41 pages."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P1",
      "times_written": 1,
      "label": "generic",
      "why": "says what anyone would say about a timeout; no value, no use of the page count",
      "text": "Increase the timeout for pdf_to_text or optimize the pdf_to_text process to handle large PDFs more efficiently."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P1",
      "times_written": 1,
      "label": "mixed",
      "why": "generic timeout advice plus skipping large PDFs, which drops work",
      "text": "Adjust the pdf_to_text timeout or implement a check to skip large PDFs before attempting to process them"
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P1",
      "times_written": 1,
      "label": "generic",
      "why": "says what anyone would say about a timeout; no value, no use of the page count",
      "text": "Increase the timeout value for pdf_to_text or optimize the pdf_to_text process to handle large page counts more efficiently."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P1",
      "times_written": 1,
      "label": "generic",
      "why": "says what anyone would say about a timeout; no value, no use of the page count",
      "text": "Increase the timeout value for pdf_to_text or optimize the pdf_to_text step to process larger PDF files more efficiently."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P1",
      "times_written": 1,
      "label": "generic",
      "why": "says what anyone would say about a timeout; no value, no use of the page count; the 10-page threshold is wrong",
      "text": "Increase timeout limit for pdf_to_text on documents with > 10 pages"
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P1",
      "times_written": 1,
      "label": "specific",
      "why": "split large files before pdf_to_text",
      "text": "try reducing the input pdf size by splitting large files into smaller ones before running the pdf_to_text step"
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P1",
      "times_written": 1,
      "label": "generic",
      "why": "says what anyone would say about a timeout; no value, no use of the page count",
      "text": "Consider increasing the timeout for pdf_to_text or improving the performance of pdf_to_text for large PDFs (> 10 pages)"
    },
    {
      "kind": "condition",
      "planted_pattern": "P2",
      "times_written": 11,
      "label": "correct",
      "why": "trigger and record counts match the data",
      "text": "The failed runs all have a trigger of 'nightly_backlog_batch' with a large number of records (20-32), whereas the successful runs all have a trigger of 'webhook' with a small number of records (1-4)."
    },
    {
      "kind": "condition",
      "planted_pattern": "P2",
      "times_written": 10,
      "label": "right factor, wrong numbers",
      "why": "trigger is right, but one failed run has exactly 20 records",
      "text": "trigger=nightly_backlog_batch and records > 20"
    },
    {
      "kind": "condition",
      "planted_pattern": "P2",
      "times_written": 2,
      "label": "correct",
      "why": "trigger is the distinguishing factor",
      "text": "The failed runs all have a trigger of 'nightly_backlog_batch' with a varying number of records, whereas the successful runs all have a trigger of 'webhook' with a small number of records (1-4)."
    },
    {
      "kind": "condition",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "correct",
      "why": "trigger",
      "text": "The failed runs all have 'trigger=nightly_backlog_batch' in their input, while the successful runs have 'trigger=webhook' in their input."
    },
    {
      "kind": "condition",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "correct",
      "why": "trigger",
      "text": "trigger=nightly_backlog_batch"
    },
    {
      "kind": "condition",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "correct",
      "why": "trigger",
      "text": "All failed runs have trigger=nightly_backlog_batch, while successful runs have trigger=webhook."
    },
    {
      "kind": "condition",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "right factor, wrong numbers",
      "why": "trigger is right, but one failed run has exactly 20 records",
      "text": "The failed runs all have input: records > 20, trigger=nightly_backlog_batch, while the successful runs all have input: records <= 4, trigger=webhook."
    },
    {
      "kind": "condition",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "correct",
      "why": "muddled wording, but the record counts and the webhook trigger are as in the data",
      "text": "The failed runs all have the same trigger input: 'records' with a value of 20, 26, 32, 23, 21, which is higher than the successful runs. The successful runs all have the trigger input: 'trigger' with a value of 'webhook'."
    },
    {
      "kind": "condition",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "correct",
      "why": "trigger and records >= 20",
      "text": "All failed runs have the trigger 'nightly_backlog_batch' and input 'records' greater than or equal to 20."
    },
    {
      "kind": "condition",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "correct",
      "why": "trigger",
      "text": "The failed runs all have 'trigger=nightly_backlog_batch' in the input, while the successful runs have 'trigger=webhook'."
    },
    {
      "kind": "condition",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "correct",
      "why": "trigger and record counts match the data",
      "text": "The failed runs all have the trigger set to 'nightly_backlog_batch' and the input has a higher number of records (20-32) compared to the successful runs (1-4)."
    },
    {
      "kind": "condition",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "correct",
      "why": "trigger",
      "text": "The failed runs all have trigger='nightly_backlog_batch', while the successful runs all have trigger='webhook'"
    },
    {
      "kind": "condition",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "correct",
      "why": "trigger",
      "text": "all failed runs have the same input: trigger=nightly_backlog_batch, while successful runs have trigger=webhook"
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P2",
      "times_written": 9,
      "label": "generic",
      "why": "true of any HTTP 429; does not use the batch trigger it had just identified",
      "text": "Implement rate limiting or retry logic for crm_api.update_contact when receiving 429 errors"
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P2",
      "times_written": 5,
      "label": "specific",
      "why": "cap records per batch run or stagger the batches",
      "text": "Consider adding a check to limit the number of records processed in a single 'nightly_backlog_batch' run, or implement a mechanism to stagger the processing of large batches to avoid hitting the 429 rate limit."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P2",
      "times_written": 4,
      "label": "specific",
      "why": "cap records per batch run or retry with a longer delay",
      "text": "Consider adding a check to limit the number of records processed in a single 'nightly_backlog_batch' run, or implement a retry mechanism with a longer delay to avoid hitting the rate limit."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "mixed",
      "why": "the CRM's rate limit is not ours to raise; reducing records per run is sound",
      "text": "Increase the rate limit for the 'nightly_backlog_batch' trigger or reduce the number of records being processed in each run to avoid hitting the rate limit."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "mixed",
      "why": "confuses the two triggers and asks to raise a third party's limit; queuing is sound",
      "text": "Increase the rate limit for the 'webhook' trigger to match the volume of requests sent by the 'nightly_backlog_batch' trigger, or implement a queuing mechanism to prevent overwhelming the crm_api.update_contact endpoint."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "mixed",
      "why": "cap records per batch run, then a vague 'more efficient update process'",
      "text": "Consider adding a check to limit the number of records processed in a single 'nightly_backlog_batch' run, or implement a more efficient update process to reduce the load on the crm_api."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "specific",
      "why": "cap records per batch run or retry with exponential backoff",
      "text": "Consider adding a check to limit the number of records processed in a single 'nightly_backlog_batch' run, or implement a retry mechanism with exponential backoff to handle the 429 errors."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "questionable",
      "why": "the CRM's rate limit is not ours to raise; 'optimize' says nothing",
      "text": "Increase the rate limit for crm_api.update_contact or optimize the update process"
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "questionable",
      "why": "switching the trigger does not process the backlog",
      "text": "Change the trigger from 'nightly_backlog_batch' to 'webhook' for the crm-updater agent to resolve the issue."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "questionable",
      "why": "more workers or a higher call rate would make a 429 worse",
      "text": "Check the crm_api.update_contact function for concurrency issues. Consider increasing the number of workers or the rate of update_contact calls."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "specific",
      "why": "honour the retry-after value the error already carries",
      "text": "Consider adding a check for the retry-after period before retrying the update_contact API call during batch processing."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "specific",
      "why": "more retries or a longer delay for the batch",
      "text": "Increase the number of retries or the retry delay in the crm-updater agent to accommodate the higher request volume triggered by nightly_backlog_batch."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "specific",
      "why": "fewer records per batch",
      "text": "Try reducing the number of records being updated in the 'records' trigger input to see if it resolves the 429 Too Many Requests error."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "specific",
      "why": "space the batch runs or keep them under 20 records",
      "text": "Increase the delay between 'nightly_backlog_batch' triggers or adjust the 'records' input to be less than 20."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "specific",
      "why": "backoff in the agent",
      "text": "Check the rate limiting configuration on the CRM API side, and consider implementing rate limiting or exponential backoff in the crm-updater agent to avoid hitting the API's request limits."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "mixed",
      "why": "fewer records per batch is sound; changing the CRM API is not ours to do",
      "text": "Reduce the number of records processed by the 'nightly_backlog_batch' trigger or adjust the crm_api.update_contact API to handle higher request volumes without blocking."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "mixed",
      "why": "limiting requests is sound; switching to the webhook trigger does not process the backlog",
      "text": "Consider adding a check to limit the number of requests to crm_api.update_contact, or modify the agent to use the 'webhook' trigger for this task"
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P2",
      "times_written": 1,
      "label": "specific",
      "why": "retry or slow the request rate for the batch trigger",
      "text": "consider adding a retry mechanism or adjusting the rate of API requests for the nightly_backlog_batch trigger"
    },
    {
      "kind": "condition",
      "planted_pattern": "P3",
      "times_written": 13,
      "label": "correct",
      "why": "thread replies without a subject",
      "text": "The failed runs all have `mode=thread_reply` and `has_subject=false`, while the successful runs all have `mode=new_message` and `has_subject=true`."
    },
    {
      "kind": "condition",
      "planted_pattern": "P3",
      "times_written": 10,
      "label": "correct",
      "why": "thread replies without a subject",
      "text": "mode=thread_reply and has_subject=false"
    },
    {
      "kind": "condition",
      "planted_pattern": "P3",
      "times_written": 1,
      "label": "correct",
      "why": "thread replies without a subject",
      "text": "The failed runs all have `has_subject=false` in their input, while the successful runs all have `has_subject=true`."
    },
    {
      "kind": "condition",
      "planted_pattern": "P3",
      "times_written": 1,
      "label": "correct",
      "why": "thread replies without a subject",
      "text": "all failed runs have mode=thread_reply and has_subject=false, while all successful runs have mode=new_message and has_subject=true"
    },
    {
      "kind": "condition",
      "planted_pattern": "P3",
      "times_written": 1,
      "label": "correct",
      "why": "thread replies without a subject",
      "text": "The failed runs all have 'mode=thread_reply, has_subject=false' in their input, while the successful runs all have 'mode=new_message, has_subject=true'."
    },
    {
      "kind": "condition",
      "planted_pattern": "P3",
      "times_written": 1,
      "label": "correct",
      "why": "thread replies without a subject",
      "text": "the agent was in 'thread_reply' mode and 'has_subject' was 'false'"
    },
    {
      "kind": "condition",
      "planted_pattern": "P3",
      "times_written": 1,
      "label": "correct",
      "why": "thread replies without a subject",
      "text": "The failed runs have in common that they are in 'thread_reply' mode, whereas the successful runs are in 'new_message' mode."
    },
    {
      "kind": "condition",
      "planted_pattern": "P3",
      "times_written": 1,
      "label": "correct",
      "why": "thread replies without a subject",
      "text": "The input 'mode' is 'thread_reply' and 'has_subject' is 'false' in the failed runs, but 'mode' is 'new_message' and 'has_subject' is 'true' in the successful runs."
    },
    {
      "kind": "condition",
      "planted_pattern": "P3",
      "times_written": 1,
      "label": "correct",
      "why": "thread replies without a subject",
      "text": "The failed runs have 'mode=thread_reply, has_subject=false' in their input, while the successful runs have 'mode=new_message, has_subject=true'."
    },
    {
      "kind": "condition",
      "planted_pattern": "P3",
      "times_written": 1,
      "label": "correct",
      "why": "thread replies without a subject",
      "text": "mode=thread_reply, has_subject=false"
    },
    {
      "kind": "condition",
      "planted_pattern": "P3",
      "times_written": 1,
      "label": "correct",
      "why": "thread replies without a subject",
      "text": "The failed runs all have input: mode=thread_reply, has_subject=false, while the successful runs all have input: mode=new_message, has_subject=true."
    },
    {
      "kind": "condition",
      "planted_pattern": "P3",
      "times_written": 1,
      "label": "correct",
      "why": "thread replies without a subject",
      "text": "has_subject=false"
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P3",
      "times_written": 9,
      "label": "specific",
      "why": "make the reply path set a subject before send_email",
      "text": "Check the input handling for `mode=thread_reply` and ensure that the `subject` property is being added to the arguments before calling `send_email`."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P3",
      "times_written": 9,
      "label": "specific",
      "why": "make the reply path set a subject before send_email",
      "text": "Add a check to ensure the 'subject' property is present when sending thread replies"
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P3",
      "times_written": 2,
      "label": "questionable",
      "why": "flipping the has_subject flag or relabelling the reply does not give the email a subject",
      "text": "Change the `mode` to `new_message` and set `has_subject` to `true` for the thread reply functionality, or modify the schema validation to accept `thread_reply` with `has_subject=false`."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P3",
      "times_written": 1,
      "label": "specific",
      "why": "make the reply path set a subject before send_email",
      "text": "Check the agent's input handling for `mode=thread_reply` and ensure it sets the `subject` property before calling `send_email`."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P3",
      "times_written": 1,
      "label": "specific",
      "why": "make the reply path set a subject before send_email",
      "text": "Check the agent's logic for handling `thread_reply` mode and ensure it always includes the `subject` property in the arguments passed to `send_email` when `has_subject=false`."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P3",
      "times_written": 1,
      "label": "specific",
      "why": "make the reply path set a subject before send_email",
      "text": "Add 'subject' to the arguments for send_email when mode=thread_reply and has_subject=false"
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P3",
      "times_written": 1,
      "label": "questionable",
      "why": "flipping the has_subject flag or relabelling the reply does not give the email a subject",
      "text": "Set `has_subject=true` in the input for the failing runs, or modify the `send_email` step to handle the case where `has_subject=false` without requiring the `subject` property."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P3",
      "times_written": 1,
      "label": "questionable",
      "why": "flipping the has_subject flag or relabelling the reply does not give the email a subject",
      "text": "Set has_subject=true for thread_reply mode in the input for the email-drafter agent"
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P3",
      "times_written": 1,
      "label": "questionable",
      "why": "flipping the has_subject flag or relabelling the reply does not give the email a subject",
      "text": "Try setting 'has_subject=true' in the input of the failed runs, or modify the send_email step to handle cases where 'subject' is missing."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P3",
      "times_written": 1,
      "label": "questionable",
      "why": "flipping the has_subject flag or relabelling the reply does not give the email a subject",
      "text": "Set 'has_subject' to 'true' in the input for 'thread_reply' mode"
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P3",
      "times_written": 1,
      "label": "questionable",
      "why": "flipping the has_subject flag or relabelling the reply does not give the email a subject",
      "text": "Change the agent to set the 'has_subject' property to 'true' when in 'thread_reply' mode."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P3",
      "times_written": 1,
      "label": "generic",
      "why": "'review the logic' or change the tool; no concrete change",
      "text": "Review the logic that determines the input 'mode' and 'has_subject' to ensure it is correctly setting these values for 'thread_reply' mode, or modify the 'send_email' step to handle the case where 'has_subject' is 'false' or 'mode' is 'thread_reply'."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P3",
      "times_written": 1,
      "label": "specific",
      "why": "make the reply path set a subject before send_email",
      "text": "Check the input handling for thread replies and ensure that the required 'subject' property is always present when has_subject=false."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P3",
      "times_written": 1,
      "label": "specific",
      "why": "make the reply path set a subject before send_email",
      "text": "Change the agent to set the 'subject' property in the input data when mode=thread_reply and has_subject=false"
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P3",
      "times_written": 1,
      "label": "questionable",
      "why": "flipping the has_subject flag or relabelling the reply does not give the email a subject",
      "text": "Change the input mode to 'new_message' and ensure 'has_subject' is true for thread replies to avoid schema validation errors."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P3",
      "times_written": 1,
      "label": "mixed",
      "why": "relabelling the reply as a new message is unsound; adding the subject is right",
      "text": "Change the input mode from thread_reply to new_message, or add the 'subject' property to the input arguments when mode=thread_reply"
    },
    {
      "kind": "condition",
      "planted_pattern": "P4",
      "times_written": 10,
      "label": "correct",
      "why": "prompt above the 8192-token limit",
      "text": "The failed runs all have input: prompt_tokens values greater than 8192, whereas the successful runs all have input: prompt_tokens values less than or equal to 8192."
    },
    {
      "kind": "condition",
      "planted_pattern": "P4",
      "times_written": 10,
      "label": "correct",
      "why": "prompt above the 8192-token limit",
      "text": "prompt_tokens > 8192"
    },
    {
      "kind": "condition",
      "planted_pattern": "P4",
      "times_written": 3,
      "label": "correct",
      "why": "prompt above the 8192-token limit",
      "text": "The failed runs all have input: prompt_tokens greater than 8192, while the successful runs all have input: prompt_tokens less than or equal to 8192."
    },
    {
      "kind": "condition",
      "planted_pattern": "P4",
      "times_written": 2,
      "label": "correct",
      "why": "prompt above the 8192-token limit",
      "text": "The failed runs have input prompts with more than 8192 tokens, whereas the successful runs have prompts with 8192 or fewer tokens."
    },
    {
      "kind": "condition",
      "planted_pattern": "P4",
      "times_written": 1,
      "label": "correct",
      "why": "prompt above the 8192-token limit",
      "text": "All failed runs have input: prompt_tokens > 8192, while successful runs have input: prompt_tokens <= 8192."
    },
    {
      "kind": "condition",
      "planted_pattern": "P4",
      "times_written": 1,
      "label": "correct",
      "why": "prompt above the 8192-token limit",
      "text": "The failed runs all have input: prompt_tokens > 8192, while the successful runs have input: prompt_tokens <= 8192."
    },
    {
      "kind": "condition",
      "planted_pattern": "P4",
      "times_written": 1,
      "label": "correct",
      "why": "prompt above the 8192-token limit",
      "text": "all failed runs have prompt_tokens > 8192"
    },
    {
      "kind": "condition",
      "planted_pattern": "P4",
      "times_written": 1,
      "label": "correct",
      "why": "prompt above the 8192-token limit",
      "text": "The failed runs all have prompt_tokens values greater than 8192, while the successful runs have prompt_tokens values less than or equal to 8192."
    },
    {
      "kind": "condition",
      "planted_pattern": "P4",
      "times_written": 1,
      "label": "correct",
      "why": "prompt above the 8192-token limit",
      "text": "All failed runs have input: prompt_tokens={token_count} > 8192, while all successful runs have input: prompt_tokens={token_count} <= 8192"
    },
    {
      "kind": "condition",
      "planted_pattern": "P4",
      "times_written": 1,
      "label": "correct",
      "why": "prompt above the 8192-token limit",
      "text": "The input prompts have more tokens than the LLM's token limit of 8192."
    },
    {
      "kind": "condition",
      "planted_pattern": "P4",
      "times_written": 1,
      "label": "correct",
      "why": "prompt above the 8192-token limit",
      "text": "The failed runs all have prompts with more than 8192 tokens, whereas the successful runs all have prompts with 8192 or fewer tokens."
    },
    {
      "kind": "condition",
      "planted_pattern": "P4",
      "times_written": 1,
      "label": "correct",
      "why": "prompt above the 8192-token limit",
      "text": "All failed runs have input prompt tokens greater than 8192"
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P4",
      "times_written": 9,
      "label": "generic",
      "why": "raise the limit or 'optimize prompt generation'; no concrete change",
      "text": "Increase the context length limit for llm_call or optimize prompt generation"
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P4",
      "times_written": 7,
      "label": "questionable",
      "why": "raising the limit only works if the model and the memory allow it, which the trace does not say; nothing about shortening the prompt",
      "text": "Increase the context length limit in the LLM call to a value greater than 8192, such as 12288, to accommodate the longer prompts."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P4",
      "times_written": 3,
      "label": "questionable",
      "why": "raising the limit only works if the model and the memory allow it, which the trace does not say; nothing about shortening the prompt",
      "text": "Increase the context length limit in the LLM call to a value greater than 8192, such as 12288 or 16384, to accommodate the longer prompts."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P4",
      "times_written": 2,
      "label": "questionable",
      "why": "raising the limit only works if the model and the memory allow it, which the trace does not say; nothing about shortening the prompt",
      "text": "Increase the context length limit in the LLM call to a value greater than 8192, such as 16384, to accommodate the longer prompts."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P4",
      "times_written": 1,
      "label": "questionable",
      "why": "raising the limit only works if the model and the memory allow it, which the trace does not say; nothing about shortening the prompt",
      "text": "Increase the context length limit in the LLM call to a value greater than 8192, such as 16384."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P4",
      "times_written": 1,
      "label": "generic",
      "why": "raise the limit or 'optimize'; no concrete change",
      "text": "Increase the limit for llm_call or optimize the prompt processing"
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P4",
      "times_written": 1,
      "label": "questionable",
      "why": "raising the limit only works if the model and the memory allow it, which the trace does not say; nothing about shortening the prompt",
      "text": "Increase the context length limit for the LLM call to accommodate longer prompts."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P4",
      "times_written": 1,
      "label": "specific",
      "why": "cap the prompt at 8192 tokens",
      "text": "Reduce the maximum number of tokens in the input prompt to 8192, or adjust the code to handle prompts with more tokens."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P4",
      "times_written": 1,
      "label": "mixed",
      "why": "cap the prompt at 8192 tokens, or an unspecified change of settings",
      "text": "Check the input prompts and limit the number of tokens to 8192 or adjust the llm_call settings to accommodate longer prompts."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P4",
      "times_written": 1,
      "label": "specific",
      "why": "truncate prompts to the limit",
      "text": "Consider truncating input prompts to 8192 tokens or less before passing them to the LLM."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P4",
      "times_written": 1,
      "label": "specific",
      "why": "cap the prompt at the limit",
      "text": "Check the input prompts and limit the token length to 8192 or lower to prevent the LLM context length exceeded error."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P4",
      "times_written": 1,
      "label": "questionable",
      "why": "raising the limit only works if the model and the memory allow it, which the trace does not say; nothing about shortening the prompt",
      "text": "Increase the LLM (Large Language Model) context length limit from 8192 tokens to accommodate longer prompts"
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P4",
      "times_written": 1,
      "label": "specific",
      "why": "truncate or split long prompts",
      "text": "Check the input prompts to ensure they do not exceed the LLM's token limit, and consider truncating or splitting long prompts."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P4",
      "times_written": 1,
      "label": "mixed",
      "why": "'decrease the limit to at least 11840' makes no sense; truncation is sound",
      "text": "Decrease the maximum context length limit in the LLM call to at least 11840 tokens, or implement tokenization and truncation of long prompts to fit within the current limit of 8192 tokens."
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P4",
      "times_written": 1,
      "label": "mixed",
      "why": "raise the limit (may not be possible) or truncate and split",
      "text": "Set the maximum token limit for the LLM call to a higher value, e.g., 16384, or implement token truncation or splitting for long prompts"
    },
    {
      "kind": "recommendation",
      "planted_pattern": "P4",
      "times_written": 1,
      "label": "questionable",
      "why": "raising the limit only works if the model and the memory allow it, which the trace does not say; nothing about shortening the prompt",
      "text": "Increase the LLU call limit to accommodate longer input prompts."
    }
  ],
  "schedule_trigger_test": {
    "what": "The published workflow's Schedule Trigger rule is 'every day at 03:00'. We did not wait for 03:00. To prove the trigger path we imported the same workflow with the rule changed to 'every 1 minute' (make_workflow.py --every-minute), published it by CLI and restarted the container.",
    "commands": [
      "n8n import:workflow --input=/files/wf-schedule.json",
      "n8n publish:workflow --id=agentTraceReview",
      "docker restart blog-n8n-loop-test",
      "n8n unpublish:workflow --id=agentTraceReview",
      "docker restart blog-n8n-loop-test"
    ],
    "publish_output": [
      "Publishing workflow with ID: agentTraceReview (current version)",
      "Note: Changes will not take effect if n8n is running.",
      "Please restart n8n for changes to take effect if n8n is currently running."
    ],
    "container_log_after_restart": "Activated workflow \"Agent trace review with local Ollama\" (ID: agentTraceReview)",
    "container_restarted_at": "2026-11-16T06:14:08+01:00",
    "scheduled_runs_observed": 3,
    "notifications_received_at_utc": [
      "2026-11-16T05:14:44.277Z",
      "2026-11-16T05:15:44.176Z",
      "2026-11-16T05:16:44.072Z"
    ],
    "each_run_wrote": "1 run_summary line and 4 lesson lines to the memory file, and 1 notification",
    "after_unpublish_and_restart": "container log: 'Processed 0 draft workflows, 0 published workflows.'; no further run_summary lines were written",
    "not_tested": "The daily 03:00 rule itself, missed-run behaviour after downtime, and the workflow timezone setting."
  },
  "memory_file": {
    "lines": 170,
    "bytes": 111561,
    "run_summaries": 34,
    "lessons": 136,
    "distinct_run_id_sets": 5,
    "lessons_with_status_unreviewed": 136,
    "note": "Append only, no deduplication: every execution (cold run, the three series, the scheduled runs) wrote its lessons again for the same day of traces.",
    "first_measured_run_lines": [
      {
        "type": "run_summary",
        "created": "2026-11-16T06:08:00.058+01:00",
        "period": "2026-11-10T00:00:00Z/2026-11-10T23:59:59Z",
        "runs": 55,
        "succeeded": 36,
        "failed": 19,
        "recurring_failures": 4,
        "one_off_failures": [
          "run-001"
        ],
        "lessons_written": 4,
        "problems": []
      },
      {
        "type": "lesson",
        "status": "unreviewed",
        "created": "2026-11-16T06:08:00.058+01:00",
        "period": "2026-11-10T00:00:00Z/2026-11-10T23:59:59Z",
        "model": "llama3.1:8b",
        "agents": [
          "invoice-extractor"
        ],
        "run_ids": [
          "run-007",
          "run-018",
          "run-024",
          "run-032",
          "run-043",
          "run-049"
        ],
        "error_signature": "pdf_to_text: timeout after N ms",
        "title": "pdf_to_text timeout",
        "what_fails": "pdf_to_text: timeout after 30000 ms",
        "condition": "The failed runs all have 48 or more pages in the input PDF, while the successful runs have 3 or fewer pages.",
        "recommendation": "Increase the timeout for pdf_to_text or optimize the pdf_to_text process to handle larger PDFs more efficiently.",
        "checks": {
          "cited_by": "code",
          "unknown_run_ids": [],
          "cited_but_succeeded": []
        }
      },
      {
        "type": "lesson",
        "status": "unreviewed",
        "created": "2026-11-16T06:08:00.058+01:00",
        "period": "2026-11-10T00:00:00Z/2026-11-10T23:59:59Z",
        "model": "llama3.1:8b",
        "agents": [
          "crm-updater"
        ],
        "run_ids": [
          "run-012",
          "run-013",
          "run-014",
          "run-015",
          "run-016"
        ],
        "error_signature": "crm_api.update_contact: HTTP N Too Many Requests (retry-after: N)",
        "title": "429 Too Many Requests on crm_api.update_contact",
        "what_fails": "crm_api.update_contact: HTTP 429 Too Many Requests (retry-after: 60)",
        "condition": "The failed runs all have a trigger of 'nightly_backlog_batch' with a large number of records (20-32), whereas the successful runs all have a trigger of 'webhook' with a small number of records (1-4).",
        "recommendation": "Consider adding a check to limit the number of records processed in a single 'nightly_backlog_batch' run, or implement a mechanism to stagger the processing of large batches to avoid hitting the 429 rate limit.",
        "checks": {
          "cited_by": "code",
          "unknown_run_ids": [],
          "cited_but_succeeded": []
        }
      },
      {
        "type": "lesson",
        "status": "unreviewed",
        "created": "2026-11-16T06:08:00.058+01:00",
        "period": "2026-11-10T00:00:00Z/2026-11-10T23:59:59Z",
        "model": "llama3.1:8b",
        "agents": [
          "email-drafter"
        ],
        "run_ids": [
          "run-008",
          "run-027",
          "run-041",
          "run-052"
        ],
        "error_signature": "send_email: arguments failed schema validation: missing required property 'subject'",
        "title": "Missing Subject in Thread Reply",
        "what_fails": "send_email: arguments failed schema validation: missing required property 'subject'",
        "condition": "The failed runs all have `mode=thread_reply` and `has_subject=false`, while the successful runs all have `mode=new_message` and `has_subject=true`.",
        "recommendation": "Check the input handling for `mode=thread_reply` and ensure that the `subject` property is being added to the arguments before calling `send_email`.",
        "checks": {
          "cited_by": "code",
          "unknown_run_ids": [],
          "cited_but_succeeded": []
        }
      },
      {
        "type": "lesson",
        "status": "unreviewed",
        "created": "2026-11-16T06:08:00.058+01:00",
        "period": "2026-11-10T00:00:00Z/2026-11-10T23:59:59Z",
        "model": "llama3.1:8b",
        "agents": [
          "meeting-summariser",
          "contract-reviewer",
          "support-triager"
        ],
        "run_ids": [
          "run-021",
          "run-033",
          "run-044"
        ],
        "error_signature": "llm_call: context length exceeded: prompt has N tokens, limit is N",
        "title": "Context Length Exceeded",
        "what_fails": "llm_call: context length exceeded: prompt has X tokens, limit is 8192",
        "condition": "The failed runs all have input: prompt_tokens values greater than 8192, whereas the successful runs all have input: prompt_tokens values less than or equal to 8192.",
        "recommendation": "Increase the context length limit in the LLM call to a value greater than 8192, such as 12288, to accommodate the longer prompts.",
        "checks": {
          "cited_by": "code",
          "unknown_run_ids": [],
          "cited_but_succeeded": []
        }
      }
    ]
  },
  "notifications": {
    "received_by_local_listener": 34,
    "sample": {
      "received": "2026-11-16T05:08:00.076Z",
      "method": "POST",
      "path": "/notify",
      "content_type": "application/json",
      "bytes": 653,
      "body": {
        "text": "Agent trace review, 2026-11-10T00:00:00Z/2026-11-10T23:59:59Z\n55 runs: 36 ok, 19 failed.\n4 recurring failures and 1 one-off (counted in code).\n4 draft lessons written to /files/learning-loop/lessons.jsonl, status unreviewed:\n- pdf_to_text timeout (6 runs: invoice-extractor)\n- 429 Too Many Requests on crm_api.update_contact (5 runs: crm-updater)\n- Missing Subject in Thread Reply (4 runs: email-drafter)\n- Context Length Exceeded (3 runs: meeting-summariser, contract-reviewer, support-triager)\nA person has to read them before any agent uses them.",
        "runs": 55,
        "failed": 19,
        "lessons": 4,
        "memory_file": "/files/learning-loop/lessons.jsonl"
      }
    },
    "note": "POSTs received by notify_listener.js inside the container. Nothing was sent to Discord, Slack, email or any external service."
  }
}
