Skip to content
Apothem
संदर्भ

हुक

SessionStart, PreToolUse और Stop पर फायर होने वाले टूल इवेंट हैंडलर, जो git आइसोलेशन और प्लान अनुशासन को लागू करने वाले संदेश संदर्भ लोड करते हैं।

हुक टूल इवेंट पर फायर होते हैं और ऐसे संदेश संदर्भ लोड करते हैं जिन्हें सहायक अतिरिक्त सिस्टम प्रॉम्प्ट के रूप में मानता है। वायरिंग Claude Code के settings.json हुक ब्लॉक, Codex की hooks.json हुक फ़ाइल, और Qwen Code के settings.json हुक मैप में रहती है।

इवेंटटाइमआउटउद्देश्य
SessionStart30 सेकंडमेमोरी पढ़ें, प्लान स्थिति जाँचें, तत्परता की रिपोर्ट दें
PreCompact30 सेकंडसंपीड़न से पहले सत्यापित करें कि स्थिति बाह्यीकृत है
PostCompact30 सेकंडसंपीड़न के बाद कार्यशील स्थिति बहाल करें
Stop60 सेकंडसत्र-समाप्ति पर बाह्यीकरण
PreToolUse (Bash)10 सेकंडBash सत्यापन — git आर्टिफ़ैक्ट आइसोलेशन
PreToolUse (Write/Edit/NotebookEdit/apply_patch)10 सेकंडप्लान-संदर्भ आइसोलेशन, frontmatter जाँच

डिस्पैचर

इंस्टॉल किए गए हुक एंट्री डिस्पैचर को निरपेक्ष स्क्रिप्ट पथ द्वारा आह्वान करते हैं। सेटिंग्स टेम्पलेट ${HARNESS_ROOT} टोकन रखते हैं — python "${HARNESS_ROOT}/apothem/hooks/dispatch.py" <event> [<message-name>] — जिसे इंस्टॉलर इंस्टॉल समय पर harness रूट के वास्तविक पथ में रेंडर करता है (Claude Code और Qwen Code डिस्पैचर को <harness-root>/apothem/hooks/ के नीचे, Codex को <harness-root>/hooks/ के नीचे मूर्त रूप देते हैं)। डिस्पैचर एक स्वतंत्र स्टैंडर्ड-लाइब्रेरी स्क्रिप्ट है: यह अपना स्वयं का sys.path बूटस्ट्रैप करता है, इसलिए होस्ट पर कोई आयात-योग्य apothem पैकेज आवश्यक नहीं है। स्रोत चेकआउट से, मॉड्यूल रूप python -m apothem.hooks.dispatch <event> (PYTHONPATH=src के साथ) विकास के लिए वही कोड चलाता है। डिस्पैचर इकोसिस्टम-रूट समाधान के लिए hooks/lib/resolve_root.py लोड करता है और hooks/emit_hook_context.py तथा hooks/session_start_bootstrap.py को सौंपता है।

संदेश संदर्भ

प्रति-इवेंट Markdown संदर्भ src/apothem/hooks/messages/ के नीचे रहते हैं:

  • postcompact.md, precompact.md, stop.md
  • pretooluse-bash.md, pretooluse-write.md, pretooluse-edit.md, pretooluse-notebookedit.md

प्रत्येक संदर्भ फ़ाइल को डिस्पैचर तब लोड करता है जब उसका इवेंट फायर होता है और उसका संदर्भ तर्क सेटिंग्स फ़ाइल में पंजीकृत होता है।

उत्पन्न हुक संदेश सूची

NameDescriptionSource
postcompactPost-compaction Blind Bootstrap (CM-24 §6.2). Restore working state from durable files; conversation context is now compressed.src/apothem/hooks/messages/postcompact.md
posttooluse-proactive-compactionProactive-compaction tracker for PostToolUse tool calls.src/apothem/hooks/messages/posttooluse-proactive-compaction.md
precompactPre-compaction protocol (CM-24 §2.3). Externalize all in-conversation state BEFORE the harness compresses context.src/apothem/hooks/messages/precompact.md
pretooluse-askuserquestion-recommendedCall-time (Recommended)-marker guard for AskUserQuestion tool calls.src/apothem/hooks/messages/pretooluse-askuserquestion-recommended.md
pretooluse-bash-plan-guardPlans-Discipline write guard for Bash tool calls (companion to pretooluse-write-plan-guard.md).src/apothem/hooks/messages/pretooluse-bash-plan-guard.md
pretooluse-bashCM-7 git-artifact isolation + M12 numeric-prefix discipline + M15 human-only authorship.src/apothem/hooks/messages/pretooluse-bash.md
pretooluse-conformity> Advisory: this hook reports; it does not block. Mechanical enforcement runs in CI.src/apothem/hooks/messages/pretooluse-conformity.md
pretooluse-dependency-guardDependency-manifest supply-chain guard (advisory).src/apothem/hooks/messages/pretooluse-dependency-guard.md
pretooluse-edit-header-guardSPDX-header inject guard for Edit tool calls.src/apothem/hooks/messages/pretooluse-edit-header-guard.md
pretooluse-editCodebase isolation (Edit scope).src/apothem/hooks/messages/pretooluse-edit.md
pretooluse-eval-guardDynamic-eval / unsafe-deserialization guard — advisory prompt-injection defense.src/apothem/hooks/messages/pretooluse-eval-guard.md
pretooluse-notebookeditCodebase isolation (notebook scope).src/apothem/hooks/messages/pretooluse-notebookedit.md
pretooluse-write-header-guardSPDX-header inject guard for Write tool calls.src/apothem/hooks/messages/pretooluse-write-header-guard.md
pretooluse-write-plan-guardPlans-Discipline write guard for Write / Edit / NotebookEdit tool calls.src/apothem/hooks/messages/pretooluse-write-plan-guard.md
pretooluse-writeCodebase isolation + frontmatter compliance.src/apothem/hooks/messages/pretooluse-write.md
sessionstartSession-start conformity posture.src/apothem/hooks/messages/sessionstart.md
stopSession-end protocol (CM-14 + CM-24 §2.5 + CM-26 + CM-22 §2/§4).src/apothem/hooks/messages/stop.md

On this page