fix: feat: SessionStart compact hook re-injects phase protocol after context compaction (#274)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-20 23:27:32 +00:00
parent 5c960f1b6e
commit e3895ad3ac
7 changed files with 86 additions and 8 deletions

View file

@ -0,0 +1,15 @@
#!/bin/bash
# on-compact-reinject.sh — SessionStart (compact) hook for dark-factory agent sessions.
#
# Called by Claude Code after context compaction. Reads a context file and
# outputs its content to stdout, which Claude Code injects as system context.
# No-op if the context file doesn't exist.
#
# Usage (in .claude/settings.json):
# {"type": "command", "command": "this-script /tmp/dev-session-PROJECT-ISSUE.context"}
#
# Args: $1 = context file path
cat > /dev/null # consume hook JSON from stdin
[ -n "${1:-}" ] && [ -f "$1" ] && cat "$1"
exit 0