{"slug": "til-one-escape-sequence-makes-my-terminal-follow-my-ai-agent-into-a-worktree", "title": "TIL: One escape sequence makes my terminal follow my AI agent into a worktree", "summary": "A developer discovered that using the OSC 7 escape sequence allows their terminal to automatically track the current directory when an AI agent like Claude Code switches to a different worktree, eliminating the need for manual navigation.", "body_md": "The thing that made me grin today: I tell [Claude Code](https://claude.com/claude-code) to *“work in a * the agent jumps into a fresh checkout, and my\n\nEscape sequences aren’t just colors. **OSC** — *Operating System Command* — is the family that sends side-channel messages to your terminal: window title, clipboard, and the one here, the **current directory** ([OSC 7](https://en.wikipedia.org/wiki/ANSI_escape_code#OSC_(Operating_System_Command)_sequences)):", "url": "https://wpnews.pro/news/til-one-escape-sequence-makes-my-terminal-follow-my-ai-agent-into-a-worktree", "canonical_source": "https://davidpoblador.com/blog/til-one-escape-sequence-makes-my-terminal-follow-my-ai-agent-into-a-worktree.html", "published_at": "2026-06-30 10:29:10+00:00", "updated_at": "2026-06-30 11:01:00.965595+00:00", "lang": "en", "topics": ["developer-tools", "ai-agents", "large-language-models"], "entities": ["Claude Code", "Claude"], "alternates": {"html": "https://wpnews.pro/news/til-one-escape-sequence-makes-my-terminal-follow-my-ai-agent-into-a-worktree", "markdown": "https://wpnews.pro/news/til-one-escape-sequence-makes-my-terminal-follow-my-ai-agent-into-a-worktree.md", "text": "https://wpnews.pro/news/til-one-escape-sequence-makes-my-terminal-follow-my-ai-agent-into-a-worktree.txt", "jsonld": "https://wpnews.pro/news/til-one-escape-sequence-makes-my-terminal-follow-my-ai-agent-into-a-worktree.jsonld"}}