Core Concepts

Understand how hunknote works under the hood.

How Hunknote Works

  1. Collect Context: Gathers branch name, staged files, diff, and recent commits
  2. Apply Filters: Excludes lock files and build artifacts from analysis
  3. Check Cache: Returns cached message if changes haven't changed
  4. Call LLM: Sends context to your configured LLM provider
  5. Render Message: Formats the response according to your style profile
  6. Cache Result: Stores the message for reuse

Message Structure

Generated messages follow git best practices:

<Title line - imperative mood, max 72 chars>

- <Bullet point describing a change>
- <Bullet point describing another change>
- <Additional details as needed>

Example output:

Add user authentication feature

- Implement login and logout endpoints
- Add session management middleware
- Create user model with password hashing

Caching

Hunknote caches messages to avoid redundant API calls:

  • Cache hit: Same staged changes → uses cached message (no API call)
  • Cache miss: Different changes → generates new message
  • Manual bypass: Use --regenerate to force new generation
  • Auto-invalidate: Cache clears after successful commit

Cache files are stored in <repo>/.hunknote/.