> For the complete documentation index, see [llms.txt](https://docs.yemreak.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.yemreak.com/contents/d61c73b0.md).

# Git Commit'lerde Session ID: Agent Kendi Bulur Neden Yaptığını

[r/ClaudeCode](https://www.reddit.com/r/ClaudeCode/comments/1omcsl7/track_which_ai_agent_wrote_which_file_in_git/) • [r/ClaudeAI](https://www.reddit.com/r/ClaudeAI/comments/1omcsm8/track_which_ai_agent_wrote_which_file_in_git/)

Değişiklik yaptım neden yaptığımı dokümante etmekten kaçınabileceğimi fark ettim. Git commit'lerine session ID gömüyorum. Agent'lar gerekçeyi kendileri buluyor. Bu, dokümantasyon yönetimini, bakım yükünü, binlerce dağınık dokümanı ortadan kaldırıyor. Şu anda test ediyorum. Denemek istersen, yaklaşım bu şekilde.

***

```sh
┌──────────────────┐
│ Agent commit atar│
│ (5:30 PM)        │
└────────┬─────────┘
         ▼
      ◉ Kod bozulur (6:45 PM)
         │
         ▼
   ┌──────────────┐
   │Agent:        │
   │git blame     │
   └────┬─────────┘
        ▼
   ┌──────────────────┐
   │Agent bulur:      │
   │Session: a4e34b0b │
   └────────┬─────────┘
            │
            ├─────────────────────────┐
            ▼                         ▼
   ┌────────────────┐      ┌──────────────────┐
   │User:           │      │Agent:            │
   │claude --resume │      │Custom tool       │
   │a4e34b0b        │      │(transcript okur) │
   └────────┬───────┘      └────────┬─────────┘
            ▼                       ▼
      ┌──────────┐           ┌───────────────┐
      │Agent:    │           │Agent:         │
      │User      │           │User           │
      │mesajları │           │mesajlarını    │
      │görür     │           │çıkarır        │
      └─────┬────┘           └─────┬─────────┘
            └──────────┬───────────┘
                       ▼
                 ┌──────────┐
                 │Agent:    │
                 │Neden     │
                 │yaptığını │
                 │anlar     │
                 └─────┬────┘
                       ▼
                 ┌──────────┐
                 │Agent:    │
                 │Sana söyler│
                 └──────────┘
```

## Kurulum

**`.claude/hooks/UserPromptSubmit`**

```bash
#!/usr/bin/env bash

INPUT=$(cat)
SESSION_ID=$(echo "$INPUT" | jq -r '.session_id')
PROMPT=$(echo "$INPUT" | jq -r '.prompt')

if echo "$PROMPT" | grep -qi "commit"; then
  cat << EOF
{
  "hookSpecificOutput": {
    "hookEventName": "UserPromptSubmit",
    "additionalContext": "Commit mesajına session ID ekle:\n\ngit commit -m \"fix: auth\"\n\nSession: $SESSION_ID"
  }
}
EOF
fi
```

## Sonuç

```
git log

commit abc123
fix: auth update

Session: a4e34b0b-3418-492f-9c97-35474d7b07c5
```

**`claude --resume a4e34b0b-3418-492f-9c97-35474d7b07c5`**

{% embed url="<https://docs.claude.com/en/docs/claude-code/hooks>" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.yemreak.com/contents/d61c73b0.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
