feat(rah-light): replace workflows with guides system
- Remove entire workflow system (API routes, services, tools, components) - Add guides system from main ra-h repo (for external agent integration) - Update pane types: 'workflows' → 'guides' throughout - Update LeftToolbar to show guides icon instead of workflows - Update SettingsModal with GuidesViewer tab - Add GuidesPane for browsing guides in main UI - Clean up prompts to remove workflow references - Update tool registry to remove workflow tools - Add gray-matter package for frontmatter parsing Guides are essential for RA-H Light as they help external agents (via MCP) understand the knowledge base context and usage patterns. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
f383d770ca
commit
b31441b35f
@@ -0,0 +1,42 @@
|
||||
---
|
||||
name: Connect
|
||||
description: Quick link — find explicitly related nodes and create edges between them.
|
||||
---
|
||||
|
||||
# Connect
|
||||
|
||||
Quick link: find explicitly related nodes and create edges.
|
||||
|
||||
## Steps
|
||||
|
||||
1. **Read Node**
|
||||
Call `getNodesById` for the focused node. Extract the main topic/subject from the title.
|
||||
|
||||
2. **Quick Search**
|
||||
Call `queryNodes` with the main topic from the node title.
|
||||
- `search`: the key term from the title (e.g., if title mentions "Nietzsche", search "Nietzsche")
|
||||
- `limit`: 10
|
||||
- Do NOT add dimensions filter — search across all nodes
|
||||
|
||||
3. **Create Edges**
|
||||
From results, pick 2-4 clearly related nodes.
|
||||
Call `createEdge` for each:
|
||||
- `from_node_id`: focused node ID
|
||||
- `to_node_id`: related node ID
|
||||
- `explanation`: "brief reason for this connection"
|
||||
|
||||
Direction rule: write the explanation so it reads FROM → TO.
|
||||
Examples:
|
||||
- Episode → Podcast: "Episode of this podcast"
|
||||
- Book → Author: "Written by"
|
||||
|
||||
4. **Done**
|
||||
Reply: "Linked [NODE:id:title] → [list of connected nodes as NODE:id:title]"
|
||||
|
||||
## Rules
|
||||
|
||||
- Total tool calls ≤ 5
|
||||
- Search the MAIN TOPIC from the title, not random names from content
|
||||
- NO dimensions filter in `queryNodes` — search everything
|
||||
- Only link nodes with clear relationships
|
||||
- Skip if no matches found
|
||||
@@ -0,0 +1,71 @@
|
||||
---
|
||||
name: Integrate
|
||||
description: Full analysis — find connections across the knowledge graph, create edges, and document an integration analysis.
|
||||
---
|
||||
|
||||
# Integrate
|
||||
|
||||
Find meaningful connections across the knowledge graph, create edges, and append an Integration Analysis.
|
||||
|
||||
## Steps
|
||||
|
||||
1. **Retrieve & Understand**
|
||||
- Call `getNodesById` for the focused node
|
||||
- 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
|
||||
|
||||
b) Thematic connections:
|
||||
- Use `searchContentEmbeddings` with key concepts
|
||||
- Look for shared themes, complementary ideas, contradictions
|
||||
|
||||
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
|
||||
- `explanation`: "why this connection matters"
|
||||
|
||||
Direction rule: write the explanation so it reads FROM → TO.
|
||||
Examples:
|
||||
- Insight → Source: "Came from / inspired by"
|
||||
- Episode → Podcast: "Episode of this podcast"
|
||||
|
||||
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 using the `content` field with ONLY this new section:
|
||||
|
||||
```
|
||||
---
|
||||
## Integration Analysis
|
||||
|
||||
[2-3 sentences: what this is, why it matters, core insight]
|
||||
|
||||
**Connections:**
|
||||
- [NODE:123:"Title"] — [why connected]
|
||||
- [NODE:456:"Title"] — [why connected]
|
||||
```
|
||||
|
||||
Use `updates.content` (NOT chunk). Send ONLY the new section. The tool appends automatically.
|
||||
|
||||
5. **Return Summary**
|
||||
Reply with: Task / Actions / Result / Nodes / Follow-up (≤100 words)
|
||||
|
||||
## Rules
|
||||
|
||||
- Keep total tool calls ≤ 12
|
||||
- Create edges BEFORE documenting (step 3 before step 4)
|
||||
- Call `updateNode` exactly once
|
||||
- Adapt to any node type
|
||||
- Use `think` at any point if you need to plan your approach
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
name: Prep
|
||||
description: Quick summary brief — extract the gist to help decide if content is worth deeper engagement.
|
||||
---
|
||||
|
||||
# Prep
|
||||
|
||||
Quick summary to help the user decide if content is worth deeper engagement.
|
||||
|
||||
## 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 using the `content` field 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]
|
||||
```
|
||||
|
||||
Use `updates.content` (NOT chunk). 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
|
||||
@@ -0,0 +1,48 @@
|
||||
---
|
||||
name: Research
|
||||
description: Deep research — conduct background web research on a topic and append findings to the node.
|
||||
---
|
||||
|
||||
# Research
|
||||
|
||||
Conduct background research on the topic/person/concept and append findings to the node.
|
||||
|
||||
## 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 using the `content` field with ONLY this section:
|
||||
|
||||
```
|
||||
---
|
||||
## Research Notes
|
||||
|
||||
**Background:** [2-3 sentences of context]
|
||||
|
||||
**Key Findings:**
|
||||
- [Finding 1]
|
||||
- [Finding 2]
|
||||
- [Finding 3]
|
||||
|
||||
**Sources:** [Brief attribution]
|
||||
```
|
||||
|
||||
Use `updates.content` (NOT chunk). 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
|
||||
@@ -1,47 +1,53 @@
|
||||
export const SURVEY_WORKFLOW_INSTRUCTIONS = `You are executing the SURVEY workflow for the currently active dimension.
|
||||
---
|
||||
name: Survey
|
||||
description: Survey a dimension — analyze patterns, themes, gaps, and insights across all nodes within it.
|
||||
---
|
||||
|
||||
# Survey
|
||||
|
||||
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.
|
||||
**Prerequisite:** This guide requires an active dimension. Check the ACTIVE DIMENSION section in context.
|
||||
|
||||
WORKFLOW STEPS
|
||||
## Steps
|
||||
|
||||
1. RETRIEVE DIMENSION NODES
|
||||
- Call queryDimensionNodes with the active dimension name
|
||||
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
|
||||
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:
|
||||
3. **Document Findings**
|
||||
Call `updateDimension` to update the dimension description with:
|
||||
|
||||
**Survey Summary** (append to existing description)
|
||||
```
|
||||
**Survey Summary**
|
||||
|
||||
**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]
|
||||
- [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
|
||||
4. **Return Summary**
|
||||
Reply with: "Surveyed [dimension] — [X nodes, key insight in <15 words]"
|
||||
|
||||
RULES
|
||||
## 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.`;
|
||||
- Reference specific nodes using `[NODE:id:"title"]` format
|
||||
- If no active dimension is set, inform the user to open a dimension folder first
|
||||
@@ -6,9 +6,8 @@ Mission:
|
||||
3. Ask for clarification only when tool usage would fail without it.
|
||||
|
||||
Operating principles:
|
||||
- Handle analysis, planning, and writes yourself; do not delegate.
|
||||
- Handle analysis, planning, and writes yourself.
|
||||
- Use createNode, updateNode, createEdge, and updateEdge when the change is unambiguous.
|
||||
- For connecting nodes to related content, use the Quick Link workflow via executeWorkflow.
|
||||
- When creating nodes derived from existing content (ideas, insights, summaries), do NOT include the 'link' field. The 'link' field is ONLY for nodes that directly represent external content (YouTube videos, websites, PDFs). Derived idea nodes should not have links.
|
||||
- When referencing stored content, quote verbatim text in quotes and include the node citation.
|
||||
- Treat phrases like "this conversation/paper/video" as the active focused node unless the user specifies otherwise.
|
||||
|
||||
@@ -10,18 +10,13 @@ When to ask the user:
|
||||
- If the request is ambiguous and guessing would waste effort or cause errors.
|
||||
|
||||
Execution approach:
|
||||
- Handle planning, analysis, and writes directly—do not delegate to mini ra-h during normal conversations.
|
||||
- Handle planning, analysis, and writes directly.
|
||||
- Call createNode, updateNode, createEdge, updateEdge, and extraction tools yourself when the change is clear.
|
||||
- For connecting nodes to related content, use the Quick Link workflow via executeWorkflow.
|
||||
- When creating nodes derived from existing content (ideas, insights, summaries), do NOT include the 'link' field. The 'link' field is ONLY for nodes that directly represent external content (YouTube videos, websites, PDFs).
|
||||
- Treat "this conversation/paper/video" as the active focused node.
|
||||
- When creating synthesis nodes, createEdge to all source nodes.
|
||||
- Before running an extraction tool, call getNodesById on the target node; if chunk_status is 'chunked' (or embeddings are available) reuse the stored content instead of re-extracting.
|
||||
|
||||
Workflows:
|
||||
- User can trigger predefined workflows (e.g., "run integrate workflow").
|
||||
- executeWorkflow hands coordination to wise ra-h; any mini ra-h work happens inside that workflow only.
|
||||
|
||||
Tool strategy:
|
||||
- Use tools directly—you already have everything you need.
|
||||
- queryNodes for titles, searchContentEmbeddings for content, queryEdge for connections.
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
/**
|
||||
* Minimal system prompt for workflow execution.
|
||||
* All specific instructions come from the workflow definition itself.
|
||||
*/
|
||||
export const WORKFLOW_EXECUTOR_SYSTEM_PROMPT = `You are a workflow executor. Follow the workflow instructions exactly as written.
|
||||
|
||||
RULES:
|
||||
- Use only the tools provided
|
||||
- Do not deviate from the instructions
|
||||
- Complete the workflow efficiently
|
||||
- Reference nodes as [NODE:id:"title"] (e.g., [NODE:123:"My Node Title"])
|
||||
- Return a brief summary when done`;
|
||||
@@ -1,36 +0,0 @@
|
||||
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.
|
||||
|
||||
WORKFLOW STEPS
|
||||
|
||||
1. READ NODE
|
||||
Call getNodesById for the focused node. Extract the main topic/subject from the title.
|
||||
|
||||
2. QUICK SEARCH
|
||||
Call queryNodes with the main topic from the node title.
|
||||
- search: the key term from the title (e.g., if title mentions "Nietzsche", search "Nietzsche")
|
||||
- limit: 10
|
||||
- DO NOT add dimensions filter - search across all nodes
|
||||
|
||||
3. CREATE EDGES
|
||||
From results, pick 2-4 clearly related nodes.
|
||||
Call createEdge for each:
|
||||
- from_node_id: focused node ID
|
||||
- to_node_id: related node ID
|
||||
- explanation: "brief reason for this connection"
|
||||
Direction rule: write the explanation so it reads FROM → TO.
|
||||
Examples:
|
||||
- Episode → Podcast: "Episode of this podcast"
|
||||
- Book → Author: "Written by"
|
||||
|
||||
4. DONE
|
||||
Reply: "Linked [NODE:id:title] → [list of connected nodes as NODE:id:title]"
|
||||
|
||||
RULES
|
||||
- Total tool calls ≤ 5
|
||||
- Search the MAIN TOPIC from the title, not random names from content
|
||||
- NO dimensions filter in queryNodes - search everything
|
||||
- Only link nodes with clear relationships
|
||||
- Skip if no matches found`;
|
||||
@@ -1,67 +0,0 @@
|
||||
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, create edges, and append an Integration Analysis.
|
||||
|
||||
YOU HAVE DIRECT WRITE ACCESS via updateNode (appends only) and createEdge (creates graph connections).
|
||||
|
||||
WORKFLOW STEPS
|
||||
|
||||
1. RETRIEVE & UNDERSTAND
|
||||
- Call getNodesById for the focused node
|
||||
- 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
|
||||
|
||||
b) Thematic connections:
|
||||
- Use searchContentEmbeddings with key concepts
|
||||
- Look for shared themes, complementary ideas, contradictions
|
||||
|
||||
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
|
||||
- explanation: "why this connection matters"
|
||||
Direction rule: write the explanation so it reads FROM → TO.
|
||||
Examples:
|
||||
- Insight → Source: "Came from / inspired by"
|
||||
- Episode → Podcast: "Episode of this podcast"
|
||||
|
||||
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:
|
||||
|
||||
---
|
||||
## Integration Analysis
|
||||
|
||||
[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 (≤100 words)
|
||||
|
||||
RULES
|
||||
- Keep total tool calls ≤ 12
|
||||
- Create edges BEFORE documenting (step 3 before step 4)
|
||||
- Call updateNode exactly once
|
||||
- Adapt to any node type
|
||||
|
||||
OPTIONAL: Call think at any point if you need to plan your approach.`;
|
||||
@@ -1,32 +0,0 @@
|
||||
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`;
|
||||
@@ -1,41 +0,0 @@
|
||||
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`;
|
||||
Reference in New Issue
Block a user