Skip to content

feat(session,config): add context memory budget with soft/hard thresholds#67

Merged
RyderFreeman4Logos merged 1 commit intomainfrom
feat/memory-budget
Feb 13, 2026
Merged

feat(session,config): add context memory budget with soft/hard thresholds#67
RyderFreeman4Logos merged 1 commit intomainfrom
feat/memory-budget

Conversation

@RyderFreeman4Logos
Copy link
Owner

Summary

  • Add TokenBudget struct to csa-session with soft (75%) / hard (100%) threshold enforcement
  • Add token_budget and max_turns optional fields to TierConfig in csa-config
  • Pipeline integration: budget initialization from tier config at session creation, pre-execution hard/soft threshold checks, post-execution token accumulation and turn counting
  • max_turns works independently of token_budget (uses u64::MAX sentinel when only turns configured)
  • Config validation rejects zero values for token_budget and max_turns
  • 17 new tests covering budget logic, serde roundtrips, and validation
  • All fields use #[serde(default)] for backward compatibility with existing TOML state files

Test plan

  • just pre-commit — 836 unit tests + 8 E2E all pass
  • csa review --diff — 3 P1 issues found and fixed
  • csa review scope=range:main...HEAD — 0 findings, low risk
  • @codex review

🤖 Generated with Claude Code

…olds (#sprint4)

[MOTIVATION]
Sessions need resource governance to prevent runaway token consumption.
Without budget limits, a single session can consume unbounded tokens,
especially in recursive/long-running agent workflows.

[IMPLEMENTATION DETAILS]
- Add TokenBudget struct to csa-session with soft (75%) / hard (100%)
  thresholds, remaining/usage tracking, and serde backward compat
- Add token_budget and max_turns optional fields to TierConfig
- Pipeline integration: budget initialization from tier config at session
  creation, pre-execution hard/soft threshold checks, post-execution
  token accumulation and turn counting
- max_turns works independently of token_budget (uses u64::MAX sentinel)
- Config validation rejects zero values for token_budget and max_turns
- 17 new tests covering budget logic, serde roundtrips, and validation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@RyderFreeman4Logos RyderFreeman4Logos merged commit 4159b39 into main Feb 13, 2026
0 of 5 checks passed
@RyderFreeman4Logos RyderFreeman4Logos deleted the feat/memory-budget branch February 13, 2026 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant