explainx.ainewsletter3.5k
TrendingNewsPathwaysSkills
Pricing
explainx.ai

Upskill in AI — 16 free pathways, live workshops & bootcamps, and 50+ courses from practitioners. Plus the skills, tools, and MCP servers to practice on.

follow us

custom AI agents

[email protected]

get started

Find your pathTake Free Evaluation

learn

pathways — start freeworkshopsbootcampscoursescertificationsmock testsexplainx universitycorporate traininglearn skills & mcp

discover

skillsmcp serversexplainx mcptoolsagentsllmsdesignsagi trackerranks

company

aboutvisionmissionteaminstructorscommunityhackathonscareers

content

daily AI newsstate of AI — live resultsblogreleasespromptsgeneratorsresource librarydemofor LLMs

solutions

all solutionsdeveloper upskillingmarketing upskillingproduct manager upskillingleadership upskilling

More from us

InfloqInfluencer marketingBgBlurPrivacy-first blurOlly SocialSocial AI copilotCeptoryVideo intelligenceBgRemoverBackground removal

newsletter · weekly

Get AI news, tools, and insights in your inbox.

supportprivacytermsdata rightssubmission guidelines

© 2026 AISOLO Technologies Pvt Ltd

On this page

  • What the /goal command does
  • Where /goal is available
  • Why developers are calling /goal the "most underrated feature of 2026"
  • How /goal tracks progress: elapsed time, turns, tokens
  • Comparison with other long-running agent systems
  • Practical use cases for /goal
  • How to use /goal effectively
  • Integration with Codex and Claude Code Mobile
  • Related on explainx.ai
  • Bottom line
← Back to blog

explainx / blog

Claude Code 2.1.139 adds /goal command: set completion conditions and let agents work across multiple turns until met

Anthropic released Claude Code version 2.1.139 on May 12, 2026, introducing the /goal command that allows setting a completion condition for AI agents to work autonomously across multiple turns—sometimes for days—until the goal is met. Available in interactive mode, -p, and Remote Control, with tracking of elapsed time, turns, and tokens.

May 12, 2026·7 min read·Yash Thakker
Claude CodeAnthropicAI AgentsAutomationLong-running tasks
go deep
Claude Code 2.1.139 adds /goal command: set completion conditions and let agents work across multiple turns until met

On May 12, 2026, Anthropic released Claude Code version 2.1.139, introducing the /goal command—a feature that lets you set a completion condition and allows Claude to work autonomously across multiple turns until that goal is met.

Early adopters are calling it "the single most underrated AI feature of 2026" because it enables long-running agent workflows that can work for hours or even days without manual intervention, tracking elapsed time, turns, and tokens as Claude iterates toward completion.

The feature is available in interactive mode, with the -p flag, and in Remote Control, and has been integrated into Codex and Claude Code Mobile.

This article breaks down what /goal does, how it works across different modes, why it matters for agent development, and how to use it effectively.

Claude Code /goal command — autonomous agent completion

Weekly digest3.5k readers

Catch up on AI

Curated AI updates on agents, skills, and MCP — delivered to your inbox. Unsubscribe anytime.

A fast look at Claude Code's /goal command in action for long-running autonomous agents.

What the /goal command does

The /goal command allows you to define a completion condition for Claude Code agents. Once you set a goal, Claude:

  1. Works autonomously across multiple turns — no manual intervention required
  2. Tracks progress toward the completion condition
  3. Monitors resource usage — elapsed time, turns, and tokens
  4. Continues iterating until the goal is satisfied or you manually stop it

Example workflow

bash
# Traditional approach (manual iteration)
$ claude "fix the bug in server.ts"
[Claude fixes one issue]
$ claude "now add tests"
[Claude adds tests]
$ claude "now verify it passes CI"
[Claude checks CI]
# Manual intervention at each step

# With /goal (autonomous completion)
$ claude
> /goal All tests passing in CI, no TypeScript errors, server.ts bug fixed
[Claude works across multiple turns autonomously until goal is met]
[Tracks: 45 minutes elapsed, 12 turns, 89,000 tokens]

Where /goal is available

According to the release notes and early reports, /goal works in three modes:

ModeDescriptionUse case
Interactive modeUse /goal in the Claude Code CLIDevelopment and debugging sessions where you want Claude to work autonomously while you monitor progress
-p flag (programmatic)Set goal with -p flag in command-line invocationsScripted workflows, CI/CD pipelines, scheduled tasks
Remote ControlUse /goal in remote sessionsCollaborative work, cloud-based agents, distributed workflows

The feature has also been integrated into Codex (OpenAI's agentic harness, ironically) and Claude Code Mobile, suggesting Anthropic is positioning /goal as a platform-wide capability for autonomous agent workflows.

Why developers are calling /goal the "most underrated feature of 2026"

Alex Finn (@AlexFinn) posted:

"It's official. Claude Code just released /goal. The single most underrated AI feature of 2026. Now Claude Code, Codex, and Hermes agent has it. It allows your agent to complete long running tasks, sometimes for days."

Daniel San (@dani_avila7) noted:

"Claude Code 2.1.139 added /goal. You set a completion condition and Claude keeps working across turns until it's met. Works in interactive, -p, and Remote Control."

Miles Deutscher (@milesdeutscher) emphasized the time-saving potential:

"/goal is f*cking insane. You can literally get your AI agents to work for HOURS without manual intervention. Already active in Claude Code and Codex - you need to use it now."

What makes /goal different from traditional agent prompting?

Traditional agent workflows require manual iteration:

  1. Give Claude a task
  2. Wait for completion
  3. Check the result
  4. Give next task
  5. Repeat

/goal collapses this into a single invocation:

  1. Define completion condition
  2. Let Claude iterate autonomously
  3. Check in when done (or monitor progress)

This is especially valuable for:

  • Complex refactoring that touches multiple files
  • Test-driven development where you want "all tests passing" as the goal
  • Security remediation where you want "all vulnerabilities patched"
  • Performance optimization where you want "load time under 2 seconds"
  • CI/CD workflows where you want "green build with coverage > 80%"

How /goal tracks progress: elapsed time, turns, tokens

One of the most useful aspects of /goal is the built-in tracking of resource usage:

  • Elapsed time — how long Claude has been working toward the goal
  • Turns — how many interaction cycles have occurred
  • Tokens — total token usage across all turns

This helps developers:

  1. Estimate costs for long-running tasks
  2. Set timeouts to prevent runaway agents
  3. Optimize workflows by identifying high-turn or high-token tasks
  4. Debug completion logic by seeing where Claude gets stuck

Example tracking output (hypothetical)

bash
> /goal All TypeScript errors resolved, tests passing, PR ready
[Turn 1] Reading codebase, identifying TypeScript errors... (3,200 tokens)
[Turn 2] Fixing type errors in auth.ts... (4,100 tokens)
[Turn 3] Running tests, 2 failures detected... (2,800 tokens)
[Turn 4] Fixing failing tests... (3,900 tokens)
[Turn 5] All tests passing, preparing PR... (2,100 tokens)
Goal met! Elapsed: 18 minutes | Turns: 5 | Tokens: 16,100

Comparison with other long-running agent systems

/goal in Claude Code is not the first attempt at long-running agent workflows, but it is notable for its integration depth and tracking capabilities.

SystemLong-running capabilityTrackingAccess
Claude Code /goal✅ Set completion condition, works across turns until metElapsed time, turns, tokensPublic (v2.1.139+)
Codex (OpenAI)✅ Agentic workflows with goal tracking (integrated from Claude Code)Not publicly documentedLimited (Daybreak partners)
Hermes agent✅ Remote VPS agents, long-running tasksCustom loggingPublic (self-hosted)
AutoGPT / BabyAGI⚠️ Task lists, but requires manual orchestrationMinimalPublic
LangGraph / Agent harnesses✅ Custom loops with state managementCustom (developer-defined)Public (requires coding)

Key differentiator: /goal is zero-configuration for Claude Code users—no custom orchestration, no state management code, just set a goal and let Claude work.

Practical use cases for /goal

1. Test-driven refactoring

bash
> /goal Refactor auth.ts to use dependency injection, all tests passing, coverage > 90%

Claude will:

  • Refactor the code
  • Run tests after each change
  • Fix failures
  • Add tests if coverage drops
  • Iterate until goal is met

2. Security remediation

bash
> /goal All npm audit vulnerabilities patched, no breaking changes, CI green

Claude will:

  • Run npm audit
  • Update dependencies
  • Test for breaking changes
  • Fix any issues
  • Verify CI passes

3. Performance optimization

bash
> /goal Lighthouse score > 95, Core Web Vitals all green, no accessibility regressions

Claude will:

  • Profile the site
  • Optimize images, lazy-load assets
  • Run Lighthouse after changes
  • Iterate until targets met

4. Documentation completeness

bash
> /goal All public APIs documented, examples for each function, no broken links

Claude will:

  • Scan for undocumented functions
  • Write docs and examples
  • Check for broken links
  • Iterate until complete

How to use /goal effectively

Based on early reports and best practices from agent development:

✅ Do: Define clear, measurable completion conditions

  • Good: "All TypeScript errors resolved, tests passing, no ESLint warnings"
  • Bad: "Make the code better"

✅ Do: Set reasonable scope

  • Good: "Refactor auth.ts to use dependency injection"
  • Bad: "Refactor the entire codebase to use functional programming"

✅ Do: Monitor progress for the first few goals

  • Check elapsed time and token usage to estimate costs
  • Identify patterns in turn counts for similar tasks

⚠️ Don't: Use /goal for open-ended creative tasks

  • Not ideal: "Design a new UI for the app"
  • Better: "Implement the approved UI mockup from design-system.md, matching all spacing and color tokens"

⚠️ Don't: Assume /goal will always succeed

  • Complex goals may hit edge cases
  • Set timeouts or turn limits if supported
  • Have a fallback plan if the goal isn't met

Integration with Codex and Claude Code Mobile

The fact that /goal has been integrated into Codex (OpenAI's agentic harness, part of the Daybreak announcement) and Claude Code Mobile suggests this is becoming a platform-wide pattern for autonomous agents.

This is notable because:

  1. Cross-vendor adoption — OpenAI's Codex integrating a Claude Code feature suggests /goal is becoming a de facto standard for agent completion conditions
  2. Mobile-first agents — /goal on Claude Code Mobile enables truly autonomous mobile workflows (e.g., "keep optimizing this component until frame rate is stable at 60fps")
  3. Remote Control interoperability — /goal in Remote Control means multiple developers can share goal-tracking agents in collaborative environments

Related on explainx.ai

  • Claude Code Loops Official Guide (July 2026) — Anthropic's full taxonomy placing /goal in the loop stack
  • Hermes agent: remote VPS, Telegram, CLI guide — another long-running agent system
  • Claude Code vs Codex rate limit boost — comparing Anthropic and OpenAI agent platforms
  • Agent harness engineering: Terminal Bench, LangChain — how to build custom agent orchestration
  • Skills lock JSON: reproducible agent skills — ensuring agent workflows are deterministic

Bottom line

Claude Code 2.1.139's /goal command is a step-function improvement in autonomous agent workflows—allowing developers to set a completion condition and let Claude work across multiple turns, tracking elapsed time, turns, and tokens, until the goal is met.

Early adopters are calling it "the most underrated AI feature of 2026" because it eliminates the need for manual iteration in multi-step tasks, enabling agents to work for hours or even days autonomously.

The feature works in interactive mode, -p flag, and Remote Control, and has been integrated into Codex and Claude Code Mobile, suggesting it's becoming a platform-wide capability.

If you're building agent workflows, update to Claude Code 2.1.139 and experiment with /goal for tasks like test-driven refactoring, security remediation, performance optimization, and documentation completeness.


Claude Code release notes: https://github.com/anthropics/claude-code/releases. Early reports via X: @AlexFinn, @dani_avila7, @milesdeutscher. explainx.ai is not affiliated with Anthropic.

Yash Thakker

Written by

Yash Thakker

Yash is an AI expert with over 300K learners. Join his workshops →

Related posts

Jul 12, 2026

Claude Code Desktop Browser: Built-In Web Browsing in the App (July 2026)

@ClaudeDevs ships Claude Code desktop browser — read, click, debug URLs sandboxed. Version 1.2581.0 July 10. explainx.ai setup, shortcuts, and developer reactions.

Jul 8, 2026

Fable 5 Advisor and Orchestrator Patterns: 92% Quality at 63% Cost (July 2026)

Anthropic's @ClaudeDevs shared two Fable 5 cost patterns July 8: advisor mode (Sonnet executes, Fable steers) and orchestrator mode (Fable plans, Sonnet researches). explainx.ai maps the benchmarks, API advisor tool, and when to use each.

Jul 7, 2026

Claude Code Loops Official Guide: Turn-Based, /goal, /loop, and /schedule (July 2026)

On July 7, 2026, @ClaudeDevs published the definitive Claude Code loops guide by @delba_oliveira — how the team categorizes loops by trigger, stop criteria, and primitive. explainx.ai maps each type to real commands, skills, and the loop-engineering corpus you already have on-site.