chore: push all design docs, V2 plan specs, and current working state
Includes AirPlan design documents, AircOding-alpha1-plan, AirPlanV2, AirPlan-ParaV2, AirPlan-Para V1 reference docs, and all working code changes across packages. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
42
AirPlan/docs/spec/AirPlan-ParaV2/AirContextServer/scripts/on_pre_compact.py
Executable file
42
AirPlan/docs/spec/AirPlan-ParaV2/AirContextServer/scripts/on_pre_compact.py
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env python3
|
||||
"""PreCompact hook — block Claude Code's built-in auto-compact.
|
||||
|
||||
Only active in projects that have opted in (AirContext/ exists). Otherwise
|
||||
Claude's default auto-compact behaviour is preserved untouched.
|
||||
|
||||
Manual `/compact` is always allowed; auto-triggered compaction is rejected so
|
||||
AirContext's rule-driven compactor is the only thing that mutates the chain.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def main() -> int:
|
||||
raw = sys.stdin.read() or "{}"
|
||||
try:
|
||||
payload = json.loads(raw)
|
||||
except json.JSONDecodeError:
|
||||
payload = {}
|
||||
|
||||
cwd = payload.get("cwd") or os.environ.get("CLAUDE_PROJECT_DIR") or os.getcwd()
|
||||
if not (Path(cwd) / "AirContext").exists():
|
||||
return 0 # project hasn't opted in; let Claude do whatever it wants
|
||||
|
||||
trigger = payload.get("trigger") or payload.get("compact_trigger")
|
||||
if trigger == "auto":
|
||||
print(json.dumps({
|
||||
"decision": "block",
|
||||
"reason": (
|
||||
"AirContext: auto-compact disabled by user policy. "
|
||||
"Custom rule-driven compaction handles this out-of-band."
|
||||
)
|
||||
}))
|
||||
return 0
|
||||
return 0 # manual /compact passes through
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user