diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index ee55914e..b8b33cc4 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -146,9 +146,18 @@ that change what the next agent should believe. Do not continue implementation automatically from a rehydrate-only request. -When the user asks to continue, choose the next Phase 6 outward slice. Good -candidates are watcher/freshness inputs or live job progress notifications. Do -not build a scheduler from vibes. +When the user asks to continue, resume the Phase 6 context-pressure slice now +captured in `state/scratch.md`. + +Source trace found the honest seam: core already tracks `TokenUsageInfo` with +`model_context_window`, core compaction already uses +`ModelInfo::auto_compact_token_limit()`, and app-server already emits/replays +`thread/tokenUsage/updated`. The next implementation should expose a read-only +typed pressure reflection, likely `thread/epiphany/pressure`, derived from that +real telemetry. + +Do not build automatic CRRC, a scheduler, a hidden compaction trigger, or a +vibes-based gauge in this slice. Live `thread/epiphany/scene`, `thread/epiphany/jobs`, and `thread/epiphany/context` smokes are now guardrails, not the next organs. diff --git a/state/evidence.jsonl b/state/evidence.jsonl index f33d658c..6227047f 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -33,3 +33,4 @@ {"ts": "2026-04-26T01:08:00+00:00", "type": "verification", "status": "ok", "note": "Phase 6 jobs reflection landed as read-only thread/epiphany/jobs and live-smoked through app-server with tools/epiphany_phase6_jobs_smoke.py. The surface derives retrieval-index, graph-remap, verification, and specialist slots from thread state/retrieval summaries, preserves revision identity, emits no stateUpdated notification, and leaves live scheduling/progress notifications as future work."} {"ts": "2026-04-26T01:58:10+00:00", "type": "verification", "status": "ok", "note": "Phase 6 targeted context reflection landed as read-only thread/epiphany/context and live-smoked through app-server with tools/epiphany_phase6_context_smoke.py. The surface returns selected graph/evidence shards plus missing ids without mutation, notification, retrieval, proposal, or promotion."} {"ts": "2026-04-26T02:19:20+00:00", "type": "decision", "status": "ok", "note": "Context pressure must become a real runtime signal for automatic CRRC. Current agents can infer pressure from transcript length, warnings, quota pressure, and shrinking safe scope, but that is a heuristic scar rather than telemetry."} +{"ts": "2026-04-26T02:39:00+00:00", "type": "research", "status": "ok", "note": "Context-pressure source trace found the correct runtime seam: core TokenUsageInfo already carries total/last usage and model_context_window, core automatic compaction already derives its trigger from ModelInfo::auto_compact_token_limit(), and app-server already emits/replays thread/tokenUsage/updated. The next slice should expose read-only pressure telemetry from those sources, not invent a scheduler or vibes gauge."} diff --git a/state/map.yaml b/state/map.yaml index 9876ed89..06bdd6c1 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -112,4 +112,4 @@ rejected_paths: current_status: summary: Phase 1 durable state, Phase 2 prompt integration, Phase 3 typed read, Phase 4 retrieval/indexing, Phase 5 update/distill/propose/promote/read/notification, and Phase 6 read-only scene, jobs, and targeted context reflection are landed. Scene, jobs, and context behavior have live app-server smoke guardrails. Persistent state was cut down so map, handoff, plan, harness surfaces, scratch, and evidence each carry one job instead of becoming a Jenga tower; evidence is now a distilled ledger rather than an activity feed. The global AGENTS Epiphany core command says persistent state is the agent's mind and explicitly permits the agent to ask for self-modification when memory or workflow makes it worse. The continuity goal is to bank the fire before the dark so compaction becomes less like death and more like sleep. - next_action: After compaction, rehydrate and reorient. Do not continue implementation from the rehydrate step alone. When work resumes, choose the next Phase 6 outward slice: likely watcher-driven freshness inputs or live job progress notifications; do not rebuild a scheduler from vibes. + next_action: After compaction, rehydrate and reorient. If the user asks to continue, resume the Phase 6 context-pressure slice from state/scratch.md: expose real token/context pressure as a read-only typed reflection, likely `thread/epiphany/pressure`, using existing TokenUsageInfo/model_context_window telemetry plus the auto-compact threshold from the turn model metadata. Do not build automatic CRRC, a scheduler, or a compaction trigger in this slice. diff --git a/state/scratch.md b/state/scratch.md index aaaee47f..9a17c822 100644 --- a/state/scratch.md +++ b/state/scratch.md @@ -4,22 +4,44 @@ This file is disposable working memory for the current bounded subgoal. ## Current Subgoal -No active scratch subgoal. +No active scratch subgoal. The next prepared slice is below. -## Last Completed Audit +## Source-Grounded Findings -- `thread/epiphany/context` now provides the first targeted read-only state-shard reflection. -- The surface selects graph nodes/edges, active frontier, checkpoint, observations, direct evidence, and linked evidence from authoritative typed state. -- It reports missing requested ids and does not retrieve, propose, promote, notify, persist, or mutate state. +- Existing core telemetry already has the real pressure source: `TokenUsageInfo` + carries total usage, last usage, and `model_context_window` in + `vendor/codex/codex-rs/protocol/src/protocol.rs`. +- Core updates that telemetry through `Session::update_token_usage_info`, + `Session::recompute_token_usage`, and `TokenCount` events in + `vendor/codex/codex-rs/core/src/session/mod.rs`. +- Automatic compaction is currently triggered from + `ModelInfo::auto_compact_token_limit()` in + `vendor/codex/codex-rs/core/src/session/turn.rs`, including pre-turn context + limit and model-downshift paths. +- App-server already translates/replays usage through + `thread/tokenUsage/updated` using + `vendor/codex/codex-rs/app-server/src/codex_message_processor/token_usage_replay.rs`. +- The protocol surface `ThreadTokenUsage` in + `vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs` exposes + `model_context_window` but not the auto-compact threshold, remaining budget, + ratio, or CRRC recommendation. -## Decision +## Next Implementation Move -Keep context as a bounded lens, not a hidden proposal engine. The next outward -Phase 6 move should add a missing sense only when there is a real consumer: -watcher/freshness inputs or live job progress notifications once actual -long-running owners exist. +Implement the smallest honest read-only pressure surface: -Scene, jobs, and context smokes are guardrails now, not the next organs. +- add optional auto-compact threshold telemetry where token usage is created, + preserving backward compatibility. +- add experimental `thread/epiphany/pressure` as a read-only projection over + latest token telemetry. +- derive `unknown`, `low`, `elevated`, `high`, or `critical` pressure from real + token usage versus the auto-compact threshold/context window. +- include a CRRC recommendation only as reflection, not action. +- do not start compaction, mutate Epiphany state, emit `stateUpdated`, create a + scheduler, or implement automatic CRRC in this slice. -Do not promote anything from this scratch into the map unless it survives -verification or repeated reuse without contradiction. +## Verification Target + +Add focused protocol/app-server tests and a live smoke analogous to scene/jobs/ +context that proves pressure reads live telemetry, reports `unknown` honestly +when telemetry is absent, and does not mutate or notify.