agentleFS
modeled-information-formatmodeled-information-format/mif-docs-plugin/skills/mif-corpus/SKILL.md

mif-corpus

Skill1 starsChanged 35 days agoMITView on GitHub

Semantically index and query a corpus of MIF documents — ingest docs into a local vector store, run free-text search, find similar documents for cross-linking, and report corpus statistics via the optional mif-rs tools (mif-mcp MCP server or mif-cli). Use when a request needs discovery over existing MIF docs ("which doc covers X?", "what should this link to?"). Anti-trigger; for proving conformance use mif-validate — similarity is a suggestion signal, never a gate.

  • Installs packages

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Document ids are the MIF @id (urn:mif:<id> from the frontmatter id).

    line 38
  2. Very specific:

    Search and similar results are (score, id) pairs, most similar first.

    line 52
  3. Very specific:

    Every failure renders as an RFC 9457 application/problem+json envelope with type, status, detail, and often suggested_fix + code_actions[].

    line 110

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

mif-corpus

Shared substrate for semantic discovery over MIF documents. Where mif-validate proves what a document IS (deterministically), this skill finds what a document is ABOUT — a local-embedding vector index queried by meaning, not string match. It is backed entirely by the optional mif-rs tools and is an enhancement layer: nothing in this suite's conformance path depends on it.

Tool resolution order (never fake results)

  1. MCP tools — when an mif-mcp server is connected in the session, use its tools: ingest_mif_document, search_documents, find_similar_documents, corpus_stats (and validate_mif_document, resolve_ontology_reference for the non-corpus operations).
  2. CLI fallback — when only the mif-cli binary is on PATH, use the matching subcommands: ingest, search, find-similar, corpus-stats.
  3. Neither available — say so plainly, point at the install route (attested release binaries from modeled-information-format/mif-rs, or cargo install mif-cli mif-mcp), and stop. Do not simulate scores, invent matches, or substitute grep output labeled as semantic search.

Store convention

  • The vector store lives at .mif/vectors.db, created on first ingest. The tools' default is relative to the working directory — run them from the repo root so the store lands at <repo>/.mif/vectors.db (or pass --db-path / the db_path parameter to pin it explicitly; a run from a subdirectory otherwise creates a second store silently). It is gitignored — a derived local index, never committed, never an authority.
  • Document ids are the MIF @id (urn:mif:<id> from the frontmatter id).
  • Re-ingesting a changed document upserts its embedding; ingest is fail-closed — a document that fails schema validation or the lossless round-trip stores nothing.

Operations

OperationMCP toolCLIBehavior
Ingestingest_mif_documentmif-cli ingest <file>validate + prove round-trip + embed + store
Searchsearch_documentsmif-cli search "<query>"rank stored docs by cosine similarity to the query
Similarfind_similar_documentsmif-cli find-similar <id>rank docs similar to an ingested one, anchor excluded
Statscorpus_statsmif-cli corpus-statscount, embedding dimension, db path

Search and similar results are (score, id) pairs, most similar first. Scores are cosine similarity; on this suite's own corpus, useful matches typically land in the ~0.55-0.78 range. Treat results as candidates for a human or a genre skill to act on — never as a validation verdict.

Multi-root queries (spanning a shared central store)

search/find-similar/corpus-stats (CLI) and their MCP counterparts search_documents/find_similar_documents/corpus_stats accept an additional, repeatable root: --extra-db-path <path> on the CLI, an extra_db_paths array parameter on the MCP tools. This lets a query span the project-local .mif/vectors.db and any number of other vector stores in one call — most commonly a shared, user-level central corpus that multiple projects ingest into (e.g. the claude-artifact-authoring plugin's persist-artifact skill best-effort-ingests graded artifacts into one via mif-corpus ingest, at an XDG-conformant path — $HOME/.local/share/claude-artifact-authoring/corpus/vectors.db, i.e. ${XDG_DATA_HOME:-$HOME/.local/share} with the default expanded).

  • Results are merge-ranked by cosine similarity across every root for search/find-similar — not grouped or root-ordered — with each match additionally tagged with the root it came from. Single-root behavior (no --extra-db-path/extra_db_paths given) is unchanged.
  • corpus-stats/corpus_stats is not a ranked search — with extra roots it returns the primary root's count/dim plus a total_count and a per-root breakdown (extra_roots); nothing is merge-ranked, since there is no query vector in a stats call.
  • Fails closed per root: a root that cannot be opened or queried aborts the whole call rather than silently dropping it from the results. A root that has a valid parent directory but no database file yet (never ingested) is treated as empty, not an error.
  • The same document id can legitimately exist in more than one root (e.g. a document ingested both locally and into the shared central store) — this is expected, not a collision to dedupe.

Known exclusion: documents with a description: key (the ADRs)

Documents carrying a top-level description: frontmatter key currently fail the Rust round-trip check inside ingest (the key is dropped by the canonical re-serialization; tracked upstream and in this repo's engine-convergence epic). In this suite's corpus those are exactly the ADR documents under docs/adr/, which carry MIF type: adr (conceptType: semantic), so the skip set is identifiable by the description: key, the docs/adr/ path, or the type: adr frontmatter value alike. Skip them in bulk ingests and say that they were skipped and why. This sits alongside the suite's existing rule that the adr genre is validated by the structured-madr Action, not mif-validate.

First-run cost

The first ingest or search downloads the sentence-embedding model into the local hf-hub cache — it needs network access once and takes noticeably longer than subsequent runs. Vectors are 384-dimensional. Warn about this before a first bulk ingest; after the model is cached, runs are local and fast.

Reading failures

Every failure renders as an RFC 9457 application/problem+json envelope with type, status, detail, and often suggested_fix + code_actions[]. Honor the applicability marker: apply a machine_applicable fix, surface a maybe_incorrect one to the user instead of auto-applying. A 404 document-not-found from find-similar means the anchor was never ingested — ingest it first.

How the suite uses this

doc-set-planner's corpus-aware Plan and Reconcile steps (shipped as their own change, stacked on this skill) consume it in two places: at Plan time, search the corpus for existing coverage of each proposed member (surface strong hits as "extend instead of create?" decisions); at Reconcile time, offer find-similar results as candidate relationships[] targets. In both cases the recipe contract and the deterministic planner-check gate stay authoritative.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.