feat(hooks): deterministic TELOS injection + SystemFileGuard#727
Closed
jlacour-git wants to merge 1 commit intodanielmiessler:mainfrom
Closed
feat(hooks): deterministic TELOS injection + SystemFileGuard#727jlacour-git wants to merge 1 commit intodanielmiessler:mainfrom
jlacour-git wants to merge 1 commit intodanielmiessler:mainfrom
Conversation
Two hooks that replace unreliable text instructions with deterministic code: 1. LoadContext: Inject USER/TELOS/PROJECTS.md at session start (~1KB). Addresses danielmiessler#479 where the model was told to read TELOS files via text instruction but often didn't. Only PROJECTS.md (not all 20 TELOS files). 2. SystemFileGuard: PreToolUse guard for Edit/Write that checks LOCAL_PATCHES.md before allowing edits to locally-patched SYSTEM files. Prevents accidental overwrite of local patches. Both follow the existing hook patterns (fail-open, <5ms, uses lib/paths). Refs: danielmiessler#695, danielmiessler#479 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
|
Thanks for this contribution! PAI v4.0 significantly restructured the architecture — new directory layout, Algorithm v3.6.0 (up from v1.x), hooks/lib/paths.ts for path resolution, and many of the underlying systems this PR targets have been rewritten. This PR targets the v3.0 architecture and can't be cleanly applied to v4.0.x. Closing as superseded. The latest release is v4.0.2. We're actively working on platform compatibility and other bigger items. If there's still a gap not covered by the new releases, we'd welcome a fresh PR against the current codebase. Thanks again! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two hooks that replace unreliable text instructions with deterministic code, as proposed in #695.
LoadContext.hook.ts— programmatically injects project context at session start instead of relying on text instructions the model can ignore. Addresses Why do we rely on the model to inject `USER/TELOS/*.md` instead of injecting them programmatically? #479. Only loads PROJECTS.md (~1KB), not all 20 TELOS files (33KB).LOCAL_PATCHES.mdbefore allowing edits to locally-patched SYSTEM files. Prevents accidental overwrite of local patches. Fail-open, <5ms.Both hooks follow existing patterns: use
lib/paths.ts, fail gracefully, and are documented in the hooks README.Test plan
LoadContextloads TELOS/PROJECTS.md when the file exists and is non-emptyLoadContextgracefully skips when TELOS/PROJECTS.md doesn't existSystemFileGuardprompts when editing a file tracked in LOCAL_PATCHES.mdSystemFileGuardpasses silently for non-patched filesSystemFileGuardpasses silently when LOCAL_PATCHES.md doesn't exist (fail-open)Refs: #695, #479
🤖 Generated with Claude Code