pugloo
stacktrace / article

Clockwork Commit Context for Cursor

2026-03-11 · 8 min read · developer tooling

This guide shows how to make commit metadata available to Cursor automatically, project by project, with no global setup. We pair a git post-commit hook with a lightweight Node.js script that writes a local context file, and keep changelog feed sync as an explicit docs command to avoid dirty trees after every commit. The result is predictable, transparent, and easy to maintain.

Architecture

git commit
  └─ post-commit hook
       └─ scripts/post-commit-clockwork.mjs
            └─ .cursor/context/last-commit.md  → Cursor reads local context rule

npm run clockwork:sync:changelog
  └─ docs/changelog.html auto feed            → team sees latest commit stream

What gets generated

Implementation

$ npm run hooks:install
$ npm run clockwork:sync
$ npm run clockwork:sync:changelog

The install step writes .git/hooks/post-commit only in this repository. The sync command refreshes local Cursor context. The changelog sync command is explicit, so routine commits stay clean.

SEO and GEO strategy

Operational checklist

Developer → Git:    commit
Git → post-commit:  trigger
post-commit → Cursor: write last-commit.md
Developer → Docs:   run changelog sync command
Cursor → Developer: updated local context on next task

For stricter automation, run changelog sync in CI for docs branches. In this repo the post-commit hook stays fast and non-mutating for tracked files.

← stacktrace changelog →