Skip to content

βš™οΈ ZSHAND Core ModulesΒΆ

πŸ“‹ Core modules are the heart of the framework β€” they run after startup and before user post.d. They configure PATH, shell options, completions, aliases, widgets, hooks, plugins, and function autoloading. Load order is strictly numeric (02 β†’ 04 β†’ … β†’ 90).

Pipeline Architecture (boot sequence) Β· Startup (what runs before core)
Override Config (rc.d/, same basename = replace)
Build Build System (zprime, 06_engine) Β· Hooks (18_hooks)
Index Documentation Index

In this doc: Module reference β†’ Numbering β†’ Module details β†’ User overrides (rc.d/)

Per-module API pages

Generated docs for each file (dependencies, usage) live under Source β†’ api (e.g. source/core/06_engine.md). Run just docs-api after changing headers.

Override without forking

Put a file in ~/.config/zshand/rc.d/ with the same basename (e.g. 14_aliases.zsh) to replace a core module. Different name = add in order. Full layout: Config.


πŸ“‚ Module ReferenceΒΆ

File Purpose Key Functions
02_vars.zsh Core variables, XDG paths, config.toml loading β€”
04_path.zsh PATH construction from path.txt and system dirs β€”
06_engine.zsh Build system, compilation, telemetry zprime, zrun, _z_system_init
08_audit.zsh Integrity checking, logging, telemetry queries zcheck, zfail, zsearch, zpulse
10_options.zsh Shell behavior (AUTO_CD, history, globbing, etc.) β€”
12_completions.zsh Tab completion engine and styles β€”
14_aliases.zsh Built-in command aliases β€”
16_widgets.zsh Widget loader and keybinding registration β€”
18_hooks.zsh Hook classification (critical vs lazy) and loading β€”
20_plugins.zsh P10k theme, syntax highlighting, autosuggestions β€”
90_functions.zsh Function directory loader β€”

πŸ”’ Numbering SchemeΒΆ

Range Owner Purpose
02–90 (even) Framework Core configuration
01–99 (odd) User Reserved for insertion via rc.d/

Gaps between even numbers allow user scripts to interleave:

02_vars.zsh        ← framework
03_my_early.zsh    ← user (rc.d/)
04_path.zsh        ← framework
05_my_paths.zsh    ← user (rc.d/)
06_engine.zsh      ← framework

πŸ“Š Module DetailsΒΆ

02_vars.zsh β€” Variables & ConfigΒΆ

First module loaded. Establishes:

  • Core paths (ZSHAND, PROJECT_ROOT)
  • XDG directories (XDG_CONFIG_HOME, XDG_CACHE_HOME, etc.)
  • User config loading (config.toml, env.zsh, secrets.zsh)
  • Shell defaults and framework flags
  • Self-sufficient β€” no dependencies on other core modules

04_path.zsh β€” PATH ConstructionΒΆ

Builds $PATH from:

  • Framework bin/ directory
  • User bin/ directory
  • Entries from path.txt (one per line)
  • System defaults

06_engine.zsh β€” Build & Runtime EngineΒΆ

The framework's engine. Provides:

  • zprime / zr β€” Rebuild and compile framework bundles
  • zrun β€” Telemetry-aware command execution with logging
  • _z_system_init β€” Security enforcement, terminal titles
  • Atuin daemon lifecycle management
  • .zwc bytecode compilation

08_audit.zsh β€” Integrity & TelemetryΒΆ

System integrity and telemetry:

  • zcheck β€” Framework health audit (bundles, permissions, deps)
  • zfail β€” Query recent failures from telemetry
  • zsearch β€” Search telemetry by pattern
  • zpulse β€” Session summary (commands, success rate)

10_options.zsh β€” Shell OptionsΒΆ

Sets zsh behavior:

  • AUTO_CD, CORRECT, EXTENDED_GLOB
  • History configuration (size, dedup, sharing)
  • Completion options

12_completions.zsh β€” Tab CompletionΒΆ

Configures the completion system:

  • compinit initialization
  • Completion styles (menu, matching, grouping)
  • Cache directory setup

14_aliases.zsh β€” AliasesΒΆ

Built-in aliases for common operations. User aliases in ~/.config/zshand/aliases.zsh load after this and can override.

16_widgets.zsh β€” Widget LoaderΒΆ

Loads ZLE widgets from widgets/ and user widgets/. Applies keybindings from config.toml via _az_bindkey_from_toml.

18_hooks.zsh β€” Hook ClassifierΒΆ

Classifies hooks as critical (sync) or lazy (deferred) and loads them. See HOOKS.md for details.

20_plugins.zsh β€” Plugin ManagerΒΆ

Loads Powerlevel10k theme, zsh-syntax-highlighting, and zsh-autosuggestions.

90_functions.zsh β€” Function LoaderΒΆ

Loads all function files from functions/ and user functions/, with override semantics (user files replace framework files with the same basename).


πŸ”€ User Overrides (rc.d/)ΒΆ

Place files in ~/.config/zshand/rc.d/:

  • Same filename β†’ replaces framework module entirely
  • Different filename β†’ both load in numeric order
# Override framework aliases completely
~/.config/zshand/rc.d/14_aliases.zsh

# Add custom options between vars and path
~/.config/zshand/rc.d/03_my_options.zsh

Document Purpose
πŸ—οΈ Architecture Boot sequence and where core fits
πŸš€ Startup What runs before core (bootstrap, TOML, safe mode)
πŸ‘€ Config Override via rc.d/, config.toml, env
πŸͺ¨ Hooks How 18_hooks.zsh classifies and loads hooks
πŸ“ Header Standard Module header format and doc generation
πŸ“š Documentation Index Full doc nav