一键导入
context-health-monitor
Use when debugging fails 3 times, same approach repeats, or context usage exceeds 60% to trigger state dump and recovery.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when debugging fails 3 times, same approach repeats, or context usage exceeds 60% to trigger state dump and recovery.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| allowed-tools | ["Read","Write","Grep","Glob","Bash"] |
| description | Use when debugging fails 3 times, same approach repeats, or context usage exceeds 60% to trigger state dump and recovery. |
| name | context-health-monitor |
| trigger | 컨텍스트 상태 확인, 세션 덤프, 3-strike 발동, 세션 인수인계, context health, session handoff, 컨텍스트 압축, context compact, 세션 일시중지, session pause, 순환 감지, circular detection, 불확실성 로깅, uncertainty logging, 컨텍스트 회전, context rot, 패턴 추출, pattern extraction, 상태 저장, state dump, 3 strike rule, circular detection, context window full, token limit |
/pause/compact 실행 (80% 자동 전)Prevent "Context Rot" — the quality degradation that occurs as the agent processes more information in a single session.
The agent should self-monitor for these warning signs:
| Signal | Threshold | Action |
|---|---|---|
| Repeated debugging | 3+ failed attempts | Trigger state dump |
| Going in circles | Same approach tried twice | Stop and reassess |
| Confusion indicators | "I'm not sure", backtracking | Document uncertainty |
| Context window filling | >60% token usage | Run /compact proactively |
| Session length | Extended back-and-forth | Recommend /pause or /handoff |
If debugging the same issue fails 3 times:
.hxsk/STATE.md:
If the same approach is being tried again:
/pause for fresh perspectiveWhen uncertain about an approach:
.hxsk/DECISIONS.md:
When context window usage exceeds ~60%:
/compact before auto-compaction kicks in (~80%)/handoff and start fresh.hxsk/memories/ directory structure must existDetect recurring failure patterns across sessions. Store health events for trend analysis so systemic issues are surfaced early.
Check if the same issue has recurred, then store the event:
Grep(pattern: "3-strike|{issue}", path: ".hxsk/memories/health-event/", output_mode: "files_with_matches")
bash .hxsk/hooks/md-store-memory.sh \
"3-Strike: {issue}" \
"{approaches tried, errors seen, current hypothesis}" \
"health,3-strike,{component}" \
"health-event"
If the search reveals the same issue appeared before, flag it as a recurring problem in the state dump.
Check if the same loop pattern was seen before, then store:
Grep(pattern: "circular|{approach}", path: ".hxsk/memories/health-event/", output_mode: "files_with_matches")
bash .hxsk/hooks/md-store-memory.sh \
"Circular: {approach}" \
"{what repeated, why it looped}" \
"health,circular,{component}" \
"health-event"
Persist session context for the next session:
bash .hxsk/hooks/md-store-memory.sh \
"Handoff: {reason}" \
"{current state, recommendations for next session}" \
"health,handoff" \
"session-handoff"
When this skill activates, scan recent memory files for failure trends:
Glob(pattern: ".hxsk/memories/health-event/*.md")
Read the most recent files and review for clusters of 3-strike, circular, or blocked keywords. If a trend is detected (2+ similar events), warn the user proactively before beginning work.
When triggered, write to .hxsk/STATE.md:
## Context Health: State Dump
**Triggered**: [date/time]
**Reason**: [3 failures / circular / uncertainty]
### What Was Attempted
1. [Approach 1] — Result: [outcome]
2. [Approach 2] — Result: [outcome]
3. [Approach 3] — Result: [outcome]
### Current Hypothesis
[Best guess at root cause]
### Recommended Next Steps
1. [Fresh perspective action]
2. [Alternative approach to try]
### Files Involved
- [file1.ext] — [what state it's in]
- [file2.ext] — [what state it's in]
When valuable patterns are discovered during a session, extract to .hxsk/PATTERNS.md:
| Category | Examples |
|---|---|
| Architecture | "jose > jsonwebtoken for Edge runtime" |
| Conventions | "API routes: src/app/api/{resource}/route.ts" |
| Gotchas | "httpOnly cookies require HTTPS even on localhost" |
| Integrations | "Stripe webhooks need raw body parser disabled" |
grep -c "^-" .hxsk/PATTERNS.md# Check PATTERNS.md size
wc -c .hxsk/PATTERNS.md # Should be < 2048
## {Category}
- {Concise pattern description} — {file:line if applicable}
| File | Size Limit | Purpose |
|---|---|---|
| PATTERNS.md | 2KB | Core learnings |
| CURRENT.md | 1KB | Session context |
| prd-active.json | 3KB | Pending tasks |
| File/Folder | Purpose |
|---|---|
| JOURNAL.md | Session history |
| CHANGELOG.md | Change history |
| prd-done.json | Completed tasks |
| reports/ | Analysis reports |
| research/ | Research docs |
| archive/ | Monthly archives |
This skill integrates with:
/compact — Proactive context compaction (Rule 4)/handoff — Lightweight session transfer when context is beyond recovery/pause — Full HXSK session handoff with state archival/resume — Loads the state dump contextPATTERNS.md — Pattern extraction on session end.gemini/GEMINI.md Rule 3 (Context Hygiene) — After 3 failed debug attempts: STOP, summarize to STATE.md, document blocker in DECISIONS.md, recommend fresh session.hxsk/hooks/compact-context.sh: Archive old entries, prune PATTERNS.md to 2KB limitNO CONTINUE DEBUGGING WITHOUT STATE.md DUMP FIRST (After 3 failures) NO REPEAT APPROACH WITHOUT ALTERNATIVE PROPOSAL OR /pause FIRST (After 2 loops) NO EXCEED 80% CONTEXT WITHOUT /compact FIRST (Trigger at 60%) NO APPEND TO PATTERNS.md WITHOUT SIZE/COUNT CHECK FIRST (Max 2KB, 20 items) NO GUESS SOLUTION WITHOUT USER GUIDANCE FIRST (When uncertain) NO STORE MEMORY WITHOUT .hxsk/memories/ DIRECTORY FIRST NO RECOMMEND FRESH SESSION WITHOUT DOCUMENTING STATE FIRST NO COMPACT MID-FINISH WITHOUT COMPLETING TASK FIRST (If task is nearly done)
Use when Ground Truth alignment finds memory contamination and the user explicitly requests scoped cleanup with /cleanse.
Use when registering, reviewing, merging, or rebuilding HXSK glossary term definitions after glossary-detect suggests a candidate or the user invokes /define.
Use when staged changes exist requiring qlty checks, logical split detection, or HXSK phase-scoped conventional commit creation.
Use when validating code for circular imports, layer violations, or design doc logic errors before merging architecture-level changes.
Use when .hxsk/.bootstrap-version is missing (fresh install) or exists (verify/update) to initialize HExoskeleton.
Use when shell scripts need linting/formatting before execution or commit to ensure code quality.