context-compaction-verification-and-recovery
Use when verifying that tool commands actually executed after compaction.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when verifying that tool commands actually executed after compaction.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when Hermes Agent needs X/Twitter search, public signal research, monitoring, or approval-gated account actions through the Hermes Tweet plugin.
Router Learning System — 越用越聰明嘅任務路由引擎。 每個 task 有最佳 path,Router 自動記錄經驗、動態調整、跳過爛 path。
Use when signaling work status across autonomous sessions.
Use when needing to standardize descriptions across many skill files at once — change format, fix wording, or enforce a convention like 'Use when...' prefix.
Use before making irreversible changes (deleting files, destructive git operations, large refactors). Use when you need the ability to roll back if something goes wrong. Use at the start of any task that modifies multiple files.
Use when the context window is getting full and tasks need breaking down.
| name | context-compaction-verification-and-recovery |
| description | Use when verifying that tool commands actually executed after compaction. |
| version | 1.0.0 |
| author | Hermes Agent |
| metadata | {"hermes":{"tags":["context-compaction","recovery","verification","debug"],"platform":["cursor","codex","claude-code"]}} |
| domain | agent-core |
| subdomain | efficiency |
| tokens | {"scan":150,"load":3285,"category":"detailed"} |
Use this protocol when:
patch, write_file, or create_file calls in a sessionTool calls that exist only in your reply text but weren't actually invoked will NOT have modified any files. This is the most common failure mode during complex multi-step sessions across context compactions.
Pattern: AI describes what it will do in markdown text blocks, the user says "繼續", and in the next turn the AI treats that description as already done without having made the actual tool calls.
These patterns strongly suggest patches never landed:
Before any "繼續" transition, mentally scan: for every file I claim to have modified, did I actually see a patch() or write_file() success response in my tool output? If you only remember typing it in prose, it didn't happen.
Before any repairs, run a comprehensive audit:
# Find all NEW files that should exist
# Check each one with ls or search_files
Key files to verify:
utils/*.js)pages/*/)For each file that was supposed to be patched, scan for distinctive keywords that would only exist after the patch:
# For each patched file, check that NEW method names, variable names,
# or import paths exist in the file content
checks = {
"someFile.js": ["newFunctionName", "newImport", "newVariable"]
}
for fpath, keywords in checks.items():
content = open(fpath).read()
for kw in keywords:
if kw not in content:
print(f"MISSING: {fpath} — no '{kw}'")
Critical clue: If the file exists but has a smaller size than expected, or if multiple keywords are missing, the patches likely never executed.
Common causes:
當發現自己 skip 咗 boot sequence / HARD STOP / 其他流程規則:
永遠用 memory tool 而非寫檔案嚟 save 流程規則。
database/hermes_memory.json patch — context compaction 後唔會 injectmemory(action='add', target='memory', ...) — context compaction 後自動 inject檢查清單(每次 context compaction handoff 後問自己):
.hermes/plans/YYYY-MM-DD_*recovery*.md)When the recovery plan has 10+ operations:
When the recovery plan has 10+ operations:
After all patches are applied:
# 1. Syntax check all JS files
node -e "require('./utils/new-file')" 2>&1 | head -5
# 2. Check all require() paths resolve
# 3. Check all WXML has matching WXSS classes
# 4. Check app.json has all page paths
For WeChat Mini Program specifically:
~/Library/Application Support/微信开发者工具/<hash>/WeappCache/open -a "wechatwebdevtools" /path/to/projectapp.json page entry won't cause launch timeout, but will crash when navigating to that pagewx:if with undefined data field renders nothing (no crash, but empty screen)display: grid with 1fr units triggers Cannot read properties of undefined (reading 'MaxCodeSize') in WeChat DevTools — use flexbox with calc(33.33% - gap) for 3-column layoutsfilter: drop-shadow() also triggers the same MaxCodeSize compile error — replace with box-shadow insteadbackdrop-filter in WXSS is another known DevTools WXSS compiler trigger — works in most files but can cause cascading compile failures when combined with other heavy CSS featuresUse this after any "it doesn't work" report:
## Pre-Recovery Audit Results
### New Files Status
- [ ] utils/foo.js — EXISTS / MISSING
- [ ] pages/bar/bar.js — EXISTS / MISSING
### Patch Status
- [ ] file1.js — all 8 keywords present / N missing
- [ ] file2.js — all 5 keywords present / N missing
### Config Status
- [ ] app.json — all page paths registered
- [ ] project.config.json — valid
### DevTools Root Cause
- [ ] routeTo appLaunch timeout (likely cold-start latency)
- [ ] require() path mismatch at: _______
- [ ] Missing page config at: _______
After applying all recovery patches, run this comprehensive check:
node -c filename.jsopen -a "wechatwebdevtools" /path/to/projectIf DevTools shows "编译 .wxss 文件错误,错误信息如上" with Cannot read properties of undefined (reading 'MaxCodeSize'):
display: grid with 1fr units — replace with flexbox layoutbackdrop-filter usage in recently modified WXSS files{ vs } counts)=> arrow functions and ?. optional chaining — these WXML errors sometimes manifest as WXSS compile errors in DevTools! Always check WXML first before debugging WXSS.| Scenario | Action |
|---|---|
| 1-3 missing patches | Just fix, no plan needed |
| 3-8 missing patches | Quick audit + execute |
| 8+ missing patches or new files | Write plan first, get user OK |
| User reported "唔work" | Always audit first, then plan |