liveBook · Manning

Agentic session

As explained in Vibe Engineering

An agent session is a bounded interaction in which an AI agent reads context, plans work, and performs potentially multi-step changes.

An agentic session is an expensive, context-heavy interaction in which an agent reads files, formulates a plan, changes code, runs tests, reads results, and iterates. A session can consume 5x–20x more tokens than standard completion, so exploration must be constrained rather than treated as free productivity. section 9.2.2 section 9.5.2

Choose the interaction mode and guardrails according to task scope:

  • Use inline editing for a clearly described change touching one file; reserve agent mode for changes spanning files or requiring architectural understanding. section 9.2.2
  • Constrain exploration with reusable commands that specify relevant files, output format, retry limits, and a token budget. section 9.5.2
  • Restrict irrelevant file reads and filter command output so test failures and build warnings, rather than unbounded logs, enter the context. section 9.5.2
  • Measure sessions while they run and stop when iteration is wandering instead of converging; unmanaged exploration can multiply cost without improving the result. section 9.2.2 section 9.5.2

A bounded refactoring session

A focused-refactor command can require reading only directly relevant files, producing a diff, running existing tests, allowing at most two fixes, and targeting fewer than 50,000 tokens. This replaces an unconstrained cleanup session that might use 500,000 tokens across forty tool calls and fifteen iterations. section 9.5.2

Listing 9.6 Custom slash commands for cost-controlled agent workflows
markdown
<!-- .claude/commands/focused-refactor.md -->
# Focused Refactor
Refactor the specified function or module with these constraints:
- Read ONLY the files directly relevant to the change
- Do NOT explore the broader codebase unless explicitly needed
- Generate ONLY the changed code (diff format preferred)
- Do NOT explain changes unless asked
- Run existing tests after changes; do NOT write new tests
- If tests fail, fix the issue in max 2 iterations, then stop and report what's unresolved
- Budget: aim to complete in under 50,000 tokens total
$ARGUMENTS

Inspect a reusable command template for converting broad agent work into a constrained, repeatable workflow. section 9.5.2

How Vibe Engineering covers it

How deep it goes
Details context collection, planning, implementation, testing, iteration, cost measurement, and guardrails, but not model internals.
Examples
Uses focused refactoring, error-handling cleanup, test runs, forbidden-directory rules, and filtered command output.
What you can do after
Operate/configure agent sessions with scoped prompts, file restrictions, output filters, retry caps, and token targets.
How it connects
Connects agentic sessions with inline editing, code completion, prompt templates, context windows, testing, and token budgets.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Vibe Engineering. The section links point to the parts of the book it draws on.