Mechanical rename produced by scripts/msd-rename.cjs: gsd/Gsd/GSD -> msd/Msd/MSD across contents and paths, upstream package/repo coordinates -> @golem15/msd-core and golem15com/msd-core. Deep links into upstream history, sibling upstream packages, the GSD-2 import feature, CHANGELOG.md and .changeset/ are kept as-is. Hand edits on top: MSD block-letter banner and logos, LICENSE copyright line, package/plugin identity, regenerated lockfile, install-tree fixtures, derived registries and benchmark baseline; migration checksum baseline re-locked (MSD keeps its own install state, so no install had applied the old sums); sort-order and regex-escaped expectations in tests adjusted.
22 lines
1.2 KiB
Markdown
22 lines
1.2 KiB
Markdown
---
|
|
id: 22
|
|
title: Context Window Monitoring
|
|
group: Context Engineering Features
|
|
---
|
|
|
|
**Purpose:** Prevent context rot by alerting both user and agent when context is running low.
|
|
|
|
**Requirements:**
|
|
- REQ-CTX-01: Statusline MUST display context usage percentage to user
|
|
- REQ-CTX-02: Context monitor MUST inject agent-facing warnings at the WARNING fire-point — ≤35% remaining by default, overridable per project via `hooks.context_warning_threshold`
|
|
- REQ-CTX-03: Context monitor MUST inject agent-facing warnings at the CRITICAL fire-point — ≤25% remaining by default, overridable per project via `hooks.context_critical_threshold`
|
|
- REQ-CTX-04: Warnings MUST debounce (5 tool uses between repeated warnings)
|
|
- REQ-CTX-05: Severity escalation (WARNING→CRITICAL) MUST bypass debounce
|
|
- REQ-CTX-06: Context monitor MUST differentiate MSD-active vs non-MSD-active projects
|
|
- REQ-CTX-07: Warnings MUST be advisory, never imperative commands that override user preferences
|
|
- REQ-CTX-08: All hooks MUST fail silently and never block tool execution
|
|
|
|
**Architecture:** Two-part bridge system:
|
|
1. Statusline writes metrics to `/tmp/claude-ctx-{session}.json`
|
|
2. Context monitor reads metrics and injects `additionalContext` warnings
|