Skip to content

mif-docs Plugin — Architecture Document (arc42)

mif-docs is a Claude Code plugin (v0.1.0, repo modeled-information-format/mif-docs-plugin, MIT) that ships one authoring skill per documentation genre and makes every document it produces a MIF (Modeled Information Format) conformant artifact. The plugin documents itself with its own skills — this arc42 document is one such artifact.

Top quality goals:

  1. Conformance — every shipped document validates against the canonical MIF schema, deterministically, with no LLM in the conformance path.
  2. Self-consistency — the plugin’s own docs are authored by its own genre skills and pass its own gates (dogfooding).
  3. Trustable releases — what users install is the reproducible, signed, SLSA-attested artifact, verified fail-closed before publication.

Stakeholders:

RoleConcern
Doc authorPicks a genre skill and gets a conformant, well-shaped document.
Coding agentConsumes the JSON-LD projection as structured, queryable knowledge.
Plugin maintainerKeeps skills, schema cache, and the release pipeline green.
Marketplace operatorAdmits only releases whose attestation verifies.
  • Deterministic conformancemif-validate must give identical input plus identical resolved schema the identical verdict; no model call in that path.
  • SHA-pinned actions — every GitHub Action is pinned to a commit SHA; CI enforces it with pin-check.
  • MIT licensed — the plugin and all bundled tooling ship under MIT.
  • Claude Code host — the plugin runs inside the Claude Code host and obeys its skill, hook, and marketplace contracts.

mif-docs is a black box wired to four external parties:

  • Claude Code host — loads the plugin’s skills and runs its PostToolUse hook.
  • mif-spec.dev schema — the canonical, authoritative MIF JSON Schema the plugin hydrates and validates against.
  • modeled-information-format/ontologies repo — the sibling ontology source the plugin hydrates at dev time and vendors into the release artifact.
  • claude-code-plugins marketplace — the org marketplace that distributes the plugin and admits releases whose attestation verifies fail-closed.

In scope: genre authoring skills, the deterministic conformance gate, the fail-closed write guard, and the attested release pipeline. Out of scope: the MIF specification itself (owned by mif-spec.dev) and the ontology vocabulary (owned by the ontologies repo).

GoalStrategy
ConformanceProject markdown to JSON-LD and validate with ajv + ajv-formats against the canonical schema; no LLM in the path.
Self-consistencyShip good.md exemplars per genre and validate every one in CI (check-exemplars).
Trustable releasesBuild a reproducible git archive tarball, attest SLSA provenance, and verify it before upload.
Safety at authoring timeA PostToolUse hook blocks any genre doc that fails the L1 floor.

The schema is treated as a refreshable cache, never an authority: it auto-hydrates from mif-spec.dev/schema and records the resolved version in schema/VENDOR.lock; offline, the last hydrated copy is used with a warning.

Level 1 decomposes mif-docs into four black boxes:

  • skills/ — 37 genre skills (the four Diataxis quadrants, arc42-arch-doc, c4-model-diagram, google-design-doc, engineering, adr, rust-rfc, python-pep, changelog, sre-runbook, playbook, prd, feature-spec, ai-architecture-doc, the three Kiro skills, five scholarly/scientific-writing genres, six regulated/compliance-report genres, four research/market-intelligence genres, and two business-communication genres — see skills by purpose for the full grouping) plus 3 substrate skills (mif-frontmatter L1–L3, ears-acceptance-criteria, mif-validate) and doc-set-planner (engine plus the diataxis, ai-spec, kiro, and architecture recipes). Each genre ships good-l1.md, good.md, bad.md, and evals/evals.json.
  • scripts/ — the deterministic tooling: mif-validate, mif-convert (emit-jsonld | emit-markdown | roundtrip), hydrate-schema, hydrate-ontology, validate-ontology, validate-plugin, check-exemplars, and planner-check.
  • hooks/hooks.json registers the PostToolUse guard mif-guard.mjs.
  • schema/ — the hydrated schema cache plus VENDOR.lock.

The genre skills emit documents; mif-validate (shared projection in scripts/lib/projection.mjs) is the one gate the skills, the hook, and CI all call.

Scenario: an author writes a genre document.

  1. Author — a genre skill produces a MIF document and writes it via the host.
  2. Guard — the PostToolUse hook fires on Write/Edit/MultiEdit and runs mif-validate --level 1 on the new file; a failing genre doc makes the hook exit 2 and blocks the write. (type: adr docs are skipped here — they are validated by the structured-madr action instead.)
  3. mif-validate — projects the markdown to JSON-LD, validates against the hydrated canonical schema, enforces the requested level floor, and checks the markdown↔JSON-LD round-trip is lossless.
  4. Projectionmif-convert derives the JSON-LD (or re-emits markdown) on demand for machine consumers.

The conformance verdict is off any model’s judgement: identical input and schema yield the identical result every time.

  • CI (.github/workflows/ci.yml) runs three job groups: pin-check plus actionlint (thin callers of the org central .github reusables @789b6baf); validate (validate-plugin, hydrate-schema, mif-validate over every shipped good.md, check-exemplars, planner-check, test:hook, lint:md); and adr-smadr (the structured-madr action in both smadr and mif modes). All green on main.
  • Release (.github/workflows/release.yml) builds a reproducible git archive tarball, attests SLSA build provenance with actions/attest-build-provenance, verifies it fail-closed with gh attestation verify --signer-workflow before upload, and uploads only on a published release. A workflow_dispatch run is a dry run. v0.1.0 is released and attested as mif-docs-plugin-v0.1.0.tar.gz.
  • Admission — the claude-code-plugins marketplace verifies that release attestation fail-closed (catalog-admission green) before listing.
  • MIF levels — documents climb an L1 → L2 → L3 floor; mif-validate --level applies a required-field overlay (L3 requires namespace, modified, temporal.validFrom, and provenance).
  • Fail-closed — every gate denies by default: the write guard blocks on failure (exit 2), and the release verifies the attestation before upload rather than after.
  • Determinism — the conformance path is pure schema validation; no network call and no model call decide the verdict.
  • Schema as cache — authority lives at mif-spec.dev; the local copy is a hydrated, version-locked cache that degrades to its last copy offline.
DecisionRationale
No LLM in the conformance pathA verdict must be reproducible and auditable; only schema validation gives that.
Schema is a hydrated cache, not vendored authorityKeeps mif-spec.dev the single source of truth while allowing offline runs.
Verify attestation before uploadFail-closed: an unverifiable artifact never reaches a release.
Skip type: adr in the write guardADRs are validated by the structured-madr action, avoiding a double gate.

Each consequential choice is recorded as a full ADR under docs/adr/; this table is the index.

Quality tree (goal → scenario):

  • Conformance
    • Deterministic verdict: given identical document input and an identical resolved schema, mif-validate returns the identical PASS/FAIL result.
  • Self-consistency
    • Exemplar coverage: when CI runs, every shipped good.md validates at its declared target level and check-exemplars confirms the L1→target climb.
  • Trustable releases
    • Fail-closed verification: when a release artifact’s attestation does not verify, the workflow stops before upload and publishes nothing.
Risk / debtImpactMitigation
Schema drift between cache and mif-spec.devStale conformance verdictshydrate-schema re-resolves and re-locks VENDOR.lock on each CI run.
Ontology lives in a separate repoA breaking ontology change can fail validationvalidate-ontology gates the hydrated copy; the release vendors a pinned copy.
Offline schema fallbackValidation may use an outdated copyThe fallback emits a warning so the staleness is visible.
TermDefinition
MIFModeled Information Format — the canonical schema documents conform to.
Genre skillA skill that authors one documentation genre (e.g. arc42, ADR).
ProjectionThe lossless markdown↔JSON-LD transform in scripts/lib/projection.mjs.
Level floorThe minimum required fields for MIF L1, L2, or L3 conformance.
Fail-closedA gate that denies by default when verification does not succeed.