feat(hooklife): auto-activation hook (SessionStart + UserPrompt)#211
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
9 tasks
Delqhi
pushed a commit
that referenced
this pull request
Jun 16, 2026
Adds cmd/sin-code/internal/hooklife/autoactivate/, a per-session rule-injection subpackage for the hooklife subsystem. Inspired by caveman's caveman-activate.js: writes a flag-file equivalent at session start, then re-emits the rule body on every UserPrompt. Wire-up: * autoactivate.NewActivator(defaults) — constructor * Activator.OnSessionStart/OnUserPrompt — per-session lifecycle * SessionStartHook + UserPromptHook — wire into any *hooklife.Registry via Activator.Register(reg); both return Warn so the runner's aggregation surfaces the rendered rule body * sin-code chat --activate <rule-list> + --no-trigger flags * Project-local .sin-code/autoactivate.toml (pure-stdlib, no new deps) Determinism: * RuleSet is map[name]Rule with sorted-Names() iteration * Render() is byte-stable for any same-content RuleSet (mandate M2 + pre-req for the system-prompt hash metric, issue #2) * EndSession(sid) drops state on exit — privacy-first Race discipline: * Single sync.RWMutex (mandate M7) over the sessions map * go test -race -count=1 passes 35 unit + 8 integration tests * 91.5% statement coverage Docs: * autoactivate/{activator,rules,triggers}.doc.md * AGENTS.md §10 hooklife event table updated (SessionStart + UserPrompt rows) * CHANGELOG.md Unreleased [v3.19.0] entry added * Last verified bumped to v3.19.0
Contributor
|
Deployment failed with the following error: Learn More: https://vercel.com/manheiler-8784s-projects?upgradeToPro=build-rate-limit |
Contributor
|
Deployment failed with the following error: Learn More: https://vercel.com/aragonheld-7756s-projects?upgradeToPro=build-rate-limit |
🏆 CEO Audit — A+ (100.0/100)
📥 Download full report (Markdown)
|
🏆 CEO Audit — A+ (100.0/100)
📥 Download full report (Markdown) Run ID:
|
| // never errors for a missing file (privacy-first: silent, opt-in by | ||
| // presence). | ||
| func LoadFile(path string) (RuleSet, Default, error) { | ||
| f, err := os.Open(path) |
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.
Closes #176
Adds cmd/sin-code/internal/hooklife/autoactivate/, a per-session rule-injection subpackage for the hooklife subsystem. Mirrors JuliusBrussee/caveman's caveman-activate.js (SessionStart) + caveman-mode-tracker.js (UserPrompt) flow: state + trigger file + per-turn re-inject.
Files
Verification
Design notes