Structured extraction

Extract schema-validated JSON from messy HTML or text fixtures with digest-bound provenance.

You’re reading version sha-96dcdfec7a99. Go to the current version

Overview

SKILL.md

Extract

What this skill does

Extract structured JSON from a bounded HTML or plain-text source inside the skill package, validate the result against a declared JSON Schema, and emit a digest-bound provenance packet. The runner is deterministic: it reads local fixture bytes, extracts headings, useful paragraphs, and HTTP/API terms, checks the packet against packets/extraction.schema.json, and returns runx.structured_extraction.result.v1.

This is not a scraper or crawler. Network fetch belongs in a separate governed web-fetch step. This skill starts after the bytes are already available as an approved package fixture, so the runx receipt can bind the input digest, schema digest, and validated output digest without depending on a live website.

When to use this skill

Use this skill when an agent needs a reproducible extraction packet from messy reference material, docs snapshots, benchmark fixtures, or captured public web content. It is appropriate when the source bytes have already been fetched, approved for local use, and pinned inside the skill package.

Use it as the extraction stage in a larger chain: fetch or curate bytes first, run structured extraction second, then pass the validated packet to a downstream agent, reviewer, search index, or evidence bundle.

When not to use this skill

Do not use this skill to fetch URLs, bypass network policy, process private customer data, parse credentials, or summarize a source without a schema. Do not use it when the desired output is free-form prose; this runner exists to produce typed, schema-checked JSON.

If the source bytes are not already present, stop with needs_input and use a web-fetch or repository-read skill with its own authority grant and receipt. If the schema is missing or unknown, stop with needs_more_evidence instead of inventing a packet shape.

Procedure

  1. Resolve input_path and schema_path relative to the skill package.
  2. Reject any path that escapes the package root.
  3. Read the source bytes and JSON Schema bytes.
  4. Record SHA-256 digests for both inputs.
  5. Extract a bounded set of headings, paragraphs, and HTTP/API terms.
  6. Build runx.structured_extraction.result.v1.
  7. Validate the packet against the schema and deterministic internal checks.
  8. Return the packet only when validation passes; otherwise fail closed.

Edge cases and stop conditions

Return needs_input when source_url, input_path, or schema_path is missing. Return needs_more_evidence when the source URL does not identify the origin of the fixture bytes. Return refused if the caller asks the skill to fetch live network content, read outside the package root, process secrets, or extract private user data.

Fail the run if the input file or schema file cannot be read, the schema is not valid JSON, the content type is unsupported, the extracted packet has too few items to be useful, or JSON Schema validation fails. Do not emit a partial success packet.

The authority scope is local fixture read plus local schema read. The proof surface is the sealed receipt containing input digest, schema digest, output digest, validation checks, and source URL.

Output schema

The runner emits structured_extraction_result with packet schema runx.structured_extraction.result.v1:

json
{
  "schema": "runx.structured_extraction.result.v1",
  "source": {
    "url": "https://example.test/source.html",
    "content_type": "text/html",
    "input_path": "fixtures/source.html",
    "input_sha256": "sha256:<hex>",
    "input_bytes": 0
  },
  "extraction": {
    "title": "Document title",
    "summary": {
      "item_count": 0,
      "heading_count": 0,
      "term_count": 0,
      "paragraph_count": 0,
      "text_chars": 0
    },
    "items": []
  },
  "validation": {
    "schema_id": "runx.structured_extraction.result.v1",
    "schema_sha256": "sha256:<hex>",
    "valid": true,
    "engine": "native-json-schema-subset-v1",
    "checks": []
  },
  "provenance": {
    "mode": "fixture",
    "tool_version": "0.1.0",
    "source_kind": "real_public_document",
    "output_payload_sha256": "sha256:<hex>"
  }
}

The packet also includes artifact and signal records that let a downstream receipt reference the input fixture, schema, and validated output.

Worked example

Extract a compact evidence packet from the packaged RFC 9110 fixture:

bash
runx skill "$PWD" extract \
  -i input_path=fixtures/rfc9110-http-semantics.html \
  -i schema_path=packets/extraction.schema.json \
  -i source_url=https://www.rfc-editor.org/rfc/rfc9110.html \
  -i content_type=text/html \
  -i max_items=18 \
  --json

Expected behavior:

  • The run stays local and does not fetch the RFC URL.
  • source.input_sha256 identifies the exact fixture bytes.
  • validation.valid is true only if the packet satisfies the schema and internal extraction checks.
  • The sealed receipt links the source digest, schema digest, and output digest.

Inputs

  • input_path: package-relative path to an HTML or text fixture.
  • schema_path: package-relative JSON Schema path.
  • source_url: canonical public source URL for the fixture bytes.
  • content_type: text/html or text/plain; defaults to text/html.
  • max_items: maximum extracted items to include; clamped by the runner.

Outputs

  • structured_extraction_result: validated packet with source, extraction, validation, provenance, artifacts, and signal metadata.

Published execution profile

The execution profile published with sha-96dcdfec7a99, shown as its exact bytes.

Runner
  • extract
Profile digestsha256:9d12cacbf8ba514abaff5eb9018c9689e313d0c49b527b3758deca14efe8d61c
skill: extract
version: "0.1.10"

catalog:
  kind: skill
  audience: public
  visibility: public
  category: data
  role: canonical
  execution: read
  completion: runtime_receipt
  approval: none
  tags: [extraction, schema-validation, provenance]

harness:
  files:
    - fixtures/rfc9110-http-semantics.html
    - fixtures/support/composed.graph
  cases: []

runners:
  extract:
    default: true
    inputs:
      input_path:
        type: string
        required: true
        description: "Package-relative messy HTML or text fixture."
      schema_path:
        type: string
        required: true
        description: "Package-relative JSON Schema used to validate output."
      source_url:
        type: string
        required: true
        description: "Canonical source URL for the fixture bytes."
      content_type:
        type: string
        required: false
        default: "text/html"
        description: "Input content type: text/html or text/plain."
      max_items:
        type: number
        required: false
        default: 20
        description: "Maximum extracted items to include in output."
    result_from: [extract_structured_json]
    steps:
      - id: extract_structured_json
        tool: structured.extract
        scopes:
          - runx:fixture:read
          - runx:schema:read
        inputs:
          input_path: "$input.input_path"
          schema_path: "$input.schema_path"
          source_url: "$input.source_url"
          content_type: "$input.content_type"
          max_items: "$input.max_items"

Published package and test evidence.

This exact version passed its recorded harness run: 2 checks passed · 0 failed.

Test result

Harness resultPassed
Tested versionsha-96dcdfec7a99
Recorded result2 checks passed · 0 failed
Result sourceReported by the publisher (runx_registry_publish)
Suiterunx-harness
Test recorded
Test recordOpen the recorded run
Inspect receipt referencessha256:c2e07642a8567f51a87794a75f0a214ee47b454e01e4e68ca05c3bcd3dfc2aa4sha256:e22e755ec654a2850aae677a210cdbf846de958b6b977f87cbd9f03c93b9350c

Package identity

Published revisionsha-96dcdfec7a99
Content digestsha256:96dcdfec7a99c3fa43320819cd8d078120cb7ad766a75316a4450790e9b4b4c2
SKILL.md digestsha256:020f114d72bf0e6e15e70ef2dd2f6e6e3e3070c0c845f08e34e9ef92b1ec0e2b
Execution profile digestsha256:9d12cacbf8ba514abaff5eb9018c9689e313d0c49b527b3758deca14efe8d61c
Publisher identityVerified publisher · runx
Trust tierVerified publisherRunx has verified this publisher. This tier is not a code assessment.
Attestations
  • Publisher · Verifiedrunx · 17 Oct 2026
Source provenanceNot published with this version

Version history

  1. 0.1.13Content digest sha256:04e4134b535e0331c36dfec26227c9f674ad30c34cf965a804aa9a5995fbac3d
  2. sha-c20500c8533eContent digest sha256:c20500c8533e2c0083ea01ac87725d5e99b0e9d6eb3bc55f6eb7023ef9494c3d
  3. sha-96dcdfec7a99ViewingContent digest sha256:96dcdfec7a99c3fa43320819cd8d078120cb7ad766a75316a4450790e9b4b4c2
  4. sha-974398020a86Content digest sha256:974398020a86b602c17c1c597e666b0d6b8223ab9a8e3a32b03557d047e0e01d
  5. sha-b2a74a995fecContent digest sha256:b2a74a995fec5bc8a614c24959073bd0f36f0b29b3fade3a8c97ae67d0f1fe91
  6. sha-a90c017e8d7fContent digest sha256:fd842c627ad953dd238dc7ff54b0337d17cea396c0d4b9b4ddb482256c22a947
  7. sha-d6da71476e61Content digest sha256:936d2d924ac8d17662c5d353cd7bcc85c250b4218aba524832343ff60eea5de9
  8. sha-53b134dd5ab0Content digest sha256:b08aae0a619205be70a23432c829ffa4030f8a798cbbc37597f1324f64e166f1