Claude Code 2.1.290 Introduces claude attach and claude logs: Detached Daemon Sessions and Telemetry Streaming
Anthropic published Claude Code version 2.1.290, introducing the claude attach and claude logs CLI commands. The update allows engineers to run agentic coding tasks in headless background processes, reconnect across terminal multiplexers, and tail JSON-RPC telemetry streams.
Anthropic published Claude Code 2.1.290 on October 6, 2026, delivering two widely requested terminal features: claude attach and claude logs.
Prior to this release, executing long-running agent workflows—such as broad repository refactoring, migration of 500 unit tests, or end-to-end integration audits—required keeping an interactive terminal session continuously open. If an SSH connection dropped, Wi-Fi stuttered, or a laptop closed, the active Claude Code process died mid-generation.
Decoupling the Client from the Daemon
Version 2.1.290 separates the terminal interface from the execution engine. When initiated with the --detach flag, Claude Code spawns a background worker process that communicates over a local Unix domain socket:
┌────────────────────────────────────────────────────────────────────────┐
│ Claude Code 2.1.290 Daemon Topology │
├────────────────────────────────────────────────────────────────────────┤
│ Terminal 1: User runs "claude --detach --prompt 'Refactor auth routes'"│
│ │ │
│ ▼ │
│ Spawns POSIX Daemon: PID 48192 (/tmp/claude-session-8f3b.sock) │
│ • Executes AST inspections, file edits, and git commits │
│ • Persists state across network interruptions │
│ │ │
│ ┌─────────────────────┴─────────────────────┐ │
│ ▼ ▼ │
│ [ claude attach 8f3b ] [ claude logs 8f3b --tail ] │
│ Interactive REPL attaches Follows live JSON-RPC trace │
│ to running socket of model tool calls │
└────────────────────────────────────────────────────────────────────────┘
If a user detaches, the daemon continues executing shell commands and editing files until it reaches completion or encounters an action that explicitly requires human permission.
Command Syntax and Workflow Examples
Developers can invoke the new commands using straightforward CLI syntax:
# 1. Start a long-running test migration in the background
$ claude --detach -p "Migrate all Jest unit tests to Vitest in src/tests/"
[Claude Code] Started detached daemon (session: vitest-mig-401, PID: 31092)
# 2. Tail the live execution logs from another terminal window
$ claude logs vitest-mig-401 --tail --json
{"timestamp":"2026-10-06T15:20:01Z","action":"file_write","path":"src/tests/auth.test.ts","tokens_used":1420}
{"timestamp":"2026-10-06T15:20:04Z","action":"bash_exec","cmd":"npx vitest run src/tests/auth.test.ts"}
# 3. Reconnect to the session to inspect status and review diffs
$ claude attach vitest-mig-401
[Claude Code] Reattached to session vitest-mig-401. 14 of 32 test files migrated successfully.
Telemetry Tracing: claude logs Schema
The claude logs command outputs structured event objects compatible with log forwarders like Datadog, Vector, and Grafana Loki:
| Log Field | Data Type | Description |
|---|---|---|
sessionId |
String | Unique UUID identifying the detached agent run |
phase |
Enum | planning, tool_exec, validation, or awaiting_approval |
tool |
String | Name of tool called (EditFile, RunBash, GrepSearch) |
exitCode |
Integer | Return status code of executed shell commands |
costAccumulated |
Float | Cumulative API cost incurred in USD |
The update positions Claude Code for automated headless CI/CD execution and remote development environments like GitHub Codespaces.