Pre-commit Hook Configuration -- cortex

July 30, 2026 · View on GitHub

Pre-commit checks run through lefthook, configured in lefthook.yml at the repo root. cortex ships no Claude Code lifecycle hooks — see ../plugin/HOOKS.md.

Hook configuration

Install the git hooks once per clone:

lefthook install

lefthook.yml pre-commit jobs (most wrapped in scripts/with_timeout.sh — the diff check and skills jobs run unwrapped):

JobCommandPurpose
diff checkgit --no-pager diff --check --cachedRejects whitespace errors and conflict markers in staged content
yaml parsepython -c 'yaml.safe_load(...)'Rejects unparseable YAML in staged files
rustfmtcargo fmt -- --checkFormatting gate
module sizescripts/check-rust-module-size.sh --limit 500Caps Rust module line count
version synccargo xtask check-version-syncAll version-bearing files agree
skillsjust validate-skillsValidates plugin/skill manifests and frontmatter (staged plugins/cortex/skills/**, .claude-plugin/**)
env guardscripts/block-env-commits.shBlocks commits containing env credential patterns

Manual checks

Run the same gates by hand:

# Plugin manifest + skill frontmatter validation
just validate-plugin

# Marketplace manifest assertions
bash scripts/validate-marketplace.sh

# Version-bearing files agree
cargo xtask check-version-sync

# Env credential scan
bash scripts/block-env-commits.sh

# Dependency policy
cargo deny check

Rust-specific checks

Before committing, run:

just fmt         # cargo fmt
just lint        # cargo clippy -- -D warnings
just test        # hermetic suite via cargo-nextest

cargo xtask pre-push bundles the heavier pre-push gate. All of these are also enforced in CI.

See also