# Data flow — ohmyzsh/ohmyzsh

> Canonical page: https://codevetter.com/unpack/ohmyzsh/data-flow

# Data flow — ohmyzsh/ohmyzsh

Scanned commit 86ef6555e068663736a33376e4055aca9c1acc89 (2026-09-22). Generated by codevetter codevetter 1.12.0 on 2026-09-22.

Configuration flows inward from .zshrc variables (ZSH_THEME, plugins array, zstyle settings, DISABLE_* flags) which oh-my-zsh.sh reads while sourcing; state flows outward into $ZSH_CACHE_DIR (zcompdump, .zsh-update, probe/alias caches) and back into .zshrc itself when `omz` commands mutate it. Prompt rendering is the hot path: git status data moves from porcelain output through regex parsing into ZSH_THEME_* variables, either synchronously or through a forked async pipe read by a zle -F callback.
- Input boundary: .zshrc defines export ZSH, ZSH_THEME, plugins=(...) and optional zstyle ':omz:...' settings, then `source $ZSH/oh-my-zsh.sh` — the template file is generated by the installer via sed replacing the ZSH= line. — [templates/zshrc.zsh-template#L5-78](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/templates/zshrc.zsh-template#L5-L78) [tools/install.sh#L405-413](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/tools/install.sh#L405-L413)
- Plugin data flow: $plugins names -> is_plugin() dir resolution -> dir prepended to $fpath -> <name>.plugin.zsh sourced via _omz_source, with $ZSH_CUSTOM/plugins shadowing $ZSH/plugins at both stages. — [oh-my-zsh.sh#L81-98](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/oh-my-zsh.sh#L81-L98) [oh-my-zsh.sh#L206-211](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/oh-my-zsh.sh#L206-L211) [oh-my-zsh.sh#L235-239](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/oh-my-zsh.sh#L235-L239)
- Completion pipeline: plugin dirs + $ZSH_CACHE_DIR/completions enter $fpath, compaudit/compinit -i produce $ZSH_COMPDUMP, OMZ metadata comments are appended, and zrecompile emits $ZSH_COMPDUMP.zwc guarded by a mkdir lock. — [oh-my-zsh.sh#L66-68](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/oh-my-zsh.sh#L66-L68) [oh-my-zsh.sh#L146-185](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/oh-my-zsh.sh#L146-L185)
- Update state lives in $ZSH_CACHE_DIR/.zsh-update (sourced to read LAST_EPOCH, EXIT_STATUS, ERROR) written by update_last_updated_file(); mutual exclusion is a mkdir on $ZSH/log/update.lock cleaned by an EXIT/INT/QUIT trap. — [tools/check_for_upgrade.sh#L136-149](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/tools/check_for_upgrade.sh#L136-L149) [tools/check_for_upgrade.sh#L209-235](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/tools/check_for_upgrade.sh#L209-L235)
- Update-availability check: reads git config oh-my-zsh.remote/oh-my-zsh.branch, fetches the remote HEAD sha from api.github.com via curl/wget/fetch (2s timeout), then compares with local HEAD via `git merge-base`; non-GitHub remotes are assumed to have updates. — [tools/check_for_upgrade.sh#L62-134](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/tools/check_for_upgrade.sh#L62-L134)
- Git prompt flow: __git_prompt_git runs `git rev-parse --git-dir --abbrev-ref HEAD` and `git status --porcelain -b`; _omz_git_prompt_status_match forces LC_ALL=C for regex parsing (workaround for REG_ILLSEQ on non-UTF-8 bytes); results map through ZSH_THEME_GIT_PROMPT_* variables into the prompt string. — [lib/git.zsh#L14-50](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/lib/git.zsh#L14-L50) [lib/git.zsh#L52-70](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/lib/git.zsh#L52-L70) [lib/git.zsh#L72-169](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/lib/git.zsh#L72-L169)
- Async prompt flow: precmd hook _omz_async_request forks each registered handler writing to a pipe fd, stores fd/pid in _OMZ_ASYNC_FDS/_OMZ_ASYNC_PIDS, and zle -F triggers _omz_async_callback which stores output in _OMZ_ASYNC_OUTPUT[handler] and calls `zle .reset-prompt` only if it changed. — [lib/async_prompt.zsh#L46-142](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/lib/async_prompt.zsh#L46-L142)
- .zshrc mutation flow (plugin enable/disable, theme set): awk program reads ${ZDOTDIR:-$HOME}/.zshrc -> writes .zshrc.new -> copies original to .zshrc.bck -> mv into place -> `zsh -n` syntax check -> on failure mv .zshrc.bck back -> _omz::reload execs a fresh zsh. — [lib/cli.zsh#L249-322](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/lib/cli.zsh#L249-L322) [lib/cli.zsh#L814-863](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/lib/cli.zsh#L814-L863)
- Startup-cost caching: expensive probes are persisted in $ZSH_CACHE_DIR — grep alias flags (grep-alias), macOS scutil LocalHostName (localhostname, keyed by $HOST), and appearance command probes (appearance-probes, an associative array dumped via print -r). — [lib/grep.zsh](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/lib/grep.zsh) [oh-my-zsh.sh#L101-127](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/oh-my-zsh.sh#L101-L127) [lib/theme-and-appearance.zsh#L16-38](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/lib/theme-and-appearance.zsh#L16-L38)
- upgrade.sh normalizes legacy robbyrussell/oh-my-zsh remotes to ohmyzsh/ohmyzsh, stores the chosen remote in `git config oh-my-zsh.remote`, records pre-update HEAD in oh-my-zsh.lastVersion, and temporarily forces rebase.autoStash before restoring it. — [tools/upgrade.sh#L205-243](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/tools/upgrade.sh#L205-L243) [tools/upgrade.sh#L268-341](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/tools/upgrade.sh#L268-L341)
- Terminal output boundary: termsupport precmd/preexec hooks emit OSC 0/1/2 title sequences and OSC 7 cwd notifications (percent-encoded via omz_urlencode) only when TERM/TERM_PROGRAM whitelists match and not inside Emacs or SSH. — [lib/termsupport.zsh#L19-45](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/lib/termsupport.zsh#L19-L45) [lib/termsupport.zsh#L130-170](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/lib/termsupport.zsh#L130-L170) [lib/functions.zsh#L176-238](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/lib/functions.zsh#L176-L238)
- Installer data flow: env vars ZSH/ZDOTDIR/REPO/REMOTE/BRANCH/CHSH/RUNZSH/KEEP_ZSHRC drive behavior; git writes repo to $ZSH; existing .zshrc moves to .zshrc.pre-oh-my-zsh (older backups get datestamped); the old shell path is saved to ~/.shell.pre-oh-my-zsh for uninstall.sh to restore. — [tools/install.sh#L18-40](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/tools/install.sh#L18-L40) [tools/install.sh#L354-416](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/tools/install.sh#L354-L416) [tools/uninstall.sh#L1-38](https://github.com/ohmyzsh/ohmyzsh/blob/86ef6555e068663736a33376e4055aca9c1acc89/tools/uninstall.sh#L1-L38)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
