FHIR AST cache

Restore, verify, seed and diagnose the prebuilt AST artefacts for an IG. Always try restore first: a full AST build via AstExportCli is expensive, a restore is fast. seed commits the IG API a layer above generates from the AST (ig-site:sidecars, via ig-api-cache.ts) as ig-api/ beside it, and the artefact index built from that tree (ig-index-cache.ts) as fhir-artifact-index/index.json, so a site reads both by raw URL at the cache commit.

Skills it satisfies

A skill states the capability; this Tool is one way to exercise it. Each skill’s declared input and output contract follows, where it has one.

compiled-artefact-cache

The general pattern for caching expensive compiled artefacts (Lean .oleans, FHIR ASTs) across builds. Defines branch-based storage, validity checking, exit code protocol, safety guards, and the restore→build→contribute loop.

Source: cat-harness/skills/process/process-core/compiled-artefact-cache.md.

Also satisfied by: ig-ast-refresh.

The skill declares no I/O contract (schemas/skills/compiled-artefact-cache/{input,output}.schema.json).

ig-ast-delta

List and view what changed between two IG ASTs, check whether an AST is still valid for the IG’s current inputs, and render the delta as just-the-docs pages that carry the provisional mark. Read before trusting a cached AST, before reviewing an incremental IG build, and before rendering anything from a cache.

Source: fhir-harness/skills/fhir-ig-base/ig-ast-delta.md.

Also satisfied by: ig-ast-diff, ig-ast-jsonld, ig-ast-list, ig-ast-pages, ig-ast-plan, ig-ast-render, ig-ast-validity.

The skill declares no I/O contract (schemas/skills/ig-ast-delta/{input,output}.schema.json).

Inputs and outputs

Each port names a shared type by IRI, so two Tools for one skill can be checked for interchangeability.

porttyperequireddescriptionconstraint
inactionIgCacheActionyesThe verb. doctor diagnoses a restore that missed.string · one of status, restore, seed, contribute, verify, list, doctor · An ig-cache verb: restore AST, seed it, or diagnose.
inigRootRepoPathThe IG whose AST is acted on.string · pattern ^[A-Za-z0-9._][A-Za-z0-9._/-]*$ · A path relative to the repository root. No .. segments.
inpackagePackageNamestring · pattern ^[a-z][a-z0-9-]*$ · A skill package, e.g. folio-core
inremotePackageNameGit remote to fetch from / push to. Default ‘origin’. Use when the IG’s origin is upstream and the cache lives on a fork.string · pattern ^[a-z][a-z0-9-]*$ · A skill package, e.g. folio-core
outresultTextA real hit, a miss, or a diagnosis — never a miss that reads as a hit.string · A short single-line human string. Not admissible as a command-line argument.

Processes and tasks

Steps this Tool can carry out, because each names a skill it satisfies:

processsteplanevia skill
The cache process: restore and save every cache a run can useLean .oleans: restore / saveBuild pipelinecompiled-artefact-cache
Is the incremental IG AST what a full build would have produced?Check the base AST against the inputsIncremental build (system)ig-ast-delta
Is the incremental IG AST what a full build would have produced?Diff the two ASTsIncremental build (system)ig-ast-delta
Is the incremental IG AST what a full build would have produced?Read the deltaQC reviewerig-ast-delta
An IG site, built from the AST on its cache branchRestore and judge the cached ASTSite build (agent, stage-local)ig-ast-delta
An IG site, built from the AST on its cache branchSeed the cache branchAST refresh (GitHub runner: IG Publisher with the AST exporter)compiled-artefact-cache
SMART Guideline end to endReview each L3 asset (before / after if adapted)Human adjudicatorsig-ast-delta

How it is deployed and reached

  • Command line. From the repository root: fhir-harness/scripts/ig-cache.sh.
  • GitHub Actions. 4 workflow line(s) run its command:
workflowline
fhir-harness/.github/workflows/ig-ast-refresh.yml162[ -f fhir-harness/scripts/ig-cache.sh ] \|\| { echo "::error::the lock mounts no fhir-harness"; exit 2; }
fhir-harness/.github/workflows/ig-ast-refresh.yml172if bash fhir-harness/scripts/ig-cache.sh restore --ig-root .; then
fhir-harness/.github/workflows/ig-ast-refresh.yml552bash fhir-harness/scripts/ig-cache.sh seed --ig-root . --push
fhir-harness/.github/workflows/ig-release.yml107[ -f fhir-harness/scripts/ig-cache.sh ] \|\| { echo "::error::the lock mounts no fhir-harness"; exit 2; }

As an API: its operation in the OpenAPI document and the MCP tool list of its layer.

installnone
runtimebash, git
networkyes

When a host it reaches is refused:

host / errorremedy
packages.fhir.orgtool fhir-cache-seed-npm
tx.fhir.orgnone: No declared Tool replaces the terminology server. The HL7 IG Publisher’s own -tx n/a skips terminology validation, at the cost of not validating it.

What it is made of

Linked data

The Tool is published as its own JSON-LD document at its IRI, https://litlfred.github.io/folio-assistant/fhir-harness/tools/ig-cache.jsonld, partOf its layer’s document. The node below is the definition this page was drawn from, and is embedded in the page as application/ld+json.

{
  "@context": "https://litlfred.github.io/folio-assistant/fhir-harness/fhir-harness.context.jsonld",
  "@id": "https://litlfred.github.io/folio-assistant/fhir-harness/tools/ig-cache.jsonld",
  "@type": "https://litlfred.github.io/cat-harness/v0/ns/Tool",
  "partOf": "https://litlfred.github.io/folio-assistant/fhir-harness/fhir-harness.jsonld",
  "name": "ig-cache",
  "title": "FHIR AST cache",
  "description": "Restore, verify, seed and diagnose the prebuilt AST artefacts for an IG. Always try `restore` first: a full AST build via AstExportCli is expensive, a restore is fast. `seed` commits the IG API a layer above generates from the AST (`ig-site:sidecars`, via `ig-api-cache.ts`) as `ig-api/` beside it, and the artefact index built from that tree (`ig-index-cache.ts`) as `fhir-artifact-index/index.json`, so a site reads both by raw URL at the cache commit.",
  "install": {
    "none": true
  },
  "invoke": {
    "shell": "fhir-harness/scripts/ig-cache.sh"
  },
  "io": {
    "inputs": [
      {
        "name": "action",
        "schema": "https://litlfred.github.io/folio-assistant/cat-harness/tool-types.schema.json#/$defs/IgCacheAction",
        "description": "The verb. `doctor` diagnoses a restore that missed.",
        "required": true,
        "arg": {
          "positional": 0
        }
      },
      {
        "name": "igRoot",
        "schema": "https://litlfred.github.io/folio-assistant/cat-harness/tool-types.schema.json#/$defs/RepoPath",
        "description": "The IG whose AST is acted on.",
        "required": false,
        "arg": {
          "flag": "--ig-root"
        }
      },
      {
        "name": "package",
        "schema": "https://litlfred.github.io/folio-assistant/cat-harness/tool-types.schema.json#/$defs/PackageName",
        "required": false,
        "arg": {
          "flag": "--package"
        }
      },
      {
        "name": "remote",
        "schema": "https://litlfred.github.io/folio-assistant/cat-harness/tool-types.schema.json#/$defs/PackageName",
        "description": "Git remote to fetch from / push to. Default 'origin'. Use when the IG's origin is upstream and the cache lives on a fork.",
        "required": false,
        "arg": {
          "flag": "--remote"
        }
      }
    ],
    "outputs": [
      {
        "name": "result",
        "schema": "https://litlfred.github.io/folio-assistant/cat-harness/tool-types.schema.json#/$defs/Text",
        "description": "A real hit, a miss, or a diagnosis — never a miss that reads as a hit."
      }
    ]
  },
  "satisfies": [
    "compiled-artefact-cache",
    "ig-ast-delta"
  ],
  "requirements": {
    "runtime": [
      "bash",
      "git"
    ],
    "network": true
  },
  "remedies": [
    {
      "host": "packages.fhir.org",
      "tool": "fhir-cache-seed-npm"
    },
    {
      "host": "tx.fhir.org",
      "none": "No declared Tool replaces the terminology server. The HL7 IG Publisher's own `-tx n/a` skips terminology validation, at the cost of not validating it."
    }
  ]
}

folio-assistant — code under the Apache License 2.0, documentation under CC BY 3.0. Generated schema and API references are rebuilt from source on every push to main.

deployed dev