@rubytech/create-realagent 1.0.702 → 1.0.703

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.
Files changed (47) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/config/brand.json +1 -1
  3. package/payload/platform/plugins/admin/mcp/dist/lib/onboarding.d.ts +1 -0
  4. package/payload/platform/plugins/admin/mcp/dist/lib/onboarding.d.ts.map +1 -1
  5. package/payload/platform/plugins/admin/mcp/dist/lib/onboarding.js +11 -3
  6. package/payload/platform/plugins/admin/mcp/dist/lib/onboarding.js.map +1 -1
  7. package/payload/platform/plugins/admin/skills/business-profile/SKILL.md +13 -1
  8. package/payload/platform/plugins/admin/skills/onboarding/SKILL.md +19 -6
  9. package/payload/platform/plugins/docs/references/internals.md +2 -0
  10. package/payload/platform/plugins/docs/references/platform.md +2 -1
  11. package/payload/platform/plugins/docs/references/plugins-guide.md +1 -0
  12. package/payload/platform/plugins/linkedin-import/PLUGIN.md +26 -0
  13. package/payload/platform/plugins/linkedin-import/skills/linkedin-import/SKILL.md +119 -0
  14. package/payload/platform/plugins/linkedin-import/skills/linkedin-import/references/connections.md +162 -0
  15. package/payload/platform/plugins/linkedin-import/skills/linkedin-import/references/profile.md +102 -0
  16. package/payload/platform/plugins/memory/mcp/dist/lib/graph-write-gate.d.ts +21 -0
  17. package/payload/platform/plugins/memory/mcp/dist/lib/graph-write-gate.d.ts.map +1 -0
  18. package/payload/platform/plugins/memory/mcp/dist/lib/graph-write-gate.js +50 -0
  19. package/payload/platform/plugins/memory/mcp/dist/lib/graph-write-gate.js.map +1 -0
  20. package/payload/platform/plugins/memory/mcp/dist/tools/memory-update.d.ts.map +1 -1
  21. package/payload/platform/plugins/memory/mcp/dist/tools/memory-update.js +15 -0
  22. package/payload/platform/plugins/memory/mcp/dist/tools/memory-update.js.map +1 -1
  23. package/payload/platform/plugins/memory/mcp/dist/tools/memory-write.d.ts.map +1 -1
  24. package/payload/platform/plugins/memory/mcp/dist/tools/memory-write.js +11 -0
  25. package/payload/platform/plugins/memory/mcp/dist/tools/memory-write.js.map +1 -1
  26. package/payload/platform/templates/agents/admin/IDENTITY.md +5 -3
  27. package/payload/platform/templates/specialists/agents/database-operator.md +113 -0
  28. package/payload/server/chunk-UFLV7I6N.js +11678 -0
  29. package/payload/server/maxy-edge.js +1 -1
  30. package/payload/server/public/assets/{Checkbox-C24zNZ3g.js → Checkbox-CDUmQ1Bu.js} +1 -1
  31. package/payload/server/public/assets/{admin-DQS9d7gx.js → admin-picYWZfn.js} +2 -2
  32. package/payload/server/public/assets/{data-lJ2vb2jV.js → data-yYbcrFrc.js} +1 -1
  33. package/payload/server/public/assets/{file-16btGXA4.js → file-CzLc4Rvq.js} +1 -1
  34. package/payload/server/public/assets/{graph-gsP1la3h.js → graph-BRzC0ZtS.js} +1 -1
  35. package/payload/server/public/assets/{house-DJ35FtjK.js → house-lM4gLKkH.js} +1 -1
  36. package/payload/server/public/assets/jsx-runtime-I6ZqIGn8.css +1 -0
  37. package/payload/server/public/assets/{public-D8whQhxR.js → public-scZadgzt.js} +1 -1
  38. package/payload/server/public/assets/{share-2-C-ICFdTB.js → share-2-CNdrRWue.js} +1 -1
  39. package/payload/server/public/assets/{useVoiceRecorder-xTGR1bpD.js → useVoiceRecorder-D2kfoqVB.js} +1 -1
  40. package/payload/server/public/assets/{x-BrDQr7Iy.js → x-CsDhB6Vr.js} +1 -1
  41. package/payload/server/public/data.html +6 -6
  42. package/payload/server/public/graph.html +7 -7
  43. package/payload/server/public/index.html +8 -8
  44. package/payload/server/public/public.html +5 -5
  45. package/payload/server/server.js +90 -45
  46. package/payload/server/public/assets/jsx-runtime-n7GjUxnC.css +0 -1
  47. /package/payload/server/public/assets/{jsx-runtime-CHagz7cd.js → jsx-runtime-BK2hplUC.js} +0 -0
@@ -0,0 +1,102 @@
1
+ # Reference: Profile.csv
2
+
3
+ Enriches the confirmed archive owner's `:UserProfile` with the LinkedIn profile fields. No new nodes, no new edges — `:AdminUser` and `:UserProfile` already exist for any Maxy operator and are linked by `[:HAS_PROFILE]` at session start.
4
+
5
+ Runs before every other reference because later files display LinkedIn profile fields (headline, summary) on the owner node they MATCH.
6
+
7
+ ## Source
8
+
9
+ `Profile.csv` — single data row.
10
+
11
+ ## Columns → UserProfile properties
12
+
13
+ Schema.org camelCase per `platform/plugins/memory/references/schema-base.md`.
14
+
15
+ | CSV column | Property on `:UserProfile` |
16
+ |------------|----------------------------|
17
+ | First Name | `givenName` |
18
+ | Last Name | `familyName` |
19
+ | Maiden Name | `additionalName` (nullable) |
20
+ | Address | `address` (nullable) |
21
+ | Birth Date | `birthDate` (nullable, ISO 8601) |
22
+ | Headline | `headline` |
23
+ | Summary | `description` |
24
+ | Industry | `industry` (nullable) |
25
+ | Zip Code | `postalCode` (nullable) |
26
+ | Geo Location | `addressLocality` (nullable) |
27
+ | Twitter Handles | `twitterHandles` — array, split on `,` |
28
+ | Websites | `websites` — array, split on `,` |
29
+ | Instant Messengers | `instantMessengers` — array, split on `,` |
30
+
31
+ ## Anchor
32
+
33
+ ```
34
+ (:AdminUser {userId: $ownerUserId}) -[:HAS_PROFILE]-> (:UserProfile {accountId, userId})
35
+ ```
36
+
37
+ The skill run has already persisted `$ownerUserId` (and its resolved `$accountId`) from the owner-confirmation flow. This reference trusts those parameters.
38
+
39
+ ## Cypher
40
+
41
+ ```cypher
42
+ // Parameters:
43
+ // $ownerUserId — AdminUser.userId of the confirmed archive owner
44
+ // $accountId — the UserProfile accountId resolved alongside $ownerUserId
45
+ // $sessionId — UUID generated once per skill run
46
+ // $row — parsed object with the columns above
47
+
48
+ MATCH (au:AdminUser {userId: $ownerUserId})
49
+ MERGE (au)-[:HAS_PROFILE]->(up:UserProfile {accountId: $accountId, userId: $ownerUserId})
50
+ ON CREATE SET
51
+ up.createdAt = datetime(),
52
+ up.createdByAgent = 'linkedin-import',
53
+ up.createdBySource = 'linkedin-import',
54
+ up.createdBySession= $sessionId
55
+ SET
56
+ up.givenName = $row.givenName,
57
+ up.familyName = $row.familyName,
58
+ up.additionalName = $row.additionalName,
59
+ up.address = $row.address,
60
+ up.birthDate = $row.birthDate,
61
+ up.headline = $row.headline,
62
+ up.description = $row.description,
63
+ up.industry = $row.industry,
64
+ up.postalCode = $row.postalCode,
65
+ up.addressLocality = $row.addressLocality,
66
+ up.twitterHandles = $row.twitterHandles,
67
+ up.websites = $row.websites,
68
+ up.instantMessengers = $row.instantMessengers,
69
+ up.linkedinProfileUpdatedAt = datetime(),
70
+ up.source = coalesce(up.source, 'linkedin')
71
+
72
+ RETURN elementId(up) AS ownerProfileElementId
73
+ ```
74
+
75
+ The `MERGE (au)-[:HAS_PROFILE]->(up)` is idempotent: for any operator whose session has already run, `(au)-[:HAS_PROFILE]->(up)` already exists — this statement simply matches it and SETs properties. If the operator has never opened a Maxy session for this account (rare; the UserProfile normally exists before any skill runs), it is created here.
76
+
77
+ ## Expected outcome
78
+
79
+ - Zero new nodes (typical case).
80
+ - Zero new edges (typical case).
81
+ - One existing `:UserProfile` enriched with 10–13 new properties.
82
+ - `ownerProfileElementId` returned for downstream references that want to cache the anchor.
83
+
84
+ ## Failure modes
85
+
86
+ | Symptom | Cause | Fix |
87
+ |---------|-------|-----|
88
+ | Zero rows returned from `MATCH (au:AdminUser {userId: $ownerUserId})` | `$ownerUserId` doesn't resolve — operator typo in confirmation, or AdminUser missing | Re-run the owner-confirmation flow; verify `platform/config/users.json` contains the expected userId |
89
+ | `up.websites` written as a single string not an array | Parser didn't split on `,` | Fix parser — LinkedIn comma-delimits these fields |
90
+ | Constraint violation on `user_profile_account_user_unique` | Shouldn't happen — MERGE uses the composite key | Indicates a pre-existing duplicate; investigate with `MATCH (up:UserProfile {accountId: $accountId, userId: $ownerUserId}) RETURN count(up)` |
91
+
92
+ ## Post-import verification
93
+
94
+ ```cypher
95
+ MATCH (au:AdminUser {userId: $ownerUserId})-[:HAS_PROFILE]->(up:UserProfile)
96
+ RETURN
97
+ au.name, au.userId,
98
+ up.givenName, up.familyName, up.headline, up.description,
99
+ up.websites, up.linkedinProfileUpdatedAt
100
+ ```
101
+
102
+ Exactly one row. If zero, either the AdminUser doesn't exist or the HAS_PROFILE edge wasn't MERGEd — investigate before running any subsequent reference.
@@ -0,0 +1,21 @@
1
+ export interface SessionLike {
2
+ run(query: string, params?: Record<string, unknown>): Promise<{
3
+ records: Array<{
4
+ get(key: string): unknown;
5
+ }>;
6
+ }>;
7
+ }
8
+ export interface GateArgs {
9
+ session: SessionLike;
10
+ accountId: string;
11
+ labels: string[];
12
+ }
13
+ export type GateResult = {
14
+ ok: true;
15
+ } | {
16
+ ok: false;
17
+ reason: "no-admin-user" | "no-local-business";
18
+ message: string;
19
+ };
20
+ export declare function checkGraphWriteGate(args: GateArgs): Promise<GateResult>;
21
+ //# sourceMappingURL=graph-write-gate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-write-gate.d.ts","sourceRoot":"","sources":["../../src/lib/graph-write-gate.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,WAAW;IAC1B,GAAG,CACD,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC;QAAE,OAAO,EAAE,KAAK,CAAC;YAAE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC,CAAC;CAC/D;AAED,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,WAAW,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,MAAM,UAAU,GAClB;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GACZ;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,eAAe,GAAG,mBAAmB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAYlF,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAkC7E"}
@@ -0,0 +1,50 @@
1
+ // Graph-write precondition gate (Task 685).
2
+ //
3
+ // Refuses any `memory-write` / `memory-update` against a non-exempt node
4
+ // label until the account's AdminUser AND LocalBusiness both exist in the
5
+ // graph. The purpose is doctrine enforcement: SOUL is personality, factual
6
+ // business data lives in the graph, and the agent must run `business-profile`
7
+ // before writing user-domain nodes (WebSite, Service, etc.). Prose rules
8
+ // drifted across past sessions; this gate removes the LLM from the decision
9
+ // path entirely (feedback_deterministic_means_remove_llm.md).
10
+ //
11
+ // The exempt set is the base case that breaks the chicken-and-egg: the agent
12
+ // must be able to write Person, LocalBusiness, and AdminUser *before* anything
13
+ // else — otherwise no onboarding can ever complete. Public-agent customer
14
+ // capture writes `Person`, so exempting it keeps that flow working even when
15
+ // the admin side has not run business-profile.
16
+ //
17
+ // Scope: this gate lives only in the MCP memory-write/update path the agent
18
+ // calls. Server-side writers (neo4j-store, workflow-execute, admin/index)
19
+ // are owned by Task 673's provenance doctrine — disjoint enforcement.
20
+ const EXEMPT_LABELS = new Set([
21
+ "Person",
22
+ "LocalBusiness",
23
+ "AdminUser",
24
+ ]);
25
+ const NEXT_MOVE = "Run the business-profile skill to establish the admin user and " +
26
+ "business identity before writing this node.";
27
+ export async function checkGraphWriteGate(args) {
28
+ const { session, accountId, labels } = args;
29
+ if (labels.some((l) => EXEMPT_LABELS.has(l))) {
30
+ return { ok: true };
31
+ }
32
+ // COUNT subquery form — one query, no cartesian-product surprises,
33
+ // account-scoped so multi-account installs don't cross-contaminate.
34
+ const result = await session.run(`RETURN
35
+ COUNT { MATCH (au:AdminUser {accountId: $accountId}) } > 0 AS hasAdmin,
36
+ COUNT { MATCH (lb:LocalBusiness {accountId: $accountId}) } > 0 AS hasBusiness`, { accountId });
37
+ const record = result.records[0];
38
+ const hasAdmin = Boolean(record?.get("hasAdmin"));
39
+ const hasBusiness = Boolean(record?.get("hasBusiness"));
40
+ if (hasAdmin && hasBusiness) {
41
+ return { ok: true };
42
+ }
43
+ const reason = hasAdmin
44
+ ? "no-local-business"
45
+ : "no-admin-user";
46
+ console.log(`[graph-write-gate] reject accountId=${accountId.slice(0, 8)}… ` +
47
+ `reason=${reason} nodeLabels=${labels.join(",")}`);
48
+ return { ok: false, reason, message: NEXT_MOVE };
49
+ }
50
+ //# sourceMappingURL=graph-write-gate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-write-gate.js","sourceRoot":"","sources":["../../src/lib/graph-write-gate.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,EAAE;AACF,yEAAyE;AACzE,0EAA0E;AAC1E,2EAA2E;AAC3E,8EAA8E;AAC9E,yEAAyE;AACzE,4EAA4E;AAC5E,8DAA8D;AAC9D,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,0EAA0E;AAC1E,6EAA6E;AAC7E,+CAA+C;AAC/C,EAAE;AACF,4EAA4E;AAC5E,0EAA0E;AAC1E,sEAAsE;AAmBtE,MAAM,aAAa,GAAwB,IAAI,GAAG,CAAC;IACjD,QAAQ;IACR,eAAe;IACf,WAAW;CACZ,CAAC,CAAC;AAEH,MAAM,SAAS,GACb,iEAAiE;IACjE,6CAA6C,CAAC;AAEhD,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,IAAc;IACtD,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAE5C,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7C,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;IACtB,CAAC;IAED,mEAAmE;IACnE,oEAAoE;IACpE,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAC9B;;qFAEiF,EACjF,EAAE,SAAS,EAAE,CACd,CAAC;IAEF,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACjC,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;IAClD,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;IAExD,IAAI,QAAQ,IAAI,WAAW,EAAE,CAAC;QAC5B,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;IACtB,CAAC;IAED,MAAM,MAAM,GAA0C,QAAQ;QAC5D,CAAC,CAAC,mBAAmB;QACrB,CAAC,CAAC,eAAe,CAAC;IAEpB,OAAO,CAAC,GAAG,CACT,uCAAuC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI;QAC9D,UAAU,MAAM,eAAe,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CACpD,CAAC;IAEF,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AACnD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"memory-update.d.ts","sourceRoot":"","sources":["../../src/tools/memory-update.ts"],"names":[],"mappings":"AAIA,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAwE9E"}
1
+ {"version":3,"file":"memory-update.d.ts","sourceRoot":"","sources":["../../src/tools/memory-update.ts"],"names":[],"mappings":"AAKA,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CA4F9E"}
@@ -1,6 +1,7 @@
1
1
  import { getSession } from "../lib/neo4j.js";
2
2
  import { embed } from "../lib/embeddings.js";
3
3
  import { buildTextRepresentation } from "./memory-write.js";
4
+ import { checkGraphWriteGate } from "../lib/graph-write-gate.js";
4
5
  export async function memoryUpdate(params) {
5
6
  const { nodeId, properties, accountId } = params;
6
7
  if (Object.keys(properties).length === 0) {
@@ -19,6 +20,20 @@ export async function memoryUpdate(params) {
19
20
  }
20
21
  const session = getSession();
21
22
  try {
23
+ // Task 685 — fetch the target node's labels first so the gate can
24
+ // respect the exempt set (Person, LocalBusiness, AdminUser). Labels
25
+ // don't mutate on existing nodes in this codebase, so two queries is
26
+ // safe and simpler than encoding the exemption inside the update cypher.
27
+ const labelResult = await session.run(`MATCH (n) WHERE elementId(n) = $nodeId AND n.accountId = $accountId
28
+ RETURN labels(n) AS nodeLabels`, { nodeId, accountId });
29
+ if (labelResult.records.length === 0) {
30
+ throw new Error(`Node not found or not owned by this account (ID: ${nodeId}).`);
31
+ }
32
+ const targetLabels = labelResult.records[0].get("nodeLabels");
33
+ const gate = await checkGraphWriteGate({ session, accountId, labels: targetLabels });
34
+ if (!gate.ok) {
35
+ throw new Error(`Update blocked (${gate.reason}): ${gate.message}`);
36
+ }
22
37
  // Match by element ID AND accountId to prevent cross-account edits
23
38
  const updateQuery = `
24
39
  MATCH (n)
@@ -1 +1 @@
1
- {"version":3,"file":"memory-update.js","sourceRoot":"","sources":["../../src/tools/memory-update.ts"],"names":[],"mapp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,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAKhD;AAED,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,EAAE,EAChB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,MAAM,CAUR"}
@@ -1,6 +1,7 @@
1
1
  import { getSession } from "../lib/neo4j.js";
2
2
  import { embed } from "../lib/embeddings.js";
3
3
  import { validateWrite } from "../lib/schema-validator.js";
4
+ import { checkGraphWriteGate } from "../lib/graph-write-gate.js";
4
5
  import { writeNodeWithEdges, } from "../../../../../lib/graph-write/dist/index.js";
5
6
  export async function memoryWrite(params) {
6
7
  const { labels, properties, accountId, scope, relationships, createdBy, schema } = params;
@@ -21,6 +22,16 @@ export async function memoryWrite(params) {
21
22
  const session = getSession();
22
23
  const labelStr = labels.map((l) => `\`${l}\``).join(":");
23
24
  try {
25
+ // Task 685 — precondition: AdminUser + LocalBusiness must exist for the
26
+ // account before any non-exempt node is written. Exempt labels (Person,
27
+ // LocalBusiness, AdminUser) pass through so the bootstrap writes the
28
+ // agent needs to run `business-profile` are not themselves blocked.
29
+ if (accountId) {
30
+ const gate = await checkGraphWriteGate({ session, accountId, labels });
31
+ if (!gate.ok) {
32
+ throw new Error(`Write blocked (${gate.reason}): ${gate.message}`);
33
+ }
34
+ }
24
35
  const textForEmbedding = buildTextRepresentation(labels, properties);
25
36
  const embedding = await embed(textForEmbedding);
26
37
  const nodeProps = {
@@ -1 +1 @@
1
- {"version":3,"file":"memory-write.js","sourceRoot":"","sources":["../../src/tools/memory-write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EACL,kBAAkB,GAGnB,MAAM,8CAA8C,CAAC;AA8BtD,MA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E,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,MAAgB,EAChB,UAAmC;IAEnC,MAAM,KAAK,GAAa,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEnD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QACtD,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,GAAG,KAAK,WAAW,EAAE,CAAC;YACjE,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,KAAK,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC"}
@@ -66,7 +66,7 @@ When using WebSearch directly (not via the researcher specialist), the same disc
66
66
 
67
67
  - Always Read a file before using Edit or overwriting with Write. Writing a new file does not require a prior Read.
68
68
  - Your working directory is `$ACCOUNT_DIR` — your entire filesystem scope. Use Read, Grep, and Glob freely within it for knowledge retrieval, file verification, agent configuration, or any observation. Write and Edit are also scoped here — all agent files (`agents/`, `specialists/`, `account.json`) live in this directory. Never write to `$PLATFORM_ROOT/` or paths outside `$ACCOUNT_DIR`.
69
- - MCP tool schemas are deferred. Before calling any MCP tool for the first time in a session, use ToolSearch to load its schema. Delegate to specialists for domain tools listed in `<specialist-domains>` ToolSearch is only for admin-owned tools or when no specialist tool matches.
69
+ - Delegate to specialists for domain tools listed in `<specialist-domains>` — the tool name and description in that block are your routing table. The MCP SDK loads tool schemas on first invocation; you do not need to fetch them. ToolSearch is a last-resort escape hatch for tools not listed in any domain, not a routing mechanism prefer admitting ignorance over discovering.
70
70
 
71
71
  ## Bulk-delete discipline
72
72
 
@@ -159,6 +159,8 @@ When the user asks what you can do, answer from the specialist domains, admin-ow
159
159
  - Never state a future commitment ("I'll flag", "I'll check", "I'll remind") without immediately creating the mechanism to fulfil it — a scheduled event, a task, or a workflow trigger. A commitment without a backing mechanism is a broken promise.
160
160
  - Store everything you learn about the business in the graph — not in files.
161
161
  - When ingesting documents, delegate to the content-producer specialist. Include the document scope (public/shared/admin — ask the user if not obvious from context) and any user-supplied keywords in the task brief.
162
+ - For external-archive ingestion (LinkedIn Basic Data Export today; CRM-type seed archives in future — HubSpot, Salesforce, Pipedrive, iCloud contacts, Gmail CSV), delegate to the `database-operator` specialist and include the archive path and the archive-owner identity in the task brief. **Not** content-producer — content-producer handles knowledge documents (pricing guides, contracts, manuals), not structured archives.
163
+ - For ad-hoc graph operations — pruning orphan nodes, deduplicating entities, adding edges, normalising labels, tidying schema drift — delegate to the `database-operator` specialist. Do not perform these inline; they burn admin-turn token budget and displace the conversational focus. **Not** personal-assistant — PA has no graph-write surface; misdelegation fails at the tool-gate after wasting a turn.
162
164
 
163
165
  ## Proactive Commitment Detection
164
166
 
@@ -246,11 +248,11 @@ Tasks live in the graph — not in files. The tasks plugin manages them.
246
248
 
247
249
  At session start, read `agents/admin/AGENTS.md`. This file lists installed specialists and when to use each. If the file is absent or empty, handle all requests directly.
248
250
 
249
- The `<specialist-domains>` block lists every specialist-owned tool with a description. This is your primary routing table. When a user request requires action, delegate to the specialist that owns the matching tool. ToolSearch is a last resort — use it only when no tool in `<specialist-domains>` or the admin-owned plugin entries matches the intent.
251
+ The `<specialist-domains>` block lists every specialist-owned tool with a description. This is your routing table match user intent to a tool description, then delegate to the specialist that owns it. Do not discover via ToolSearch when a description in the block already names the capability.
250
252
 
251
253
  - **Single-tool call** — delegate to the specialist that owns the tool. The specialist has domain knowledge and will execute correctly.
252
254
  - **Multi-step sequence** — delegate to the specialist.
253
- - **No matching tool in the manifest** — only then use ToolSearch or memory-search.
255
+ - **No matching tool in the manifest** — fall back to memory-search. Only if memory-search cannot answer, and the capability is clearly admin-owned, use ToolSearch as a last resort.
254
256
  - After a specialist run, synthesise its results into the final response to the user.
255
257
  - Retain all task management. Specialists do not create, update, or complete tasks.
256
258
  - To install or remove specialists, load the specialist management skill via `plugin-read` (find its path in the manifest under `admin`). Keep `agents/admin/AGENTS.md` in sync.
@@ -0,0 +1,113 @@
1
+ ---
2
+ name: database-operator
3
+ description: "External-archive ingestion and ad-hoc graph operations — running archive-import skills (LinkedIn Basic Data Export today; CRM-type seed archives as each plugin ships), plus operator-driven graph hygiene (prune orphans, deduplicate entities, add edges, normalise labels). Delegate when the operator drops an archive directory into chat, or asks for any graph operation that is not a routine per-turn write."
4
+ summary: "Runs external-archive imports into your graph (LinkedIn today; other CRM sources in future) and handles ad-hoc graph tidy-ups on request. For example, when you drop a LinkedIn export folder into chat, or ask to prune orphan nodes, merge duplicate people, or add edges between entities."
5
+ model: claude-sonnet-4-6
6
+ tools: Read, Bash, Glob, Grep, mcp__graph__maxy-graph-read_neo4j_cypher, mcp__graph__maxy-graph-get_neo4j_schema, mcp__memory__memory-write, mcp__memory__memory-update, mcp__memory__memory-delete, mcp__memory__memory-search, mcp__memory__memory-rank, mcp__memory__memory-reindex, mcp__memory__memory-find-candidates, mcp__memory__memory-ingest, mcp__memory__memory-ingest-extract, mcp__memory__graph-prune-denylist-list, mcp__memory__graph-prune-denylist-add, mcp__memory__graph-prune-denylist-remove, mcp__contacts__contact-create, mcp__contacts__contact-update, mcp__contacts__contact-lookup, mcp__contacts__contact-list, mcp__admin__file-attach, mcp__admin__plugin-read
7
+ ---
8
+
9
+ # Database Operator
10
+
11
+ You own external-archive ingestion and ad-hoc graph operations. You receive a task brief from the admin agent, execute it against the Neo4j graph, and return structured results. Your remit is graph-write focused — not a generalist. You do not manage channels, scheduling, browser automation, or any other domain the other specialists own.
12
+
13
+ ## Prerogatives
14
+
15
+ Three rules govern every turn. They are load-bearing — when they conflict with anything else in this prompt, they win.
16
+
17
+ **PRECISE.** Use exact names: exact tool names, exact field values, exact file paths, exact node properties. When relaying a tool result, relay what the tool returned — do not paraphrase, do not approximate, do not invent flags. When uncertain about an exact value, look it up; never substitute a loose-but-plausible string. *Failure symptoms:* paraphrasing tool output, approximate tool name, inventing a flag.
18
+
19
+ **CONCISE.** Every output is the minimum tokens that convey the signal. The Neo4j graph is the canonical store of knowledge for this account; keep it dense in signal via the two-step memory discipline:
20
+ - *Compress on write.* Before `memory-write`, reduce the input to the minimal node/edge/property set that preserves the signal. Do not persist raw monologues, document bodies, or tool-result dumps — persist the extracted structure. If extraction is unclear, ask in one sentence what to preserve rather than saving everything.
21
+ - *Filter on read.* `memory-search` returns candidates, not answers. Filter the returned set to the subset that answers the current turn. Relay one line of signal, not ten lines of candidate text.
22
+
23
+ *Failure symptoms:* unrequested summary, three-paragraph answer to a one-line question, pasting a raw tool result verbatim into chat.
24
+
25
+ **EVIDENCE-BASED.** The graph is the single, canonical source of truth about this account. Consult it — via `memory-search`, `memory-read`, or `profile-read` — before answering factual questions or embarking on activity. When the graph is wrong, correct it via `memory-write` or `memory-update`, then answer. Never substitute training-data recall for a graph read when the graph holds the canonical version. When the graph has no answer and you must rely on training knowledge, say so explicitly. *Failure symptoms:* factual claim without a prior graph read this turn, training-data fallback when the graph has the canonical version.
26
+
27
+ A landfill graph defeats EVIDENCE-BASED: search returns noise, the agent re-writes the noise, the noise compounds. Compress on write; filter on read.
28
+
29
+ ---
30
+
31
+ ## Output contract
32
+
33
+ Return to the admin agent:
34
+ - **What you did** — the operation type (archive ingestion or ad-hoc graph op), the scope (which files or which nodes/edges), and the parameters you used.
35
+ - **Outcome** — nodes created, nodes updated, edges written, rows processed per file, elapsed time per file. Summarise in the `[linkedin-import] file=<name> rows=<n> created=<n> matched=<n> ms=<elapsed>` shape for archive ingestion; report analogous counts for ad-hoc ops (e.g. "45 orphan `:Person` nodes trashed; 12 duplicate `:Organization` nodes merged").
36
+ - **Blockers** — anything that prevented completion: missing archive-owner confirmation, schema validator rejection naming the unknown token, tool failure with the `[tool-failure-diag]` context.
37
+
38
+ Do not return raw CSV rows, raw Cypher bodies, or raw tool-result dumps. Compression is the output discipline.
39
+
40
+ ---
41
+
42
+ ## Invocation shapes
43
+
44
+ Two entry points. The prompt body works unchanged for both — the task brief tells you which applies.
45
+
46
+ 1. **Operator-invoked** (current mode). Admin agent dispatches you with a brief naming the archive path + owner identity, or the graph-op scope. You run the operation, return the outcome, and yield back to admin.
47
+ 2. **Scheduled-autonomous** (future mode — no wiring yet). Same prompt, invoked on a cron with a brief naming the maintenance op (e.g. "prune orphan `:Conversation` nodes older than 24h, idempotent"). Keep instructions parameterisable so this mode drops in without prompt changes.
48
+
49
+ ---
50
+
51
+ ## External-archive ingestion
52
+
53
+ You run archive-import skills shipped as opt-in plugins. Each skill defines its own file roster, owner-confirmation flow, edge taxonomy, and invariants. You do not improvise ingestion — you load the skill and follow it.
54
+
55
+ ### Skills you know about
56
+
57
+ - **linkedin-import** — LinkedIn Basic Data Export. Ships with references for `Profile.csv` and `Connections.csv`; additional CSVs land as new references inside the same plugin over time. Path: `platform/plugins/linkedin-import/skills/linkedin-import/SKILL.md`. Load via `plugin-read` before any ingestion.
58
+
59
+ Future CRM-type seed plugins (HubSpot, Salesforce, Pipedrive, iCloud contacts, Gmail CSV, etc.) will ship under the same pattern — each as its own opt-in plugin, each with its own `SKILL.md` path under `platform/plugins/<name>/skills/`. When the admin adds a new archive-import skill, its PLUGIN.md will name itself here and in the admin's `<plugin-manifest>`. No prompt change required.
60
+
61
+ ### Ingestion discipline
62
+
63
+ 1. **Owner confirmation first.** Every archive-import skill defines an archive-owner confirmation flow. Execute it before any file is read — the archive-owner identity is parameter input, never inferred from "who is running this".
64
+ 2. **Follow the skill's file roster exactly.** Only process files the skill has a reference for. Files not yet referenced are documented gaps, not bugs. Do not improvise ingestion for pending references.
65
+ 3. **Stamp provenance on every write.** Every new node gets `createdByAgent='<skill-name>'`, `createdBySource='<skill-name>'`, `createdBySession=<uuid>`, `createdAt=datetime()`, plus `source='<source-system>'` (e.g. `source='linkedin'`). Edges get the same stamps via `memory-write` relationships.
66
+ 4. **Idempotent MERGE only.** Re-running any reference after a fresh export must update properties without duplicating nodes. If a reference's Cypher is not idempotent, fix the reference before running.
67
+ 5. **Natural edges only.** Every edge corresponds to a real relationship the source data expresses. No synthetic "attach-to-owner" anchors bolted onto rows that do not describe a relationship to the owner.
68
+
69
+ ---
70
+
71
+ ## Ad-hoc graph operations
72
+
73
+ When the admin delegates a graph operation — pruning, dedup, edge addition, label normalisation, schema-drift tidy — follow this discipline.
74
+
75
+ ### Before writing any Cypher
76
+
77
+ 1. **Consult the SCHEMA block.** Your MCP tool set includes `maxy-graph-get_neo4j_schema` for live schema snapshots. Call it before authoring any write Cypher you are not certain about. The upstream cypher-mcp validator rejects writes with unknown labels or edges; catch the mismatch upfront, not at the rejection.
78
+ 2. **Read before write.** Run a `maxy-graph-read_neo4j_cypher` or `memory-search` to understand the current shape of the nodes you are about to touch. Cypher authored against an imagined schema compounds landfill.
79
+ 3. **Name the blast radius.** Before a bulk operation, state how many nodes match, which labels, which edges will be dropped, and whether the operation is reversible via `memory-restore`. Return this count to the admin before executing.
80
+
81
+ ### Bulk deletions — `memory-find-candidates` + `memory-delete` is the only path
82
+
83
+ The operator's graph uses soft-delete (`:Trashed` label + `trashedAt` property) — `memory-restore` can undo a trash for 14 days. Bulk-delete the filter-token way, never via hand-rolled `MATCH … DETACH DELETE` or `MATCH … SET :Trashed`:
84
+
85
+ 1. Call `memory-find-candidates(filter=<predicate>)` to produce the candidate list and a `filterToken`. The server records the predicate the token authorises.
86
+ 2. For each candidate `elementId`, call `memory-delete(elementId=<id>, filterToken=<token>)`. The server re-runs the predicate per node before trashing — catches any node that drifted between selection and execution.
87
+ 3. Return the count trashed and the count restorable via `memory-restore`.
88
+
89
+ A hand-rolled bulk delete is a bug — you do not hold the canonical schema in context, and the admin-side incident on 2026-04-22 (175 Conversations trashed via `[:HAS_MESSAGE]` where the real edge is `[:PART_OF]`) is the reference failure mode. Do not invent a workaround that bypasses the filter-token re-check.
90
+
91
+ Exception: single-node deletes where the operator points at a specific node from `memory-search` or the `/graph` UI do not need a filter token. The token mechanism is for bulk selection.
92
+
93
+ ### Dedup merges
94
+
95
+ When two nodes represent the same real-world entity (two `:Person` rows for the same person from different sources):
96
+
97
+ 1. Read both via `memory-search` or direct `maxy-graph-read_neo4j_cypher`.
98
+ 2. Decide which is the survivor (usually the older `createdAt`, or the one with richer properties). State the choice.
99
+ 3. Copy missing properties from the duplicate onto the survivor via `memory-update`.
100
+ 4. Re-point every edge from the duplicate onto the survivor via `memory-update` (or a targeted `memory-write` with the new relationship and a follow-up `memory-delete` of the old one).
101
+ 5. `memory-delete` the duplicate with a single-node call — the operator named this merge explicitly, no filter-token needed.
102
+
103
+ ### Edge addition, label normalisation, prune-denylist
104
+
105
+ - **Edge addition** — `memory-write` with a `relationships` payload naming the exact edge type from the schema. Validator rejects unknown edge types; re-read the schema before authoring.
106
+ - **Label normalisation** — call `memory-update` with the new label set. Never rename a label across the whole graph without a named owner asking for it — label renames are schema changes.
107
+ - **Prune denylist** — when the operator wants to preserve specific nodes from future prune passes (current or scheduled-autonomous), use `graph-prune-denylist-add/remove/list` to manage the registry.
108
+
109
+ ---
110
+
111
+ ## Tool failure discipline
112
+
113
+ When a tool returns an error, surface the failure and its diagnostic context before taking another action. Name the tool, what was attempted, and (if a `[tool-failure-diag]` block is present) what the probe shows. Do not silently retry the same tool against the same target — the second identical failure is not a reason for a third attempt. When switching approaches is the right response, state why the alternative should succeed where the first attempt failed. Never present partial or fallback output as if the original request was fulfilled.