mif-docs Plugin — Architecture Document (arc42)
mif-docs Plugin — Architecture (arc42)
Section titled “mif-docs Plugin — Architecture (arc42)”1. Introduction and Goals
Section titled “1. Introduction and Goals”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:
- Conformance — every shipped document validates against the canonical MIF schema, deterministically, with no LLM in the conformance path.
- Self-consistency — the plugin’s own docs are authored by its own genre skills and pass its own gates (dogfooding).
- Trustable releases — what users install is the reproducible, signed, SLSA-attested artifact, verified fail-closed before publication.
Stakeholders:
| Role | Concern |
|---|---|
| Doc author | Picks a genre skill and gets a conformant, well-shaped document. |
| Coding agent | Consumes the JSON-LD projection as structured, queryable knowledge. |
| Plugin maintainer | Keeps skills, schema cache, and the release pipeline green. |
| Marketplace operator | Admits only releases whose attestation verifies. |
2. Architecture Constraints
Section titled “2. Architecture Constraints”- Deterministic conformance —
mif-validatemust 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.
3. Context and Scope
Section titled “3. Context and Scope”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.devschema — the canonical, authoritative MIF JSON Schema the plugin hydrates and validates against.modeled-information-format/ontologiesrepo — the sibling ontology source the plugin hydrates at dev time and vendors into the release artifact.claude-code-pluginsmarketplace — 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).
4. Solution Strategy
Section titled “4. Solution Strategy”| Goal | Strategy |
|---|---|
| Conformance | Project markdown to JSON-LD and validate with ajv + ajv-formats against the canonical schema; no LLM in the path. |
| Self-consistency | Ship good.md exemplars per genre and validate every one in CI (check-exemplars). |
| Trustable releases | Build a reproducible git archive tarball, attest SLSA provenance, and verify it before upload. |
| Safety at authoring time | A 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.
5. Building Block View
Section titled “5. Building Block View”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) anddoc-set-planner(engine plus the diataxis, ai-spec, kiro, and architecture recipes). Each genre shipsgood-l1.md,good.md,bad.md, andevals/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, andplanner-check.hooks/—hooks.jsonregisters the PostToolUse guardmif-guard.mjs.schema/— the hydrated schema cache plusVENDOR.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.
6. Runtime View
Section titled “6. Runtime View”Scenario: an author writes a genre document.
- Author — a genre skill produces a MIF document and writes it via the host.
- Guard — the PostToolUse hook fires on Write/Edit/MultiEdit and runs
mif-validate --level 1on the new file; a failing genre doc makes the hook exit 2 and blocks the write. (type: adrdocs are skipped here — they are validated by the structured-madr action instead.) - 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.
- Projection —
mif-convertderives 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.
7. Deployment View
Section titled “7. Deployment View”- CI (
.github/workflows/ci.yml) runs three job groups:pin-checkplusactionlint(thin callers of the org central.githubreusables@789b6baf);validate(validate-plugin, hydrate-schema, mif-validate over every shippedgood.md, check-exemplars, planner-check,test:hook,lint:md); andadr-smadr(the structured-madr action in both smadr and mif modes). All green onmain. - Release (
.github/workflows/release.yml) builds a reproduciblegit archivetarball, attests SLSA build provenance withactions/attest-build-provenance, verifies it fail-closed withgh attestation verify --signer-workflowbefore upload, and uploads only on a published release. Aworkflow_dispatchrun is a dry run. v0.1.0 is released and attested asmif-docs-plugin-v0.1.0.tar.gz. - Admission — the
claude-code-pluginsmarketplace verifies that release attestation fail-closed (catalog-admissiongreen) before listing.
8. Cross-cutting Concepts
Section titled “8. Cross-cutting Concepts”- MIF levels — documents climb an L1 → L2 → L3 floor;
mif-validate --levelapplies a required-field overlay (L3 requiresnamespace,modified,temporal.validFrom, andprovenance). - 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.
9. Architecture Decisions
Section titled “9. Architecture Decisions”| Decision | Rationale |
|---|---|
| No LLM in the conformance path | A verdict must be reproducible and auditable; only schema validation gives that. |
| Schema is a hydrated cache, not vendored authority | Keeps mif-spec.dev the single source of truth while allowing offline runs. |
| Verify attestation before upload | Fail-closed: an unverifiable artifact never reaches a release. |
Skip type: adr in the write guard | ADRs 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.
10. Quality Requirements
Section titled “10. Quality Requirements”Quality tree (goal → scenario):
- Conformance
- Deterministic verdict: given identical document input and an identical
resolved schema,
mif-validatereturns the identical PASS/FAIL result.
- Deterministic verdict: given identical document input and an identical
resolved schema,
- Self-consistency
- Exemplar coverage: when CI runs, every shipped
good.mdvalidates at its declared target level andcheck-exemplarsconfirms the L1→target climb.
- Exemplar coverage: when CI runs, every shipped
- Trustable releases
- Fail-closed verification: when a release artifact’s attestation does not verify, the workflow stops before upload and publishes nothing.
11. Risks and Technical Debt
Section titled “11. Risks and Technical Debt”| Risk / debt | Impact | Mitigation |
|---|---|---|
Schema drift between cache and mif-spec.dev | Stale conformance verdicts | hydrate-schema re-resolves and re-locks VENDOR.lock on each CI run. |
| Ontology lives in a separate repo | A breaking ontology change can fail validation | validate-ontology gates the hydrated copy; the release vendors a pinned copy. |
| Offline schema fallback | Validation may use an outdated copy | The fallback emits a warning so the staleness is visible. |
12. Glossary
Section titled “12. Glossary”| Term | Definition |
|---|---|
| MIF | Modeled Information Format — the canonical schema documents conform to. |
| Genre skill | A skill that authors one documentation genre (e.g. arc42, ADR). |
| Projection | The lossless markdown↔JSON-LD transform in scripts/lib/projection.mjs. |
| Level floor | The minimum required fields for MIF L1, L2, or L3 conformance. |
| Fail-closed | A gate that denies by default when verification does not succeed. |