Skip to content

Context Linked Commits

LeonXu edited this page Apr 1, 2026 · 1 revision

Context-Linked Commits

Automatically bind git commits to the AI conversation that produced them.

The Problem

Git records what changed (code diff) but not why (the conversation and reasoning). When you go back to a historical commit, Memora had to guess which conversation was related — using timestamps, which isn't always precise.

The Solution

When your AI coding tool makes a commit during a conversation, Memora's hook detects it and records the link:

commit abc1234 ←→ session 2130af27-a863-4d3c-bc7c-747020ceccfe

This creates an exact, unbreakable association between code changes and the conversation that produced them.

How It Works

  1. AI tool completes a turn (e.g., Claude Code runs a command)
  2. Memora hook fires on turn-complete
  3. Hook checks if any new git commits appeared in the last 30 seconds
  4. If yes, writes a commit-link event mapping commit hash → session ID
  5. On next sync, the link is stored in the database

Visual Indicator

Commits with a linked conversation show a 💬 icon:

💬 abc1234  feat: add user authentication     +156  Mar 31 at 15:24
   def5678  fix: typo in README               +1    Mar 31 at 14:00
  • 💬 = Full conversation context available (can restore exact reasoning)
  • No icon = Code-only commit (falls back to time-based context matching)

Impact on Other Features

Recall

When you Recall from a 💬 commit, Memora loads the exact conversation session instead of guessing by time. 100% precise context.

History Branching

When you Branch from a 💬 commit, the CLAUDE.md in the new branch contains the actual conversation that led to this code state.

Graceful Degradation

  • Old commits (before this feature): No session_id, no icon, time-based matching as before
  • Manual commits (not via AI): No hook fires, no link, same as old behavior
  • New AI-assisted commits: Automatically linked, 💬 icon, precise context

No data migration needed. The feature enhances new data without breaking old data.

Clone this wiki locally