@synap-core/workspace-templates 0.46.0 → 0.48.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/README.md +4 -3
- package/automations/lead-converted-becomes-client.automation.json +89 -0
- package/automations/lead-converted-becomes-client.catalog.json +13 -0
- package/capabilities/apify.capability.json +8 -1
- package/capabilities/apollo.capability.json +8 -1
- package/capabilities/cal-com.capability.json +8 -1
- package/capabilities/exa.capability.json +8 -1
- package/capabilities/fal-ai.capability.json +8 -1
- package/capabilities/fal-media-lab.capability.json +8 -1
- package/capabilities/fireflies.capability.json +8 -1
- package/capabilities/mailgun.capability.json +8 -1
- package/capabilities/omniroute.capability.json +7 -1
- package/capabilities/posthog-analytics.capability.json +7 -1
- package/capabilities/postiz.capability.json +7 -1
- package/capabilities/replicate-rvm.capability.json +21 -5
- package/capabilities/stripe.capability.json +10 -1
- package/capabilities/unipile-linkedin.capability.json +39 -3
- package/capabilities/vercel.capability.json +8 -1
- package/dist/{define-BAPO0xZf.d.ts → define-Dto5_E47.d.ts} +15 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +623 -96
- package/dist/index.js.map +1 -1
- package/dist/wire.d.ts +1 -1
- package/package.json +1 -1
- package/src/agency-os.yaml +1 -1
- package/src/brand-library.yaml +6 -6
- package/src/builder.yaml +17 -12
- package/src/content-os.template.test.ts +38 -22
- package/src/content-os.video-takes.template.test.ts +4 -2
- package/src/content-os.yaml +33 -23
- package/src/crm-absorbs-outreach.template.test.ts +5 -1
- package/src/crm.yaml +53 -30
- package/src/decisions-wave.template.test.ts +99 -5
- package/src/finance.yaml +11 -6
- package/src/foundation.yaml +22 -10
- package/src/grants.yaml +4 -0
- package/src/intent.test.ts +4 -2
- package/src/lead-automations.test.ts +93 -0
- package/src/lead-becomes-client.template.test.ts +137 -0
- package/src/lifecycle-declarations.test.ts +20 -1
- package/src/lifecycle-presets.test.ts +39 -7
- package/src/marketing.yaml +3 -3
- package/src/operations.yaml +155 -24
- package/src/postiz-contract.test.ts +3 -2
- package/src/process-contract.validate.test.ts +4 -1
- package/src/publish-official-lib.test.ts +8 -7
- package/src/research-base.yaml +2 -2
- package/src/research-decision.yaml +1 -1
- package/src/ship-a-change.template.test.ts +11 -2
- package/src/templates.ts +223 -74
- package/src/types.ts +15 -3
- package/src/unipile-lookups-read-only.test.ts +1 -0
- package/src/validate-flow.ts +15 -1
- package/src/validate.ts +40 -4
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lead → client in the product, the catalog half (wave W2 of design 05ed390c,
|
|
3
|
+
* founder-approved 17 Nov 2026 with its defaults: `converted` = signed, lead →
|
|
4
|
+
* client directly, a new client starts at `onboarding`, the converted lead role
|
|
5
|
+
* stays as history, the Clients space is Operations, the 07:00 pick-up stays as
|
|
6
|
+
* a safety net, an engagement's client may be a person).
|
|
7
|
+
*
|
|
8
|
+
* Pinned:
|
|
9
|
+
* - ONE door: CRM's "Win a deal" Won stage proposes the lead's move to
|
|
10
|
+
* converted and no longer attaches the client role or opens an engagement;
|
|
11
|
+
* - Operations declares the `client` role (reference form), a Clients board
|
|
12
|
+
* grouped on its lifecycle, and "Onboard a client": subject the client role,
|
|
13
|
+
* started on the role's attach (propose), Welcome (onboarding) → Open or
|
|
14
|
+
* reuse the engagement (engagement_for_client) → Kick-off confirmed (a
|
|
15
|
+
* person's gate, active);
|
|
16
|
+
* - the engagement's client is whoever wears the client role (company or
|
|
17
|
+
* person), and both doors that open an engagement dedupe on it;
|
|
18
|
+
* - the whole touched corpus validates with zero errors.
|
|
19
|
+
* Not covered (NEEDS-DOGFOOD): that the attach made under the CRM space starts
|
|
20
|
+
* the Operations activator (backend W1), that a role board drags on
|
|
21
|
+
* clientStatus, that the picker lists role holders.
|
|
22
|
+
*/
|
|
23
|
+
import { describe, expect, it } from "vitest";
|
|
24
|
+
import { readYamlTemplates } from "./generate.mjs";
|
|
25
|
+
import type { WorkspaceYaml } from "./types.js";
|
|
26
|
+
import { validateTemplate } from "./validate.js";
|
|
27
|
+
|
|
28
|
+
const corpus = readYamlTemplates().map((t) => t.data as WorkspaceYaml);
|
|
29
|
+
const tpl = (slug: string) => {
|
|
30
|
+
const t = corpus.find((x) => x.meta.slug === slug);
|
|
31
|
+
if (!t) throw new Error(`template ${slug} not in the corpus`);
|
|
32
|
+
return t;
|
|
33
|
+
};
|
|
34
|
+
const playbookOf = (t: WorkspaceYaml, name: string) => {
|
|
35
|
+
const pb = t.playbooks?.find((p) => p.name === name);
|
|
36
|
+
if (!pb) throw new Error(`playbook ${name} not in ${t.meta.slug}`);
|
|
37
|
+
return pb;
|
|
38
|
+
};
|
|
39
|
+
const ops = tpl("operations");
|
|
40
|
+
const crm = tpl("crm");
|
|
41
|
+
|
|
42
|
+
describe("Win a deal — one door to a client", () => {
|
|
43
|
+
const win = playbookOf(crm, "Win a deal");
|
|
44
|
+
const won = win.stages!.find((s) => s.key === "won")!;
|
|
45
|
+
const negotiate = win.stages!.find((s) => s.key === "negotiate")!;
|
|
46
|
+
|
|
47
|
+
it("the Won stage proposes the lead's move to converted, behind a person's gate", () => {
|
|
48
|
+
// D2: the deal reaches won when the person approves at Won's gate (Negotiate's onApproved), never on entering Won.
|
|
49
|
+
expect(won.subjectStatus).toBeUndefined();
|
|
50
|
+
expect(negotiate.onApproved).toBe("won");
|
|
51
|
+
expect(won.gate).toEqual({ kind: "human" });
|
|
52
|
+
expect(won.goal).toMatch(/propose moving the deal's lead to converted/);
|
|
53
|
+
expect(win.goalTemplate).toMatch(/propose moving the\s+deal's lead \(the company's lead, else the person's\) to converted/);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("it no longer attaches the client role nor opens an engagement itself", () => {
|
|
57
|
+
expect(won.goal).not.toMatch(/attach the client role/);
|
|
58
|
+
expect(win.goalTemplate).toMatch(/Never attach\s+the client role and never open an engagement yourself/);
|
|
59
|
+
expect((win.expectedOutputs ?? []).map((o) => o.kind)).not.toContain("engagement");
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("no CRM process converts a lead on a booked meeting any more", () => {
|
|
63
|
+
const text = JSON.stringify(crm.playbooks);
|
|
64
|
+
expect(text).not.toMatch(/that same\s+step converts the lead/);
|
|
65
|
+
expect(text).not.toMatch(/not modeled yet/);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
describe("Operations — the Clients space", () => {
|
|
70
|
+
it("references the pod-wide client role, with no body restated", () => {
|
|
71
|
+
const client = ops.profiles.find((p) => p.slug === "client")!;
|
|
72
|
+
expect(client).toEqual({ slug: "client", displayName: "Client", scope: "shared", profileKind: "role", properties: [] });
|
|
73
|
+
expect(ops.dependencies).toEqual(expect.arrayContaining([expect.objectContaining({ slug: "foundation", relation: "require" })]));
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it("a Clients board groups the role on its lifecycle, in the sidebar", () => {
|
|
77
|
+
const view = ops.views!.find((v) => v.slug === "clients")!;
|
|
78
|
+
expect(view).toMatchObject({ name: "Clients", type: "kanban", scopeProfileSlug: "client", config: { groupByField: "clientStatus" } });
|
|
79
|
+
const lc = tpl("foundation").profiles.find((p) => p.slug === "client")!.lifecycle!;
|
|
80
|
+
expect(lc.property).toBe("clientStatus");
|
|
81
|
+
const sidebar = (ops.layout as { sidebarItems?: Array<{ viewName?: string }> }).sidebarItems ?? [];
|
|
82
|
+
expect(sidebar.map((i) => i.viewName)).toContain("Clients");
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("an engagement's client is whoever wears the client role (company or person), and both doors dedupe on it", () => {
|
|
86
|
+
const field = ops.profiles.find((p) => p.slug === "engagement")!.properties.find((p) => p.slug === "engagement-client")!;
|
|
87
|
+
expect(field).toMatchObject({ valueType: "entity_id", targetProfileSlug: "client" });
|
|
88
|
+
expect(tpl("foundation").profiles.find((p) => p.slug === "client")!.applicableKinds).toEqual(
|
|
89
|
+
expect.arrayContaining(["company", "person"])
|
|
90
|
+
);
|
|
91
|
+
// The edge exists to a company AND to a person.
|
|
92
|
+
const links = (ops.entityLinks ?? []).filter((l) => l.type === "engagement_for_client").map((l) => l.targetProfileSlug);
|
|
93
|
+
expect(links.sort()).toEqual(["company", "person"]);
|
|
94
|
+
// The 07:00 safety net is kept and dedupes on the same key.
|
|
95
|
+
const pickup = ops.automations!.find((a) => (a as { key?: string }).key === "operations-crm-handoff-pickup")!;
|
|
96
|
+
expect(pickup).toBeDefined();
|
|
97
|
+
const flow = JSON.stringify(pickup);
|
|
98
|
+
expect(flow).toContain('"dedupeBy":"engagement-client"');
|
|
99
|
+
expect(flow).toContain('{\\"engagement-client\\": \\"{{loop.item.id}}\\"}');
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("Onboard a client: subject the role, started on its attach, Welcome → engagement → a person's kick-off", () => {
|
|
103
|
+
const pb = playbookOf(ops, "Onboard a client");
|
|
104
|
+
expect(pb.subjectProfile).toEqual({ profileSlug: "client" });
|
|
105
|
+
expect(pb.activators).toEqual([{ on: "created", mode: "propose" }]);
|
|
106
|
+
expect(pb.params).toEqual([{ name: "client", type: "entity", label: "Client", required: true }]);
|
|
107
|
+
expect(pb.goalTemplate).toContain("{client}");
|
|
108
|
+
const stages = pb.stages!.map((s) => [s.key, s.subjectStatus ?? null, s.gate?.kind ?? null]);
|
|
109
|
+
expect(stages).toEqual([
|
|
110
|
+
["welcome", "onboarding", null],
|
|
111
|
+
["engagement", null, null],
|
|
112
|
+
["kickoff", "active", "human"],
|
|
113
|
+
]);
|
|
114
|
+
const engagement = pb.stages!.find((s) => s.key === "engagement")!;
|
|
115
|
+
expect(engagement.name).toBe("Open or reuse the engagement");
|
|
116
|
+
expect(engagement.expectedOutputs).toEqual([
|
|
117
|
+
{ kind: "engagement", label: "Client engagement", relationToSubject: "engagement_for_client" },
|
|
118
|
+
]);
|
|
119
|
+
expect(pb.stages!.find((s) => s.key === "kickoff")!.onFail).toEqual({ toStage: "engagement" });
|
|
120
|
+
// The statuses it moves are options of the client lifecycle.
|
|
121
|
+
const keys = tpl("foundation").profiles.find((p) => p.slug === "client")!.lifecycle!.options.map((o) => o.key);
|
|
122
|
+
expect(keys).toEqual(expect.arrayContaining(["onboarding", "active"]));
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it("Operations produces the client; CRM no longer does", () => {
|
|
126
|
+
expect(ops.meta.intent!.produces!.map((p) => p.profile)).toContain("client");
|
|
127
|
+
expect(crm.meta.intent!.produces!.map((p) => p.profile)).not.toContain("client");
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
describe("the touched templates validate", () => {
|
|
132
|
+
for (const slug of ["foundation", "crm", "operations"]) {
|
|
133
|
+
it(`${slug}: zero errors`, () => {
|
|
134
|
+
expect(validateTemplate(tpl(slug), { corpus }).errors).toEqual([]);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
});
|
|
@@ -179,6 +179,25 @@ describe("lifecycle declarations — the mandatory four", () => {
|
|
|
179
179
|
}
|
|
180
180
|
});
|
|
181
181
|
|
|
182
|
+
// Founder, 17 Nov 2026 (design 05ed390c): a new client starts at onboarding,
|
|
183
|
+
// an open step right before active. Every declaration of the ONE pod-wide
|
|
184
|
+
// role says so (foundation is the SSOT; grants restates the body), and the
|
|
185
|
+
// select offers it. Not person-only: "Onboard a client"'s Welcome stage
|
|
186
|
+
// moves the client there; the person's commitment is the kick-off → active.
|
|
187
|
+
it("client: onboarding is an open status right before active, on every declaration", () => {
|
|
188
|
+
for (const slug of ["foundation", "grants"]) {
|
|
189
|
+
const t = tpl(slug);
|
|
190
|
+
const lc = lifecycleOf(t, "client")!;
|
|
191
|
+
const keys = lc.options.map((o) => o.key);
|
|
192
|
+
expect(keys.indexOf("onboarding"), slug).toBe(keys.indexOf("active") - 1);
|
|
193
|
+
const onboarding = lc.options.find((o) => o.key === "onboarding")!;
|
|
194
|
+
expect(onboarding.category, slug).toBe("open");
|
|
195
|
+
expect(onboarding.humanOnly, slug).toBeUndefined();
|
|
196
|
+
const select = t.profiles.find((p) => p.slug === "client")!.properties.find((p) => p.slug === "clientStatus")!;
|
|
197
|
+
expect(select.enumValues, slug).toEqual(keys);
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
|
|
182
201
|
it("the post Produce Content drives declares post-status", () => {
|
|
183
202
|
const produce = tpl("content-os").playbooks!.find((p) => p.name === "Produce Content")!;
|
|
184
203
|
expect(produce.subjectProfile).toEqual({ profileSlug: "post" });
|
|
@@ -207,7 +226,7 @@ function playbookBindings({ withSystem = false } = {}) {
|
|
|
207
226
|
.filter(
|
|
208
227
|
(pb) =>
|
|
209
228
|
pb.subjectProfile?.profileSlug &&
|
|
210
|
-
((pb.stages ?? []).some((st) => st.subjectStatus) || (pb.activators ?? []).some((a) => a.status)) &&
|
|
229
|
+
((pb.stages ?? []).some((st) => st.subjectStatus || st.onApproved) || (pb.activators ?? []).some((a) => a.status)) &&
|
|
211
230
|
(withSystem ||
|
|
212
231
|
!SYSTEM_PROFILES.has(pb.subjectProfile.profileSlug) ||
|
|
213
232
|
TEMPLATE_OWNED_SYSTEM_LIFECYCLES.has(pb.subjectProfile.profileSlug))
|
|
@@ -79,14 +79,46 @@ describe("lifecycle presets — the converted lifecycles compile byte-identical"
|
|
|
79
79
|
"brand-asset": { deprecated: "textMuted" },
|
|
80
80
|
"brand-reference": { archived: "textMuted" },
|
|
81
81
|
};
|
|
82
|
+
// The second intended change: a step ADDED to a converted lifecycle
|
|
83
|
+
// (`add:` in the YAML), inserted before an existing key. `onboarding` before
|
|
84
|
+
// `active` on the client (founder, 17 Nov 2026, design 05ed390c: a new
|
|
85
|
+
// client starts at onboarding).
|
|
86
|
+
const ADDED_SINCE: Record<string, { key: string; category: string; before: string }[]> = {
|
|
87
|
+
client: [{ key: "onboarding", category: "open", before: "active" }],
|
|
88
|
+
};
|
|
89
|
+
const withAdded = <T extends { key: string }>(list: T[], profile: string, make: (a: { key: string; category: string }) => T): T[] => {
|
|
90
|
+
const out = [...list];
|
|
91
|
+
for (const a of ADDED_SINCE[profile] ?? []) out.splice(out.findIndex((o) => o.key === a.before), 0, make(a));
|
|
92
|
+
return out;
|
|
93
|
+
};
|
|
82
94
|
const withTone = (b: (typeof before.profiles)[number]) => ({
|
|
83
95
|
...b.lifecycle,
|
|
84
|
-
options:
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
96
|
+
options: withAdded(
|
|
97
|
+
b.lifecycle.options.map((o) => {
|
|
98
|
+
const tone = TONE_SINCE[b.profile]?.[o.key];
|
|
99
|
+
if (!tone) return o;
|
|
100
|
+
const { key, category, ...rest } = o;
|
|
101
|
+
return { key, category, tone, ...rest };
|
|
102
|
+
}),
|
|
103
|
+
b.profile,
|
|
104
|
+
(a) => ({ key: a.key, category: a.category }) as (typeof b.lifecycle.options)[number]
|
|
105
|
+
),
|
|
106
|
+
});
|
|
107
|
+
const withAddedEnum = (b: (typeof before.profiles)[number]) =>
|
|
108
|
+
ADDED_SINCE[b.profile]
|
|
109
|
+
? {
|
|
110
|
+
...b.property,
|
|
111
|
+
enumValues: withAdded(
|
|
112
|
+
(b.property.enumValues ?? []).map((key) => ({ key })),
|
|
113
|
+
b.profile,
|
|
114
|
+
(a) => ({ key: a.key })
|
|
115
|
+
).map((o) => o.key),
|
|
116
|
+
}
|
|
117
|
+
: b.property;
|
|
118
|
+
|
|
119
|
+
it("non-vacuity: the added step lands where it is declared (client: onboarding before active)", () => {
|
|
120
|
+
const keys = profileOf(compiled.get("foundation")!, "client").lifecycle!.options.map((o) => o.key);
|
|
121
|
+
expect(keys).toEqual(["prospect", "onboarding", "active", "paused", "former", "churned"]);
|
|
90
122
|
});
|
|
91
123
|
|
|
92
124
|
for (const b of before.profiles) {
|
|
@@ -99,7 +131,7 @@ describe("lifecycle presets — the converted lifecycles compile byte-identical"
|
|
|
99
131
|
JSON.stringify(
|
|
100
132
|
profile.properties.find((p) => p.slug === b.property.slug)
|
|
101
133
|
)
|
|
102
|
-
).toBe(JSON.stringify(b
|
|
134
|
+
).toBe(JSON.stringify(withAddedEnum(b)));
|
|
103
135
|
});
|
|
104
136
|
}
|
|
105
137
|
});
|
package/src/marketing.yaml
CHANGED
|
@@ -389,7 +389,7 @@ playbooks:
|
|
|
389
389
|
- name: Run a campaign
|
|
390
390
|
description: Take a campaign from brief to results — goal, audience, plan, content, launch with a person's approval, and a report on the leads it brought.
|
|
391
391
|
goalTemplate: >-
|
|
392
|
-
Run this campaign ({campaign}); each stage moves its status. BRIEF: write
|
|
392
|
+
Run this campaign ({campaign}); each stage moves its status when its work is approved. BRIEF: write
|
|
393
393
|
the campaign's goal as a number, its target audience, channel, budget,
|
|
394
394
|
start and end dates, from the brand kit and the agency's offers. PLAN:
|
|
395
395
|
list the pieces to make and the outreach to send, each with a date. MAKE:
|
|
@@ -458,8 +458,8 @@ playbooks:
|
|
|
458
458
|
- key: report
|
|
459
459
|
name: Report
|
|
460
460
|
category: completed
|
|
461
|
-
|
|
462
|
-
goal: Record lead count and conversion rate, link the leads, and write what to change.
|
|
461
|
+
onApproved: completed
|
|
462
|
+
goal: Record lead count and conversion rate, link the leads, and write what to change, then move the campaign to completed yourself (update_entity, campaign-status completed, expectedStatus active); nothing else moves it, and your move into completed comes back proposed for the person to approve, which is success.
|
|
463
463
|
criteria:
|
|
464
464
|
- key: campaign-results
|
|
465
465
|
statement: The lead count and conversion rate are set.
|
package/src/operations.yaml
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
# Operations workspace template — client-delivery domain.
|
|
2
|
-
# How client work gets delivered end to end: the
|
|
3
|
-
#
|
|
2
|
+
# How client work gets delivered end to end: the clients you serve, the
|
|
3
|
+
# engagements you're running, the deliverables due inside them, and the
|
|
4
|
+
# contracts that govern them. Consumes the `crm` domain, provides `operations`.
|
|
5
|
+
#
|
|
6
|
+
# The Clients space (founder, 17 Nov 2026, design 05ed390c). A lead that signs
|
|
7
|
+
# in the CRM becomes a client here: a person moves the lead to `converted`
|
|
8
|
+
# (= signed), the CRM automation `lead-converted-becomes-client` attaches the
|
|
9
|
+
# pod-wide `client` role (handoffStatus handed_off, handoffDestination
|
|
10
|
+
# Operations), and "Onboard a client" below starts on that role: Welcome
|
|
11
|
+
# (clientStatus onboarding) → open or reuse the engagement → kick-off confirmed
|
|
12
|
+
# by a person (active). The engagement then runs "Deliver a client engagement".
|
|
13
|
+
# The 07:00 "Pick up handed-off clients" stays as a safety net.
|
|
4
14
|
# Validated against types.ts at build time.
|
|
5
15
|
|
|
6
16
|
meta:
|
|
7
17
|
slug: operations
|
|
8
18
|
domain: company
|
|
9
19
|
name: Operations
|
|
10
|
-
description: "Deliver client work end to end — the engagements you're running, the deliverables due inside them, and the contracts that govern them.
|
|
20
|
+
description: "Deliver client work end to end — the clients you serve, the engagements you're running, the deliverables due inside them, and the contracts that govern them. A lead that signs in the CRM becomes a client here, is onboarded, and its work runs as an engagement."
|
|
11
21
|
icon: briefcase
|
|
12
22
|
color: "#0F766E"
|
|
13
23
|
tags: [operations, delivery, clients, engagements]
|
|
@@ -36,9 +46,12 @@ meta:
|
|
|
36
46
|
label: Delivery
|
|
37
47
|
# The ONE primary output (One model decision 3): a delivered engagement (Deliver a client engagement).
|
|
38
48
|
primary: engagement
|
|
49
|
+
# `client` joined on 17 Nov 2026: Operations is the Clients space (design
|
|
50
|
+
# 05ed390c); the client's lifecycle (onboarding → active …) is worked here.
|
|
39
51
|
produces:
|
|
40
52
|
- profile: engagement
|
|
41
53
|
- profile: deliverable
|
|
54
|
+
- profile: client
|
|
42
55
|
|
|
43
56
|
workspace:
|
|
44
57
|
name: Operations
|
|
@@ -64,9 +77,19 @@ dependencies:
|
|
|
64
77
|
- slug: foundation
|
|
65
78
|
kind: workspace
|
|
66
79
|
relation: require
|
|
67
|
-
reason: "Provides the pod-wide `client` role
|
|
80
|
+
reason: "Provides the pod-wide `client` role this space onboards and serves (Clients board, Onboard a client) and its automations query."
|
|
68
81
|
|
|
69
82
|
profiles:
|
|
83
|
+
# The pod-wide `client` role, REFERENCED (foundation's SSOT body; crm.yaml
|
|
84
|
+
# declares the same reference). Declaring it grants this space the role, so
|
|
85
|
+
# the Clients board, "Onboard a client" and the engagement's client field
|
|
86
|
+
# see it (founder, 17 Nov 2026, design 05ed390c). No extra properties: the
|
|
87
|
+
# handoff fields are the CRM's overlay.
|
|
88
|
+
- slug: client
|
|
89
|
+
displayName: Client
|
|
90
|
+
scope: shared
|
|
91
|
+
profileKind: role
|
|
92
|
+
properties: []
|
|
70
93
|
- slug: engagement
|
|
71
94
|
displayName: Engagement
|
|
72
95
|
icon: briefcase
|
|
@@ -88,10 +111,15 @@ profiles:
|
|
|
88
111
|
valueType: string
|
|
89
112
|
inputType: select
|
|
90
113
|
constraints: { defaultValue: proposed }
|
|
114
|
+
# The client the work is for: whoever wears the `client` role, a company
|
|
115
|
+
# or a person (founder, 17 Nov 2026: a solo client like Claire is the
|
|
116
|
+
# client herself). It is also the dedupe key of every door that opens an
|
|
117
|
+
# engagement for a client ("Onboard a client", "Pick up handed-off
|
|
118
|
+
# clients"): one engagement per client, whichever door runs first.
|
|
91
119
|
- slug: engagement-client
|
|
92
120
|
label: Client
|
|
93
121
|
valueType: entity_id
|
|
94
|
-
targetProfileSlug:
|
|
122
|
+
targetProfileSlug: client
|
|
95
123
|
inputType: entity_select
|
|
96
124
|
- slug: engagement-start
|
|
97
125
|
label: Start Date
|
|
@@ -301,6 +329,15 @@ entityLinks:
|
|
|
301
329
|
|
|
302
330
|
# CURATED views — the delivery motion, not one per profile
|
|
303
331
|
views:
|
|
332
|
+
# The flow board of "Onboard a client": the client role's lifecycle, a drag
|
|
333
|
+
# is the governed status move (onboarding → active is a person's call there).
|
|
334
|
+
- name: Clients
|
|
335
|
+
slug: clients
|
|
336
|
+
type: kanban
|
|
337
|
+
scopeProfileSlug: client
|
|
338
|
+
config:
|
|
339
|
+
groupByField: clientStatus
|
|
340
|
+
description: "Clients on a board by status, from onboarding to active."
|
|
304
341
|
- name: Engagements
|
|
305
342
|
slug: engagements
|
|
306
343
|
type: kanban
|
|
@@ -372,6 +409,10 @@ layout:
|
|
|
372
409
|
defaultView: Engagements
|
|
373
410
|
defaultApp: null
|
|
374
411
|
sidebarItems:
|
|
412
|
+
- kind: view
|
|
413
|
+
viewName: Clients
|
|
414
|
+
label: Clients
|
|
415
|
+
icon: users
|
|
375
416
|
- kind: view
|
|
376
417
|
viewName: Engagements
|
|
377
418
|
label: Engagements
|
|
@@ -670,14 +711,24 @@ automations:
|
|
|
670
711
|
- { id: e-resolve-post, source: resolve-team, target: post-recap }
|
|
671
712
|
|
|
672
713
|
# ══════════════════════════════════════════════════════════════════════════
|
|
673
|
-
# CRM → Operations HANDOFF PICKUP
|
|
714
|
+
# CRM → Operations HANDOFF PICKUP — the SAFETY NET
|
|
715
|
+
#
|
|
716
|
+
# Since 17 Nov 2026 (design 05ed390c) a client arrives through ONE door: a
|
|
717
|
+
# person moves the lead to `converted` (= signed), the CRM automation
|
|
718
|
+
# `lead-converted-becomes-client` attaches the pod-wide `client` role with
|
|
719
|
+
# `handoffStatus: handed_off`, and "Onboard a client" (below) starts on that
|
|
720
|
+
# attach and opens or reuses the engagement. This daily job stays as the
|
|
721
|
+
# safety net (founder default 6): a client whose onboarding never started
|
|
722
|
+
# (a declined run, an attach before the cross-space delivery landed, a client
|
|
723
|
+
# attached by another door such as The Arch's "Win and hand off") still gets
|
|
724
|
+
# its delivery shell — a `proposed` engagement plus a `draft` contract — at
|
|
725
|
+
# most 24 h late.
|
|
674
726
|
#
|
|
675
|
-
#
|
|
676
|
-
#
|
|
677
|
-
#
|
|
678
|
-
#
|
|
679
|
-
#
|
|
680
|
-
# delivery shell — a `proposed` engagement plus a `draft` contract.
|
|
727
|
+
# ONE DEDUPE KEY for every door: an engagement belongs to a client through
|
|
728
|
+
# its `engagement-client` property (plus the `engagement_for_client` edge).
|
|
729
|
+
# "Onboard a client" sets both on the engagement it opens and reuses the one
|
|
730
|
+
# this job opened; this job skips a client that already has one. Whichever
|
|
731
|
+
# door runs first, a client gets one engagement.
|
|
681
732
|
#
|
|
682
733
|
# WHY THE SHARED `client` SLUG MATTERS: this reads foundation's pod-wide
|
|
683
734
|
# `client` role. When the CRM wrote a workspace-scoped `crm-client` instead,
|
|
@@ -724,10 +775,12 @@ automations:
|
|
|
724
775
|
- key: operations-crm-handoff-pickup
|
|
725
776
|
name: Pick up handed-off clients
|
|
726
777
|
description: >-
|
|
727
|
-
Daily. Finds pod-wide clients the CRM marked ready or handed
|
|
728
|
-
no engagement yet
|
|
729
|
-
|
|
730
|
-
|
|
778
|
+
Daily safety net. Finds pod-wide clients the CRM marked ready or handed
|
|
779
|
+
off that have no engagement yet (Onboard a client normally opens it), and
|
|
780
|
+
opens the delivery shell for them — a proposed engagement plus a draft
|
|
781
|
+
contract, both linked to the client. Deduped per client on the
|
|
782
|
+
engagement's client, the key Onboard a client uses too, so it is safe to
|
|
783
|
+
re-run.
|
|
731
784
|
triggerType: cron
|
|
732
785
|
triggerConfig:
|
|
733
786
|
expression: "0 7 * * *"
|
|
@@ -924,10 +977,88 @@ automations:
|
|
|
924
977
|
- { id: h-contract-link, source: create-contract, target: link-contract }
|
|
925
978
|
|
|
926
979
|
playbooks:
|
|
980
|
+
# ── Onboard a client — the Clients space's process ───────────────────────
|
|
981
|
+
# Founder decision 17 Nov 2026 (design 05ed390c, defaults approved). Its
|
|
982
|
+
# subject is the pod-wide `client` ROLE, whose lifecycle foundation declares
|
|
983
|
+
# (clientStatus, with `onboarding` before `active`). It starts when the role
|
|
984
|
+
# is attached (`on: created` on a role = the attach; `mode: propose`, so a
|
|
985
|
+
# person approves the run): normally by the CRM automation
|
|
986
|
+
# `lead-converted-becomes-client`, once a person moved the lead to converted
|
|
987
|
+
# (= signed). An attach made under the CRM space reaches this Operations rule
|
|
988
|
+
# only once the backend delivers a pod-wide role attach to every space of the
|
|
989
|
+
# entity (wave W1); until then the 07:00 safety net opens the engagement.
|
|
990
|
+
# Engagement dedupe: `engagement-client` (see the pickup automation above).
|
|
991
|
+
# Sending the welcome goes through the pod's one send door (a proposed
|
|
992
|
+
# message a person approves); the commitment, kick-off done → active, is a
|
|
993
|
+
# person's gate.
|
|
994
|
+
- name: Onboard a client
|
|
995
|
+
description: Welcome a new client, open or reuse their engagement, and have a person confirm the kick-off — the client moves from onboarding to active.
|
|
996
|
+
goalTemplate: >-
|
|
997
|
+
Onboard this new client ({client}); each stage moves the client's
|
|
998
|
+
status. WELCOME: read how they became a client — the converted lead,
|
|
999
|
+
the won deal and its proposal, every message with them, and the
|
|
1000
|
+
handoff notes on the client role — and write a short brief in the
|
|
1001
|
+
client's notes: what they bought, who signs, and what they expect
|
|
1002
|
+
first. Draft one welcome message to them as a proposed message in
|
|
1003
|
+
their channel, through the pod's send door (messaging.send): a person
|
|
1004
|
+
approves it before it is sent; never send it another way.
|
|
1005
|
+
ENGAGEMENT: find the engagement whose client is this client (the daily
|
|
1006
|
+
pick-up may already have opened one) and reuse it. Only when there is
|
|
1007
|
+
none, open one at proposed with its client set to this client and its
|
|
1008
|
+
scope and value from the won deal, and link it to the client. Never
|
|
1009
|
+
open a second one. Opening it starts "Deliver a client engagement".
|
|
1010
|
+
KICK-OFF: propose the kick-off (its date, who attends, what is decided
|
|
1011
|
+
there) as the engagement's next step; a person confirms the kick-off
|
|
1012
|
+
happened, which makes the client active.
|
|
1013
|
+
subjectProfile:
|
|
1014
|
+
profileSlug: client
|
|
1015
|
+
activators:
|
|
1016
|
+
- { on: created, mode: propose }
|
|
1017
|
+
params:
|
|
1018
|
+
- { name: client, type: entity, label: Client, required: true }
|
|
1019
|
+
executor: is-agent
|
|
1020
|
+
status: active
|
|
1021
|
+
tools: [list_records, send_message]
|
|
1022
|
+
metadata:
|
|
1023
|
+
lineage: { method: "Agency client onboarding: welcome, engagement set-up, kick-off" }
|
|
1024
|
+
stages:
|
|
1025
|
+
- key: welcome
|
|
1026
|
+
name: Welcome
|
|
1027
|
+
category: planned
|
|
1028
|
+
subjectStatus: onboarding
|
|
1029
|
+
goal: Write the client brief in the client's notes and propose a welcome message in their channel for a person to approve.
|
|
1030
|
+
criteria:
|
|
1031
|
+
- key: welcome-brief
|
|
1032
|
+
statement: The client's notes hold a short brief — what they bought, who signs, and what they expect first.
|
|
1033
|
+
check: { kind: judge }
|
|
1034
|
+
- key: welcome-message-proposed
|
|
1035
|
+
statement: A welcome message to the client is proposed in their channel for a person to approve.
|
|
1036
|
+
check: { kind: judge }
|
|
1037
|
+
- key: engagement
|
|
1038
|
+
name: Open or reuse the engagement
|
|
1039
|
+
category: started
|
|
1040
|
+
goal: Reuse the engagement whose client is this client; only when none exists, open one at proposed with its client set and link it to the client.
|
|
1041
|
+
expectedOutputs:
|
|
1042
|
+
- { kind: engagement, label: Client engagement, relationToSubject: engagement_for_client }
|
|
1043
|
+
criteria:
|
|
1044
|
+
- key: engagement-one-per-client
|
|
1045
|
+
statement: Exactly one engagement names this client as its client.
|
|
1046
|
+
check: { kind: judge }
|
|
1047
|
+
- key: engagement-linked
|
|
1048
|
+
statement: That engagement is linked to the client.
|
|
1049
|
+
check: { kind: judge }
|
|
1050
|
+
- key: kickoff
|
|
1051
|
+
name: Kick-off confirmed
|
|
1052
|
+
category: completed
|
|
1053
|
+
subjectStatus: active
|
|
1054
|
+
goal: A person confirms the kick-off happened; the client becomes active.
|
|
1055
|
+
gate: { kind: human }
|
|
1056
|
+
onFail: { toStage: engagement }
|
|
1057
|
+
|
|
927
1058
|
- name: Deliver a client engagement
|
|
928
1059
|
description: Run one client engagement from kick-off to close — scope, contract, deliverables, final review and the closing invoice — with a person approving the start and the close.
|
|
929
1060
|
goalTemplate: >-
|
|
930
|
-
Run this client engagement ({engagement}); each stage moves its status.
|
|
1061
|
+
Run this client engagement ({engagement}); each stage moves its status when its work is approved.
|
|
931
1062
|
KICK-OFF: read the won deal, the proposal and every message with the
|
|
932
1063
|
client; write the scope, owner, start and end dates and value on the
|
|
933
1064
|
engagement; create one deliverable per promised output (each with a due
|
|
@@ -988,6 +1119,7 @@ playbooks:
|
|
|
988
1119
|
- key: deliver
|
|
989
1120
|
name: Deliver
|
|
990
1121
|
category: started
|
|
1122
|
+
onApproved: completed
|
|
991
1123
|
goal: Track every deliverable to accepted or cancelled, and end with a short status of what moved and what is late as your answer.
|
|
992
1124
|
indefinite: true
|
|
993
1125
|
criteria:
|
|
@@ -1000,7 +1132,6 @@ playbooks:
|
|
|
1000
1132
|
- key: close
|
|
1001
1133
|
name: Close
|
|
1002
1134
|
category: completed
|
|
1003
|
-
subjectStatus: completed
|
|
1004
1135
|
goal: Write the closing review, create the closing invoice, propose the renewal; a person approves the close.
|
|
1005
1136
|
gate: { kind: human }
|
|
1006
1137
|
onFail: { toStage: deliver }
|
|
@@ -1012,7 +1143,7 @@ playbooks:
|
|
|
1012
1143
|
- name: Deliver a deliverable
|
|
1013
1144
|
description: Take one deliverable from in progress to accepted by the client — plan, produce, review internally, send, get the client's sign-off, and bill it when the engagement bills per deliverable.
|
|
1014
1145
|
goalTemplate: >-
|
|
1015
|
-
Deliver this deliverable ({deliverable}); each stage moves its status.
|
|
1146
|
+
Deliver this deliverable ({deliverable}); each stage moves its status when its work is approved.
|
|
1016
1147
|
PLAN: read the engagement's scope and the client's brief, and write what
|
|
1017
1148
|
done looks like for this deliverable. PRODUCE: make it, or break it into
|
|
1018
1149
|
tasks for the people who will. REVIEW: check it against what done looks
|
|
@@ -1066,7 +1197,7 @@ playbooks:
|
|
|
1066
1197
|
- key: send
|
|
1067
1198
|
name: Send to client
|
|
1068
1199
|
category: started
|
|
1069
|
-
|
|
1200
|
+
onApproved: delivered
|
|
1070
1201
|
goal: A person approves sending; record the delivered date.
|
|
1071
1202
|
gate: { kind: human }
|
|
1072
1203
|
onFail: { toStage: produce }
|
|
@@ -1092,7 +1223,7 @@ playbooks:
|
|
|
1092
1223
|
- name: Get a contract signed
|
|
1093
1224
|
description: Take a client contract from draft to signed and active, with a person approving what is sent and confirming the signature.
|
|
1094
1225
|
goalTemplate: >-
|
|
1095
|
-
Get this contract ({contract}) signed; each stage moves its status.
|
|
1226
|
+
Get this contract ({contract}) signed; each stage moves its status when its work is approved.
|
|
1096
1227
|
DRAFT: fill the contract from the engagement's scope, value, dates and
|
|
1097
1228
|
the agency's standard terms, and list every term that differs from the
|
|
1098
1229
|
standard. SEND: a person approves the contract before it goes to the
|
|
@@ -1126,7 +1257,7 @@ playbooks:
|
|
|
1126
1257
|
- key: send
|
|
1127
1258
|
name: Send
|
|
1128
1259
|
category: started
|
|
1129
|
-
|
|
1260
|
+
onApproved: sent
|
|
1130
1261
|
goal: A person approves the contract before it goes to the client.
|
|
1131
1262
|
gate: { kind: human }
|
|
1132
1263
|
onFail: { toStage: draft }
|
|
@@ -1149,8 +1280,8 @@ playbooks:
|
|
|
1149
1280
|
- key: active
|
|
1150
1281
|
name: Active
|
|
1151
1282
|
category: completed
|
|
1152
|
-
|
|
1153
|
-
goal: Set the dates and link the signed document on the contract.
|
|
1283
|
+
onApproved: active
|
|
1284
|
+
goal: Set the dates and link the signed document on the contract, then move the contract to active yourself (update_entity, contract-status active, expectedStatus signed); nothing else moves it.
|
|
1154
1285
|
criteria:
|
|
1155
1286
|
- key: contract-document-linked
|
|
1156
1287
|
statement: The signed document's link is set on the contract.
|
|
@@ -85,11 +85,12 @@ describe("Postiz contract — the keys the webhook and the capability share", ()
|
|
|
85
85
|
|
|
86
86
|
it("Produce Content requires publish_post and queues at Scheduled", () => {
|
|
87
87
|
const pb = (contentOs?.playbooks ?? []).find((p: { name?: string }) => p.name === "Produce Content") as
|
|
88
|
-
| { tools?: string[]; stages?: Array<{ key: string;
|
|
88
|
+
| { tools?: string[]; stages?: Array<{ key: string; onApproved?: string; goal?: string }> }
|
|
89
89
|
| undefined;
|
|
90
90
|
expect(pb?.tools).toContain("publish_post");
|
|
91
91
|
const schedule = pb?.stages?.find((s) => s.key === "schedule");
|
|
92
|
-
|
|
92
|
+
// D2: Scheduled is reached when the schedule is approved (Publish's gate).
|
|
93
|
+
expect(schedule?.onApproved).toBe("Scheduled");
|
|
93
94
|
expect(schedule?.goal).toContain("postiz_schedule_post");
|
|
94
95
|
expect(schedule?.goal).toContain("postiz-post-id");
|
|
95
96
|
});
|
|
@@ -326,7 +326,10 @@ describe("process contract — the shipped corpus", () => {
|
|
|
326
326
|
const produce = contentOs.playbooks!.find((p) => p.name === "Produce Content")!;
|
|
327
327
|
expect(produce.subjectProfile).toEqual({ profileSlug: "post" });
|
|
328
328
|
expect(contentOs.profiles.find((p) => p.slug === "post")?.lifecycle?.property).toBe("post-status");
|
|
329
|
-
|
|
329
|
+
// D2: two statuses held while worked (In Draft, Review), four reached on
|
|
330
|
+
// approval (Briefed, Scripted, Scheduled, Published).
|
|
331
|
+
expect(produce.stages!.filter((s) => s.subjectStatus).length).toBe(2);
|
|
332
|
+
expect(produce.stages!.filter((s) => s.onApproved).length).toBe(4);
|
|
330
333
|
const errs = corpus.flatMap((t) =>
|
|
331
334
|
validateTemplate(t, { corpus })
|
|
332
335
|
.errors.filter((e) => PROCESS_RULES.has(e.rule))
|
|
@@ -90,13 +90,14 @@ describe("plan → execute — the wire", () => {
|
|
|
90
90
|
const posted = calls.find(isWrite)!.body.definition.playbooks;
|
|
91
91
|
expect(posted).toEqual(yamlPlaybooks);
|
|
92
92
|
const postedProduce = posted.find((p: any) => p.name === "Produce Content");
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
"
|
|
96
|
-
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
93
|
+
// Both status fields reach the pod (decision D2): entered, then reached.
|
|
94
|
+
expect(postedProduce.stages.map((s: any) => [s.subjectStatus, s.onApproved])).toEqual([
|
|
95
|
+
[undefined, "Briefed"],
|
|
96
|
+
[undefined, "Scripted"],
|
|
97
|
+
["In Draft", undefined],
|
|
98
|
+
["Review", undefined],
|
|
99
|
+
[undefined, "Scheduled"],
|
|
100
|
+
[undefined, "Published"],
|
|
100
101
|
]);
|
|
101
102
|
// Retired from the catalog (One model decision 4): nothing to carry.
|
|
102
103
|
expect(postedProduce.humanOnlyStatuses).toBeUndefined();
|
package/src/research-base.yaml
CHANGED
|
@@ -412,7 +412,7 @@ playbooks:
|
|
|
412
412
|
description: Investigate a question end-to-end — gather and rank sources (keeping the rejected ones), weigh hypotheses, emit findings with calibrated confidence, and map them onto the knowledge graph.
|
|
413
413
|
goalTemplate: >-
|
|
414
414
|
Investigate the question {question} and record the WHOLE investigation,
|
|
415
|
-
not just the answer; each stage moves the question's status. FRAME:
|
|
415
|
+
not just the answer; each stage moves the question's status when its work is approved. FRAME:
|
|
416
416
|
restate the question so it can be answered, and say what evidence would
|
|
417
417
|
answer it. GATHER: use the source-triage skill to gather sources widely
|
|
418
418
|
via web search, classify each by type and credibility, and create a
|
|
@@ -462,6 +462,7 @@ playbooks:
|
|
|
462
462
|
- key: weigh
|
|
463
463
|
name: Weigh
|
|
464
464
|
category: started
|
|
465
|
+
onApproved: answered
|
|
465
466
|
goal: Form hypotheses, link evidence for and against, and emit findings with calibrated confidence.
|
|
466
467
|
criteria:
|
|
467
468
|
- key: findings-cited
|
|
@@ -473,7 +474,6 @@ playbooks:
|
|
|
473
474
|
- key: answer
|
|
474
475
|
name: Answer
|
|
475
476
|
category: completed
|
|
476
|
-
subjectStatus: answered
|
|
477
477
|
goal: Record the research, its conclusion and confidence, and mark the question answered.
|
|
478
478
|
gate: { kind: check }
|
|
479
479
|
onFail: { toStage: weigh }
|
|
@@ -193,6 +193,7 @@ playbooks:
|
|
|
193
193
|
name: Prepare
|
|
194
194
|
category: started
|
|
195
195
|
subjectStatus: proposed
|
|
196
|
+
onApproved: accepted
|
|
196
197
|
goal: Summarise the question, the options, the evidence and the recommendation in one screen.
|
|
197
198
|
criteria:
|
|
198
199
|
- key: decision-options-listed
|
|
@@ -201,7 +202,6 @@ playbooks:
|
|
|
201
202
|
- key: accept
|
|
202
203
|
name: Accept
|
|
203
204
|
category: completed
|
|
204
|
-
subjectStatus: accepted
|
|
205
205
|
goal: A person accepts the decision.
|
|
206
206
|
gate: { kind: human }
|
|
207
207
|
onFail: { toStage: prepare }
|