@memberjunction/cli 6.2.0-edge.4 → 6.2.0-edge.6

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 (53) hide show
  1. package/README.md +22 -0
  2. package/dist/commands/agent/init.d.ts +5 -0
  3. package/dist/commands/agent/init.d.ts.map +1 -1
  4. package/dist/commands/agent/init.js +109 -0
  5. package/dist/commands/agent/init.js.map +1 -1
  6. package/dist/commands/ai/actions/run.d.ts.map +1 -1
  7. package/dist/commands/ai/actions/run.js +5 -1
  8. package/dist/commands/ai/actions/run.js.map +1 -1
  9. package/dist/commands/ai/agents/run.d.ts +1 -0
  10. package/dist/commands/ai/agents/run.d.ts.map +1 -1
  11. package/dist/commands/ai/agents/run.js +20 -6
  12. package/dist/commands/ai/agents/run.js.map +1 -1
  13. package/dist/commands/ai/prompts/run.d.ts.map +1 -1
  14. package/dist/commands/ai/prompts/run.js +5 -1
  15. package/dist/commands/ai/prompts/run.js.map +1 -1
  16. package/dist/commands/app/install.d.ts.map +1 -1
  17. package/dist/commands/app/install.js +17 -2
  18. package/dist/commands/app/install.js.map +1 -1
  19. package/dist/commands/app/upgrade.d.ts.map +1 -1
  20. package/dist/commands/app/upgrade.js +7 -1
  21. package/dist/commands/app/upgrade.js.map +1 -1
  22. package/dist/commands/dbdoc/analyze.d.ts +1 -0
  23. package/dist/commands/dbdoc/analyze.d.ts.map +1 -1
  24. package/dist/commands/dbdoc/analyze.js +7 -0
  25. package/dist/commands/dbdoc/analyze.js.map +1 -1
  26. package/dist/commands/dbdoc/export.d.ts +6 -0
  27. package/dist/commands/dbdoc/export.d.ts.map +1 -1
  28. package/dist/commands/dbdoc/export.js +32 -0
  29. package/dist/commands/dbdoc/export.js.map +1 -1
  30. package/dist/commands/sync/watch.d.ts.map +1 -1
  31. package/dist/commands/sync/watch.js +3 -5
  32. package/dist/commands/sync/watch.js.map +1 -1
  33. package/dist/init-templates/citizen-builder/.agents/skills/new-agent/SKILL.md +19 -6
  34. package/dist/init-templates/citizen-builder/.agents/skills/test-agent/SKILL.md +4 -1
  35. package/dist/init-templates/citizen-builder/.claude/skills/new-agent/SKILL.md +19 -6
  36. package/dist/init-templates/citizen-builder/.claude/skills/test-agent/SKILL.md +4 -1
  37. package/dist/init-templates/citizen-builder/.env.example +4 -2
  38. package/dist/init-templates/citizen-builder/AGENTS.md +136 -40
  39. package/dist/init-templates/citizen-builder/README.md +18 -5
  40. package/dist/init-templates/citizen-builder/docker-compose.yml +6 -5
  41. package/dist/init-templates/citizen-builder/metadata/.mj-sync.json +7 -4
  42. package/dist/init-templates/citizen-builder/metadata/agents/.customer-insight-agent.json +17 -13
  43. package/dist/init-templates/citizen-builder/metadata/prompts/.customer-insight-prompt.json +3 -1
  44. package/dist/init-templates/citizen-builder/metadata/prompts/templates/customer-insight.template.md +8 -0
  45. package/dist/init-templates/citizen-builder/scripts/docker-entrypoint.sh +140 -38
  46. package/dist/init-templates/citizen-builder/scripts/sync-metadata.sh +1 -1
  47. package/dist/lib/dev-workspace/build.d.ts.map +1 -1
  48. package/dist/lib/dev-workspace/build.js +43 -11
  49. package/dist/lib/dev-workspace/build.js.map +1 -1
  50. package/dist/lib/dev-workspace/types.d.ts +9 -5
  51. package/dist/lib/dev-workspace/types.d.ts.map +1 -1
  52. package/oclif.manifest.json +864 -791
  53. package/package.json +26 -26
@@ -14,6 +14,12 @@ export default class DbDocExport extends Command {
14
14
  apply: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
15
15
  'approved-only': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
16
16
  'confidence-threshold': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
17
+ 'erd-mode': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
18
+ 'erd-columns': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
19
+ 'erd-hub-min-inbound': import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
20
+ 'erd-lookup-max-rows': import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
21
+ 'erd-page-size': import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
22
+ 'erd-min-cluster-size': import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
17
23
  };
18
24
  run(): Promise<void>;
19
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../../src/commands/dbdoc/export.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAC;AAE7C,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,OAAO;IAC9C,MAAM,CAAC,WAAW,SAAgF;IAElG,MAAM,CAAC,QAAQ,WAQb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;MAuCV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAwB3B"}
1
+ {"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../../src/commands/dbdoc/export.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAC;AAE7C,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,OAAO;IAC9C,MAAM,CAAC,WAAW,SAAgF;IAElG,MAAM,CAAC,QAAQ,WAQb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;;;;;;;MA2DV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA8B3B"}
@@ -48,6 +48,26 @@ export default class DbDocExport extends Command {
48
48
  'confidence-threshold': Flags.string({
49
49
  description: 'Minimum confidence threshold',
50
50
  default: '0'
51
+ }),
52
+ 'erd-mode': Flags.string({
53
+ description: 'ERD layout: full, clusters (one diagram per subject area) or both',
54
+ options: ['full', 'clusters', 'both']
55
+ }),
56
+ 'erd-columns': Flags.string({
57
+ description: 'Columns drawn per entity: all, keys (PK/FK only) or none',
58
+ options: ['all', 'keys', 'none']
59
+ }),
60
+ 'erd-hub-min-inbound': Flags.integer({
61
+ description: 'A table referenced by at least this many tables is a subject-area hub'
62
+ }),
63
+ 'erd-lookup-max-rows': Flags.integer({
64
+ description: 'A table that references nothing and has fewer rows than this is a reference table'
65
+ }),
66
+ 'erd-page-size': Flags.integer({
67
+ description: 'Tables per diagram page beyond the hub'
68
+ }),
69
+ 'erd-min-cluster-size': Flags.integer({
70
+ description: 'Subject areas smaller than this fold into a neighbour'
51
71
  })
52
72
  }; }
53
73
  async run() {
@@ -78,6 +98,18 @@ export default class DbDocExport extends Command {
78
98
  args.push('--approved-only');
79
99
  if (flags['confidence-threshold'])
80
100
  args.push('--confidence-threshold', flags['confidence-threshold']);
101
+ if (flags['erd-mode'])
102
+ args.push('--erd-mode', flags['erd-mode']);
103
+ if (flags['erd-columns'])
104
+ args.push('--erd-columns', flags['erd-columns']);
105
+ if (flags['erd-hub-min-inbound'] !== undefined)
106
+ args.push('--erd-hub-min-inbound', String(flags['erd-hub-min-inbound']));
107
+ if (flags['erd-lookup-max-rows'] !== undefined)
108
+ args.push('--erd-lookup-max-rows', String(flags['erd-lookup-max-rows']));
109
+ if (flags['erd-page-size'] !== undefined)
110
+ args.push('--erd-page-size', String(flags['erd-page-size']));
111
+ if (flags['erd-min-cluster-size'] !== undefined)
112
+ args.push('--erd-min-cluster-size', String(flags['erd-min-cluster-size']));
81
113
  // Execute the DBAutoDoc export command
82
114
  await ExportCommand.run(args);
83
115
  }
@@ -1 +1 @@
1
- {"version":3,"file":"export.js","sourceRoot":"","sources":["../../../src/commands/dbdoc/export.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,OAAO;aACvC,gBAAW,GAAG,4E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B,CAAC,KAAK,SAAS;YAAE,IAAI,CAAC,IAAI,CAAC,uBAAuB,EAAE,MAAM,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QACzH,IAAI,KAAK,CAAC,eAAe,CAAC,KAAK,SAAS;YAAE,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QACvG,IAAI,KAAK,CAAC,sBAAsB,CAAC,KAAK,SAAS;YAAE,IAAI,CAAC,IAAI,CAAC,wBAAwB,EAAE,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;QAE5H,uCAAuC;QACvC,MAAM,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/watch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAC;AAK7C,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,OAAO;IACxC,MAAM,CAAC,WAAW,SAAmD;IAErE,MAAM,CAAC,QAAQ,WAKb;IAEF,MAAM,CAAC,KAAK;;;;;MAKV;IAEF,OAAO,CAAC,eAAe,CAAC,CAAM;IAExB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAwH3B"}
1
+ {"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/watch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAC;AAK7C,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,OAAO;IACxC,MAAM,CAAC,WAAW,SAAmD;IAErE,MAAM,CAAC,QAAQ,WAKb;IAEF,MAAM,CAAC,KAAK;;;;;MAKV;IAEF,OAAO,CAAC,eAAe,CAAC,CAAM;IAExB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAqH3B"}
@@ -17,7 +17,7 @@ export default class Watch extends Command {
17
17
  verbose: Flags.boolean({ char: 'v', description: 'Show detailed output' }),
18
18
  }; }
19
19
  async run() {
20
- const { WatchService, loadMJConfig, loadSyncConfig, initializeProvider, getSyncEngine, getSystemUser, resetSyncEngine, configManager, } = await import('@memberjunction/metadata-sync');
20
+ const { WatchService, loadMJConfig, initializeProvider, getSyncEngine, getSystemUser, resetSyncEngine, configManager, } = await import('@memberjunction/metadata-sync');
21
21
  const { BaseEntity } = await import('@memberjunction/core');
22
22
  const { flags } = await this.parse(Watch);
23
23
  const spinner = ora();
@@ -28,9 +28,6 @@ export default class Watch extends Command {
28
28
  if (!mjConfig) {
29
29
  this.error('No mj.config.cjs found in current directory or parent directories');
30
30
  }
31
- // Load sync config
32
- const syncConfigDir = flags.dir ? path.resolve(configManager.getOriginalCwd(), flags.dir) : configManager.getOriginalCwd();
33
- const syncConfig = await loadSyncConfig(syncConfigDir);
34
31
  // Stop spinner before provider initialization
35
32
  spinner.stop();
36
33
  // Initialize data provider
@@ -84,9 +81,10 @@ export default class Watch extends Command {
84
81
  const action = isNew ? 'created' : 'updated';
85
82
  this.log(chalk.green(`✅ Record ${action} for ${entityConfig.entity}`));
86
83
  },
84
+ // A failed file is reported and the watch goes on with the other files
87
85
  onError: (error) => {
88
86
  spinner.fail('Watch error');
89
- this.error(error);
87
+ this.logToStderr(error.message);
90
88
  },
91
89
  onWarn: (message) => {
92
90
  this.warn(message);
@@ -1 +1 @@
1
- {"version":3,"file":"watch.js","sourceRoot":"","sources":["../../../src/commands/sync/watch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,GAAG,MAAM,aAAa,CAAC;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,OAAO;aACjC,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H,CAAC;aACF,CAAC,CAAC;YAEH,qBAAqB;YACrB,MAAM,IAAI,OAAO,CAAC,GAAG,EAAE;gBACrB,2DAA2D;gBAC3D,sCAAsC;YACxC,CAAC,CAAC,CAAC;QAEL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAE7B,yBAAyB;YACzB,IAAI,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;YAC1C,IAAI,CAAC,GAAG,CAAC,eAAe,KAAK,EAAE,WAAW,EAAE,IAAI,IAAI,SAAS,EAAE,CAAC,CAAC;YACjE,IAAI,CAAC,GAAG,CAAC,kBAAkB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAErF,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;gBAC1C,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;gBAC3B,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACxB,CAAC;YAED,IAAI,CAAC,KAAK,CAAC,KAAc,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC"}
@@ -16,9 +16,9 @@ Ask clarifying questions if the requirement is ambiguous:
16
16
 
17
17
  ## Step 2: Determine Tier & Agent Type
18
18
  - **Tier 1 (Preferred)**:
19
- - If the agent follows a predictable sequence of steps, use **`TypeID: "@lookup:MJ: AI Agent Types.Name=Flow"`**.
20
- - If the agent needs dynamic problem solving or open-ended tool calling, use **`TypeID: "@lookup:MJ: AI Agent Types.Name=Loop"`**.
21
- - Always keep **`ModelSelectionMode: "Agent Type"`** and **`ExposeAsAction: false`**.
19
+ - **Recommended Default (`Loop`)**: Use **`TypeID: "@lookup:MJ: AI Agent Types.Name=Loop"`** for interactive, conversational, and exploratory Citizen Builder agents where the agent synthesizes user input or calls bound actions (`MJ: AI Agent Actions`).
20
+ - **Deterministic Task Graphs (`Flow`)**: Use **`TypeID: "@lookup:MJ: AI Agent Types.Name=Flow"`** only when the user wants a fixed, non-interactive sequence of steps (`MJ: AI Agent Steps`).
21
+ - Always keep **`ModelSelectionMode: "Agent Type"`**, **`ExposeAsAction: false`**, and **`ArtifactCreationMode: "Never"`** (valid values: `"Never"`, `"Always"`, `"System Only"`).
22
22
  - **Tier 2 (Only if custom code is strictly necessary)**:
23
23
  - If custom JavaScript formatting or computation is required that no existing action supports, create a sandboxed Runtime Action.
24
24
  - Define an explicit `allowedEntities` list (never wildcards).
@@ -28,12 +28,13 @@ Ask clarifying questions if the requirement is ambiguous:
28
28
  Save to: `metadata/prompts/templates/<agent-slug>.template.md`
29
29
  Structure:
30
30
  - Clear persona and objective.
31
- - Exact instructions and step sequence.
32
- - Business rules and edge-case handling.
31
+ - Exact instructions, business rules, and edge-case handling.
33
32
  - Explicit Markdown output formatting guidelines.
33
+ - *(For `Flow` agent `Prompt` steps, also include `{{ userMessage }}` and `{{ payload | dump(2) }}` to read upstream step outputs).*
34
34
 
35
35
  2. **Prompt Metadata JSON**:
36
36
  Save to: `metadata/prompts/.<agent-slug>-prompt.json`
37
+ - **For a `Loop` agent (Recommended Default)** — the prompt is injected as a system child prompt (`PromptRole: "System"`, `PromptPosition: "First"`):
37
38
  ```json
38
39
  [
39
40
  {
@@ -41,6 +42,8 @@ Ask clarifying questions if the requirement is ambiguous:
41
42
  "Name": "<Agent Name> Prompt",
42
43
  "Description": "...",
43
44
  "CategoryID": "@lookup:MJ: AI Prompt Categories.Name=Agent Type System Prompts",
45
+ "PromptRole": "System",
46
+ "PromptPosition": "First",
44
47
  "TypeID": "@lookup:MJ: AI Prompt Types.Name=Chat",
45
48
  "Status": "Active",
46
49
  "TemplateText": "@file:templates/<agent-slug>.template.md"
@@ -49,16 +52,26 @@ Ask clarifying questions if the requirement is ambiguous:
49
52
  }
50
53
  ]
51
54
  ```
55
+ - **For a `Flow` agent `Prompt` step** — the prompt runs standalone (`ResponseFormat: "Markdown"`, `OutputType: "string"`, `ValidationBehavior: "None"`).
52
56
 
53
57
  3. **Agent Metadata JSON**:
54
58
  Save to: `metadata/agents/.<agent-slug>-agent.json`
55
- Wire `MJ: AI Agent Prompts`, `MJ: AI Agent Steps`, and optional `MJ: AI Agent Actions`.
59
+ - **For a `Loop` agent (Recommended Default)**:
60
+ Wire `MJ: AI Agent Prompts` (`ExecutionOrder: 0`) and optional `MJ: AI Agent Actions` (e.g. `Run Ad-hoc Query`, `Run Stored Query`). See `metadata/agents/.customer-insight-agent.json` for a complete reference.
61
+ - **For a `Flow` agent**:
62
+ Wire `MJ: AI Agent Prompts` and `MJ: AI Agent Steps` (with nested `MJ: AI Agent Step Paths` on origin steps):
63
+ - For `Action` steps using `Run Ad-hoc Query` or `Run Stored Query`:
64
+ - Use native JSON objects (never escaped strings) for `ActionInputMapping` and `ActionOutputMapping`.
65
+ - Prefix literal inputs with `static:` (e.g. `"Query": "static:SELECT ..."`, `"DataFormat": "static:markdown"`).
66
+ - Map structured action outputs (`Results`, `FormattedResults`, `RowCount`, `ExecutionTimeMs`) to payload keys in `ActionOutputMapping` (e.g. `{"Results": "rows", "FormattedResults": "tableMarkdown", "RowCount": "rowCount"}`).
67
+ - Connect each origin step to its next step via `relatedEntities["MJ: AI Agent Step Paths"]` with `"OriginStepID": "@parent:ID"` and `"DestinationStepID": "@lookup:MJ: AI Agent Steps.Name=<Next Step Name>&AgentID=@parent:AgentID"`.
56
68
 
57
69
  ## Step 4: Sync to Database
58
70
  Run:
59
71
  ```bash
60
72
  ./scripts/sync-metadata.sh
61
73
  ```
74
+ *(Note: `./scripts/sync-metadata.sh` runs `mj sync push --dir /work/metadata` so `@file:` templates create and link `TemplateID` records on first push, and `metadata/.mj-sync.json` ensures `prompts` are pushed before `agents`).*
62
75
  Verify that the sync command outputs success.
63
76
 
64
77
  ## Step 5: Hand off to Testing
@@ -12,14 +12,17 @@ You can invoke the agent directly via the CLI to test basic functionality and in
12
12
 
13
13
  ```bash
14
14
  docker compose exec -T mj mj ai agents run -a "<Agent Name>" -p "<Test Prompt or Input>" --format json
15
+ # Or pass a multi-line prompt file to avoid shell escaping issues:
16
+ docker compose exec -T mj mj ai agents run -a "<Agent Name>" -f /work/prompt.txt --format json
15
17
  ```
16
18
 
17
19
  Options:
18
20
  - `--format json`: Machine-readable structured JSON result.
21
+ - `-f` / `--prompt-file`: Path to a file containing the prompt text.
19
22
  - `-v` / `--verbose`: Detailed diagnostic logging.
20
23
 
21
24
  ## Method B: User Interactive Testing (Explorer UI)
22
- Instruct the user to open their browser at `http://localhost:4202` to test interactively.
25
+ Instruct the user to open their browser at `http://localhost:4202` to test interactively (Zero-Config Local Dev Auth is enabled by default on localhost).
23
26
 
24
27
  ---
25
28
 
@@ -16,9 +16,9 @@ Ask clarifying questions if the requirement is ambiguous:
16
16
 
17
17
  ## Step 2: Determine Tier & Agent Type
18
18
  - **Tier 1 (Preferred)**:
19
- - If the agent follows a predictable sequence of steps, use **`TypeID: "@lookup:MJ: AI Agent Types.Name=Flow"`**.
20
- - If the agent needs dynamic problem solving or open-ended tool calling, use **`TypeID: "@lookup:MJ: AI Agent Types.Name=Loop"`**.
21
- - Always keep **`ModelSelectionMode: "Agent Type"`** and **`ExposeAsAction: false`**.
19
+ - **Recommended Default (`Loop`)**: Use **`TypeID: "@lookup:MJ: AI Agent Types.Name=Loop"`** for interactive, conversational, and exploratory Citizen Builder agents where the agent synthesizes user input or calls bound actions (`MJ: AI Agent Actions`).
20
+ - **Deterministic Task Graphs (`Flow`)**: Use **`TypeID: "@lookup:MJ: AI Agent Types.Name=Flow"`** only when the user wants a fixed, non-interactive sequence of steps (`MJ: AI Agent Steps`).
21
+ - Always keep **`ModelSelectionMode: "Agent Type"`**, **`ExposeAsAction: false`**, and **`ArtifactCreationMode: "Never"`** (valid values: `"Never"`, `"Always"`, `"System Only"`).
22
22
  - **Tier 2 (Only if custom code is strictly necessary)**:
23
23
  - If custom JavaScript formatting or computation is required that no existing action supports, create a sandboxed Runtime Action.
24
24
  - Define an explicit `allowedEntities` list (never wildcards).
@@ -28,12 +28,13 @@ Ask clarifying questions if the requirement is ambiguous:
28
28
  Save to: `metadata/prompts/templates/<agent-slug>.template.md`
29
29
  Structure:
30
30
  - Clear persona and objective.
31
- - Exact instructions and step sequence.
32
- - Business rules and edge-case handling.
31
+ - Exact instructions, business rules, and edge-case handling.
33
32
  - Explicit Markdown output formatting guidelines.
33
+ - *(For `Flow` agent `Prompt` steps, also include `{{ userMessage }}` and `{{ payload | dump(2) }}` to read upstream step outputs).*
34
34
 
35
35
  2. **Prompt Metadata JSON**:
36
36
  Save to: `metadata/prompts/.<agent-slug>-prompt.json`
37
+ - **For a `Loop` agent (Recommended Default)** — the prompt is injected as a system child prompt (`PromptRole: "System"`, `PromptPosition: "First"`):
37
38
  ```json
38
39
  [
39
40
  {
@@ -41,6 +42,8 @@ Ask clarifying questions if the requirement is ambiguous:
41
42
  "Name": "<Agent Name> Prompt",
42
43
  "Description": "...",
43
44
  "CategoryID": "@lookup:MJ: AI Prompt Categories.Name=Agent Type System Prompts",
45
+ "PromptRole": "System",
46
+ "PromptPosition": "First",
44
47
  "TypeID": "@lookup:MJ: AI Prompt Types.Name=Chat",
45
48
  "Status": "Active",
46
49
  "TemplateText": "@file:templates/<agent-slug>.template.md"
@@ -49,16 +52,26 @@ Ask clarifying questions if the requirement is ambiguous:
49
52
  }
50
53
  ]
51
54
  ```
55
+ - **For a `Flow` agent `Prompt` step** — the prompt runs standalone (`ResponseFormat: "Markdown"`, `OutputType: "string"`, `ValidationBehavior: "None"`).
52
56
 
53
57
  3. **Agent Metadata JSON**:
54
58
  Save to: `metadata/agents/.<agent-slug>-agent.json`
55
- Wire `MJ: AI Agent Prompts`, `MJ: AI Agent Steps`, and optional `MJ: AI Agent Actions`.
59
+ - **For a `Loop` agent (Recommended Default)**:
60
+ Wire `MJ: AI Agent Prompts` (`ExecutionOrder: 0`) and optional `MJ: AI Agent Actions` (e.g. `Run Ad-hoc Query`, `Run Stored Query`). See `metadata/agents/.customer-insight-agent.json` for a complete reference.
61
+ - **For a `Flow` agent**:
62
+ Wire `MJ: AI Agent Prompts` and `MJ: AI Agent Steps` (with nested `MJ: AI Agent Step Paths` on origin steps):
63
+ - For `Action` steps using `Run Ad-hoc Query` or `Run Stored Query`:
64
+ - Use native JSON objects (never escaped strings) for `ActionInputMapping` and `ActionOutputMapping`.
65
+ - Prefix literal inputs with `static:` (e.g. `"Query": "static:SELECT ..."`, `"DataFormat": "static:markdown"`).
66
+ - Map structured action outputs (`Results`, `FormattedResults`, `RowCount`, `ExecutionTimeMs`) to payload keys in `ActionOutputMapping` (e.g. `{"Results": "rows", "FormattedResults": "tableMarkdown", "RowCount": "rowCount"}`).
67
+ - Connect each origin step to its next step via `relatedEntities["MJ: AI Agent Step Paths"]` with `"OriginStepID": "@parent:ID"` and `"DestinationStepID": "@lookup:MJ: AI Agent Steps.Name=<Next Step Name>&AgentID=@parent:AgentID"`.
56
68
 
57
69
  ## Step 4: Sync to Database
58
70
  Run:
59
71
  ```bash
60
72
  ./scripts/sync-metadata.sh
61
73
  ```
74
+ *(Note: `./scripts/sync-metadata.sh` runs `mj sync push --dir /work/metadata` so `@file:` templates create and link `TemplateID` records on first push, and `metadata/.mj-sync.json` ensures `prompts` are pushed before `agents`).*
62
75
  Verify that the sync command outputs success.
63
76
 
64
77
  ## Step 5: Hand off to Testing
@@ -12,14 +12,17 @@ You can invoke the agent directly via the CLI to test basic functionality and in
12
12
 
13
13
  ```bash
14
14
  docker compose exec -T mj mj ai agents run -a "<Agent Name>" -p "<Test Prompt or Input>" --format json
15
+ # Or pass a multi-line prompt file to avoid shell escaping issues:
16
+ docker compose exec -T mj mj ai agents run -a "<Agent Name>" -f /work/prompt.txt --format json
15
17
  ```
16
18
 
17
19
  Options:
18
20
  - `--format json`: Machine-readable structured JSON result.
21
+ - `-f` / `--prompt-file`: Path to a file containing the prompt text.
19
22
  - `-v` / `--verbose`: Detailed diagnostic logging.
20
23
 
21
24
  ## Method B: User Interactive Testing (Explorer UI)
22
- Instruct the user to open their browser at `http://localhost:4202` to test interactively.
25
+ Instruct the user to open their browser at `http://localhost:4202` to test interactively (Zero-Config Local Dev Auth is enabled by default on localhost).
23
26
 
24
27
  ---
25
28
 
@@ -16,8 +16,10 @@ API_PORT=4000
16
16
  # Explorer port (use 4202 if 4200 is in use, as 4202 is an authorized redirect URI for Auth0/MSAL)
17
17
  EXPLORER_PORT=4202
18
18
 
19
- # Security
20
- MJ_BASE_ENCRYPTION_KEY=0123456789abcdef0123456789abcdef
19
+ # Security & Local Development Auth
20
+ MJ_BASE_ENCRYPTION_KEY=MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY=
21
+ # Zero-config local dev auth for MJExplorer on localhost (never enable in production)
22
+ MJ_DEV_AUTH_ENABLED=true
21
23
 
22
24
  # LLM Provider API Keys (Provide at least one)
23
25
  OPENAI_API_KEY=
@@ -41,31 +41,33 @@ If you have access to the MemberJunction repository (or view them on GitHub at `
41
41
  The MetadataSync engine (`mj sync push`) parses declarative JSON files under `./metadata/` and maps them into SQL Server records. Follow these rules strictly:
42
42
 
43
43
  ### A. JSON-Type Fields: Native JSON Objects (NEVER Escaped Strings)
44
- In MemberJunction v6, database fields that hold structured JSON (such as `Configuration`, `Settings`, `Metadata`, etc.) **MUST be written as clean, native nested JSON objects** directly in your metadata files.
44
+ In MemberJunction v6, database fields that hold structured JSON (such as `ActionInputMapping`, `ActionOutputMapping`, `Configuration`, `Settings`, `Metadata`, etc.) **MUST be written as clean, native nested JSON objects** directly in your metadata files.
45
45
 
46
46
  ```json
47
47
  // ❌ WRONG — Escaped strings break validation and reference resolution!
48
48
  {
49
49
  "fields": {
50
- "Name": "Invoice Analysis Agent",
51
- "Configuration": "{\"Steps\":[{\"Name\":\"ProcessInvoice\",\"StepType\":\"Prompt\"}]}"
50
+ "Name": "Fetch Overdue Invoices",
51
+ "StepType": "Action",
52
+ "ActionInputMapping": "{\"Query\":\"static:SELECT TOP 10 * FROM Invoices\"}"
52
53
  }
53
54
  }
54
55
 
55
56
  // ✅ CORRECT — Clean, native nested JSON object
56
57
  {
57
58
  "fields": {
58
- "Name": "Invoice Analysis Agent",
59
- "Configuration": {
60
- "Steps": [
61
- {
62
- "Name": "ProcessInvoice",
63
- "StepType": "Prompt",
64
- "TargetID": "@lookup:MJ: AI Prompts.Name=Invoice Analysis Prompt",
65
- "ExecutionOrder": 1,
66
- "OnError": "fail"
67
- }
68
- ]
59
+ "Name": "Fetch Overdue Invoices",
60
+ "StepType": "Action",
61
+ "ActionID": "@lookup:MJ: Actions.Name=Run Ad-hoc Query",
62
+ "ActionInputMapping": {
63
+ "Query": "static:SELECT TOP 10 * FROM Invoices",
64
+ "DataFormat": "static:markdown",
65
+ "ColumnMaxLength": 200
66
+ },
67
+ "ActionOutputMapping": {
68
+ "Results": "invoices",
69
+ "FormattedResults": "invoicesTable",
70
+ "RowCount": "invoiceCount"
69
71
  }
70
72
  }
71
73
  }
@@ -80,40 +82,130 @@ Never hardcode foreign key UUIDs. Use dynamic reference tokens:
80
82
  - *Multi-field lookup*: `"PromptID": "@lookup:MJ: AI Prompts.Name=My Prompt&Status=Active"`
81
83
  * **`@file:<relativePath>`**: Replaces the field value with the contents of an external file.
82
84
  - Used for prompt templates: `"TemplateText": "@file:templates/my-agent.template.md"`
83
- - *Note*: `@file:` paths are resolved at push time. If you modify a `.template.md` file, you must run `./scripts/sync-metadata.sh` again to push changes to the database.
84
- * **`@parent:<FieldName>`**: References a field on the parent record in nested hierarchical JSON files (e.g. `"AgentID": "@parent:ID"`).
85
+ - *Note*: `@file:` paths are resolved at push time (`mj sync push --dir /work/metadata`). `./scripts/sync-metadata.sh` creates and links `MJ: Templates` and `MJ: Template Contents` records via `TemplateID` automatically on first push.
86
+ * **`@parent:<FieldName>`**: References a field on the parent record in nested hierarchical JSON files (e.g. `"AgentID": "@parent:ID"`, `"OriginStepID": "@parent:ID"`).
87
+ * **Directory Ordering (`.mj-sync.json`)**: `metadata/.mj-sync.json` sets `"directoryOrder": ["prompts", "agents"]` so prompts are always created before agents that reference them via `@lookup:MJ: AI Prompts.Name=...`.
85
88
 
86
89
  ### C. System-Generated Fields: Do NOT Include `sync`
87
90
  * **NEVER author a `sync` block** (`lastModified`, `checksum`). `mj sync push` manages this block automatically. If you write it by hand, checksum calculation will fail.
88
91
  * **Do NOT include timestamp fields**: `CreatedAt`, `UpdatedAt`, `__mj_CreatedAt`, `__mj_UpdatedAt` are managed by the database engine.
89
92
  * **Assign deterministic `primaryKey`**: Assign a fresh UUID in uppercase (e.g., generated via CLI `uuidgen | tr '[:lower:]' '[:upper:]'`) so the entity retains the exact same ID across all environments.
90
93
 
91
- ### D. Flow Agent Step Graph Schema
92
- For `Flow` agents, structure the `Configuration.Steps` array in `metadata/agents/.*.json` like this:
94
+ ### D. Loop Agent Schema (Recommended Default) vs Flow Agent Step Graph Schema
95
+
96
+ #### 1. Loop Agents (`@lookup:MJ: AI Agent Types.Name=Loop` — Recommended Default)
97
+ `Loop` agents are interactive, conversational, and can dynamically call actions/tools across multiple turns. Bind the agent's system prompt in `MJ: AI Agent Prompts` (`ExecutionOrder: 0`, `PromptRole: "System"`, `PromptPosition: "First"`, without overriding `ResponseFormat`) and bind any allowed tools in `MJ: AI Agent Actions`:
98
+ ```json
99
+ {
100
+ "fields": {
101
+ "Name": "Customer Insight Specialist",
102
+ "CategoryID": "@lookup:MJ: AI Agent Categories.Name=Assistant",
103
+ "Description": "Interactive Loop agent that summarizes customer activity and suggests next actions.",
104
+ "TypeID": "@lookup:MJ: AI Agent Types.Name=Loop",
105
+ "Status": "Active",
106
+ "ExecutionOrder": 0,
107
+ "ExposeAsAction": false,
108
+ "ArtifactCreationMode": "Never",
109
+ "ModelSelectionMode": "Agent Type"
110
+ },
111
+ "relatedEntities": {
112
+ "MJ: AI Agent Prompts": [
113
+ {
114
+ "fields": {
115
+ "AgentID": "@parent:ID",
116
+ "PromptID": "@lookup:MJ: AI Prompts.Name=Customer Insight Specialist Prompt",
117
+ "Status": "Active",
118
+ "ExecutionOrder": 0
119
+ },
120
+ "primaryKey": { "ID": "<UUID-1>" }
121
+ }
122
+ ],
123
+ "MJ: AI Agent Actions": [
124
+ {
125
+ "fields": {
126
+ "AgentID": "@parent:ID",
127
+ "ActionID": "@lookup:MJ: Actions.Name=Run Ad-hoc Query",
128
+ "Status": "Active"
129
+ },
130
+ "primaryKey": { "ID": "<UUID-2>" }
131
+ }
132
+ ]
133
+ },
134
+ "primaryKey": { "ID": "<UUID-0>" }
135
+ }
136
+ ```
137
+ > **Important (`ArtifactCreationMode`)**: Valid values for `ArtifactCreationMode` are `"Never"`, `"Always"`, or `"System Only"` (never `"None"`).
138
+
139
+ #### 2. Flow Agents (`@lookup:MJ: AI Agent Types.Name=Flow` — Deterministic Task Graphs)
140
+ For non-interactive deterministic pipelines (`Flow` agents), steps are defined in `relatedEntities["MJ: AI Agent Steps"]` and connected via nested `relatedEntities["MJ: AI Agent Step Paths"]` on the origin step:
93
141
  ```json
94
- "Configuration": {
95
- "Steps": [
142
+ "relatedEntities": {
143
+ "MJ: AI Agent Prompts": [
144
+ {
145
+ "fields": {
146
+ "AgentID": "@parent:ID",
147
+ "PromptID": "@lookup:MJ: AI Prompts.Name=Synthesize Report Prompt",
148
+ "Status": "Active",
149
+ "ExecutionOrder": 1
150
+ },
151
+ "primaryKey": { "ID": "<UUID-1>" }
152
+ }
153
+ ],
154
+ "MJ: AI Agent Steps": [
96
155
  {
97
- "Name": "Step 1 Name",
98
- "Description": "Evaluates customer orders",
99
- "StepType": "Prompt",
100
- "TargetID": "@lookup:MJ: AI Prompts.Name=Step 1 Prompt",
101
- "ExecutionOrder": 1,
102
- "OnError": "fail",
103
- "RetryCount": 0,
104
- "TimeoutSeconds": 300
156
+ "fields": {
157
+ "AgentID": "@parent:ID",
158
+ "Name": "Query Account Data",
159
+ "StepType": "Action",
160
+ "StartingStep": true,
161
+ "ActionID": "@lookup:MJ: Actions.Name=Run Ad-hoc Query",
162
+ "ActionInputMapping": {
163
+ "Query": "static:SELECT TOP 20 Name, AccountType, Industry, AnnualRevenue FROM [__mj].[vwAccounts] ORDER BY AnnualRevenue DESC",
164
+ "DataFormat": "static:markdown",
165
+ "ColumnMaxLength": 200
166
+ },
167
+ "ActionOutputMapping": {
168
+ "Results": "accounts",
169
+ "FormattedResults": "accountsMarkdown",
170
+ "RowCount": "accountCount"
171
+ },
172
+ "Status": "Active",
173
+ "PositionX": 100,
174
+ "PositionY": 100
175
+ },
176
+ "relatedEntities": {
177
+ "MJ: AI Agent Step Paths": [
178
+ {
179
+ "fields": {
180
+ "OriginStepID": "@parent:ID",
181
+ "DestinationStepID": "<UUID-4>",
182
+ "Priority": 1,
183
+ "Description": "Pass queried rows to synthesis prompt"
184
+ },
185
+ "primaryKey": { "ID": "<UUID-3>" }
186
+ }
187
+ ]
188
+ },
189
+ "primaryKey": { "ID": "<UUID-2>" }
105
190
  },
106
191
  {
107
- "Name": "Step 2 Name",
108
- "Description": "Executes notification action",
109
- "StepType": "Action",
110
- "TargetID": "@lookup:MJ: Actions.Name=Send Email",
111
- "ExecutionOrder": 2,
112
- "OnError": "continue"
192
+ "fields": {
193
+ "AgentID": "@parent:ID",
194
+ "Name": "Synthesize Report",
195
+ "StepType": "Prompt",
196
+ "StartingStep": false,
197
+ "PromptID": "@lookup:MJ: AI Prompts.Name=Synthesize Report Prompt",
198
+ "Status": "Active",
199
+ "PositionX": 400,
200
+ "PositionY": 100
201
+ },
202
+ "primaryKey": { "ID": "<UUID-4>" }
113
203
  }
114
204
  ]
115
205
  }
116
206
  ```
207
+ * **Flow Prompt Step Nunjucks Context**: Every Flow `Prompt` step automatically receives `{{ payload }}` (and `{{ _CURRENT_PAYLOAD }}`), `{{ userMessage }}` (the user's input prompt), and `{{ flowContext }}` in its Nunjucks template context. Reference mapped action outputs as `{{ payload.accountsMarkdown }}` or `{{ payload.accounts | dump(2) }}`.
208
+ * **Flow Prompt Response Format**: If the final `Prompt` step produces a human-readable report, set `"ResponseFormat": "Markdown"`, `"OutputType": "string"`, `"ValidationBehavior": "None"` on the `MJ: AI Prompts` record; the Flow agent automatically returns the Markdown output as the run's final message.
117
209
 
118
210
  ### E. File Naming & Directory Structure
119
211
  * **Agent definitions**: `metadata/agents/.<slug>-agent.json` (must start with `.` to match the `.*.json` pattern in `.mj-sync.json`).
@@ -174,9 +266,11 @@ These defaults prevent portability bugs and privilege escalation:
174
266
  3. **Never Hardcode Record Names or IDs:**
175
267
  - Entity schemas are portable across environments; record instances and IDs are not.
176
268
  - Prompts must resolve records dynamically via queries, lookup actions, or input parameters. Never write prompts like `"Find the member named John Doe (ID: 12345)"`.
177
- 4. **Prefer `Flow` Over `Loop` for Deterministic Sequences:**
178
- - If the task is sequential and bounded, use a `Flow` agent. It is faster, cheaper, and far easier to audit. Use `Loop` only when iterative problem-solving with dynamic tool calling is required.
179
- 5. **Never Hand-Edit `ID`, `lastModified`, or `checksum`:**
269
+ 4. **Prefer `Loop` Agents by Default for Interactive Citizen Builder Scenarios:**
270
+ - Use a `Loop` agent (`@lookup:MJ: AI Agent Types.Name=Loop`) by default — `Loop` agents are interactive, conversational in MJExplorer and CLI, and can invoke bound `MJ: AI Agent Actions` as needed. Use a `Flow` agent (`@lookup:MJ: AI Agent Types.Name=Flow`) only when you want a fixed, non-interactive multi-step pipeline.
271
+ 5. **Valid `ArtifactCreationMode` Values:**
272
+ - Always use `"Never"`, `"Always"`, or `"System Only"` (never `"None"`).
273
+ 6. **Never Hand-Edit `ID`, `lastModified`, or `checksum`:**
180
274
  - Let `mj sync push` manage identity and sync checksums in `.agent.json` and `.prompt.json`. Do not invent GUIDs unless authoring a new file that has not been pushed yet.
181
275
 
182
276
  ---
@@ -249,9 +343,9 @@ Determine:
249
343
  - Error handling: For each step, should failures halt execution (`"OnError": "fail"`) or continue (`"OnError": "continue"`)?
250
344
 
251
345
  ### Step 5: Select the Execution Pattern
346
+ - **Loop Agent (`Loop` — Recommended Default)**: Best for interactive Citizen Builder agents, conversational assistants, and tasks that dynamically invoke actions/queries or synthesize user-provided notes.
347
+ - **Flow Agent (`Flow`)**: Best for non-interactive, fixed sequential pipelines ("Step 1: Run fixed query -> Step 2: Run synthesis prompt") where every run executes the exact same step graph.
252
348
  - **Single Prompt**: Lightweight classification, summarization, or single-entity extraction.
253
- - **Flow Agent (`Flow`)**: Best for deterministic, sequential, multi-step pipelines ("Step 1: Fetch order history -> Step 2: Compute risk score -> Step 3: Draft retention email"). Predictable, auditable, and low token overhead.
254
- - **Loop Agent (`Loop`)**: Iterative problem-solving requiring dynamic tool calling, multi-step reasoning, or exploratory querying.
255
349
  - **Orchestrator / Sub-Agent Tree**: Complex multi-domain tasks decomposed into specialist sub-agents (e.g., a triage agent dispatching to a risk agent and a billing agent).
256
350
 
257
351
  ### Step 6: Author Declarative Metadata under `metadata/`
@@ -279,8 +373,10 @@ Test the agent with representative test cases:
279
373
  - **Headless CLI execution**:
280
374
  ```bash
281
375
  docker compose exec -T mj mj ai agents run -a "<Agent Name>" -p "<Test Input>" --format json
376
+ # Or pass a multi-line prompt file to avoid shell escaping issues:
377
+ docker compose exec -T mj mj ai agents run -a "<Agent Name>" -f /work/prompt.txt --format json
282
378
  ```
283
- - **Interactive UI testing**: Invite the user to test in their browser at `http://localhost:4202`.
379
+ - **Interactive UI testing**: Invite the user to test in their browser at `http://localhost:4202` (Zero-Config Local Dev Auth is enabled by default on localhost).
284
380
 
285
381
  ### Step 10: Audit Execution Traces & Assert Behavior
286
382
  Inspect the run trace to verify internal execution paths and safety: