Skip to main content
The quality of a saved context depends on how you ask your agent to generate it. Here are prompts and practices that consistently produce good output.

When to save

Save a context when:
  • You’ve completed a meaningful feature, bugfix, or refactoring session
  • You made non-obvious architectural decisions (algorithm choice, schema design, library selection)
  • You rejected alternatives that a future reader might wonder about
  • Before opening a pull request
  • Before the context window fills and the agent loses earlier reasoning
You don’t need to save for every commit. One context per logical unit of work is the right cadence.

Asking the agent to save

Basic prompt

This works when the agent has skill files or rules configured. It will generate the structured context and call git why save.

When you want to guide the output

Tell the agent what to emphasize:

Specifying domain and topic

If you don’t specify, GitWhy auto-categorizes based on the title and files changed.

Asking for a rich context

After saving

Review what the agent saved:
If a section is thin or missing important detail, ask the agent to update it:

Common output problems and how to fix them

The Reasoning section is just a restatement of What Was Done

This happens when the agent doesn’t have enough context about why decisions were made. Prompt with:

Rejected Alternatives is empty or has only one entry

Good rejected alternatives take effort to articulate. Prompt with:

The Risks section is vague (“could be improved”)

Actionable risks are more useful. Prompt with:

Files section is missing descriptions

Tips for consistent output

Start sessions with context. If you’re resuming work, give the agent a brief recap before asking it to save. “We spent this session implementing rate limiting using the token bucket algorithm. Save a context for this.” Ask to save before switching tasks. Agent context windows have limits. “Save this session with GitWhy before we move on to the frontend work.” Reference the existing context when continuing. If you’re continuing yesterday’s work: “We’re continuing from ctx_a1b2c3d4. Retrieve it so you have the full context.” This ensures the new context’s Reasoning section connects to the prior decision history.

See also

  • Template — required and optional sections
  • Examples — a complete well-written context