[{"data":1,"prerenderedAt":503},["ShallowReactive",2],{"doc-seo-\u002Fdocs\u002Fcontracts\u002Fchange-plan-contract":3,"content-query-wg7jCCQEqM":6},{"title":4,"description":5},"Hooks & Pre-Write Checks","How Septum's pre-write hook and Git pre-commit check validate imports before edits land.",{"_path":7,"_dir":8,"_draft":9,"_partial":9,"_locale":10,"title":4,"description":5,"badge":11,"body":12,"_type":498,"_id":499,"_source":100,"_file":500,"_stem":501,"_extension":502},"\u002Fdocs\u002Fcontracts\u002Fchange-plan-contract","contracts",false,"","Hooks",{"type":13,"children":14,"toc":490},"root",[15,38,53,79,334,340,345,379,443,449,484],{"type":16,"tag":17,"props":18,"children":19},"element","p",{},[20,28,30,36],{"type":16,"tag":21,"props":22,"children":24},"code",{"className":23},[],[25],{"type":26,"value":27},"text","septum init",{"type":26,"value":29}," can scaffold editor\u002Fagent pre-write hooks and a Git pre-commit hook (",{"type":16,"tag":21,"props":31,"children":33},{"className":32},[],[34],{"type":26,"value":35},"septum check --staged",{"type":26,"value":37},") while preserving your existing unrelated hooks.",{"type":16,"tag":39,"props":40,"children":42},"h2",{"id":41},"pre-write-hook-septum-hook-pre-write",[43,45,51],{"type":26,"value":44},"Pre-Write Hook (",{"type":16,"tag":21,"props":46,"children":48},{"className":47},[],[49],{"type":26,"value":50},"septum hook pre-write",{"type":26,"value":52},")",{"type":16,"tag":17,"props":54,"children":55},{},[56,61,63,69,71,77],{"type":16,"tag":21,"props":57,"children":59},{"className":58},[],[60],{"type":26,"value":50},{"type":26,"value":62}," reads a JSON edit payload from ",{"type":16,"tag":21,"props":64,"children":66},{"className":65},[],[67],{"type":26,"value":68},"stdin",{"type":26,"value":70},", reconstructs the proposed file content, extracts its imports, and checks them against the module rules stored in ",{"type":16,"tag":21,"props":72,"children":74},{"className":73},[],[75],{"type":26,"value":76},".septum\u002Fseptum.db",{"type":26,"value":78},".",{"type":16,"tag":80,"props":81,"children":82},"ul",{},[83,149,302],{"type":16,"tag":84,"props":85,"children":86},"li",{},[87,93,95,101,103,109,111,117,118,124,126,132,133,139,141,147],{"type":16,"tag":88,"props":89,"children":90},"strong",{},[91],{"type":26,"value":92},"Supported payload formats",{"type":26,"value":94},": Full file content (",{"type":16,"tag":21,"props":96,"children":98},{"className":97},[],[99],{"type":26,"value":100},"content",{"type":26,"value":102}," \u002F ",{"type":16,"tag":21,"props":104,"children":106},{"className":105},[],[107],{"type":26,"value":108},"CodeContent",{"type":26,"value":110},"), targeted string replacements (",{"type":16,"tag":21,"props":112,"children":114},{"className":113},[],[115],{"type":26,"value":116},"old_string",{"type":26,"value":102},{"type":16,"tag":21,"props":119,"children":121},{"className":120},[],[122],{"type":26,"value":123},"TargetContent",{"type":26,"value":125},"), multi-chunk edits (",{"type":16,"tag":21,"props":127,"children":129},{"className":128},[],[130],{"type":26,"value":131},"edits",{"type":26,"value":102},{"type":16,"tag":21,"props":134,"children":136},{"className":135},[],[137],{"type":26,"value":138},"ReplacementChunks",{"type":26,"value":140},"), and Codex ",{"type":16,"tag":21,"props":142,"children":144},{"className":143},[],[145],{"type":26,"value":146},"apply_patch",{"type":26,"value":148}," diffs.",{"type":16,"tag":84,"props":150,"children":151},{},[152,157,159],{"type":16,"tag":88,"props":153,"children":154},{},[155],{"type":26,"value":156},"Exit codes & client modes",{"type":26,"value":158},":\n",{"type":16,"tag":80,"props":160,"children":161},{},[162,221,282],{"type":16,"tag":84,"props":163,"children":164},{},[165,167,173,175,181,183,189,191,197,198,204,205,211,213,219],{"type":26,"value":166},"Policy violations exit with code ",{"type":16,"tag":21,"props":168,"children":170},{"className":169},[],[171],{"type":26,"value":172},"1",{"type":26,"value":174}," (or ",{"type":16,"tag":21,"props":176,"children":178},{"className":177},[],[179],{"type":26,"value":180},"2",{"type":26,"value":182}," when passed ",{"type":16,"tag":21,"props":184,"children":186},{"className":185},[],[187],{"type":26,"value":188},"--exit-code-2",{"type":26,"value":190},", ",{"type":16,"tag":21,"props":192,"children":194},{"className":193},[],[195],{"type":26,"value":196},"--claude",{"type":26,"value":190},{"type":16,"tag":21,"props":199,"children":201},{"className":200},[],[202],{"type":26,"value":203},"--cursor",{"type":26,"value":190},{"type":16,"tag":21,"props":206,"children":208},{"className":207},[],[209],{"type":26,"value":210},"--codex",{"type":26,"value":212},", or ",{"type":16,"tag":21,"props":214,"children":216},{"className":215},[],[217],{"type":26,"value":218},"--opencode",{"type":26,"value":220},").",{"type":16,"tag":84,"props":222,"children":223},{},[224,226,232,234,240,242,247,248,253,254,259,260,265,267,273,275,280],{"type":26,"value":225},"Default mode prints ",{"type":16,"tag":21,"props":227,"children":229},{"className":228},[],[230],{"type":26,"value":231},"{\"decision\": \"deny\", \"reason\": \"...\"}",{"type":26,"value":233}," to ",{"type":16,"tag":21,"props":235,"children":237},{"className":236},[],[238],{"type":26,"value":239},"stdout",{"type":26,"value":241},"; client flags (",{"type":16,"tag":21,"props":243,"children":245},{"className":244},[],[246],{"type":26,"value":196},{"type":26,"value":190},{"type":16,"tag":21,"props":249,"children":251},{"className":250},[],[252],{"type":26,"value":203},{"type":26,"value":190},{"type":16,"tag":21,"props":255,"children":257},{"className":256},[],[258],{"type":26,"value":210},{"type":26,"value":190},{"type":16,"tag":21,"props":261,"children":263},{"className":262},[],[264],{"type":26,"value":218},{"type":26,"value":266},") write the reason to ",{"type":16,"tag":21,"props":268,"children":270},{"className":269},[],[271],{"type":26,"value":272},"stderr",{"type":26,"value":274}," so ",{"type":16,"tag":21,"props":276,"children":278},{"className":277},[],[279],{"type":26,"value":239},{"type":26,"value":281}," stays clean.",{"type":16,"tag":84,"props":283,"children":284},{},[285,287,292,294,300],{"type":26,"value":286},"If ",{"type":16,"tag":21,"props":288,"children":290},{"className":289},[],[291],{"type":26,"value":76},{"type":26,"value":293}," does not exist or the file is outside any mapped module, the hook exits ",{"type":16,"tag":21,"props":295,"children":297},{"className":296},[],[298],{"type":26,"value":299},"0",{"type":26,"value":301}," without blocking.",{"type":16,"tag":84,"props":303,"children":304},{},[305,310,312,317,319,325,327,332],{"type":16,"tag":88,"props":306,"children":307},{},[308],{"type":26,"value":309},"Scope limits",{"type":26,"value":311},": The pre-write hook checks ",{"type":16,"tag":88,"props":313,"children":314},{},[315],{"type":26,"value":316},"proposed import rules only",{"type":26,"value":318},"—not full dependency cycles or runtime behavior. Use ",{"type":16,"tag":21,"props":320,"children":322},{"className":321},[],[323],{"type":26,"value":324},"septum_boundary",{"type":26,"value":326}," or ",{"type":16,"tag":21,"props":328,"children":330},{"className":329},[],[331],{"type":26,"value":35},{"type":26,"value":333}," for full audits.",{"type":16,"tag":39,"props":335,"children":337},{"id":336},"git-pre-commit-check",[338],{"type":26,"value":339},"Git Pre-Commit Check",{"type":16,"tag":17,"props":341,"children":342},{},[343],{"type":26,"value":344},"The generated Git pre-commit hook runs:",{"type":16,"tag":346,"props":347,"children":351},"pre",{"className":348,"code":349,"language":350,"meta":10,"style":10},"language-bash shiki shiki-themes github-light github-dark","septum check --staged\n","bash",[352],{"type":16,"tag":21,"props":353,"children":354},{"__ignoreMap":10},[355],{"type":16,"tag":356,"props":357,"children":360},"span",{"class":358,"line":359},"line",1,[361,367,373],{"type":16,"tag":356,"props":362,"children":364},{"style":363},"--shiki-default:#6F42C1;--shiki-dark:#B392F0",[365],{"type":26,"value":366},"septum",{"type":16,"tag":356,"props":368,"children":370},{"style":369},"--shiki-default:#032F62;--shiki-dark:#9ECBFF",[371],{"type":26,"value":372}," check",{"type":16,"tag":356,"props":374,"children":376},{"style":375},"--shiki-default:#005CC5;--shiki-dark:#79B8FF",[377],{"type":26,"value":378}," --staged\n",{"type":16,"tag":80,"props":380,"children":381},{},[382,413],{"type":16,"tag":84,"props":383,"children":384},{},[385,387,396,398,404,406,411],{"type":26,"value":386},"In ",{"type":16,"tag":88,"props":388,"children":389},{},[390],{"type":16,"tag":21,"props":391,"children":393},{"className":392},[],[394],{"type":26,"value":395},"warn",{"type":26,"value":397}," mode (default), ",{"type":16,"tag":21,"props":399,"children":401},{"className":400},[],[402],{"type":26,"value":403},"septum check",{"type":26,"value":405}," reports violations and exits ",{"type":16,"tag":21,"props":407,"children":409},{"className":408},[],[410],{"type":26,"value":299},{"type":26,"value":412}," (advisory).",{"type":16,"tag":84,"props":414,"children":415},{},[416,417,426,428,434,436,441],{"type":26,"value":386},{"type":16,"tag":88,"props":418,"children":419},{},[420],{"type":16,"tag":21,"props":421,"children":423},{"className":422},[],[424],{"type":26,"value":425},"strict",{"type":26,"value":427}," mode (",{"type":16,"tag":21,"props":429,"children":431},{"className":430},[],[432],{"type":26,"value":433},"septum check --staged --strict",{"type":26,"value":435},"), violations, unresolved imports, or unindexed workspaces exit ",{"type":16,"tag":21,"props":437,"children":439},{"className":438},[],[440],{"type":26,"value":172},{"type":26,"value":442}," and block the commit.",{"type":16,"tag":39,"props":444,"children":446},{"id":445},"index-freshness-watcher",[447],{"type":26,"value":448},"Index Freshness & Watcher",{"type":16,"tag":17,"props":450,"children":451},{},[452,454,459,461,467,469,475,477,483],{"type":26,"value":453},"While the MCP server is running, Septum's built-in file watcher keeps ",{"type":16,"tag":21,"props":455,"children":457},{"className":456},[],[458],{"type":26,"value":76},{"type":26,"value":460}," updated in-process—so default harness configs do not need a separate ",{"type":16,"tag":21,"props":462,"children":464},{"className":463},[],[465],{"type":26,"value":466},"PostToolUse",{"type":26,"value":468}," shell hook. For CLI-only workflows, ",{"type":16,"tag":21,"props":470,"children":472},{"className":471},[],[473],{"type":26,"value":474},"septum-post-write.sh",{"type":26,"value":476}," is still available and coalesces bursts using ",{"type":16,"tag":21,"props":478,"children":480},{"className":479},[],[481],{"type":26,"value":482},".septum\u002Fsync.lock",{"type":26,"value":78},{"type":16,"tag":485,"props":486,"children":487},"style",{},[488],{"type":26,"value":489},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":10,"searchDepth":491,"depth":491,"links":492},3,[493,496,497],{"id":41,"depth":494,"text":495},2,"Pre-Write Hook (septum hook pre-write)",{"id":336,"depth":494,"text":339},{"id":445,"depth":494,"text":448},"markdown","content:docs:contracts:change-plan-contract.md","docs\u002Fcontracts\u002Fchange-plan-contract.md","docs\u002Fcontracts\u002Fchange-plan-contract","md",1795576106769]