Skip to content

feat(contribute): add sharing.contributeHint.enabled to opt out of the share-learnings nudge - #432

Merged
jeff-r2026 merged 1 commit into
Tencent:mainfrom
Rererr:feat/contribute-hint-toggle
Sep 8, 2026
Merged

jeff-r2026 merged 1 commit into
Tencent:mainfrom
Rererr:feat/contribute-hint-toggle

Conversation

@Rererr

@Rererr Rererr commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Add sharing.contributeHint.enabled (team default), contributeHintEnabled (member override) and TEAMAI_CONTRIBUTE_HINT_DISABLED=1 (kill switch) so a team can turn off the post-session /teamai-share-learnings nudge without disabling the whole built-in Stop hook. Today the only way to silence the nudge is builtin.disabled: ["Hook dispatch stop"] in hooks/hooks.yaml, which also drops the CLI update check, votes sync and dashboard reporting.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature causing existing behavior to change)
  • Documentation only
  • Refactor / internal cleanup

Test Plan

  • npx tsc --noEmit passes

  • npx vitest run passes (full suite; the only failures on my macOS machine are lock-atomic.test.ts and push-*.test.ts concurrency/timing tests, which fail identically on a pristine main checkout 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 existing teamai.yaml / config.yaml without the new fields still parse.

  • hook-handlers.test.ts: contribute-check returns null and never calls contributeCheckForSession when 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=1 silences it; pending-hint consumes a stashed hint without delivering it while still delivering votes hints.

Mutation check: removing the guard in contributeCheckHandler makes 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

  • Shape follows the existing two-tier pattern of sharing.recall / sharing.coAuthor (optional block, no .default so existing TeamaiConfig literals stay valid; resolved through isContributeHintEnabled()).
  • The handler resolves the switch per run via autoDetectInit() (project scope first, then user), so flipping it in teamai.yaml takes effect on the next pull with no hook re-injection. If config cannot be loaded it falls back to enabled, so half-initialized installs behave exactly as before.
  • On stdout-less tools (codebuddy / workbuddy) the pending-hint handler 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.
  • Scope: only the nudge. Friction scoring, teamai contribute --file, and manual /teamai-share-learnings keep working. Docs updated in both usage guides (new "Turning the hint off" subsection + config reference) and both READMEs (one sentence).
  • Motivation: our team runs a personal retrospective loop that files ordinary PRs to the team repo, so the automatic nudge is noise for us — but we still want update checks and reporting from the Stop hook.

…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.
@jeff-r2026
jeff-r2026 merged commit 3f52bad into Tencent:main Sep 8, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants