Passive Capture

Git Hooks

Automatically capture context from your git workflow. No manual commands after installation.

Installation

$ contxt hook install          # Install all hooks
✓ Installed post-commit, pre-push, post-checkout, prepare-commit-msg

$ contxt hook status           # Check installed hooks
$ contxt hook uninstall        # Remove all Contxt hooks

Available Hooks

post-commit<200ms

Scans the commit message for decision keywords and conventional commit prefixes. Creates draft entries and updates the context file list.

# Triggers on: "decided", "switched to", "migrated", "chose"
# Also: feat(), fix(), refactor(), arch() prefixes
$ git commit -m "feat(db): migrate from Drizzle to Prisma"
contxt: draft saved — "migrate from Drizzle to Prisma" (decision)
pre-push

Counts unpushed commits and changed files, then updates the active context with a session summary. Optionally syncs to cloud before the push completes if hooks.syncToCloud is enabled in config.

post-checkout

Detects branch checkouts (not file checkouts) and switches the Contxt memory branch to match the git branch you just checked out. Your context stays aligned with your working branch automatically.

prepare-commit-msg

Injects your active context as # comment lines into the commit message template, so you always have your feature, blockers, and recent decisions visible when writing commits.

# ─── Contxt context ───────────────────────
# Feature: User onboarding flow
# Blockers: Stripe webhook signature verification
# Recent: JWT in httpOnly cookies, Prisma for ORM
# ────────────────────────────────────────────
|

Non-Destructive Installation

Contxt hooks append to existing hook files rather than replacing them. They are fully compatible with existing hook managers. If you already use Husky or lint-staged, Contxt adds its logic alongside yours without conflict.

The installer wraps added lines between CONTXT_BLOCK_START and CONTXT_BLOCK_END sentinel comments. Running contxt hook uninstall removes only those lines — your existing hook logic is untouched.

Configuration

Hook behavior is controlled by the hooks key in .contxt/config.json:

{
  "hooks": {
    "post-commit": {
      "enabled": true,
      "decisionDetection": true
    },
    "pre-push": {
      "enabled": true,
      "syncToCloud": false
    },
    "post-checkout": {
      "enabled": true,
      "switchMemoryBranch": true
    },
    "prepare-commit-msg": {
      "enabled": true
    }
  }
}