At present there are two kinds of mods: built-in and local. Local mods are, as the name implies, specific to a given installation. Most folks creating / using Wagn mods will be working with local ones.
There are two built-in mods:
Core and standard mods are found in the pack (soon to be renamed to mod) subdirectory of Wagn's root directory. (For brevity, this doc will assume that you are already in Wagn's root directory and begin all file paths with a ".". In those terms, core and standard mods are in ./pack)
By default, local mods are kept in ./local/packs. However you can configure Wagn to use different or additional directories in your ./config/wagn.yml file using the pack_dirs directive.
Each subdirectory of the packs directory is the name of a different mod. For example, if I were to create a mod for podcasting and called it "mypodcast", then I would start by adding a ./local/packs/mypodcast directory.
A mod can contain any of the following subdirectories: sets, formats, files, lib, set_patterns, and chunks.
As mentioned above, set modules are the heart of mods. They are located in ./[pack dir]/[modname]/sets. In the podcast example, the directory would be ./local/packs/mypodcast/sets.
To understand the directory structure for sets, you'll need to understand a bit about how sets work. Sets are explained in more detail on the set card, but in short they're groups of cards to which rules may be attached. From a Wagneer's perspective, rules involve "settings" (like *create, *structure, *table of contents, etc.) Set modules are used to create different kinds of rules, namely model methods, views, and events.
A set can be as broad as "all cards" and as narrow as a single one. Every set is represented by a card. For example, the set of all cards is represented by "*all", and the set of the card "Menu" is represented by "Menu+*self". The naming pattern is:
[ anchor + ] set pattern
*all and *self are set patterns. Menu is an anchor. Every set has a pattern, but not every set has an anchor.
To create a local mod for a given set, you need to use the following directory structure:
./[mods dir]/[mod name]/sets/[set pattern]/[anchor or module name].rb
To see this in action, let's look into the sets directory for the built-in "standard" mod. Here are all the modules for sets with the set pattern "self":
$ ls pack/standard/sets/self account_links.rb recent.rb alerts.rb search.rb foot.rb style_functional.rb head.rb style_jquery_ui_smoothness.rb navbox.rb style_standard.rb now.rb version.rb
There you see all the set modules for "singleton sets" (sets that have just one member) that have a module attached to them. So, for example, in navbox.rb there is code related to the *navbox+*self set.
A few important observations: