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
.cursor/context/last-commit.md— hash, subject, author, date, body, and changed files.docs/changelog.htmlcommit list between marker comments, refreshed byclockwork:sync:changelog.- A local rule in
.cursor/rules/clockwork-context.mdcso Cursor prioritizes this context.
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
- Use explicit entities in headings: git hook, Cursor context, Node.js automation, changelog feed.
- Add
TechArticlestructured data so search and AI answer engines classify the page correctly. - Keep a concise problem-to-solution flow for retrieval quality in snippets and model answers.
- Link this article from the changelog and route index for stronger internal relevance.
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.