@synap-core/workspace-templates 0.36.0 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synap-core/workspace-templates",
3
- "version": "0.36.0",
3
+ "version": "0.37.0",
4
4
  "type": "module",
5
5
  "description": "Canonical workspace definitions — YAML source + typed exports for browser, backend, CLI, and marketplace",
6
6
  "repository": {
@@ -526,11 +526,16 @@ profiles:
526
526
  description: "Generated or curated voice guidance by context: traits, tone, vocabulary, and copy examples."
527
527
  semanticSlug: brand.voice
528
528
  # The ONE lifecycle (work model L1): every option's category.
529
+ # `approved` is a person's call (design b199a3a4, trust (a), 8 Nov 2026):
530
+ # an approved guide is rendered into the instructions of every playbook
531
+ # that declares `guidance: kind:brand-voice-guide` (the CRM drafters), so
532
+ # an agent's text reaches a future prompt only once a person approved it.
533
+ # An agent writes a draft; a person approves it.
529
534
  lifecycle:
530
535
  property: voice-status
531
536
  options:
532
537
  - { key: draft, category: open }
533
- - { key: approved, category: done }
538
+ - { key: approved, category: done, humanOnly: true }
534
539
  - { key: deprecated, category: lost, humanOnly: true }
535
540
  properties:
536
541
  - slug: voice-context
@@ -547,7 +552,11 @@ profiles:
547
552
  legal,
548
553
  editorial,
549
554
  investor,
555
+ outreach,
550
556
  ]
557
+ # `outreach`: how we write to a lead (design b199a3a4, founder 8 Nov
558
+ # 2026: ONE voice for content and sales). The CRM drafters read the
559
+ # `general` and `outreach` guides (`guidance` where voice-context).
551
560
  constraints: { defaultValue: general }
552
561
  - slug: voice-status
553
562
  label: Status
@@ -877,6 +886,13 @@ views:
877
886
  description: Base, format and goal-frame guidelines for making content.
878
887
 
879
888
  entityLinks:
889
+ # A new version of a voice guide is a new guide, a draft that `revises` the
890
+ # approved one (design b199a3a4): approving it and deprecating the old one
891
+ # is a person's act, and the chain of revisions is the guide's history.
892
+ - sourceProfileSlug: brand-voice-guide
893
+ targetProfileSlug: brand-voice-guide
894
+ type: revises
895
+ label: Revises
880
896
  - sourceProfileSlug: brand-token-set
881
897
  targetProfileSlug: brand-color
882
898
  type: derived_from
@@ -11,6 +11,10 @@
11
11
  * channel, filed through the pod's `messaging.send` with `to` = their
12
12
  * entity id; never a tool's own send verb, never an outreach touch, never
13
13
  * synap_capture; ONE paragraph, word for word, in every drafter;
14
+ * - RULES (design b199a3a4, 8 Nov 2026): the style a drafter writes in is
15
+ * the rules it follows (`guidance`: Voice, then By kind of lead), rendered
16
+ * by the pod from person-approved records; ONE paragraph, word for word,
17
+ * in every drafter, and the old style lines are gone from the goals;
14
18
  * - the CADENCE counts the outbound messages in the lead's channels, and a
15
19
  * reply (an inbound message after our last outbound one) is read by
16
20
  * "Follow up on leads in outreach";
@@ -69,6 +73,23 @@ const DRAFT_RULES =
69
73
  "DRAFT RULES: each draft is one proposed message in the channel of the person it is written to, filed through the pod's send door: run messaging.send with to = that person's entity id (for a company lead, its decider: when that person is not in the pod, create them through the entity door with only their own fields, such as name, role and LinkedIn URL, never the company's website, domain or email), text = the message, and provider linkedin or email. Read their channel first (synap_get_channel, mode person) for what was already said. The pod files it for a person to review in that channel; it goes out only once they approve it. Never call a tool's own send verb (Unipile, Gmail), never create an outreach touch, a note or a task holding the message, and never use synap_capture for it. Never send. " +
70
74
  LINKEDIN_ORDER;
71
75
 
76
+ /**
77
+ * RULES (design b199a3a4, slice 2, 8 Nov 2026): the style a drafter writes in
78
+ * is no longer lines of its goal but the rules it follows (`guidance`), which
79
+ * every run renders from the current, person-approved records under "Rules
80
+ * this playbook follows". ONE paragraph, word for word, in every drafter.
81
+ */
82
+ const RULES =
83
+ "RULES: follow the rules this process follows, in order: Voice, then By kind of lead (the first row that fits the lead; a given campaign's angle comes first). A rule shown as not available is left out: say so.";
84
+ /** The rules every drafter declares, in this order (Voice, By kind of lead). */
85
+ const GUIDANCE = [
86
+ { ref: "kind:brand-voice-guide", label: "Voice", where: { "voice-context": ["general", "outreach"] } },
87
+ { ref: "kind:outreach-angle", label: "By kind of lead" },
88
+ ];
89
+ /** The style lines the drafters' goals held until 8 Nov 2026: they seed the Voice now. */
90
+ const STYLE_SEED =
91
+ 'Its message is personal: it cites the buying signal and what it showed, or a past exchange, never a generic template; short; in the person\'s language, French by default, and in French it says vous. It offers one useful next step, never pressure.';
92
+
72
93
  /** What a drafter yields: a `messaging.external.send` proposal (target type `messaging`). */
73
94
  const PROPOSED_MESSAGE = "messaging";
74
95
  const outputsOf = (p: NonNullable<WorkspaceYaml["playbooks"]>[number]) => [
@@ -114,6 +135,24 @@ describe("CRM messages and cadence — catalog contract", () => {
114
135
  expect(DRAFT_RULES).toContain(part);
115
136
  });
116
137
 
138
+ it("RULES: every drafter declares the same guidance and holds one RULES paragraph; the style lines left the goals", () => {
139
+ for (const name of DRAFTERS) {
140
+ expect(playbookOf(name).guidance, name).toEqual(GUIDANCE);
141
+ expect(goalOf(name), name).toContain(RULES);
142
+ // The style lines moved into guidance (their seed is "Propose my rules
143
+ // from my sent messages"): no drafter states them in its goal any more.
144
+ for (const gone of ["French by default", "says vous", "never pressure", "never a generic template", "short and in the lead's language", "specific to them"])
145
+ expect(goalOf(name), `${name}: ${gone}`).not.toContain(gone);
146
+ }
147
+ // Only the drafters hold it: a fourth copy would be a second wording.
148
+ const holders = (crm.playbooks ?? []).filter((p) => flat(p.goalTemplate).includes("RULES: follow the rules")).map((p) => p.name);
149
+ expect(holders.sort()).toEqual([...DRAFTERS].sort());
150
+ // The seed of the voice is the old style lines, word for word.
151
+ expect(goalOf("Propose my rules from my sent messages")).toContain(STYLE_SEED);
152
+ // The pod refuses a goal over 5,000 characters (playbookDefinitionSchema).
153
+ for (const name of DRAFTERS) expect(playbookOf(name).goalTemplate.length, name).toBeLessThanOrEqual(5000);
154
+ });
155
+
117
156
  it("'Draft a first message': send it to <name> today, then follow up 3 days after the send", () => {
118
157
  const name = "Draft a first message";
119
158
  expect(goalOf(name)).toContain('"Send the first message to <name> on LinkedIn"');
@@ -0,0 +1,156 @@
1
+ /**
2
+ * CRM rules a playbook follows (design b199a3a4 Question 1, slice 2; founder
3
+ * approval 8 Nov 2026, Brand & communication board), pinned against the REAL
4
+ * YAML corpus. The pod (backend#924) renders a playbook's `guidance` from the
5
+ * CURRENT versions only: a kind's entities whose lifecycle category is `done`.
6
+ * Entity text becomes prompt text, so:
7
+ *
8
+ * - "By kind of lead" is the CRM kind `outreach-angle`: the match (a
9
+ * condition, an optional audience and offer), lead with, offer, proof,
10
+ * avoid, tone, channel and the `order` the pod sorts by; its `current`
11
+ * (done) and `retired` options are a person's (humanOnly);
12
+ * - Voice is Brand Library's `brand-voice-guide` with an `outreach` context;
13
+ * its `approved` (done) option is a person's (humanOnly);
14
+ * - a new version is a draft that `revises` the current one;
15
+ * - "Propose my rules from my sent messages" writes DRAFTS only, and no stage
16
+ * of it moves anything to a done option.
17
+ *
18
+ * The drafters' declarations and their RULES paragraph are pinned in
19
+ * crm-messages-cadence.template.test.ts. Does NOT cover what the pod renders
20
+ * or what an agent does at run time.
21
+ */
22
+
23
+ import { describe, expect, it } from "vitest";
24
+ import { readYamlTemplates } from "./generate.mjs";
25
+ import type { WorkspaceYaml } from "./types.js";
26
+
27
+ const corpus = readYamlTemplates().map((t) => t.data as WorkspaceYaml);
28
+ const tpl = (slug: string) => {
29
+ const t = corpus.find((x) => x.meta.slug === slug);
30
+ if (!t) throw new Error(`template ${slug} not in the corpus`);
31
+ return t;
32
+ };
33
+ const kindOf = (t: WorkspaceYaml, slug: string) => {
34
+ const p = t.profiles?.find((x) => x.slug === slug);
35
+ if (!p) throw new Error(`kind ${slug} not in ${t.meta.slug}`);
36
+ return p;
37
+ };
38
+ const flat = (s: string | undefined) => (s ?? "").replace(/\s+/g, " ");
39
+ const lifecycleShape = (p: ReturnType<typeof kindOf>) =>
40
+ (p.lifecycle?.options ?? []).map((o) => [o.key, o.category, o.humanOnly === true]);
41
+
42
+ const crm = tpl("crm");
43
+ const brand = tpl("brand-library");
44
+
45
+ describe("By kind of lead: the outreach-angle kind", () => {
46
+ const angle = kindOf(crm, "outreach-angle");
47
+
48
+ it("draft → current → retired; only a person makes a row current or retires it", () => {
49
+ expect(angle.lifecycle?.property).toBe("angle-status");
50
+ expect(lifecycleShape(angle)).toEqual([
51
+ ["draft", "open", false],
52
+ ["current", "done", true],
53
+ ["retired", "lost", true],
54
+ ]);
55
+ const status = angle.properties.find((p) => p.slug === "angle-status");
56
+ expect(status?.enumValues).toEqual(["draft", "current", "retired"]);
57
+ // A new row is a draft: an agent's write never lands current.
58
+ expect(status?.constraints).toEqual({ defaultValue: "draft" });
59
+ });
60
+
61
+ it("the match, then what to lead with, in the order the pod renders them; `order` sorts the rows", () => {
62
+ expect(angle.properties.map((p) => p.slug)).toEqual([
63
+ "angle-status",
64
+ "angle-if",
65
+ "angle-audience",
66
+ "angle-about-offer",
67
+ "angle-lead-with",
68
+ "angle-offer",
69
+ "angle-proof",
70
+ "angle-avoid",
71
+ "angle-tone",
72
+ "angle-channel",
73
+ // The pod's renderer sorts an ordered kind by the property named exactly
74
+ // `order` (backend playbook-guidance.ts ORDER_PROPERTY) and never renders it.
75
+ "order",
76
+ ]);
77
+ const prop = (slug: string) => angle.properties.find((p) => p.slug === slug);
78
+ expect(prop("order")).toMatchObject({ valueType: "number" });
79
+ expect(prop("angle-audience")).toMatchObject({ valueType: "entity_id", targetProfileSlug: "audience" });
80
+ expect(prop("angle-about-offer")).toMatchObject({ valueType: "entity_id", targetProfileSlug: "offer" });
81
+ // The CRM's own reference to the pod-wide audience kind, and foundation
82
+ // (a dependency) owns offer: both targets resolve.
83
+ expect(crm.profiles?.some((p) => p.slug === "audience")).toBe(true);
84
+ expect(crm.dependencies?.some((d) => d.slug === "foundation")).toBe(true);
85
+ expect(kindOf(tpl("foundation"), "offer")).toBeTruthy();
86
+ });
87
+
88
+ it("a new version revises the current one (the history is the retired chain)", () => {
89
+ expect(crm.entityLinks).toContainEqual(
90
+ expect.objectContaining({ sourceProfileSlug: "outreach-angle", targetProfileSlug: "outreach-angle", type: "revises" }),
91
+ );
92
+ });
93
+ });
94
+
95
+ describe("Voice: Brand Library's voice guide", () => {
96
+ const voice = kindOf(brand, "brand-voice-guide");
97
+
98
+ it("approved is a person's call (trust (a)); a new guide is a draft", () => {
99
+ expect(lifecycleShape(voice)).toEqual([
100
+ ["draft", "open", false],
101
+ ["approved", "done", true],
102
+ ["deprecated", "lost", true],
103
+ ]);
104
+ expect(voice.properties.find((p) => p.slug === "voice-status")?.constraints).toEqual({ defaultValue: "draft" });
105
+ });
106
+
107
+ it("one voice for content and sales: an outreach context, and the default stays general", () => {
108
+ const context = voice.properties.find((p) => p.slug === "voice-context");
109
+ expect(context?.enumValues).toContain("outreach");
110
+ expect(context?.enumValues).toContain("general");
111
+ expect(context?.constraints).toEqual({ defaultValue: "general" });
112
+ // Say / Don't say are the guide's Do / Don't.
113
+ expect(voice.properties.map((p) => p.slug)).toEqual(expect.arrayContaining(["voice-example-do", "voice-example-dont"]));
114
+ expect(brand.entityLinks).toContainEqual(
115
+ expect.objectContaining({ sourceProfileSlug: "brand-voice-guide", targetProfileSlug: "brand-voice-guide", type: "revises" }),
116
+ );
117
+ });
118
+ });
119
+
120
+ describe("'Propose my rules from my sent messages': drafts only", () => {
121
+ const name = "Propose my rules from my sent messages";
122
+ const pb = crm.playbooks?.find((p) => p.name === name);
123
+
124
+ it("exists, started by the person, and yields draft voice and By kind of lead rows", () => {
125
+ expect(pb).toBeTruthy();
126
+ expect(pb?.executor).toBe("is-agent");
127
+ expect(pb?.grants).toEqual(["entity.create"]);
128
+ expect((pb?.expectedOutputs ?? []).map((o) => o.kind).sort()).toEqual(["brand-voice-guide", "outreach-angle"]);
129
+ });
130
+
131
+ it("never makes a version current: no stage moves a status, and its goal says drafts only", () => {
132
+ for (const st of pb?.stages ?? []) expect(st.subjectStatus, st.key).toBeUndefined();
133
+ // Only a person makes them current, at a human gate.
134
+ expect(pb?.stages?.at(-1)?.gate).toEqual({ kind: "human" });
135
+ const goal = flat(pb?.goalTemplate);
136
+ expect(goal).toContain("status draft");
137
+ expect(goal).toContain("never set a voice guide to approved or deprecated, nor a row to current or retired");
138
+ expect(goal).toContain("never edit or retire a current one");
139
+ expect(goal).toContain("a new record that revises it");
140
+ expect(goal).toContain("context outreach");
141
+ const criteria = Object.fromEntries((pb?.stages ?? []).flatMap((s) => s.criteria ?? []).map((c) => [c.key, flat(c.statement)]));
142
+ expect(criteria["rules-drafts-only"]).toMatch(/is a draft .* no approved voice guide or current row was edited, approved or retired/);
143
+ });
144
+
145
+ it("every value it names exists: the voice context, and each status it writes or forbids", () => {
146
+ const goal = flat(pb?.goalTemplate);
147
+ const voice = kindOf(brand, "brand-voice-guide");
148
+ const angle = kindOf(crm, "outreach-angle");
149
+ const keys = (p: ReturnType<typeof kindOf>) => (p.lifecycle?.options ?? []).map((o) => o.key);
150
+ expect(voice.properties.find((p) => p.slug === "voice-context")?.enumValues).toContain("outreach");
151
+ for (const k of ["approved", "deprecated", "draft"]) expect(keys(voice)).toContain(k);
152
+ for (const k of ["current", "retired", "draft"]) expect(keys(angle)).toContain(k);
153
+ expect(goal).toContain("profileSlug brand-voice-guide");
154
+ expect(goal).toContain("profileSlug outreach-angle");
155
+ });
156
+ });
package/src/crm.yaml CHANGED
@@ -700,6 +700,92 @@ profiles:
700
700
  valueType: string
701
701
  inputType: textarea
702
702
 
703
+ # ── Outreach angle: one row of "By kind of lead" (design b199a3a4, 8 Nov 2026) ─
704
+ # What to lead with, depending on the lead: IF the lead is X (a condition in
705
+ # words, optionally an audience it was found for and an offer it is about),
706
+ # lead with an angle, put an offer forward, show a proof, avoid something,
707
+ # in a tone, on a channel. The rows are ORDERED (`order`): the drafters take
708
+ # the first row whose condition fits the lead, else the last one, so the
709
+ # catch-all row ("Anything else") carries the highest order.
710
+ # A RULE, not an output: the CRM drafters ("Draft a first message", "Follow
711
+ # up on leads in outreach", "Personalized Outreach") declare
712
+ # `guidance: kind:outreach-angle`, and every run renders the CURRENT rows into
713
+ # the AI's instructions (backend#924: only rows whose status category is
714
+ # done render). So `current` is a person's call (trust (a)): an agent writes
715
+ # a draft, a person makes it current. A new version of a row is a new row in
716
+ # draft that `revises` the current one (entityLinks below); making it current
717
+ # and retiring the old one is the person's act, and the retired chain is the
718
+ # row's history. The fields render in this order; `order` and the status do
719
+ # not. The CRM's Brand & communication page reads and writes these rows.
720
+ - slug: outreach-angle
721
+ displayName: Outreach angle
722
+ icon: compass
723
+ color: violet
724
+ description: "One row of \"By kind of lead\": if the lead is X, lead with this angle, offer, proof, tone and channel. The first row that fits the lead wins; a person makes a row current."
725
+ # The ONE lifecycle (work model L1): every option's category.
726
+ lifecycle:
727
+ property: angle-status
728
+ options:
729
+ - { key: draft, category: open }
730
+ - { key: current, category: done, humanOnly: true }
731
+ - { key: retired, category: lost, humanOnly: true }
732
+ properties:
733
+ - slug: angle-status
734
+ label: Status
735
+ valueType: string
736
+ inputType: select
737
+ enumValues: [draft, current, retired]
738
+ constraints: { defaultValue: draft }
739
+ # The match: the condition in words, plus the audience it was found for
740
+ # and the offer it is about, when they apply.
741
+ - slug: angle-if
742
+ label: If the lead
743
+ valueType: string
744
+ inputType: textarea
745
+ placeholder: e.g. Posted a small automation project on Codeur or Malt
746
+ - slug: angle-audience
747
+ label: Audience
748
+ valueType: entity_id
749
+ targetProfileSlug: audience
750
+ inputType: entity_select
751
+ - slug: angle-about-offer
752
+ label: About the offer
753
+ valueType: entity_id
754
+ targetProfileSlug: offer
755
+ inputType: entity_select
756
+ - slug: angle-lead-with
757
+ label: Lead with
758
+ valueType: string
759
+ inputType: textarea
760
+ - slug: angle-offer
761
+ label: Offer
762
+ valueType: string
763
+ inputType: textarea
764
+ placeholder: e.g. Fixed small set-up, tool costs listed apart
765
+ - slug: angle-proof
766
+ label: Proof
767
+ valueType: string
768
+ inputType: textarea
769
+ - slug: angle-avoid
770
+ label: Avoid
771
+ valueType: string
772
+ inputType: textarea
773
+ - slug: angle-tone
774
+ label: Tone
775
+ valueType: string
776
+ inputType: text
777
+ - slug: angle-channel
778
+ label: Channel
779
+ valueType: string
780
+ inputType: text
781
+ placeholder: e.g. LinkedIn, else email
782
+ # The row's place: the first row that fits wins (the pod's renderer
783
+ # sorts by the property named exactly `order`).
784
+ - slug: order
785
+ label: Order
786
+ valueType: number
787
+ inputType: number
788
+
703
789
  # `linked_to_deal` is the GENERIC counterparty edge and stays the SSOT for "who
704
790
  # is on this deal" — the handoff flow's `find-party` node reads exactly it and
705
791
  # requires exactly one match, so nothing below may replace it.
@@ -789,6 +875,12 @@ entityLinks:
789
875
  targetProfileSlug: audience
790
876
  type: targets
791
877
  label: Targets
878
+ # A new version of a "By kind of lead" row is a draft that `revises` the
879
+ # current one (design b199a3a4): the retired chain is the row's history.
880
+ - sourceProfileSlug: outreach-angle
881
+ targetProfileSlug: outreach-angle
882
+ type: revises
883
+ label: Revises
792
884
 
793
885
  # Views folded from Outreach & Comms (2026-10-23). The CRM's own surface is the
794
886
  # website (layout.primarySurface); these are the workbench lenses on the same
@@ -1440,11 +1532,11 @@ playbooks:
1440
1532
  them; ignored, draft by email instead when they have an email address.
1441
1533
  While the draft waits for them to connect, set the lead's nextAction to
1442
1534
  "Wait for <name> to accept the LinkedIn request" and its nextActionAt 7
1443
- days later. An email message needs none of this. Its message
1444
- is personal: it cites the buying signal and what it showed, or a past
1445
- exchange, never a generic template; short; in the person's language,
1446
- French by default, and in French it says vous. It offers one useful
1447
- next step, never pressure. Draft one message only: a person reviews
1535
+ days later. An email message needs none of this.
1536
+ RULES: follow the rules this process follows, in order: Voice, then By
1537
+ kind of lead (the first row that fits the lead; a given campaign's angle
1538
+ comes first). A rule shown as not available is left out: say so. Draft
1539
+ one message only: a person reviews
1448
1540
  it in the channel, edits it if needed and approves it. NEXT ACTION:
1449
1541
  set the lead's nextAction to "Send the first message to <name> on
1450
1542
  LinkedIn" ("Send the first message to <name> by email" on email),
@@ -1479,6 +1571,16 @@ playbooks:
1479
1571
  - { name: channel, type: choice, label: Channel, options: [linkedin, email], defaultValue: linkedin }
1480
1572
  executor: is-agent
1481
1573
  status: active
1574
+ # The rules it writes by (design b199a3a4, backend#924): every run renders
1575
+ # the CURRENT, person-approved versions under "Rules this playbook
1576
+ # follows", in this order. The style lines this goal held (personal, cites
1577
+ # the signal, short, the person's language, French with vous, one useful
1578
+ # next step, never pressure) seed the Voice now, through "Propose my rules
1579
+ # from my sent messages"; DRAFT RULES and CADENCE stay here: they are
1580
+ # process. Foundation's positioning joins once its kind has a lifecycle.
1581
+ guidance:
1582
+ - { ref: "kind:brand-voice-guide", label: Voice, where: { voice-context: [general, outreach] } }
1583
+ - { ref: "kind:outreach-angle", label: By kind of lead }
1482
1584
  grants: [entity.create]
1483
1585
  stages:
1484
1586
  - key: draft
@@ -1499,8 +1601,10 @@ playbooks:
1499
1601
  - key: first-message-no-capture
1500
1602
  statement: No tool's own send verb was called, no outreach touch, note or task holds the message, no record was made with synap_capture, and a decider created for a company lead carries only the person's own fields, never the company's website, domain or email.
1501
1603
  check: { kind: judge }
1502
- - key: first-message-personal
1503
- statement: The message cites the lead's buying signal or a past exchange, is in the person's language (French by default, with vous), and is not a generic template.
1604
+ # The style it is judged by is the rules it follows (guidance), not
1605
+ # lines of this goal (design b199a3a4).
1606
+ - key: first-message-rules
1607
+ statement: The message follows the rules this process follows, as its instructions showed them (the approved Voice, then the first By kind of lead row that fits the lead, or the campaign's angle when one was given).
1504
1608
  check: { kind: judge }
1505
1609
  - key: first-message-not-rescored
1506
1610
  statement: The lead's icpScore, buyingSignal and scoredAt are unchanged, and its stage was not moved.
@@ -1737,10 +1841,10 @@ playbooks:
1737
1841
  only when the lead's next action date is today or past and no
1738
1842
  proposed message to it is still waiting, draft the next message, to
1739
1843
  the lead (for a company, the person who decides there) and in the
1740
- angle of the lead's outreach campaign: follow its value proposition
1741
- and call to action, short and in the lead's language, offering the
1742
- next useful step, never pressure. For a lead with no campaign, ask the
1743
- person which one. Draft at most two follow-ups per lead: a lead
1844
+ angle of the lead's outreach campaign: follow its value proposition and
1845
+ call to action. With no campaign and no By kind of lead row that fits,
1846
+ ask the person which campaign. Draft at most two follow-ups per lead: a
1847
+ lead
1744
1848
  already sent two follow-ups gets no draft, never a third follow-up;
1745
1849
  when its last date passes in silence, propose moving it to nurturing
1746
1850
  through the status door, with its expected status. DRAFT RULES: each
@@ -1772,8 +1876,12 @@ playbooks:
1772
1876
  them; ignored, draft by email instead when they have an email address.
1773
1877
  While the draft waits for them to connect, set the lead's nextAction to
1774
1878
  "Wait for <name> to accept the LinkedIn request" and its nextActionAt 7
1775
- days later. An email message needs none of this. For each draft, set
1776
- the lead's `nextAction` to send it (e.g. "Send the drafted message to
1879
+ days later. An email message needs none of this.
1880
+ RULES: follow the rules this process follows, in order: Voice, then By
1881
+ kind of lead (the first row that fits the lead; a given campaign's angle
1882
+ comes first). A rule shown as not available is left out: say so. For
1883
+ each draft, set the
1884
+ lead's `nextAction` to send it (e.g. "Send the drafted message to
1777
1885
  Ana on LinkedIn") and `nextActionAt` to today. The person reviews each
1778
1886
  proposed message in its channel, edits it if needed and approves it;
1779
1887
  the agent never sends. CADENCE: when a message is sent (a person
@@ -1802,6 +1910,16 @@ playbooks:
1802
1910
  - { on: manual, mode: propose }
1803
1911
  executor: is-agent
1804
1912
  status: active
1913
+ # The rules it writes by (design b199a3a4, backend#924): every run renders
1914
+ # the CURRENT, person-approved versions under "Rules this playbook
1915
+ # follows", in this order. The style lines this goal held (personal, cites
1916
+ # the signal, short, the person's language, French with vous, one useful
1917
+ # next step, never pressure) seed the Voice now, through "Propose my rules
1918
+ # from my sent messages"; DRAFT RULES and CADENCE stay here: they are
1919
+ # process. Foundation's positioning joins once its kind has a lifecycle.
1920
+ guidance:
1921
+ - { ref: "kind:brand-voice-guide", label: Voice, where: { voice-context: [general, outreach] } }
1922
+ - { ref: "kind:outreach-angle", label: By kind of lead }
1805
1923
  expectedOutputs:
1806
1924
  # Proposed messages on the people's channels (see "Draft a first message").
1807
1925
  - { kind: messaging, label: Proposed follow-ups, relationToSubject: none }
@@ -1815,7 +1933,7 @@ playbooks:
1815
1933
  statement: Each draft reflects what was already sent to that lead and any reply, read from its channels.
1816
1934
  check: { kind: judge }
1817
1935
  - key: followup-angle
1818
- statement: Each draft follows the angle of the lead's outreach campaign and its call to action.
1936
+ statement: Each draft follows the angle of the lead's outreach campaign and its call to action, or, with no campaign, the first By kind of lead row that fits the lead, and the approved Voice.
1819
1937
  check: { kind: judge }
1820
1938
  - key: followup-no-draft-after-reply
1821
1939
  statement: No message is drafted for a lead who replied (its reply is summarised and a next step proposed, no deal opened), nor a third follow-up for a lead already sent two.
@@ -1854,13 +1972,13 @@ playbooks:
1854
1972
  goalTemplate: >-
1855
1973
  Run this outreach campaign ({campaign}) on {channel}; each stage moves
1856
1974
  its status. If its type is not outreach, stop and say so. PREPARE: write
1857
- the target audience, the value proposition and the call to action. Pick
1975
+ the target audience, the value proposition and the call to action (from
1976
+ the By kind of lead row that fits the audience, when one does). Pick
1858
1977
  the people to reach from the pod (and public sources when the pod has
1859
1978
  too few), resolving each one before creating anything, link each as a
1860
1979
  member of the campaign with the lead role (lead source cold-outreach
1861
1980
  when it has none), and for each draft one first message to that person
1862
- in this campaign's angle, specific to them — their company, role and
1863
- any past message — never a generic template. DRAFT RULES: each draft is
1981
+ in this campaign's angle. DRAFT RULES: each draft is
1864
1982
  one proposed message in the channel of the person it is written to,
1865
1983
  filed through the pod's send door: run messaging.send with to = that
1866
1984
  person's entity id (for a company lead, its decider: when that person
@@ -1889,7 +2007,11 @@ playbooks:
1889
2007
  them; ignored, draft by email instead when they have an email address.
1890
2008
  While the draft waits for them to connect, set the lead's nextAction to
1891
2009
  "Wait for <name> to accept the LinkedIn request" and its nextActionAt 7
1892
- days later. An email message needs none of this. START: a person approves the audience, the offer and
2010
+ days later. An email message needs none of this.
2011
+ RULES: follow the rules this process follows, in order: Voice, then By
2012
+ kind of lead (the first row that fits the lead; a given campaign's angle
2013
+ comes first). A rule shown as not available is left out: say so. START:
2014
+ a person approves the audience, the offer and
1893
2015
  the list,
1894
2016
  then reviews each proposed message in its channel and approves it;
1895
2017
  nothing goes out before they approve it, and the agent never sends.
@@ -1925,6 +2047,16 @@ playbooks:
1925
2047
  - { name: channel, type: choice, label: Channel, options: [linkedin, email], defaultValue: linkedin }
1926
2048
  executor: is-agent
1927
2049
  status: active
2050
+ # The rules it writes by (design b199a3a4, backend#924): every run renders
2051
+ # the CURRENT, person-approved versions under "Rules this playbook
2052
+ # follows", in this order. The style lines this goal held (personal, cites
2053
+ # the signal, short, the person's language, French with vous, one useful
2054
+ # next step, never pressure) seed the Voice now, through "Propose my rules
2055
+ # from my sent messages"; DRAFT RULES and CADENCE stay here: they are
2056
+ # process. Foundation's positioning joins once its kind has a lifecycle.
2057
+ guidance:
2058
+ - { ref: "kind:brand-voice-guide", label: Voice, where: { voice-context: [general, outreach] } }
2059
+ - { ref: "kind:outreach-angle", label: By kind of lead }
1928
2060
  requiredIntents: [find_people, enrich_entity]
1929
2061
  grants: [entity.create]
1930
2062
  expectedOutputs:
@@ -1940,8 +2072,8 @@ playbooks:
1940
2072
  - key: outreach-offer
1941
2073
  statement: The target audience, value proposition and call to action are written on the campaign.
1942
2074
  check: { kind: judge }
1943
- - key: outreach-personal
1944
- statement: Every drafted message names something specific to its person.
2075
+ - key: outreach-rules
2076
+ statement: Every drafted message follows the rules this process follows, as its instructions showed them (the approved Voice, in this campaign's angle).
1945
2077
  check: { kind: judge }
1946
2078
  - key: start
1947
2079
  name: Person approves the list
@@ -2132,6 +2264,76 @@ playbooks:
2132
2264
  statement: The lead records the date and the channel the estimate was sent on.
2133
2265
  check: { kind: judge }
2134
2266
 
2267
+ # ── Propose my rules from my sent messages — the first rules ────────────
2268
+ # Design b199a3a4 Question 1, slice 2 (8 Nov 2026). The drafters write by
2269
+ # their `guidance` (Voice, By kind of lead) and no longer carry style lines
2270
+ # in their goals. This process seeds those rules as DRAFTS: from the lines
2271
+ # the drafters' goals held until now (quoted below, word for word the seed)
2272
+ # and from the messages the person actually sent. It writes drafts only,
2273
+ # never a current version: `approved` (voice) and `current` (angle) are
2274
+ # humanOnly, so a person makes each one current, on the CRM's Brand &
2275
+ # communication page or in the pod. A draft of something that already has a
2276
+ # current version is a NEW record that `revises` it, never an edit of it.
2277
+ # No subject and no activator: the person starts it, as "Propose a Health
2278
+ # cell". grants entity.create: it creates the draft records.
2279
+ - name: Propose my rules from my sent messages
2280
+ description: Propose the first rules your drafts follow, the voice (say, don't say) and what to lead with by kind of lead, from the rules your drafters held until now and the messages you sent; they stay drafts until you make them current.
2281
+ goalTemplate: >-
2282
+ Propose the rules the CRM drafters write by, as drafts for a person to
2283
+ make current. READ: the current and draft voice guides
2284
+ (synap_get_entities profileSlug brand-voice-guide) and By kind of lead
2285
+ rows (profileSlug outreach-angle), the audiences and offers, and the
2286
+ messages already sent: for the leads with a lastContactedAt, newest
2287
+ first, at most 20, their channels (synap_get_channel, mode person) and
2288
+ the outbound messages they show. SEED: the drafters' rules until now,
2289
+ word for word: "Its message is personal: it cites the buying signal and
2290
+ what it showed, or a past exchange, never a generic template; short; in
2291
+ the person's language, French by default, and in French it says vous.
2292
+ It offers one useful next step, never pressure." VOICE: one voice
2293
+ guide, context outreach, status draft, in the Brand Library space: its
2294
+ Do lines (what to say) and Don't lines (what never to say), one per
2295
+ line, start from the seed and add only what at least two sent messages
2296
+ show; Source IDs lists the messages' channel or entity ids. BY KIND OF
2297
+ LEAD: one row per kind of lead the sent messages show, status draft:
2298
+ If the lead (the condition in words), its audience and offer when one
2299
+ fits, Lead with, Offer, Proof, Avoid, Tone, Channel and an order, the
2300
+ most specific first; end with an "Anything else" row with the highest
2301
+ order. Never invent a proof: leave it empty and say so. When a current
2302
+ version exists, the draft is a new record that revises it (a revises
2303
+ edge to it) and says what changed; never edit or retire a current one.
2304
+ DRAFTS ONLY: never set a voice guide to approved or deprecated, nor a
2305
+ row to current or retired; a person does, on the Brand and
2306
+ communication page. With fewer than three sent messages, propose the
2307
+ voice from the seed alone and one "Anything else" row, and say so.
2308
+ FINISH: list each draft with the messages it came from.
2309
+ executor: is-agent
2310
+ status: active
2311
+ grants: [entity.create]
2312
+ expectedOutputs:
2313
+ - { kind: brand-voice-guide, label: Draft outreach voice, relationToSubject: none }
2314
+ - { kind: outreach-angle, label: "Draft \"By kind of lead\" rows", relationToSubject: none }
2315
+ stages:
2316
+ - key: draft
2317
+ name: Propose the drafts
2318
+ category: started
2319
+ goal: Read the current rules, the audiences and offers and the sent messages; write one draft outreach voice guide from the seed and the messages, and one draft By kind of lead row per kind of lead, ending with an "Anything else" row.
2320
+ criteria:
2321
+ - key: rules-drafts-only
2322
+ statement: Every voice guide and By kind of lead row this run wrote is a draft (voice status draft, angle status draft), and no approved voice guide or current row was edited, approved or retired.
2323
+ check: { kind: judge }
2324
+ - key: rules-seeded
2325
+ statement: The draft voice holds the seed lines (cite the signal or a past exchange, never a generic template, short, the person's language, French by default with vous, one useful next step, never pressure) as Do and Don't lines, plus only what at least two sent messages show.
2326
+ check: { kind: judge }
2327
+ - key: rules-rows-sourced
2328
+ statement: Each By kind of lead row names the sent messages it came from, has an order, and the last one is an "Anything else" row; no proof is invented.
2329
+ check: { kind: judge }
2330
+ - key: review
2331
+ name: Person makes them current
2332
+ category: completed
2333
+ goal: The person reads the drafts, edits them if needed and makes each one current (a voice guide approved, a row current) on the Brand and communication page or in the pod, or drops it.
2334
+ gate: { kind: human }
2335
+ onFail: { toStage: draft }
2336
+
2135
2337
  # ── Propose a Health cell — one tile of the Health view ─────────────────
2136
2338
  # Design b199a3a4 Question 2, slice 5. The person asks a question of their
2137
2339
  # sales ("reply rate by audience, weekly"); the AI writes ONE HTML cell that
@@ -161,10 +161,13 @@ describe("lifecycle declarations — coverage (derived from the playbooks)", ()
161
161
  * this ledger makes any change to one a deliberate, reviewed edit. Founder
162
162
  * decisions among them: ui-design.approved (design review, DESIGN-DEV-XP-PLAN
163
163
  * P6, 2026-10-12), outreach-touch.sent (a person sends, 2026-10-20),
164
- * devplane_feature.cancelled / devplane_story.dropped (homes, 2026-10-13).
164
+ * devplane_feature.cancelled / devplane_story.dropped (homes, 2026-10-13),
165
+ * brand-voice-guide.approved and outreach-angle.current / retired (rules a
166
+ * playbook renders into the AI's instructions, design b199a3a4, 8 Nov 2026).
165
167
  */
166
168
  const HUMAN_ONLY = [
167
169
  "brand-library:brand-asset.deprecated",
170
+ "brand-library:brand-voice-guide.approved",
168
171
  "brand-library:brand-voice-guide.deprecated",
169
172
  "brand-library:content-guideline.deprecated",
170
173
  "builder-workspace:devplane_feature.cancelled",
@@ -181,6 +184,8 @@ describe("lifecycle declarations — coverage (derived from the playbooks)", ()
181
184
  "crm:campaign.cancelled",
182
185
  "crm:campaign.paused",
183
186
  "crm:deal.lost",
187
+ "crm:outreach-angle.current",
188
+ "crm:outreach-angle.retired",
184
189
  "crm:outreach-touch.replaced",
185
190
  "crm:outreach-touch.sent",
186
191
  "finance:expense.reimbursed",