---
id: T-138
name: "Redesign context budget: cron-based monitor + PreToolUse enforcement"
description: >
  Redesign context budget: cron-based monitor + PreToolUse enforcement
status: work-completed
workflow_type: inception
horizon:
owner: agent
tags: []
related_tasks: []
created: 2026-02-18T07:02:20Z
last_update: '2026-06-11T22:23:46Z'
date_finished: 2026-02-18T07:29:09Z
target_blast_radius: 3   # T-2193 migration default (M=small-subsystem floor)
voi_score: 0.5            # T-2193 migration default (medium)
bvp_scores_proposed:
  - ts: '2026-06-11T22:23:46Z'
    estimator: bvp-estimator-v1-heuristic
    scores:
      D1: 2
      D2: 2
      D3: 2
      D4: 2
      F-RECALL: 2
      F-ORCH: 2
      F3: 2
      F1: 2
      F2: 2
    rationale: D1=2 (no-signal); D2=2 (no-signal); D3=2 (no-signal); D4=2 
      (no-signal); F-RECALL=2 (no-signal); F-ORCH=2 (no-signal); F3=2 
      (no-signal); F1=2 (no-signal); F2=2 (no-signal)
    rubric_sha: e4a00f38e801
---

# T-138: Redesign context budget: cron-based monitor + PreToolUse enforcement

## Context

Current budget system failed catastrophically in sprechloop cycle 3 (25 handover commits in 10min) and in this session (agent at 80%/160K tokens, never checked once). Root cause: PostToolUse hooks run inside the agent's loop — agent controls when they fire and can ignore warnings. Commit counters measure the wrong metric.

Inception findings: `docs/T-138-inception-findings.md`
- 11 flaws in current system (3 critical)
- Cron + PreToolUse design proposed
- Portability concern: hybrid approach recommended (cron optional, PostToolUse fallback)
- Go/no-go decision: PENDING

## Go/No-Go Criteria

- [ ] Decision on approach: pure cron vs hybrid (keep PostToolUse as fallback)
- [ ] Decision on portability: accept Linux-only cron or require cross-platform
- [ ] Prototype budget-gate.sh (PreToolUse hook) to validate exit-code-2 blocking works
- [ ] Record decision via `fw inception decide T-138 go|no-go`

## Updates

### 2026-02-18T07:02:20Z — task-created [task-create-agent]
- **Action:** Created task via task-create agent
- **Output:** /opt/999-Agentic-Engineering-Framework/.tasks/active/T-138-redesign-context-budget-cron-based-monit.md
- **Context:** Initial task creation

### 2026-02-18T07:03:53Z — status-update [task-update-agent]
- **Change:** status: started-work → captured

### 2026-02-18T07:03:58Z — status-update [task-update-agent]
- **Change:** status: captured → started-work

### 2026-02-18T07:29:09Z — inception-decision [inception-workflow]
- **Action:** Recorded inception decision
- **Decision:** GO
- **Rationale:** Hybrid approach: build PreToolUse budget-gate.sh as primary enforcement, keep PostToolUse checkpoint.sh as fallback during transition. Defer cron to separate task. User decision.

### 2026-02-18T07:29:09Z — status-update [task-update-agent]
- **Change:** status: started-work → work-completed
- **Reason:** Inception decision: GO

## Reviewer Verdict (v1.5)

- **Scan ID:** R-73eabbeb
- **Timestamp:** 2026-06-02T14:57:08Z
- **Catalogue:** v1.3-seed
- **Overall:** PASS
- **Needs Human:** no
- **Findings:** none
