Skip to content

Spend and context visible to the model; one notice before auto-compaction #6490

Description

@Hmbown

Gap.

  • With auto-compaction on (the default), the context-pressure warning is suppressed (core/engine/compaction.rs:~150-172), so the model gets no notice before its memory is compacted.
  • The model never sees spend so far, cost, or the remaining session budget. A token budget exists only while a goal is active (engine.rs:~3705-3728).

Change

  1. Extend <turn_meta> (engine.rs:~3850-3887) with context: <pct>% of <window> and spent: <cost> this session. When the person has set a session budget, also add budget: <remaining> of <total>. Use values the usage and cost ledger already computes. Omit cost when pricing is unknown; never guess it.
  2. Warn before compaction, even with auto-compaction on. Add a one-time notice per threshold crossing before "Making room" (the §19 wording): "Context is at 85%; Codewhale will make room soon. Checkpoint anything you need in files or the task list." After compaction the existing summary still says how to re-read live state. This is related to feat(engine): soft model-facing context notice while auto-compaction is enabled (no competing save/compact ceremony) #6425.
  3. Optional session budget. Add a session_budget config key and a /budget command. On reaching it, stop the turn with a clear notice; never cut mid-tool silently.

Tests

  • turn_meta_includes_context_and_spend
  • unknown_pricing_omits_cost
  • pre_compaction_notice_fires_once_with_auto_compact_on
  • session_budget_stops_turn_with_notice

Size: M.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions