Files
meshcore-bot/scripts/post_tool_counter.sh
Stacy Olivas e9f4240704 docs: record CI fix commits in BUGS.md and TODO.md
Log ruff/mypy/ShellCheck fixes (e0eae09) and Python 3.9 matrix
removal (92c5910) in BUGS.md fixed section; update TODO.md
last-updated line to reflect current CI status.
2026-03-17 21:01:07 -07:00

18 lines
555 B
Bash
Executable File

#!/usr/bin/env bash
# Post-tool counter: increments tool call count and runs checkpoint every 100 calls
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
COUNTER_FILE="/tmp/mc_tool_count"
# Increment counter
COUNT=$(cat "$COUNTER_FILE" 2>/dev/null || echo "0")
COUNT=$((COUNT + 1))
echo "$COUNT" > "$COUNTER_FILE"
# Every 100 tool calls, run checkpoint
if [ $((COUNT % 100)) -eq 0 ]; then
echo "post_tool_counter: $COUNT tool calls — running context checkpoint"
bash "$REPO_ROOT/scripts/context_checkpoint.sh"
fi