32 lines
758 B
Python
32 lines
758 B
Python
|
|
#!/usr/bin/env python3
|
||
|
|
"""SessionStart hook: inject ORCHESTRATION.md as additionalContext.
|
||
|
|
|
||
|
|
Fires on startup/resume/clear, and on 'compact' (matcher includes it) so the
|
||
|
|
rules survive a context-compaction pass, not just the first turn.
|
||
|
|
"""
|
||
|
|
import json
|
||
|
|
import os
|
||
|
|
import sys
|
||
|
|
|
||
|
|
PLUGIN_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||
|
|
ORCHESTRATION_FILE = os.path.join(PLUGIN_ROOT, "ORCHESTRATION.md")
|
||
|
|
|
||
|
|
|
||
|
|
def main():
|
||
|
|
try:
|
||
|
|
with open(ORCHESTRATION_FILE) as f:
|
||
|
|
context = f.read()
|
||
|
|
except OSError:
|
||
|
|
return
|
||
|
|
|
||
|
|
print(json.dumps({
|
||
|
|
"hookSpecificOutput": {
|
||
|
|
"hookEventName": "SessionStart",
|
||
|
|
"additionalContext": context,
|
||
|
|
}
|
||
|
|
}))
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
sys.exit(main())
|