Skip to content

Add max session length/turns limit #4

@alexknowshtml

Description

@alexknowshtml

Summary

Limit how long Claude sessions can run or how many turns they can take to prevent runaway costs.

Implementation Options

  1. Max turns - Count messages in a thread, stop responding after N turns
  2. Max duration - Track session start time, stop after X minutes
  3. Token budget - Track approximate token usage (harder to implement)

Suggested Behavior

  • MAX_TURNS_PER_SESSION=50 - After 50 back-and-forth messages, warn then stop
  • MAX_SESSION_DURATION_MS=3600000 - 1 hour max
  • Send warning message before hitting limit

Priority

Lower - Claude Code already has its own context limits, this is a secondary safeguard

Related

  • Independent of other safety features

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions