@tacitai/mcp-server 0.6.31 → 0.6.33

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.
@@ -0,0 +1,105 @@
1
+ # Agent role templates — shipped with MCP server, versioned.
2
+ # Each template defines a default role for the workspace exec team.
3
+ # Instances are created lazily on first delegate/approve action.
4
+
5
+ roles:
6
+ - slug: general_manager
7
+ display_name: General Manager
8
+ description: Oversees content placement, artifact lifecycle, and cross-functional coordination.
9
+ icon: briefcase
10
+ default_capabilities:
11
+ - content_placement
12
+ - artifact_management
13
+ - cross_reference
14
+ workflow_types:
15
+ - gm_content_placement
16
+ - cos_coordination
17
+
18
+ - slug: chief_of_staff
19
+ display_name: Chief of Staff
20
+ description: Coordinates cross-functional workflows, manages approvals, and ensures operational alignment.
21
+ icon: clipboard
22
+ default_capabilities:
23
+ - coordination
24
+ - approval_management
25
+ - status_reporting
26
+ workflow_types:
27
+ - cos_coordination
28
+
29
+ - slug: pyramid_executor
30
+ display_name: Pyramid Executor
31
+ description: Manages portfolio, program, and value stream operations within the strategic pyramid.
32
+ icon: layers
33
+ default_capabilities:
34
+ - portfolio_management
35
+ - program_management
36
+ - value_stream_ops
37
+ workflow_types:
38
+ - pyr_exec
39
+
40
+ - slug: coo_operator
41
+ display_name: COO Operator
42
+ description: Handles day-to-day operational workflows, resource allocation, and process management.
43
+ icon: settings
44
+ default_capabilities:
45
+ - operations_management
46
+ - resource_allocation
47
+ - process_optimization
48
+ workflow_types:
49
+ - coo_operations
50
+
51
+ - slug: cmo_marketer
52
+ display_name: CMO Marketer
53
+ description: Manages marketing pipeline, content strategy, and campaign execution.
54
+ icon: megaphone
55
+ default_capabilities:
56
+ - marketing_pipeline
57
+ - content_strategy
58
+ - campaign_management
59
+ workflow_types:
60
+ - cmo_marketing_pipeline
61
+
62
+ - slug: sales_executor
63
+ display_name: Sales Executor
64
+ description: Manages the full sales pipeline from prospecting through close.
65
+ icon: trending_up
66
+ default_capabilities:
67
+ - pipeline_management
68
+ - prospect_engagement
69
+ - deal_management
70
+ workflow_types:
71
+ - sales_full_pipeline
72
+
73
+ - slug: wiki_editor
74
+ display_name: Wiki Editor
75
+ description: Authors and maintains wiki content with structured classification and validation workflows.
76
+ icon: book
77
+ default_capabilities:
78
+ - wiki_authoring
79
+ - content_classification
80
+ - content_validation
81
+ workflow_types:
82
+ - wiki_authoring
83
+
84
+ - slug: kb_curator
85
+ display_name: KB Curator
86
+ description: Curates knowledge base articles, collections, and source integrations.
87
+ icon: library
88
+ default_capabilities:
89
+ - kb_management
90
+ - article_curation
91
+ - source_administration
92
+ workflow_types:
93
+ - kb_management
94
+
95
+ - slug: lake_operator
96
+ display_name: Lake Operator
97
+ description: Manages data lake ingestion, classification, taxonomy, and structure proposals.
98
+ icon: database
99
+ default_capabilities:
100
+ - lake_ingestion
101
+ - classification
102
+ - taxonomy_management
103
+ - structure_proposals
104
+ workflow_types:
105
+ - lake_operations
package/dist/flags.js CHANGED
@@ -22,12 +22,17 @@ export function isWorkflowTypeActive(typeName) {
22
22
  if (!envVar)
23
23
  return true; // GM and unknown types are always active
24
24
  const val = process.env[envVar];
25
- return val === 'true' || val === '1';
25
+ // Unset = enabled (npm users have no env vars). Only explicit 'false'/'0' disables.
26
+ if (val === 'false' || val === '0')
27
+ return false;
28
+ return true;
26
29
  }
27
30
  export function getWorkflowTypeFlag(typeName) {
28
31
  return WORKFLOW_TYPE_FLAGS[typeName];
29
32
  }
30
33
  export function isUserWorkflowTypesActive() {
31
34
  const val = process.env['FEATURE_WORKFLOW_USER_TYPES'];
32
- return val === 'true' || val === '1';
35
+ if (val === 'false' || val === '0')
36
+ return false;
37
+ return true;
33
38
  }
package/dist/index.js CHANGED
@@ -43,6 +43,7 @@ import { registerAnnotationTools } from './tools/annotations.js';
43
43
  import { registerExportTools } from './tools/export.js';
44
44
  import { registerMoveTools } from './tools/move.js';
45
45
  import { registerAgentTools } from './tools/agents.js';
46
+ import { registerExecRouteTool } from './tools/exec-route.js';
46
47
  import { registerPyramidTools } from './tools/pyramid.js';
47
48
  import { registerSharingTools } from './tools/sharing.js';
48
49
  import { registerKbTools } from './tools/kb.js';
@@ -92,6 +93,45 @@ const gate = new WorkflowGate({
92
93
  }
93
94
  },
94
95
  });
96
+ // F-12: convert workflow guidance constants to human-readable sentences
97
+ const GUIDANCE_MAP = {
98
+ GM_WORKFLOW: 'Active GM workflow. Next: call tacit_gm_approve to confirm content placement, or tacit_gm_reset to cancel.',
99
+ COS_SUB_WORKFLOWS: 'Chief of Staff coordinating. Use tacit_agent_delegate to hand off sub-tasks to the appropriate role.',
100
+ PYR_EXEC_SUB_WORKFLOWS: 'Pyramid operations active. Use tacit_pyramid_list_* tools to explore structure before making changes.',
101
+ COO_SUB_WORKFLOWS: 'COO operations active. Delegate sub-tasks to specialized roles via tacit_agent_delegate.',
102
+ CMO_INTAKE: 'CMO pipeline: intake phase. Describe the marketing objective and target audience.',
103
+ CMO_BRAND_LOAD: 'CMO pipeline: loading brand context. The system will pull voice profiles and brand guidelines.',
104
+ CMO_PRODUCE: 'CMO pipeline: production phase. Creating marketing content.',
105
+ CMO_LINT: 'CMO pipeline: lint phase. Call tacit_cmo_lint to check brand and compliance rules.',
106
+ CMO_JUDGE_RECEIPT: 'CMO pipeline: judge/receipt phase. Content is being evaluated for quality.',
107
+ CMO_HANDOFF: 'CMO pipeline: handoff. Route final content through tacit_gm_ingest for placement.',
108
+ CMO_MARKETING_PIPELINE: 'CMO marketing pipeline active. Follow the phase sequence: intake → brand → produce → lint → judge → handoff.',
109
+ SALES_CONTEXT: 'Sales pipeline: context phase. Gather client context before discovery.',
110
+ SALES_DISCOVERY: 'Sales pipeline: discovery phase. Run discovery analysis.',
111
+ SALES_PROPOSAL: 'Sales pipeline: proposal phase. Draft the proposal.',
112
+ SALES_REVIEW: 'Sales pipeline: review phase. Review and refine the proposal.',
113
+ SALES_QUOTE: 'Sales pipeline: quote phase. Generate pricing.',
114
+ SALES_PILOT: 'Sales pipeline: pilot phase. Set up a pilot engagement.',
115
+ SALES_PIPELINE: 'Sales pipeline: pipeline management. Track deal status.',
116
+ SALES_FULL_PIPELINE: 'Sales pipeline active. Follow phase sequence: context → discovery → proposal → review → quote → pilot → pipeline.',
117
+ RESEARCH_PREPARE: 'Research: prepare phase. Call tacit_research_prepare to set up the research plan.',
118
+ RESEARCH_PLAN_APPROVAL: 'Research: awaiting plan approval before launching.',
119
+ RESEARCH_DISPATCH: 'Research: dispatch phase. Call tacit_research_launch to start execution.',
120
+ RESEARCH_SYNTHESIS: 'Research: synthesis in progress.',
121
+ RESEARCH_PLACEMENT: 'Research: placement phase. Call tacit_research_place to file the results.',
122
+ RESEARCH_EXEC: 'Research workflow active. Follow: prepare → approve → launch → synthesize → place.',
123
+ WIKI_AUTHORING: 'Wiki authoring active. Follow: classify → validate → author. Write/override require approval.',
124
+ KB_MANAGEMENT: 'KB management active. Browse the KB structure first, then curate content.',
125
+ LAKE_OPERATIONS: 'Data lake operations active. Explore catalog first, then ingest/classify, then propose structure.',
126
+ };
127
+ function expandGuidance(raw, _typeName, phase) {
128
+ const expanded = GUIDANCE_MAP[raw];
129
+ if (expanded)
130
+ return expanded;
131
+ if (phase)
132
+ return `Workflow phase: ${phase}. Check tacit_workflow_prereqs for required next steps.`;
133
+ return `Active workflow. Check tacit_workflow_prereqs for required next steps.`;
134
+ }
95
135
  // MV-1539 W1 Step 3: preCall hook — wraps every tool handler to record calls centrally.
96
136
  const PRECALL_EXEMPT = new Set(['tacit_cmo_lint']);
97
137
  function installPreCallHook(server) {
@@ -121,12 +161,32 @@ function installPreCallHook(server) {
121
161
  return { content: [{ type: 'text', text: JSON.stringify(block) }], isError: true };
122
162
  }
123
163
  if (!gate.routeToolCall(principal, toolName)) {
124
- const coldBlock = gate.checkColdToolBlock(toolName);
125
- if (coldBlock) {
126
- return { content: [{ type: 'text', text: JSON.stringify(coldBlock) }], isError: true };
164
+ const autoStarted = gate.autoStartForTool(principal, toolName);
165
+ if (autoStarted) {
166
+ gate.recordCallForAll(principal, toolName);
167
+ }
168
+ else {
169
+ const coldBlock = gate.checkColdToolBlock(toolName);
170
+ if (coldBlock) {
171
+ return { content: [{ type: 'text', text: JSON.stringify(coldBlock) }], isError: true };
172
+ }
173
+ }
174
+ }
175
+ // F-12: inject post-call guidance from active workflows
176
+ const handlerResult = await originalHandler(...callArgs);
177
+ if (handlerResult && !handlerResult['isError']) {
178
+ const allGuidance = gate.getGuidanceAll(principal);
179
+ if (allGuidance.length > 0) {
180
+ const guidanceText = allGuidance.map((g) => expandGuidance(g.guidance, g.typeName, g.phase)).filter(Boolean);
181
+ if (guidanceText.length > 0) {
182
+ const content = handlerResult['content'];
183
+ if (Array.isArray(content)) {
184
+ content.push({ type: 'text', text: `\n--- Workflow guidance ---\n${guidanceText.join('\n')}` });
185
+ }
186
+ }
127
187
  }
128
188
  }
129
- return originalHandler(...callArgs);
189
+ return handlerResult;
130
190
  };
131
191
  return originalTool(...registerArgs);
132
192
  };
@@ -209,7 +269,33 @@ async function run() {
209
269
  checkCompatibility();
210
270
  const server = new McpServer({ name: '@tacitai/mcp-server', version: '0.3.0' }, {
211
271
  capabilities: { tools: {}, prompts: {} },
212
- instructions: 'This MCP server manages a workspace executive team with workflow-enforced operations. Use tacit_agent_list to see the team. Use tacit_workflow_prereqs to discover prerequisite chains before calling gated tools. Workflows enforce ordered phases — complete prerequisites before attempting write operations.',
272
+ instructions: [
273
+ 'You have an executive team powered by TACIT. Each role handles a domain — route requests to the right role using tacit_exec_route.',
274
+ '',
275
+ 'ROLE ROUTING TABLE:',
276
+ '- "morning brief", "daily brief", "triage email", "meeting prep" → chief_of_staff',
277
+ '- "operational status", "team coordination", "process review" → coo_operator',
278
+ '- "file this", "save this", "ingest", "place this" → general_manager',
279
+ '- "portfolio", "program", "value stream", "dossier" → pyramid_executor',
280
+ '- "marketing campaign", "brand", "content strategy" → cmo_marketer',
281
+ '- "sales pipeline", "proposal", "discovery", "prospect" → sales_executor',
282
+ '- "research", "competitors", "SOTA", "survey" → use tacit_research_prepare directly',
283
+ '- "wiki article", "publish to wiki" → wiki_editor',
284
+ '- "knowledge base", "KB article", "organize knowledge" → kb_curator',
285
+ '- "data sources", "data lake", "classify", "taxonomy" → lake_operator',
286
+ '',
287
+ 'HOW TO START:',
288
+ '1. For any business request, call tacit_exec_route with the user\'s intent. It returns the role, workflow type, and a script of tools to call.',
289
+ '2. Follow the returned script step by step — each tool result includes next-step guidance.',
290
+ '3. Use tacit_agent_list to see the team and their status.',
291
+ '4. Use tacit_agent_delegate to hand work to a specific role (async by default).',
292
+ '5. Use tacit_workflow_prereqs to check what steps a gated tool requires.',
293
+ '',
294
+ 'RULES:',
295
+ '- Workflows enforce ordered phases. Complete prerequisites before write operations.',
296
+ '- Wiki writes require approval. KB and lake reads are ungated.',
297
+ '- Follow tool result scripts deterministically — they encode the workflow.',
298
+ ].join('\n'),
213
299
  });
214
300
  const isHttpMode = process.env['MCP_TRANSPORT'] === 'http';
215
301
  let clientInstance = null;
@@ -261,6 +347,7 @@ async function run() {
261
347
  registerWorkflowTypeTools(server, getClient, gate.getRegistry());
262
348
  registerWorkflowPrereqsTool(server, gate.getRegistry());
263
349
  registerCmoTools(server);
350
+ registerExecRouteTool(server);
264
351
  registerPrompts(server, getClient);
265
352
  if (process.env['MCP_TRANSPORT'] === 'http') {
266
353
  await startHttpTransport(server);
@@ -55,7 +55,7 @@ export declare const agentDelegateInputSchema: z.ZodEffects<z.ZodObject<{
55
55
  agent_id: z.ZodOptional<z.ZodString>;
56
56
  role_slug: z.ZodOptional<z.ZodString>;
57
57
  task: z.ZodString;
58
- kind: z.ZodOptional<z.ZodString>;
58
+ kind: z.ZodDefault<z.ZodOptional<z.ZodEnum<["task", "goal", "schedule"]>>>;
59
59
  target_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
60
60
  program_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
61
61
  dossier_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -63,12 +63,12 @@ export declare const agentDelegateInputSchema: z.ZodEffects<z.ZodObject<{
63
63
  wait_timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
64
64
  }, "strip", z.ZodTypeAny, {
65
65
  task: string;
66
+ kind: "task" | "goal" | "schedule";
66
67
  wait: boolean;
67
68
  wait_timeout: number;
68
69
  program_ids?: string[] | undefined;
69
70
  role_slug?: string | undefined;
70
71
  agent_id?: string | undefined;
71
- kind?: string | undefined;
72
72
  target_ids?: string[] | undefined;
73
73
  dossier_ids?: string[] | undefined;
74
74
  }, {
@@ -76,19 +76,19 @@ export declare const agentDelegateInputSchema: z.ZodEffects<z.ZodObject<{
76
76
  program_ids?: string[] | undefined;
77
77
  role_slug?: string | undefined;
78
78
  agent_id?: string | undefined;
79
- kind?: string | undefined;
79
+ kind?: "task" | "goal" | "schedule" | undefined;
80
80
  target_ids?: string[] | undefined;
81
81
  dossier_ids?: string[] | undefined;
82
82
  wait?: boolean | undefined;
83
83
  wait_timeout?: number | undefined;
84
84
  }>, {
85
85
  task: string;
86
+ kind: "task" | "goal" | "schedule";
86
87
  wait: boolean;
87
88
  wait_timeout: number;
88
89
  program_ids?: string[] | undefined;
89
90
  role_slug?: string | undefined;
90
91
  agent_id?: string | undefined;
91
- kind?: string | undefined;
92
92
  target_ids?: string[] | undefined;
93
93
  dossier_ids?: string[] | undefined;
94
94
  }, {
@@ -96,7 +96,7 @@ export declare const agentDelegateInputSchema: z.ZodEffects<z.ZodObject<{
96
96
  program_ids?: string[] | undefined;
97
97
  role_slug?: string | undefined;
98
98
  agent_id?: string | undefined;
99
- kind?: string | undefined;
99
+ kind?: "task" | "goal" | "schedule" | undefined;
100
100
  target_ids?: string[] | undefined;
101
101
  dossier_ids?: string[] | undefined;
102
102
  wait?: boolean | undefined;
@@ -59,7 +59,9 @@ export function buildAgentListRequest(client, input) {
59
59
  try {
60
60
  const result = await callAgentTool(client, 'tacit.agents.list', args);
61
61
  const r = result;
62
- const list = Array.isArray(r) ? r : r?.agents;
62
+ const list = Array.isArray(r)
63
+ ? r
64
+ : r?.items ?? r?.agents;
63
65
  if (Array.isArray(list))
64
66
  instances = list;
65
67
  }
@@ -100,11 +102,11 @@ export const agentDelegateInputSchema = z.object({
100
102
  agent_id: z.string().min(1).optional().describe('UUID of the agent to delegate to (provide this OR role_slug)'),
101
103
  role_slug: z.string().min(1).optional().describe('Role template slug (e.g. "wiki_editor"). Resolves to agent_id; creates instance on first use'),
102
104
  task: z.string().min(1).describe('Task description to delegate'),
103
- kind: z.string().optional().describe('Task kind (default: "task")'),
105
+ kind: z.enum(['task', 'goal', 'schedule']).optional().default('task').describe('Task kind (default: "task")'),
104
106
  target_ids: z.array(z.string()).optional().describe('Target entity UUIDs for the task'),
105
107
  program_ids: z.array(z.string()).optional().describe('Program UUIDs to scope the task'),
106
108
  dossier_ids: z.array(z.string()).optional().describe('Dossier UUIDs to scope the task'),
107
- wait: z.boolean().optional().default(true).describe('Wait for the run to complete and return results inline (default: true)'),
109
+ wait: z.boolean().optional().default(false).describe('Return immediately with run_id (default: false). Set true to wait for results inline.'),
108
110
  wait_timeout: z.number().int().positive().optional().default(120).describe('Max seconds to wait for completion (default: 120)'),
109
111
  }).refine((d) => d.agent_id || d.role_slug, { message: 'Either agent_id or role_slug is required' });
110
112
  export const AGENT_DELEGATE_TOOL_DEF = {
@@ -123,7 +125,7 @@ export const AGENT_DELEGATE_TOOL_DEF = {
123
125
  target_ids: { type: 'array', items: { type: 'string' }, description: 'Target entity UUIDs' },
124
126
  program_ids: { type: 'array', items: { type: 'string' }, description: 'Program UUIDs to scope the task' },
125
127
  dossier_ids: { type: 'array', items: { type: 'string' }, description: 'Dossier UUIDs to scope the task' },
126
- wait: { type: 'boolean', description: 'Wait for run completion and return results inline (default: true)' },
128
+ wait: { type: 'boolean', description: 'Return immediately with run_id (default: false). Set true to wait for results inline.' },
127
129
  wait_timeout: { type: 'number', description: 'Max seconds to wait for completion (default: 120)' },
128
130
  },
129
131
  required: ['task'],
@@ -284,6 +286,20 @@ export function buildAgentDelegateRequest(client, input) {
284
286
  : 'timeout',
285
287
  messages,
286
288
  };
289
+ // A5: if delegation produced artifacts, guide toward GM placement
290
+ if (poll.completed && Array.isArray(messages) && messages.length > 0) {
291
+ const hasArtifact = messages.some((m) => {
292
+ const msg = m;
293
+ const content = (msg['content'] ?? msg['text'] ?? '');
294
+ return content.includes('artifact') || content.includes('draft') || content.includes('produced');
295
+ });
296
+ if (hasArtifact) {
297
+ combined['_next_steps'] = [
298
+ 'The delegate produced content. Route it through tacit_gm_ingest for proper placement in the data lake, KB, or pyramid.',
299
+ 'Call tacit_exec_route with role_hint="general_manager" to get the placement workflow script.',
300
+ ];
301
+ }
302
+ }
287
303
  return { content: [{ type: 'text', text: JSON.stringify(combined) }] };
288
304
  }
289
305
  catch (err) {
@@ -468,7 +484,7 @@ export function registerAgentTools(server, getClientFn) {
468
484
  const client = await getClientFn();
469
485
  return buildAgentListRequest(client, args).execute();
470
486
  });
471
- server.tool('tacit_agent_delegate', 'Delegate a task to a business agent and wait for results. Accepts agent_id or role_slug. Returns the agent\'s output inline by default.', {
487
+ server.tool('tacit_agent_delegate', 'Delegate a task to a business agent. Accepts agent_id or role_slug. Returns run_id immediately by default; set wait=true to get results inline.', {
472
488
  agent_id: z.string().min(1).optional().describe('UUID of the agent to delegate to (provide this OR role_slug)'),
473
489
  role_slug: z.string().min(1).optional().describe('Role template slug (e.g. "wiki_editor"). Creates instance on first use'),
474
490
  task: z.string().min(1).describe('Task description to delegate'),
@@ -476,7 +492,7 @@ export function registerAgentTools(server, getClientFn) {
476
492
  target_ids: z.array(z.string()).optional().describe('Target entity UUIDs'),
477
493
  program_ids: z.array(z.string()).optional().describe('Program UUIDs'),
478
494
  dossier_ids: z.array(z.string()).optional().describe('Dossier UUIDs'),
479
- wait: z.boolean().optional().default(true).describe('Wait for completion and return results (default: true)'),
495
+ wait: z.boolean().optional().default(false).describe('Return immediately with run_id (default: false). Set true to wait for results inline.'),
480
496
  wait_timeout: z.number().int().positive().optional().default(120).describe('Max seconds to wait (default: 120)'),
481
497
  }, async (args) => {
482
498
  const client = await getClientFn();
@@ -510,4 +526,18 @@ export function registerAgentTools(server, getClientFn) {
510
526
  const client = await getClientFn();
511
527
  return buildAgentTimelineRequest(client, args).execute();
512
528
  });
529
+ // A4: tacit_agent_status — check status of a delegation run
530
+ server.tool('tacit_agent_status', 'Check status of an agent delegation run. Returns run status, progress, and output messages if complete.', {
531
+ run_id: z.string().min(1).describe('Run ID from a prior tacit_agent_delegate call'),
532
+ }, async (args) => {
533
+ const client = await getClientFn();
534
+ try {
535
+ const result = await client.request('GET', `/api/v1/agents/mcp/runs/${args.run_id}`);
536
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
537
+ }
538
+ catch (err) {
539
+ const msg = err instanceof Error ? err.message : String(err);
540
+ return { content: [{ type: 'text', text: JSON.stringify({ error: msg }) }], isError: true };
541
+ }
542
+ });
513
543
  }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * tacit_exec_route — Route a natural-language request to the correct executive role.
3
+ *
4
+ * Under tool deferral (163+ deferred tools), the LLM sees only tool names.
5
+ * `tacit_agent_delegate` doesn't signal "ask your CMO about marketing."
6
+ * This tool bridges natural language intent → correct executive role →
7
+ * imperative next-step script the LLM can follow deterministically.
8
+ */
9
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
10
+ export declare function registerExecRouteTool(server: McpServer): void;
@@ -0,0 +1,157 @@
1
+ /**
2
+ * tacit_exec_route — Route a natural-language request to the correct executive role.
3
+ *
4
+ * Under tool deferral (163+ deferred tools), the LLM sees only tool names.
5
+ * `tacit_agent_delegate` doesn't signal "ask your CMO about marketing."
6
+ * This tool bridges natural language intent → correct executive role →
7
+ * imperative next-step script the LLM can follow deterministically.
8
+ */
9
+ import { z } from 'zod';
10
+ const ROLE_ROUTES = [
11
+ {
12
+ slug: 'general_manager',
13
+ present_as: 'General Manager',
14
+ workflow_type: 'gm_operations',
15
+ keywords: ['file this', 'save this', 'ingest', 'place this', 'store', 'catalog', 'route content', 'gm'],
16
+ description: 'Routes and places content into the data lake, KB, or pyramid. The default for "do something with this content."',
17
+ },
18
+ {
19
+ slug: 'chief_of_staff',
20
+ present_as: 'Chief of Staff',
21
+ workflow_type: 'cos_operations',
22
+ keywords: ['morning brief', 'daily brief', 'triage', 'email', 'meeting prep', 'agenda', 'schedule', 'priorities'],
23
+ description: 'Daily operations, briefings, meeting prep, email triage, priority management.',
24
+ },
25
+ {
26
+ slug: 'coo_operator',
27
+ present_as: 'COO Operator',
28
+ workflow_type: 'coo_operations',
29
+ keywords: ['operational status', 'team coordination', 'process review', 'ops', 'workflow', 'capacity', 'resource'],
30
+ description: 'Operational oversight, team coordination, process reviews, capacity planning.',
31
+ },
32
+ {
33
+ slug: 'pyramid_executor',
34
+ present_as: 'Pyramid Executor',
35
+ workflow_type: 'pyramid_operations',
36
+ keywords: ['portfolio', 'program', 'value stream', 'dossier', 'alignment', 'strategic', 'pyramid'],
37
+ description: 'Manages the organizational pyramid: portfolios, programs, value streams, dossiers.',
38
+ },
39
+ {
40
+ slug: 'cmo_marketer',
41
+ present_as: 'CMO Marketer',
42
+ workflow_type: 'cmo_operations',
43
+ keywords: ['marketing', 'campaign', 'brand', 'content strategy', 'social media', 'positioning', 'messaging'],
44
+ description: 'Marketing campaigns, brand strategy, content creation, positioning.',
45
+ },
46
+ {
47
+ slug: 'sales_executor',
48
+ present_as: 'Sales Executor',
49
+ workflow_type: 'sales_operations',
50
+ keywords: ['sales', 'pipeline', 'proposal', 'discovery', 'prospect', 'lead', 'deal', 'quote', 'revenue'],
51
+ description: 'Sales pipeline, proposals, discovery calls, prospecting, deal management.',
52
+ },
53
+ {
54
+ slug: 'wiki_editor',
55
+ present_as: 'Wiki Editor',
56
+ workflow_type: 'wiki_operations',
57
+ keywords: ['wiki', 'article', 'publish to wiki', 'documentation', 'wiki write'],
58
+ description: 'Authors and publishes wiki articles. Wiki writes require approval.',
59
+ },
60
+ {
61
+ slug: 'kb_curator',
62
+ present_as: 'KB Curator',
63
+ workflow_type: 'kb_operations',
64
+ keywords: ['knowledge base', 'kb article', 'organize knowledge', 'kb collection', 'kb category'],
65
+ description: 'Manages the knowledge base: articles, collections, categories, source registration.',
66
+ },
67
+ {
68
+ slug: 'lake_operator',
69
+ present_as: 'Lake Operator',
70
+ workflow_type: 'lake_operations',
71
+ keywords: ['data source', 'data lake', 'classify', 'taxonomy', 'catalog', 'connector', 'sync'],
72
+ description: 'Manages the data lake: sources, classification, taxonomy, connectors, sync.',
73
+ },
74
+ ];
75
+ function matchRole(request) {
76
+ const lower = request.toLowerCase();
77
+ const scores = [];
78
+ for (const route of ROLE_ROUTES) {
79
+ let score = 0;
80
+ for (const kw of route.keywords) {
81
+ if (lower.includes(kw)) {
82
+ score += kw.split(' ').length; // multi-word matches score higher
83
+ }
84
+ }
85
+ if (score > 0) {
86
+ scores.push({ route, score });
87
+ }
88
+ }
89
+ scores.sort((a, b) => b.score - a.score);
90
+ if (scores.length === 0) {
91
+ // Default to GM — it can triage
92
+ return {
93
+ primary: ROLE_ROUTES[0],
94
+ alternatives: [],
95
+ };
96
+ }
97
+ const primary = scores[0].route;
98
+ const alternatives = scores.slice(1, 3).map((s) => ({
99
+ role_slug: s.route.slug,
100
+ reason: s.route.description,
101
+ }));
102
+ return { primary, alternatives };
103
+ }
104
+ function buildScript(role) {
105
+ const steps = [];
106
+ steps.push(`Call tacit_agent_delegate with role_slug="${role.slug}" and your task description.`);
107
+ steps.push('The delegation returns a run_id. Use tacit_agent_status to check progress if wait=false.');
108
+ if (role.workflow_type === 'gm_operations') {
109
+ steps.push('For content placement: call tacit_gm_ingest first, then tacit_gm_approve to confirm placement.');
110
+ }
111
+ else if (role.workflow_type === 'wiki_operations') {
112
+ steps.push('Wiki writes require approval. The workflow enforces: draft → review → approve → publish.');
113
+ }
114
+ else if (role.workflow_type === 'pyramid_operations') {
115
+ steps.push('Use tacit_pyramid_list_portfolios to see the current structure before making changes.');
116
+ }
117
+ steps.push('Check tacit_workflow_prereqs if a tool returns a workflow block — it shows required prior steps.');
118
+ return steps;
119
+ }
120
+ export function registerExecRouteTool(server) {
121
+ server.tool('tacit_exec_route', 'Route a business request to the right executive role. Returns the role, workflow type, and a step-by-step script of tools to call. Use this as the first step for any business request.', {
122
+ request: z.string().min(1).describe('Natural language description of what you want to do'),
123
+ role_hint: z.string().optional().describe('If you already know the role slug, pass it here to skip matching'),
124
+ }, async (args) => {
125
+ const { request, role_hint } = args;
126
+ let primary;
127
+ let alternatives = [];
128
+ if (role_hint) {
129
+ const found = ROLE_ROUTES.find((r) => r.slug === role_hint);
130
+ if (!found) {
131
+ const slugs = ROLE_ROUTES.map((r) => r.slug).join(', ');
132
+ return {
133
+ content: [{ type: 'text', text: JSON.stringify({ error: `Unknown role_hint: ${role_hint}. Available: ${slugs}` }) }],
134
+ isError: true,
135
+ };
136
+ }
137
+ primary = found;
138
+ }
139
+ else {
140
+ const match = matchRole(request);
141
+ primary = match.primary;
142
+ alternatives = match.alternatives;
143
+ }
144
+ const result = {
145
+ role_slug: primary.slug,
146
+ present_as: primary.present_as,
147
+ workflow_type: primary.workflow_type,
148
+ description: primary.description,
149
+ first_tool: 'tacit_agent_delegate',
150
+ script: buildScript(primary),
151
+ ...(alternatives.length > 0 ? { alternatives } : {}),
152
+ };
153
+ return {
154
+ content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
155
+ };
156
+ });
157
+ }
@@ -35,7 +35,7 @@ function excerptOf(r) {
35
35
  }
36
36
  function toSource(r, type) {
37
37
  return {
38
- title: str(r['title'] ?? r['name'] ?? r['file_name'] ?? r['path']) || '(untitled)',
38
+ title: str(r['title'] ?? r['name'] ?? r['file_name'] ?? r['path'] ?? r['source_uri']) || '(untitled)',
39
39
  excerpt: excerptOf(r),
40
40
  source_id: str(r['id'] ?? r['source_id'] ?? r['article_id'] ?? r['entity_id']),
41
41
  source_type: type,
@@ -190,6 +190,13 @@ export declare class WorkflowGate {
190
190
  * the caller has no active instance (first-contact rejection).
191
191
  */
192
192
  checkColdToolBlock(toolName: string): GateVerdict | null;
193
+ /**
194
+ * Auto-start a workflow when a tool is the phase-0 requiredTool of exactly one
195
+ * phased type whose flag is active. Returns the new instance, or null if no
196
+ * unambiguous match (0 or 2+ candidates). Called from the pre-call hook between
197
+ * routeToolCall miss and checkColdToolBlock.
198
+ */
199
+ autoStartForTool(principal: string | null, toolName: string): WorkflowInstance | null;
193
200
  /**
194
201
  * Record a tool call for ALL active instances that include this tool in their
195
202
  * type definition. For legacy GM callers, the 2-arg recordCall below also works.
@@ -14,6 +14,7 @@
14
14
  */
15
15
  import { createDefaultRegistry, PYRAMID_PREREQ_TOOLS as _PYRAMID_PREREQ_TOOLS, KB_PREREQ_TOOL as _KB_PREREQ_TOOL, } from './workflow-registry.js';
16
16
  import { getCachedAutonomy as _getCachedAutonomyFromClient, autonomyAtLeast, } from './client.js';
17
+ import { isWorkflowTypeActive } from './flags.js';
17
18
  /** Re-export from workflow-registry.ts (canonical source) for backwards compatibility. */
18
19
  export const PYRAMID_PREREQ_TOOLS = _PYRAMID_PREREQ_TOOLS;
19
20
  export const KB_PREREQ_TOOL = _KB_PREREQ_TOOL;
@@ -658,6 +659,31 @@ export class WorkflowGate {
658
659
  }
659
660
  return null;
660
661
  }
662
+ /**
663
+ * Auto-start a workflow when a tool is the phase-0 requiredTool of exactly one
664
+ * phased type whose flag is active. Returns the new instance, or null if no
665
+ * unambiguous match (0 or 2+ candidates). Called from the pre-call hook between
666
+ * routeToolCall miss and checkColdToolBlock.
667
+ */
668
+ autoStartForTool(principal, toolName) {
669
+ const candidates = [];
670
+ for (const typeDef of this.registry.list()) {
671
+ if (typeDef.prereqs.kind !== 'phased')
672
+ continue;
673
+ if (!isWorkflowTypeActive(typeDef.name))
674
+ continue;
675
+ const phase0 = typeDef.prereqs.phases[0];
676
+ if (!phase0)
677
+ continue;
678
+ if (phase0.requiredTools.includes(toolName)) {
679
+ candidates.push(typeDef);
680
+ }
681
+ }
682
+ if (candidates.length !== 1)
683
+ return null;
684
+ const typeDef = candidates[0];
685
+ return this.startWorkflowTyped(principal, typeDef.name);
686
+ }
661
687
  /**
662
688
  * Record a tool call for ALL active instances that include this tool in their
663
689
  * type definition. For legacy GM callers, the 2-arg recordCall below also works.
@@ -298,7 +298,7 @@ export const RESEARCH_TYPE_DEF = {
298
298
  { name: 'plan_approval', requiredTools: [], gatedTools: ['tacit_research_launch'], approvalGate: true, guidance: 'RESEARCH_PLAN_APPROVAL' },
299
299
  { name: 'dispatch', requiredTools: ['tacit_research_launch'], gatedTools: [], approvalGate: false, guidance: 'RESEARCH_DISPATCH' },
300
300
  { name: 'synthesis', requiredTools: [], gatedTools: [], approvalGate: false, guidance: 'RESEARCH_SYNTHESIS' },
301
- { name: 'placement', requiredTools: ['tacit_research_place'], gatedTools: ['tacit_gm_ingest'], approvalGate: true, guidance: 'RESEARCH_PLACEMENT' },
301
+ { name: 'placement', requiredTools: ['tacit_research_place'], gatedTools: [], approvalGate: true, guidance: 'RESEARCH_PLACEMENT' },
302
302
  ],
303
303
  },
304
304
  persistent: true,
@@ -316,7 +316,7 @@ export const WIKI_TYPE_DEF = {
316
316
  phases: [
317
317
  { name: 'classify', requiredTools: ['tacit_wiki_classify'], gatedTools: [], approvalGate: false, guidance: 'Classify the content type and target wiki section before authoring.' },
318
318
  { name: 'validate', requiredTools: ['tacit_wiki_validate'], gatedTools: [], approvalGate: false, guidance: 'Validate content structure and references before writing.' },
319
- { name: 'author', requiredTools: ['tacit_wiki_author'], gatedTools: ['tacit_wiki_write', 'tacit_wiki_override'], approvalGate: false, guidance: 'Author the content. Write and override tools unlock after this phase.' },
319
+ { name: 'author', requiredTools: ['tacit_wiki_author'], gatedTools: ['tacit_wiki_write', 'tacit_wiki_override'], approvalGate: true, guidance: 'Author the content. Approval required before write and override tools unlock.' },
320
320
  ],
321
321
  },
322
322
  failDirection: 'open',
@@ -331,7 +331,7 @@ export const KB_TYPE_DEF = {
331
331
  kind: 'phased',
332
332
  phases: [
333
333
  { name: 'browse', requiredTools: ['tacit_kb_browse_tree', 'tacit_kb_list_collections', 'tacit_kb_list_categories'], gatedTools: [], approvalGate: false, guidance: 'Browse the knowledge base structure before making changes.' },
334
- { name: 'curate', requiredTools: [], gatedTools: ['tacit_kb_create_article', 'tacit_kb_update_article', 'tacit_kb_create_category', 'tacit_kb_create_collection', 'tacit_kb_update_collection', 'tacit_kb_delete_collection', 'tacit_kb_promote_from_artifact', 'tacit_kb_promote_from_catalog'], approvalGate: false, guidance: 'Create, update, or promote KB content. Browse phase must complete first.' },
334
+ { name: 'curate', requiredTools: [], gatedTools: ['tacit_kb_create_article', 'tacit_kb_update_article', 'tacit_kb_create_category', 'tacit_kb_create_collection', 'tacit_kb_update_collection', 'tacit_kb_delete_collection', 'tacit_kb_promote_from_artifact', 'tacit_kb_promote_from_catalog', 'tacit_artifact_create'], approvalGate: false, guidance: 'Create, update, or promote KB content. Browse phase must complete first.' },
335
335
  { name: 'source_admin', requiredTools: [], gatedTools: ['tacit_kb_pull_source'], approvalGate: true, guidance: 'Source administration requires approval. Note: tacit_kb_register_source is ADMIN_ONLY transport and bypasses this gate.' },
336
336
  ],
337
337
  },
@@ -347,7 +347,7 @@ export const LAKE_TYPE_DEF = {
347
347
  kind: 'phased',
348
348
  phases: [
349
349
  { name: 'explore', requiredTools: ['tacit_lake_browse_catalog', 'tacit_lake_folder_list', 'tacit_lake_taxonomy_browse'], gatedTools: [], approvalGate: false, guidance: 'Explore the data lake catalog and taxonomy before operations.' },
350
- { name: 'ingest', requiredTools: [], gatedTools: ['tacit_lake_ingest', 'tacit_lake_classify', 'tacit_lake_classify_subject', 'tacit_lake_reclassify', 'tacit_lake_reclassify_subjects', 'tacit_lake_folder_add', 'tacit_lake_folder_rename'], approvalGate: false, guidance: 'Ingest and classify content. Explore phase must complete first.' },
350
+ { name: 'ingest', requiredTools: [], gatedTools: ['tacit_lake_ingest', 'tacit_lake_classify', 'tacit_lake_classify_subject', 'tacit_lake_reclassify', 'tacit_lake_reclassify_subjects', 'tacit_lake_folder_add', 'tacit_lake_folder_rename', 'tacit_move'], approvalGate: false, guidance: 'Ingest and classify content. Explore phase must complete first.' },
351
351
  { name: 'structure', requiredTools: [], gatedTools: ['tacit_lake_propose_structure', 'tacit_lake_confirm_proposal'], approvalGate: true, guidance: 'Structure proposals require approval before confirmation.' },
352
352
  ],
353
353
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tacitai/mcp-server",
3
- "version": "0.6.31",
3
+ "version": "0.6.33",
4
4
  "description": "stdio MCP server wrapping Tacit /api/v1 REST/SSE API",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -15,7 +15,8 @@
15
15
  },
16
16
  "files": [
17
17
  "dist",
18
- "!dist/**/*.map"
18
+ "!dist/**/*.map",
19
+ "config"
19
20
  ],
20
21
  "engines": {
21
22
  "node": ">=18.0.0"
@@ -39,5 +40,7 @@
39
40
  "typescript": "^5.4.0",
40
41
  "vitest": "^4.1.7"
41
42
  },
42
- "private": false
43
+ "publishConfig": {
44
+ "access": "restricted"
45
+ }
43
46
  }