Back to Stacktrace Open changelog

Clockwork Commit Context for Cursor in a Node.js Repo

Published 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. We 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

flowchart TD
  A[git commit] --> B[post-commit hook]
  B --> C[scripts/post-commit-clockwork.mjs]
  C --> D[.cursor/context/last-commit.md]
  H[npm run clockwork:sync:changelog] --> E[docs/changelog.html auto feed]
  D --> F[Cursor reads local context rule]
  E --> G[Team sees latest commit stream]
      

What gets generated

Implementation notes

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

sequenceDiagram
  participant Dev as Developer
  participant Git as Git
  participant Hook as post-commit
  participant Docs as docs/changelog.html
  participant Cursor as Cursor context
  Dev->>Git: commit
  Git->>Hook: trigger
  Hook->>Cursor: write last-commit.md
  Dev->>Docs: run changelog sync command
  Cursor-->>Dev: updated local context on next task
      

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