feat(contribute): add sharing.contributeHint.enabled to opt out of the share-learnings nudge - #432
Merged
Conversation
…e share-learnings nudge Teams that route knowledge sharing through their own review flow had no way to silence the post-session "/teamai-share-learnings" hint: the only knob was disabling the whole built-in Stop hook via hooks.yaml `builtin.disabled`, which also drops the update check, votes sync and dashboard reporting. Add a dedicated switch with the same two-tier shape as recall and coAuthor: - teamai.yaml `sharing.contributeHint.enabled` (default true) - local config `contributeHintEnabled` (member override) - `TEAMAI_CONTRIBUTE_HINT_DISABLED=1` as an emergency kill switch The Stop-hook handler resolves it per run (no hook re-injection needed) and falls back to enabled when config cannot be loaded, so half- initialized installs behave exactly as before. On stdout-less tools the pending-hint handler still consumes the stash so a hint stashed before the switch flipped is never delivered later; votes hints are unaffected. Friction scoring, `teamai contribute --file` and manual use of the skill are untouched.
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
Add
sharing.contributeHint.enabled(team default),contributeHintEnabled(member override) andTEAMAI_CONTRIBUTE_HINT_DISABLED=1(kill switch) so a team can turn off the post-session/teamai-share-learningsnudge without disabling the whole built-in Stop hook. Today the only way to silence the nudge isbuiltin.disabled: ["Hook dispatch stop"]inhooks/hooks.yaml, which also drops the CLI update check, votes sync and dashboard reporting.Type of Change
Test Plan
npx tsc --noEmitpassesnpx vitest runpasses (full suite; the only failures on my macOS machine arelock-atomic.test.tsandpush-*.test.tsconcurrency/timing tests, which fail identically on a pristinemaincheckout and are unrelated to this change)Added/updated tests for the change
contribute-hint-toggle.test.ts(new): resolution order (default true → team → member override → env kill switch) and schema parsing, including that existingteamai.yaml/config.yamlwithout the new fields still parse.hook-handlers.test.ts:contribute-checkreturnsnulland never callscontributeCheckForSessionwhen the team turned the hint off; a member override re-enables it; config load failure keeps the old behavior (hint still emitted);TEAMAI_CONTRIBUTE_HINT_DISABLED=1silences it;pending-hintconsumes a stashed hint without delivering it while still delivering votes hints.Mutation check: removing the guard in
contributeCheckHandlermakes two of the new tests fail.Related Issues
None directly. Related context: #354 (share-learnings hint delivery on stdout-less tools) — this PR keeps that stash path intact and only decides whether the stashed hint is shown.
Notes for Reviewers
sharing.recall/sharing.coAuthor(optional block, no.defaultso existingTeamaiConfigliterals stay valid; resolved throughisContributeHintEnabled()).autoDetectInit()(project scope first, then user), so flipping it inteamai.yamltakes effect on the nextpullwith no hook re-injection. If config cannot be loaded it falls back to enabled, so half-initialized installs behave exactly as before.codebuddy/workbuddy) thepending-hinthandler still consumes the stash when disabled, so a hint stashed before the switch flipped is never delivered later when it is turned back on. Votes hints on the same handler are unaffected.teamai contribute --file, and manual/teamai-share-learningskeep working. Docs updated in both usage guides (new "Turning the hint off" subsection + config reference) and both READMEs (one sentence).