{
  "id": "service/launchctl",
  "family": "service-state",
  "description": "Compact launchctl output while preserving labels and status rows.",
  "match": {
    "toolNames": ["exec"],
    "argv0": ["launchctl"]
  },
  "transforms": {
    "stripAnsi": true,
    "dedupeAdjacent": true,
    "trimEmptyEdges": true
  },
  "filters": {
    "keepPatterns": [
      "^-?\\d+\\s+\\S+\\s+.+",
      "^PID\\s+Status\\s+Label$",
      "error|failed|stopped|disabled"
    ]
  },
  "summarize": {
    "head": 8,
    "tail": 6
  },
  "failure": {
    "preserveOnFailure": true,
    "head": 10,
    "tail": 10
  },
  "counters": [
    {
      "name": "service",
      "pattern": "^(?!PID\\s+Status\\s+Label$).+\\S.*$"
    },
    {
      "name": "error",
      "pattern": "error|failed|stopped|disabled",
      "flags": "i"
    }
  ]
}
