Repository navigation
feat(addie): surface CTA context blocks in Addie's system prompt - #3377
Merged
Merged
Conversation
These five MemberContext blocks were hydrated for the suggested-prompts engine but never plumbed through to Addie's system prompt: - certification: in-progress attempts with module id and started-days, flagged as stale past 45 days; passed/failed states summarised - agent_testing: last test age and outcome, stale flag past 14 days, no-tests-on-record nudge for never-tested users - perspectives: zero-state writing nudge or count + last-published-days - next_event: upcoming registered event with days-until - adoption: missing public company listing, low team WG coverage Closes the data-flow gap where Addie was forced into tool round-trips (or worse, generic responses) for state we already had on context. The suggested-prompts rules and Addie's reasoning now both read the same hydrated context blocks. Tests: 9 new cases covering each rendered section, plus the negative case where adoption signals are healthy and the section is omitted. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
prompt-engineer review on #3377 flagged that lines like "gently suggest", "if they discuss X, suggest tool Y", "be encouraging if they want to retry" are response policy, not user context. Three problems: (a) different users get different policy depending on hydration, (b) the same nudge is restated in N places with drift risk, (c) prompt-injection surface widens since user-controlled fields rendered nearby could smuggle directives. Keep the factual signals (cert in-progress with module id and age, test staleness flag, perspectives count, etc.); strip the imperatives. Response policy belongs in server/src/addie/rules/*.md, applied uniformly when the corresponding signal is present. 35 unit tests still pass — assertions that checked "stale" and "older than 45 days" still match the trimmed wording. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
3 tasks done
bokelley
added a commit
that referenced
this pull request
Apr 28, 2026
…fig) (#3382) * refactor(addie): co-locate cross-cut CTAs in one registry (strangler) The digest-newsletter pickNudge maintained its own parallel rule list, duplicating "Continue cert", "Find a WG", "Complete profile" with the suggested-prompts engine. Adding a new CTA meant editing two files in sync. Co-locate the catalog: cross-cut rules in prompt-rules.ts now have an optional `digest` facet alongside their `pull` fields. Each facet keeps its own `when` clause typed against the surface's native shape (MemberContext for pull, DigestEmailRecipient for digest) — we share the catalog, not the eligibility logic. Lossy adapters between the two shapes were the alternative; per-surface gates are honest. Three digest-only CTAs (become member, join Slack, contributor cert) live in a separate DIGEST_ONLY_NUDGES list since they have no pull-surface analog. Adding more lists like this is the migration path for future surfaces (push DM jobs, etc.). pickNudge becomes a 15-line wrapper. No behavior change — same 7 nudges, same priority order (1-6 + the dynamic cert text), same copy. 14 new digest-nudge tests covering each rule's eligibility, priority ordering between cross-cut and digest-only CTAs, dynamic cert text grammar. Also documents two invariants in .agents/playbook.md: - MemberContext fields must surface to both hydration and formatMemberContextForPrompt (the data-plane invariant from #3377) - Cross-surface CTAs co-locate in the registry; each surface keeps its own when clause Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * fixup: apply expert review for #3382 Code review: - Extract RuleWithDigest type alias instead of inline `r is typeof r & { digest: DigestNudgeFacet }` narrowing - Deterministic secondary sort key on `id` so ordering doesn't rely on V8's stable-sort guarantee implicitly - New boundary test: zero-progress non-contributor must not receive the cert nudge (locks in cert facet's `> 0 && < total` gate) DX-expert: - Boot-time assertion in prompt-rules.ts: any rule with function- valued `prompt` must provide `matchClick`. Without it, click telemetry silently zeros for the new rule. Catching at module load is cheaper than discovering weeks later when CTR is empty. - Playbook invariants now pair each rule with "what mistake this prevents" + a code-pointer (canonical example) so future contributors can pattern-match instead of inferring abstract intent. Product expert: no blockers. The cert digest "Continue learning" vs pull "Continue A1" copy mismatch is real but minor (different surfaces, different attentional contexts). Defer. 140 unit tests total. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
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.
Why
When we built the suggested-prompts engine we hydrated five new `MemberContext` blocks (`certification`, `agent_testing`, `perspectives`, `next_event`, `adoption`) — but `formatMemberContextForPrompt` (the function that injects user context into Addie's system prompt) was never updated to read them.
Result: Addie has been blind to all this state when reasoning. A learner clicks "Continue A1" → Addie sees the message but her system prompt has no idea they have an in-progress A1 attempt. Best case: she calls a cert tool to find out. Common case: generic response.
What changed
`formatMemberContextForPrompt` now renders sections for all five blocks. Specific signals surfaced:
Why this matters beyond this PR
This is a small fix but a meaningful invariant: any new MemberContext field must be surfaced to both the rules engine AND Addie's prompt. Otherwise we end up with two parallel data planes — one for picking prompts, one for reasoning about them — and they drift.
Test plan
🤖 Generated with Claude Code