<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/naming-claude-code-and-copilot-sessions-after-their-project-tgzjqvoym" -->

---
title: Naming Claude Code and Copilot Sessions After Their Project
description: You can make Claude Code and Copilot CLI sessions name themselves after their project, with an emoji, using hooks. In Claude Code, a UserPromptSubmit hook can...
canonical: https://daily.dev/posts/naming-claude-code-and-copilot-sessions-after-their-project-tgzjqvoym
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Naming Claude Code and Copilot Sessions After Their Project | daily.dev
og:description: You can make Claude Code and Copilot CLI sessions name themselves after their project, with an emoji, using hooks. In Claude Code, a UserPromptSubmit hook can...
og:url: https://daily.dev/posts/naming-claude-code-and-copilot-sessions-after-their-project-tgzjqvoym
og:image: https://api.daily.dev/og/posts/tGzJqvoYM.png
og:image:alt: Naming Claude Code and Copilot Sessions After Their Project
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Naming Claude Code and Copilot Sessions After Their Project

**[RUBYLAND](https://daily.dev/sources/rubyla)** · 4 min read · 0 upvotes · 0 comments

## Summary

You can make Claude Code and Copilot CLI sessions name themselves after their project, with an emoji, using hooks. In Claude Code, a UserPromptSubmit hook can print hookSpecificOutput.sessionTitle to set the title on the first prompt. Copilot hooks can't set titles, so the hook instead tells the agent to call rename_session with the exact name. Both call one shared bash script that matches a project under ~/source in the prompt, then the working directory, then asks Haiku for a short topic. A cached run takes 40ms.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://code.dblock.org/2026/11/27/naming-claude-code-and-copilot-sessions-after-their-project.html>

## Questions this post answers

### How can I automatically set the session title in Claude Code from a hook?

Use a UserPromptSubmit hook that prints JSON with hookSpecificOutput.sessionTitle; that value becomes the session title, same as /rename. The hook also receives session_title when the session already has one, so it can rename only on the first prompt and never override a manual /rename.

_Developers tuning Claude Code workflows follow hook tricks like this on daily.dev._

### Can GitHub Copilot CLI hooks set the session title, and what is the workaround?

No. A userPromptSubmitted hook can only add context for the model. The workaround is to enable the session management tools (sessionManagementTools.enabled on) and have the hook's additionalContext instruct the agent to call rename_session with an exact name. It stays best effort, and non-interactive -p runs skip it.

_Anyone juggling several Copilot CLI sessions can keep up with these workarounds on daily.dev._

### Why does calling claude -p from a Claude Code hook cause infinite recursion and how do I avoid it?

claude -p starts a new Claude Code session, which runs the same hook, which calls claude -p again. The --bare flag skips hooks but only accepts an API key, not OAuth. Instead, run claude -p --model haiku --no-session-persistence --settings '{"disableAllHooks":true}' --tools "" so hooks are disabled and nothing is saved.

_Developers building Claude Code automations hit gotchas like this, and daily.dev tracks them._

## Similar posts on daily.dev

- [If you're with me on team…](https://daily.dev/posts/if-you-re-with-me-on-team--xvypsqbup) · Justin Searls · 1 upvotes · 0 comments
- [GitHub Copilot CLI Tips & Tricks — Part 4: Automating and enforcing policies with hooks](https://daily.dev/posts/github-copilot-cli-tips-tricks-part-4-automating-and-enforcing-policies-with-hooks-ucqhydtbd) · The Art of Simplicity · 0 upvotes · 0 comments

---

Tags: [#github](https://daily.dev/tags/github), [#claude-code](https://daily.dev/tags/claude-code), [#bash](https://daily.dev/tags/bash), [#react-hooks](https://daily.dev/tags/react-hooks), [#dotfiles](https://daily.dev/tags/dotfiles)

[View this post on daily.dev](https://daily.dev/posts/naming-claude-code-and-copilot-sessions-after-their-project-tgzjqvoym)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Naming Claude Code and Copilot Sessions After Their Project","url":"https://daily.dev/posts/naming-claude-code-and-copilot-sessions-after-their-project-tgzjqvoym","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/naming-claude-code-and-copilot-sessions-after-their-project-tgzjqvoym"},"datePublished":"2026-11-27T19:26:14.592Z","dateModified":"2026-11-27T19:26:34.324Z","description":"You can make Claude Code and Copilot CLI sessions name themselves after their project, with an emoji, using hooks. In Claude Code, a UserPromptSubmit hook can...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/1f75c8b356093ede054db0f69be99468?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/1f75c8b356093ede054db0f69be99468?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"RUBYLAND","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"RUBYLAND","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/rubyla","url":"https://daily.dev/sources/rubyla"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/naming-claude-code-and-copilot-sessions-after-their-project-tgzjqvoym","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"github,claude-code,bash,react-hooks,dotfiles","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"RUBYLAND","item":"https://daily.dev/sources/rubyla"},{"@type":"ListItem","position":3,"name":"Naming Claude Code and Copilot Sessions After Their Project"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/naming-claude-code-and-copilot-sessions-after-their-project-tgzjqvoym#faq","mainEntity":[{"@type":"Question","name":"How can I automatically set the session title in Claude Code from a hook?","acceptedAnswer":{"@type":"Answer","text":"Use a UserPromptSubmit hook that prints JSON with hookSpecificOutput.sessionTitle; that value becomes the session title, same as /rename. The hook also receives session_title when the session already has one, so it can rename only on the first prompt and never override a manual /rename. Developers tuning Claude Code workflows follow hook tricks like this on daily.dev."}},{"@type":"Question","name":"Can GitHub Copilot CLI hooks set the session title, and what is the workaround?","acceptedAnswer":{"@type":"Answer","text":"No. A userPromptSubmitted hook can only add context for the model. The workaround is to enable the session management tools (sessionManagementTools.enabled on) and have the hook's additionalContext instruct the agent to call rename_session with an exact name. It stays best effort, and non-interactive -p runs skip it. Anyone juggling several Copilot CLI sessions can keep up with these workarounds on daily.dev."}},{"@type":"Question","name":"Why does calling claude -p from a Claude Code hook cause infinite recursion and how do I avoid it?","acceptedAnswer":{"@type":"Answer","text":"claude -p starts a new Claude Code session, which runs the same hook, which calls claude -p again. The --bare flag skips hooks but only accepts an API key, not OAuth. Instead, run claude -p --model haiku --no-session-persistence --settings '{\"disableAllHooks\":true}' --tools \"\" so hooks are disabled and nothing is saved. Developers building Claude Code automations hit gotchas like this, and daily.dev tracks them."}}]}
```

