Skip to content

feat(hooks): support context injection#245

Open
tjb-tech wants to merge 1 commit into
mainfrom
feature/claude-mem
Open

feat(hooks): support context injection#245
tjb-tech wants to merge 1 commit into
mainfrom
feature/claude-mem

Conversation

@tjb-tech
Copy link
Copy Markdown
Collaborator

@tjb-tech tjb-tech commented May 9, 2026

Summary

Adds generic command-hook capabilities needed by external memory/context integrations:

  • command hooks can receive the JSON hook payload on stdin via stdin_payload
  • command hook stdout JSON is parsed for additional_context
  • supports Claude-style hookSpecificOutput.additionalContext
  • session_start hook context is appended to the runtime system prompt
  • user_prompt_submit hook context is injected for the current turn only
  • hook payloads now include richer fields such as cwd, session_id, model, permission_mode, tool_response, and last_assistant_message

This enables integrations such as claude-mem without hard-coding any specific memory backend into OpenHarness.

Validation

PYTHONPATH=src python -m pytest -q tests/test_hook_context_injection.py
PYTHONPATH=src python -m pytest -q

Results:

  • 3 passed for the new hook context tests
  • 1033 passed, 14 warnings for the full suite

Also validated manually with a real OpenHarness agent loop, a real Claude subscription model, a real grep tool call, and a claude-mem fork worker hook receiving platformSource=openharness observations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant