AgentWorkshop.GitContext (AgentWorkshop v0.3.0)

Copy Markdown View Source

Git context injection for Workshop agents.

When git_context: true is set in configure/1, a summary of the current git state is automatically appended to every agent's system prompt. Agents always know what branch they're on, what's changed, and recent commit history.

Usage

configure(git_context: true)

What's injected

  • Current branch and tracking info
  • Dirty/clean status
  • Staged and unstaged file counts
  • Last 5 commit subjects
  • Uncommitted file list (if dirty)

Summary

Functions

Build a git context string for the current working directory.

Get uncommitted changes as a formatted string.

Get a structured summary of the current git state.

Functions

build(opts \\ [])

@spec build(keyword()) :: String.t() | nil

Build a git context string for the current working directory.

Returns a formatted string suitable for appending to an agent's system prompt, or nil if git info is unavailable.

changes(opts \\ [])

@spec changes(keyword()) :: {:ok, String.t()} | {:error, term()}

Get uncommitted changes as a formatted string.

summary(opts \\ [])

@spec summary(keyword()) :: {:ok, map()} | {:error, term()}

Get a structured summary of the current git state.

Returns a map with branch, status, recent commits, and file changes.