{
  "$schema": "https://unpkg.com/hankweave@0.10.0/schemas/hank.schema.json",
  "meta": {
    "name": "connector-build-test",
    "version": "1.0.0",
    "description": "Clausetta-derived polymorphic build fixture: a fixed spec + deterministic bun test suite, an agentic build loop with fresh continuation and an eval rig between iterations, then a documentation codon with a beforeCopy quality gate."
  },
  "hank": [
    {
      "id": "research",
      "name": "Read the spec and test suite",
      "model": "haiku",
      "continuationMode": "fresh",
      "promptFile": "prompts/research.md",
      "rigSetup": [
        {
          "type": "copy",
          "copy": {
            "from": "spec.md",
            "to": "spec.md"
          }
        },
        {
          "type": "copy",
          "copy": {
            "from": "tests",
            "to": "tests"
          }
        }
      ],
      "checkpointedFiles": ["notes.md"],
      "onFailure": "abort",
      "budget": {
        "maxDollars": 0.2,
        "maxTimeSeconds": 240,
        "onExceeded": "fail"
      }
    },
    {
      "type": "loop",
      "id": "build",
      "name": "Build the connector until the tests pass",
      "terminateOn": {
        "type": "iterationLimit",
        "limit": 3
      },
      "budget": {
        "maxDollars": 0.6,
        "maxTimeSeconds": 600,
        "onExceeded": "complete"
      },
      "codons": [
        {
          "id": "implement",
          "name": "Write the connector implementation",
          "model": "haiku",
          "continuationMode": "fresh",
          "promptFile": "prompts/build.md",
          "rigSetup": [
            {
              "type": "copy",
              "copy": {
                "from": "spec.md",
                "to": "spec.md"
              }
            },
            {
              "type": "copy",
              "copy": {
                "from": "tests",
                "to": "tests"
              }
            },
            {
              "type": "command",
              "command": {
                "run": "bun test 2>&1 | tee test-output.txt"
              },
              "allowFailure": true
            }
          ],
          "checkpointedFiles": ["connector.ts"],
          "onFailure": "retry",
          "retryConfig": {
            "maxAttempts": 2,
            "delayMs": 1000,
            "maxDelayMs": 60000
          },
          "budget": {
            "maxDollars": 0.2,
            "maxTimeSeconds": 300,
            "onExceeded": "complete"
          }
        }
      ]
    },
    {
      "id": "document",
      "name": "Write the implementation note",
      "model": "haiku",
      "continuationMode": "fresh",
      "promptFile": "prompts/document.md",
      "checkpointedFiles": ["IMPLEMENTATION.md"],
      "outputFiles": [
        {
          "beforeCopy": [
            {
              "type": "command",
              "command": {
                "run": "bun test"
              }
            }
          ],
          "copy": ["IMPLEMENTATION.md", "connector.ts"]
        }
      ],
      "onFailure": "abort",
      "budget": {
        "maxDollars": 0.2,
        "maxTimeSeconds": 240,
        "onExceeded": "fail"
      }
    }
  ]
}
