Formal edges from the Lean build

Extract ELABORATED formal dependencies between a folio’s lean.ref declarations (LeanArchitect’s rule over the folio’s own lean.ref set). Needs a Lean toolchain and a built Lake project. Tagged declarations missing from the build are reported, never recorded as dependency-free; with ingest the result is recorded in the formal cache as source “elaborated”.

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.

lean-formal-edges

Extract ELABORATED formal dependencies between a folio’s lean.ref declarations — the trustworthy replacement for the lexical --scan cache. Use when the formal graph matters (impact analysis, staleness, a blueprint’s \uses), when lean-formal-graph reports source “scan”, or before trusting a type/value split.

Source: folio-assistant-sci/skills/lean/lean-formal-edges.md.

The skill declares no I/O contract (schemas/skills/lean-formal-edges/{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
inlake_dirRepoPathyesThe folio’s Lake project directory (holds lakefile.* and .lake/).string · pattern ^[A-Za-z0-9._][A-Za-z0-9._/-]*$ · A path relative to the repository root. No .. segments.
inrootRepoPathContent root to collect lean.ref targets from (default: the folio’s declared one).string · pattern ^[A-Za-z0-9._][A-Za-z0-9._/-]*$ · A path relative to the repository root. No .. segments.
iningestFlagRecord the result in the formal cache as source “elaborated”.boolean · A boolean switch — projects to a bare flag, with no value word
outreportMarkdownThe extracted edges, or why they could not be determined — never an empty edge set in place of a failure.string · Markdown text. Not admissible as a command-line argument — see INJECTION_SAFE.

Processes and tasks

No process step names a skill this Tool satisfies.

How it is deployed and reached

  • MCP. Served as lean_formal_edges by sage (cat-harness-tools/scripts/sage-mcp.sh), google-drive (cat-harness-tools/scripts/google-drive-mcp.sh), folio-assistant (bun run cat-harness-tools/src/index.ts --stdio --repo .), the servers .mcp.json declares.
  • In process. pipeline/formal-edges-mcp.ts — loaded by the harness directly, with no server.
  • GitHub Actions. No workflow in this checkout runs its command.

The MCP tool it serves, as tools/list answers:

lean_formal_edges — read from its registrar.

lean_formal_edges [1..1]lean-formal-edges«tool»lean-formal-edgeslean_formal_edges : LeanFormalEdgesInput [1..1]LeanFormalEdgesInput«json-schema»LeanFormalEdgesInputlake_dir : string [1..1]root : string [0..1]ingest : boolean [0..1]
parametertyperequireddescription
lake_dirstringyesThe folio’s Lake project directory (holds lakefile.* and .lake/)
rootstringContent root to collect lean.ref targets from (default: the folio’s declared one)
ingestbooleanRecord the result in the formal cache as source “elaborated”

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

installnone
runtimebun, lake
networkno

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/folio-assistant-sci/tools/lean-formal-edges.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/folio-assistant-sci/folio-assistant-sci.context.jsonld",
  "@id": "https://litlfred.github.io/folio-assistant/folio-assistant-sci/tools/lean-formal-edges.jsonld",
  "@type": "https://litlfred.github.io/cat-harness/v0/ns/Tool",
  "partOf": "https://litlfred.github.io/folio-assistant/folio-assistant-sci/folio-assistant-sci.jsonld",
  "name": "lean-formal-edges",
  "title": "Formal edges from the Lean build",
  "description": "Extract ELABORATED formal dependencies between a folio's lean.ref declarations (LeanArchitect's rule over the folio's own lean.ref set). Needs a Lean toolchain and a built Lake project. Tagged declarations missing from the build are reported, never recorded as dependency-free; with ingest the result is recorded in the formal cache as source \"elaborated\".",
  "install": {
    "none": true
  },
  "invoke": {
    "mcp": {
      "tool": "lean_formal_edges"
    },
    "inProcess": {
      "module": "pipeline/formal-edges-mcp.ts"
    }
  },
  "io": {
    "inputs": [
      {
        "name": "lake_dir",
        "schema": "https://litlfred.github.io/folio-assistant/cat-harness/tool-types.schema.json#/$defs/RepoPath",
        "description": "The folio's Lake project directory (holds lakefile.* and .lake/).",
        "required": true
      },
      {
        "name": "root",
        "schema": "https://litlfred.github.io/folio-assistant/cat-harness/tool-types.schema.json#/$defs/RepoPath",
        "description": "Content root to collect lean.ref targets from (default: the folio's declared one).",
        "required": false
      },
      {
        "name": "ingest",
        "schema": "https://litlfred.github.io/folio-assistant/cat-harness/tool-types.schema.json#/$defs/Flag",
        "description": "Record the result in the formal cache as source \"elaborated\".",
        "required": false
      }
    ],
    "outputs": [
      {
        "name": "report",
        "schema": "https://litlfred.github.io/folio-assistant/cat-harness/tool-types.schema.json#/$defs/Markdown",
        "description": "The extracted edges, or why they could not be determined — never an empty edge set in place of a failure."
      }
    ]
  },
  "satisfies": [
    "lean-formal-edges"
  ],
  "requirements": {
    "runtime": [
      "bun",
      "lake"
    ],
    "network": false
  }
}

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