Libra CodeHub

CedarCopilot/cedar-mail

Branch: staging

fix(playbook): default post-close stages and agents to do nothing

merged#2675CedarCopilot

CedarCopilot wants to merge 1 commit into staging from fix/post-close-stage-defaults

Live on prod, no production signal yetTimeline and evidence
  1. Opened
    Sep 3, 2026, 1:50 PM
  2. Sep 3, 2026, 1:59 PM
  3. Merged
    Sep 3, 2026, 4:15 PM
  4. Live on prod
    Sep 3, 2026, 4:15 PM
  5. Observed 0 hours
    Sep 3, 2026, 4:15 PM
  6. Unobserved

    Live on prod, no production signal yet

    Sep 3, 2026, 4:15 PM
  7. Pipelines steady after this deploy
    Sep 3, 2026, 4:15 PM

Behaviors Libra is checking

Meeting preparation for a closed or otherwise terminal deal skips first-meeting and follow-up sales templates and produces only a short recap of attendees and open commitments already on the deal.Not checked
prod
The next-steps agent does not create a task merely because the user appears on a thread or meeting for visibility, and requires an explicit ask, commitment, or open question addressed to that user.Not checked
prod
Generated organization playbooks now include default do-nothing instructions on stages whose value or label indicates won or lost, while leaving other stages unchanged.Not checked
prod
Agents must not create drafts, follow-up tasks, or full sales-style preparation for normally resolved deals, including when a user is involved only in a support or customer-success handoff.Not checked
prod
A genuine new expansion, upsell, additional use case, or stated intent to buy more overrides the post-close no-op defaults and is handled as a normal sales action.Not checked
prod

Libra has verdicts on 0 of 5 tracked behaviors on prod; 5 are still being checked. Libra checks hourly for 3 days after each deploy.

Summary

  • Aspire (a live customer) hit two symptoms from the same root cause: seller tasks getting created from post-close CS/onboarding threads a rep was only CC'd on for visibility, and meeting-prep writing full sales talk-tracks (objection handling, pricing) for post-close CS calls.
  • Both traced back to the seeded closedStageDefaultInstructions() text's vague "unless acting in a customer success capacity" carve-out , easy for an agent to self-justify just by being present on a thread.
  • agent-defaults/next-steps.ts: default "never create tasks for" list now explicitly excludes visibility-only thread presence and closed/terminal-stage deals, with a narrow exception for a genuine new expansion/upsell signal.
  • agent-defaults/meeting-prep.ts: default template now checks deal status first and skips sales-mode templates for closed/terminal deals, posting a short recap instead.
  • seed-playbook.ts: tightened closedStageDefaultInstructions() itself, and wired it into buildOrgPlaybookTemplate(), which previously never emitted closed-stage <instructions> at all (only the per-user template did).
  • Already applied by hand to the live Aspire account (reps with agent execution enabled); this makes it the default for every new account going forward.

Test plan

  • pnpm --filter @zero/server exec vitest run on seed-playbook.test.ts, agent-defaults.test.ts, curated-agenda-migration.test.ts, playbook-renderers.test.ts, resolve-playbook-context.test.ts, golden-output-regression.test.ts, playbook-regression-fixtures.test.ts , 227 passed
  • pnpm --filter @zero/server run types , clean

šŸ¤– Generated with Claude Code

https://claude.ai/code/session_01CjbZa1VXCaUFrDmUVs7o7Z

Greptile Summary

This PR tightens default playbook behavior so agents avoid sales tasks and full meeting preparation after a deal closes, except for genuine expansion signals.

  • Adds explicit post-close handling to meeting-prep and next-steps defaults.
  • Strengthens the shared closed-stage instruction text.
  • Adds closed-stage instructions to organization playbook seeds.
  • Updates the closed-stage regression test.

Confidence Score: 4/5

The PR appears safe to merge, with a non-blocking prompt duplication issue in newly seeded organization and user playbooks.

The behavioral changes consistently suppress post-close sales work, but new accounts will render the same closed-stage instruction from both playbook levels because runtime resolution concatenates them.

Files Needing Attention: apps/server/src/services/playbook/seed-playbook.ts

Important Files Changed

FilenameOverview
apps/server/src/services/playbook/seed-playbook.tsStrengthens closed-stage defaults and adds them to organization templates, but causes identical organization and user guidance to be rendered together.
apps/server/src/services/playbook/agent-defaults/meeting-prep.tsDirects closed-deal meetings toward a concise recap instead of sales-oriented preparation.
apps/server/src/services/playbook/agent-defaults/next-steps.tsPrevents visibility-only and ordinary post-close activity from creating seller tasks while preserving expansion signals.
apps/server/src/services/playbook/tests/seed-playbook.test.tsUpdates assertions to cover the strengthened closed-stage instruction language.
Prompt To Fix All With AI
### Issue 1
apps/server/src/services/playbook/seed-playbook.ts:899-903
**Closed-stage guidance is duplicated**

New accounts seed the same closed-stage instructions into both organization and per-user playbooks, while runtime resolution concatenates both entries. Every closed-stage execution therefore receives the lengthy instruction twice, consuming prompt context and unnecessarily overweighting the duplicated guidance.

---

For each issue above, determine whether it
Show production surfaces and changed-file mapping

Production surfaces

Libra has not measured any production surfaces for this change yet.

Changed files → surfaces

  • apps/server/src/services/playbook/__tests__/seed-playbook.test.tsno production surface mapped
  • apps/server/src/services/playbook/agent-defaults/meeting-prep.tsno production surface mapped
  • apps/server/src/services/playbook/agent-defaults/next-steps.tsno production surface mapped
  • apps/server/src/services/playbook/seed-playbook.tsno production surface mapped