Recently Written · git

ai-config

One canonical AI agent config (rules, skills, MCP servers) rendered into Claude Code, Codex, Copilot CLI and Antigravity by acsync

git clone https://github.com/equwal/ai-config

Log | Files | Refs


commit 9d6a859419918e63b4cf8e9941f025021b0f1296
equwal <13551856+equwal@users.noreply.github.com>
2026-10-04 19:02:03 -0700

Add set_autocompact.sh: 500k auto-compact for Claude Code and Codex

 scripts/set_autocompact.sh | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
diff --git a/scripts/set_autocompact.sh b/scripts/set_autocompact.sh
new file mode 100644
index 0000000..82418dd
--- /dev/null
+++ b/scripts/set_autocompact.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+# Set a 500k-token auto-compact threshold for Claude Code and Codex on this computer.
+# Needs jq. Copilot CLI (hardcoded 95%) and Antigravity have no setting for it.
+set -eu
+TOKENS=500000
+
+# Back up $1, replace it with $2, then commit and push it in its config repo.
+save() {
+  if [ -f "$1" ]; then cp "$1" "$1.bak-autocompact"; fi
+  mv "$2" "$1"
+  dir=$(dirname "$1")
+  if [ -d "$dir/.git" ]; then
+    git -C "$dir" commit -qm "Set auto-compact threshold to $TOKENS tokens" -- "$(basename "$1")" || true
+    git -C "$dir" push -q || true
+  fi
+  echo "set: $1"
+}
+
+mkdir -p ~/.claude ~/.codex
+
+f=~/.claude/settings.json
+if [ ! -f "$f" ]; then echo '{}' > "$f"; fi
+jq --indent 2 ".autoCompactWindow = $TOKENS" "$f" > "$f.tmp"
+save "$f" "$f.tmp"
+
+# Drop any old value, then put the key first so it stays out of every [table].
+f=~/.codex/config.toml
+{
+  echo "model_auto_compact_token_limit = $TOKENS"
+  if [ -f "$f" ]; then grep -v '^model_auto_compact_token_limit[[:space:]]*=' "$f" || true; fi
+} > "$f.tmp"
+save "$f" "$f.tmp"
+
+echo "blocked: Copilot CLI and Antigravity have no setting"