Vibe.Plugins.Rules.Loader (vibe v0.2.3)

Copy Markdown View Source

Load rule files from ~/.vibe/rules/ into the system prompt.

Rule files are Markdown files (.md) scanned recursively. Optional YAML frontmatter controls filtering:

---
models: "openai_codex/*"
---
Always use pattern matching instead of if/else chains.

Rules without models: frontmatter apply to all models. The models: field accepts a glob pattern or list of patterns matched against provider:model_id.

Loaded automatically by Vibe.Plugins.Rules.

Summary

Types

rule()

@type rule() :: %{path: String.t(), body: String.t(), models: [String.t()] | nil}

Functions

filter_for_model(rules, model)

@spec filter_for_model([rule()], String.t() | nil) :: [rule()]

load()

@spec load() :: [rule()]

load_dir(dir)

@spec load_dir(String.t()) :: [rule()]

rules_dir()

@spec rules_dir() :: String.t()

Intentional facade for the public Vibe API boundary.

system_prompt_block(model \\ nil)

@spec system_prompt_block(String.t() | nil) :: String.t()