sync: Workflows P2 features from private repo

- 5 bundled workflows (prep, research, connect, integrate, survey)
- quickLink tool for fast edge creation
- queryDimensionNodes tool for dimension queries
- Workflow orchestration tools (list, get, edit)
- Dimension awareness with active dimension tracking
- Unified Workflows tab in Agent Panel
- MCP server updates for workflow execution

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
“BeeRad”
2026-01-11 18:54:34 +11:00
co-authored by Claude Opus 4.5
parent 3951d9daf4
commit f9271aeeb4
24 changed files with 2842 additions and 153 deletions
+32
View File
@@ -0,0 +1,32 @@
export const CONNECT_WORKFLOW_INSTRUCTIONS = `You are executing the CONNECT workflow for the currently focused node.
MISSION
Quick link: find explicitly related nodes and create edges. Fast text search only - no slow embedding search.
WORKFLOW STEPS
1. READ NODE
Call getNodesById for the focused node. Note the title, type, and key names/entities mentioned.
2. QUICK SEARCH
Call queryNodes ONCE with the most specific entity (person name, project name, company, tool).
- Use search parameter with the exact name
- Set limit: 10
DO NOT call searchContentEmbeddings - use queryNodes only for speed.
3. CREATE EDGES
From the search results, pick 2-4 nodes that are clearly related.
Call createEdge for each:
- from_node_id: focused node ID
- to_node_id: related node ID
- context: { explanation: "brief reason" }
4. DONE
Reply: "Linked [title] → [list of connected node titles]"
RULES
- Total tool calls ≤ 5 (1 read + 1 search + up to 3 edges)
- Use queryNodes only - NO searchContentEmbeddings
- Only link nodes with clear, explicit relationships
- Skip if no good matches found`;
+44 -52
View File
@@ -1,71 +1,63 @@
export const INTEGRATE_WORKFLOW_INSTRUCTIONS = `You are executing the INTEGRATE workflow for the currently focused node.
MISSION
Find meaningful connections across the user's knowledge graph and append an Integration Analysis to the node.
Find meaningful connections across the user's knowledge graph, create edges, and append an Integration Analysis.
YOU HAVE DIRECT WRITE ACCESS via updateNode. The tool automatically appends you cannot overwrite existing content.
YOU HAVE DIRECT WRITE ACCESS via updateNode (appends only) and createEdge (creates graph connections).
WORKFLOW STEPS
0. PLAN (MANDATORY)
- Call think to outline your approach for steps 14
- Focus on what entities/concepts to extract and how to search for them
1. RETRIEVE & GROUND THE NODE
1. RETRIEVE & UNDERSTAND
- Call getNodesById for the focused node
- Identify what type of thing this is (person, project, paper, idea, video, tweet, technique, etc.)
- Extract key entities: specific names, projects, concepts, techniques mentioned
- Summarize the core insight in one sentence
- Identify: what type of thing is this? (person, project, paper, idea, video, etc.)
- Extract key entities: names, projects, concepts, techniques
- Note the core insight in one sentence
2. SEARCH FOR CONNECTIONS
Search the database using entities from step 1:
a) Structural connections:
- Names mentioned → queryNodes to find nodes about those people
- Projects/tools mentioned → queryNodes to find those nodes
2. SEARCH THE DATABASE FOR CONNECTIONS
Search the ENTIRE database:
a) Obvious structural connections:
- If names mentioned → queryNodes to find existing nodes about those people
- If projects mentioned → queryNodes to find those project nodes
- If specific techniques/tools mentioned → search for those exact terms
b) Thematic connections:
- Use searchContentEmbeddings with key concepts from step 1
- Use searchContentEmbeddings with key concepts
- Look for shared themes, complementary ideas, contradictions
- Prefer nodes with high-signal relevance over weak matches
- Aim for 38 strong connections, not 20 weak ones
- Check existing edges with queryEdge to avoid duplicating connections
3. CONTEXTUALIZE WITH TOP NODES
Review the BACKGROUND CONTEXT (top nodes by edge count):
- Why might this node matter given the user's focus areas?
- Does it advance any themes visible in their most connected nodes?
- Keep this brief 12 sentences maximum
Target: 3-5 strong connections (quality over quantity)
3. CREATE EDGES
For each connection found, call createEdge:
- from_node_id: the focused node ID
- to_node_id: the connected node ID
- context: { explanation: "why this connection matters" }
The tool handles duplicates gracefully - if edge exists, it returns an error and you continue.
Create 3-5 edges total.
4. DOCUMENT IN CONTENT
Call updateNode ONCE with ONLY this new section:
4. APPEND INTEGRATION ANALYSIS
Call updateNode ONCE with ONLY the new section (do NOT include existing content):
---
## Integration Analysis
[23 sentences: what this node is, why it matters, core insight]
**Database Connections:**
- [NODE:123:"Title"] — [why: authorship/shared concept/dependency/contradiction]
- [NODE:456:"Title"] — [why: ...]
- [continue for 38 connections found in step 2]
**Relevance:** [12 sentences connecting to user's top nodes/focus areas]
CRITICAL: Send ONLY this new section. The tool will automatically append it to existing content.
After ONE successful updateNode call, IMMEDIATELY move to step 5. Do NOT call updateNode again.
[2-3 sentences: what this is, why it matters, core insight]
**Connections:**
- [NODE:123:"Title"] — [why connected]
- [NODE:456:"Title"] — [why connected]
[list all edges created in step 3]
CRITICAL: Send ONLY the new section. The tool appends automatically.
5. RETURN SUMMARY
Reply with: Task / Actions / Result / Nodes / Follow-up (≤120 words)
Reply with: Task / Actions / Result / Nodes / Follow-up (≤100 words)
CRITICAL RULES
- Search the FULL database, not just top nodes
- Use entities from step 1 to guide searches in step 2
- Call updateNode EXACTLY ONCE - after success, move to step 5 immediately
- Keep total tool calls ≤ 18 (be efficient)
- Adapt to any node type don't assume it's always a paper or video
RULES
- Keep total tool calls ≤ 12
- Create edges BEFORE documenting (step 3 before step 4)
- Call updateNode exactly once
- Adapt to any node type
The goal: integrate this node into the knowledge graph through meaningful, database-wide connections.`;
OPTIONAL: Call think at any point if you need to plan your approach.`;
+32
View File
@@ -0,0 +1,32 @@
export const PREP_WORKFLOW_INSTRUCTIONS = `You are executing the PREP workflow for the currently focused node.
MISSION
Quick summary to help the user decide if this content is worth deeper engagement.
WORKFLOW STEPS
1. READ THE NODE
- Call getNodesById for the focused node
- Understand what this is and extract the core message
2. APPEND BRIEF
Call updateNode ONCE with ONLY this section:
---
## Brief
**What:** [One sentence - what is this?]
**Gist:** [2-3 sentences - the core message or takeaway]
**Why it matters:** [1-2 sentences - relevance or implications]
CRITICAL: Send ONLY the new section. The tool appends automatically.
3. RETURN SUMMARY
Reply with a one-line confirmation: "Prepped [title] - [gist in <10 words]"
RULES
- Keep total tool calls ≤ 3
- Call updateNode exactly once
- Be concise - this is a quick prep, not deep analysis`;
+41
View File
@@ -0,0 +1,41 @@
export const RESEARCH_WORKFLOW_INSTRUCTIONS = `You are executing the RESEARCH workflow for the currently focused node.
MISSION
Conduct background research on the topic/person/concept and append findings to the node.
WORKFLOW STEPS
1. READ & IDENTIFY
- Call getNodesById for the focused node
- Identify: what needs researching? (person's background, concept origins, recent developments, etc.)
2. WEB RESEARCH
- Call webSearch with targeted queries (1-2 searches)
- Focus on: background context, recent news, authoritative sources
- Extract the most relevant findings
3. APPEND RESEARCH
Call updateNode ONCE with ONLY this section:
---
## Research Notes
**Background:** [2-3 sentences of context]
**Key Findings:**
- [Finding 1]
- [Finding 2]
- [Finding 3]
**Sources:** [Brief attribution]
CRITICAL: Send ONLY the new section. The tool appends automatically.
4. RETURN SUMMARY
Reply with: "Researched [topic] - [key insight in <15 words]"
RULES
- Keep total tool calls ≤ 5
- Call updateNode exactly once
- Focus on factual background, not opinion
- Cite sources when possible`;
+47
View File
@@ -0,0 +1,47 @@
export const SURVEY_WORKFLOW_INSTRUCTIONS = `You are executing the SURVEY workflow for the currently active dimension.
MISSION
Analyze the active dimension to identify patterns, themes, gaps, and insights across all nodes within it.
PREREQUISITE: This workflow requires an active dimension. Check ACTIVE DIMENSION section in context.
WORKFLOW STEPS
1. RETRIEVE DIMENSION NODES
- Call queryDimensionNodes with the active dimension name
- Set limit to 50 to get a comprehensive view
- Note the total count and most connected nodes
2. ANALYZE THEMES
- Call searchContentEmbeddings with key concepts from the dimension
- Identify recurring themes, patterns, and relationships
- Note any gaps or underrepresented areas
3. DOCUMENT FINDINGS
Call updateDimension to update the dimension description with:
**Survey Summary** (append to existing description)
**Node Count:** [X nodes]
**Top Hubs:** [List 3-5 most connected nodes with [NODE:id:"title"]]
**Themes:**
- [Theme 1 - brief description]
- [Theme 2 - brief description]
**Gaps/Opportunities:**
- [Identified gap or area for expansion]
**Connections to Other Dimensions:**
- [Any cross-dimension patterns observed]
4. RETURN SUMMARY
Reply with: "Surveyed [dimension] — [X nodes, key insight in <15 words]"
RULES
- Keep total tool calls ≤ 5
- Focus on patterns across the dimension, not individual node details
- Identify both strengths (dense areas) and gaps (sparse areas)
- Reference specific nodes using [NODE:id:"title"] format
If no active dimension is set, inform the user to open a dimension folder first.`;