You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/knowledge/DESIGN.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -269,14 +269,15 @@ Injected via the `prepare-commit-msg` git hook, which reads the active session I
269
269
270
270
### Git hooks for commit integration
271
271
272
-
Two git hooks handle all commit-related operations:
272
+
Three git hooks handle commit integration and notes sharing:
273
273
274
274
| Git hook | When | What it does |
275
275
|---|---|---|
276
-
|`prepare-commit-msg`| Before commit message editor opens | Reads `.git/agentnote/session`, appends `Agentnote-Session` trailer to message file |
277
-
|`post-commit`| After commit succeeds | Calls `recordCommitEntry()` to write session data as a git note on HEAD |
276
+
|`prepare-commit-msg`| Before commit message editor opens | Checks session freshness via heartbeat, appends `Agentnote-Session` trailer. Skips amend/reuse (`$2=commit`). |
277
+
|`post-commit`| After commit succeeds | Reads session ID from the finalized trailer on HEAD, calls `agentnote record <session-id>` to write git note. Idempotent — skips if note already exists. |
278
+
|`pre-push`| Before push to remote | Auto-pushes `refs/notes/agentnote` to the actual remote (`$1`) in background. Recursion-guarded via `AGENTNOTE_PUSHING` env var. |
278
279
279
-
These replaced the previous approach of using AI agent PreToolUse/PostToolUse hooks to detect `git commit` commands via pattern matching, which was fragile with chained commands (`git add && git commit`).
280
+
Session freshness is verified via per-session heartbeat file (`sessions/<id>/heartbeat`). Stop writes `0` to heartbeat for immediate invalidation. Missing heartbeat in git hooks = skip (fail closed).
0 commit comments