Implement hook-based history compaction in fast-agent (rolling window, context threshold truncation, tool-result clearing, summary prompt compaction). Use when adding or extending compaction hooks and wiring them into agent cards.
Implement and wire compaction hooks via after_turn_complete.
scripts/compaction_hooks.py into your project hooks module.tool_hooks.after_turn_complete.tool_hooks:
after_turn_complete: hooks.py:rolling_window
rolling_windowtruncate_over_thresholdclear_results_softclear_results_hardcompaction_promptSee references/compaction.md for the design summary.
if not ctx.is_turn_complete: return.ctx.usage when available to read context usage.ctx.load_message_history(...) to replace history.show_hook_message(...) to display a compaction notice.Run a hook against saved history:
python scripts/hook_smoke_test.py \
--hook path/to/hooks.py:rolling_window \
--history ./history.json \
--hook-type after_turn_complete \
--output ./history-modified.json
npx skills add fast-agent-ai/compaction-strategies下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer