From 22cfd6ee3a8c984091bdabd8bc7bb744f6bb5747 Mon Sep 17 00:00:00 2001 From: Ralph Chang Date: Wed, 18 Feb 2026 10:13:28 +0800 Subject: [PATCH] Fix pressure thresholds and ASCII diagram alignment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Corrected pressure levels: 75% (moderate) / 90% (high) - Removed incorrect 'critical' level (95%) - Fixed ASCII diagram alignment in README - Updated all documentation to match actual code implementation - Pruning modes: < 75% (normal), 75-89% (aggressive), ≥ 90% (hyper-aggressive) --- README.md | 4 ++-- docs/architecture.md | 21 ++++++++++----------- docs/configuration.md | 6 +++--- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index fd76de3..02eb91b 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ Auto-extracts and ranks important information: Real-time token tracking from session database: -- Monitors context window usage (75% → 90% → 95% thresholds) +- Monitors context window usage (75% moderate → 90% high) - Proactive intervention messages when pressure is high - Pressure-aware smart pruning (adapts compression based on pressure) @@ -158,7 +158,7 @@ The plugin exposes these tools to your OpenCode agent: ┌───────────────────────────────────────────────────────────┐ │ Memory Pressure Monitor │ │ • Tracks tokens from session DB │ -│ • Warns at 75% / 90% / 95% │ +│ • Warns at 75% (moderate) / 90% (high) │ │ • Sends proactive interventions │ │ • Adjusts pruning aggressiveness │ └───────────────────────────────────────────────────────────┘ diff --git a/docs/architecture.md b/docs/architecture.md index 514deef..7aceb57 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -27,8 +27,8 @@ The Working Memory Plugin implements a **four-tier memory architecture** designe ↓ ┌─────────────────────────────────────────────────────────────┐ │ TIER 4: PRESSURE MONITORING │ -│ Tracks context usage: safe → moderate → high → critical │ -│ Thresholds: 70% | 85% | 95% │ +│ Tracks context usage: safe → moderate → high │ +│ Thresholds: 75% (moderate) | 90% (high) │ │ Intervention: Sends promptAsync() with full visible prompt │ └─────────────────────────────────────────────────────────────┘ ``` @@ -83,18 +83,18 @@ Reduce context bloat by filtering tool outputs before they enter the conversatio ### Pruning Modes -#### Normal Mode (Pressure < 85%) +#### Normal Mode (Pressure < 75%) - Remove file/directory listings > 50 lines - Truncate verbose tool outputs - Keep first/last 30 lines of long outputs - Preserve error messages and key information -#### Aggressive Mode (85% ≤ Pressure < 95%) +#### Aggressive Mode (75% ≤ Pressure < 90%) - Threshold drops to 30 lines - More aggressive truncation (first/last 20 lines) - Filter repetitive content -#### Hyper-Aggressive Mode (Pressure ≥ 95%) +#### Hyper-Aggressive Mode (Pressure ≥ 90%) - Threshold drops to 15 lines - Keep only first/last 10 lines - Maximum compression @@ -209,10 +209,9 @@ Where: | Level | Threshold | Behavior | |-------|-----------|----------| -| **safe** | < 70% | Normal operation | -| **moderate** | 70-84% | Warning in system prompt | -| **high** | 85-94% | Aggressive pruning + warning | -| **critical** | ≥ 95% | Hyper-aggressive pruning + intervention | +| **safe** | < 75% | Normal operation | +| **moderate** | 75-89% | Warning in system prompt + aggressive pruning | +| **high** | ≥ 90% | Hyper-aggressive pruning + intervention | ### Pressure Storage @@ -221,7 +220,7 @@ Where: ```typescript { sessionID: string; - level: "safe" | "moderate" | "high" | "critical"; + level: "safe" | "moderate" | "high"; percentage: number; visiblePromptChars: number; estimatedLimit: 180000; @@ -232,7 +231,7 @@ Where: ### Intervention Mechanism -When pressure reaches **critical** (≥95%): +When pressure reaches **high** (≥90%): 1. Plugin sends `promptAsync()` message to agent 2. Message includes full visible prompt for review 3. Agent can compress core memory, clear working memory, or continue diff --git a/docs/configuration.md b/docs/configuration.md index 4e69a5d..aa952d5 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -91,13 +91,13 @@ const ESTIMATED_CONTEXT_LIMIT = 180000; // Conservative estimate (chars) ### Line Thresholds ```typescript -// Normal mode (pressure < 85%) +// Normal mode (pressure < 75%) const PRUNE_THRESHOLD_NORMAL = 50; -// Aggressive mode (85% ≤ pressure < 95%) +// Aggressive mode (75% ≤ pressure < 90%) const PRUNE_THRESHOLD_AGGRESSIVE = 30; -// Hyper-aggressive mode (pressure ≥ 95%) +// Hyper-aggressive mode (pressure ≥ 90%) const PRUNE_THRESHOLD_HYPER = 15; ```