Sypha AI Docs
FeaturesSlash commands

Workflows

With Workflows, you can establish a sequence of actions that direct Sypha through recurring tasks, including service deployments and PR submissions.

To trigger a workflow, enter /[workflow-name.md] into the chat.

How to Create and Use Workflows

Workflows are stored in the same location as Sypha Rules. Setting one up is simple:

Workflows tab in Sypha
  1. Compose a markdown file containing explicit instructions for each step Sypha needs to execute
  2. Store it using a .md extension within your workflows directory
  3. To activate a workflow, simply enter / followed by the workflow's filename
  4. Supply any necessary parameters when requested

The true strength lies in how you organize your workflow files. You have the ability to:

  • Utilize Sypha's built-in tools such as ask_followup_question, read_file, search_files, and new_task
  • Incorporate command-line utilities already present on your system like gh or docker
  • Call upon external MCP tool calls such as Slack or Whatsapp
  • Link multiple operations in a defined order

Real-world Example

I built a PR Review workflow that's proving to be an incredible time-saver.

The `gh` terminal command is available to you. Authentication has been completed on your behalf. Please utilize it to review the PR that I've requested you to examine. You're currently working within the `sypha` repo.

<detailed_sequence_of_steps>

# GitHub PR Review Process - Detailed Sequence of Steps

## 1. Collect PR Information

1. Retrieve the PR title, description, and comments:

    ```bash
    gh pr view <PR-number> --json title,body,comments
    ```

2. Obtain the complete diff of the PR:
    ```bash
    gh pr diff <PR-number>
    ```

## 2. Comprehend the Context

1. Determine which files have been modified in the PR:

    ```bash
    gh pr view <PR-number> --json files
    ```

2. Inspect the original files from the main branch to grasp the context:

    ```xml
    <read_file>
    <path>path/to/file</path>
    </read_file>
    ```

3. For particular sections within a file, utilize search_files:
    ```xml
    <search_files>
    <path>path/to/directory</path>
    <regex>search term</regex>
    <file_pattern>*.ts</file_pattern>
    </search_files>
    ```

## 3. Examine the Modifications

1. For every altered file, comprehend:

    - What modifications were made
    - The rationale behind the changes (derived from PR description)
    - The impact on the codebase
    - Possible side effects

2. Search for:
    - Issues related to code quality
    - Possible bugs
    - Performance ramifications
    - Security vulnerabilities
    - Testing coverage

## 4. Request User Confirmation

1. Prior to reaching a decision, inquire whether the user wants you to approve the PR, presenting your evaluation and reasoning:

    ```xml
    <ask_followup_question>
    <question>Based on my review of PR #<PR-number>, I recommend [approving/requesting changes]. Here's my justification:

    [Detailed justification with key points about the PR quality, implementation, and any concerns]

    Would you like me to proceed with this recommendation?</question>
    <options>["Yes, approve the PR", "Yes, request changes", "No, I'd like to discuss further"]</options>
    </ask_followup_question>
    ```

## 5. Inquire About Comment Drafting

1. Following the user's approval/rejection decision, ask whether they'd like a comment composed:

    ```xml
    <ask_followup_question>
    <question>Would you like me to draft a comment for this PR that you can copy and paste?</question>
    <options>["Yes, please draft a comment", "No, I'll handle the comment myself"]</options>
    </ask_followup_question>
    ```

2. Should the user request a drafted comment, deliver a well-organized comment they can copy:

    ```
    Thank you for this PR! Here's my assessment:

    [Detailed assessment with key points about the PR quality, implementation, and any suggestions]

    [Include specific feedback on code quality, functionality, and testing]
    ```

## 6. Reach a Conclusion

1. Approve the PR when it satisfies quality standards:

    ```bash
    # For single-line comments:
    gh pr review <PR-number> --approve --body "Your approval message"

    # For multi-line comments with proper whitespace formatting:
    cat << EOF | gh pr review <PR-number> --approve --body-file -
    Thanks @username for this PR! The implementation looks good.

    I particularly like how you've handled X and Y.

    Great work!
    EOF
    ```

2. Request modifications when improvements are necessary:

    ```bash
    # For single-line comments:
    gh pr review <PR-number> --request-changes --body "Your feedback message"

    # For multi-line comments with proper whitespace formatting:
    cat << EOF | gh pr review <PR-number> --request-changes --body-file -
    Thanks @username for this PR!

    The implementation looks promising, but there are a few things to address:

    1. Issue one
    2. Issue two

    Please make these changes and we can merge this.
    EOF
    ```

    Note: The `cat << EOF | ... --body-file -` method maintains all whitespace and formatting without needing temporary files. The `-` parameter instructs the command to read from standard input.
    </detailed_sequence_of_steps>

<example_review_process>

# Example PR Review Process

Let's examine an actual example of reviewing PR #3627 which addresses the thinking mode calculation for Claude 3.7 models.

## Step 1: Collect PR Information

```bash
# Get PR details
gh pr view 3627 --json title,body,comments

# Get the full diff
gh pr diff 3627
```

## Step 2: Comprehend the Context

```xml
# Inspect the original files to understand what's being modified
<read_file>
<path>src/shared/api.ts</path>
</read_file>

# Look at the ThinkingBudgetSlider component implementation
<read_file>
<path>webview-ui/src/components/settings/ThinkingBudgetSlider.tsx</path>
</read_file>

# Verify how thinking mode is presently managed in API providers
<search_files>
<path>src/api/providers</path>
<regex>reasoningOn</regex>
<file_pattern>*.ts</file_pattern>
</search_files>
```

## Step 3: Examine the Modifications

Based on the PR information and code review, we can observe that:

1. The PR resolves an issue regarding the thinking mode budget calculation for Claude 3.7 models
2. Presently, the thinking budget is erroneously calculated as 80% of maxTokens (8192), yielding 6553 tokens
3. Claude 3.7 actually accommodates a significantly larger thinking budget (reaching 64000 tokens)
4. The PR introduces a `thinkingConfig` property with `maxBudget: 64000` to model definitions
5. It modifies API handlers to utilize this value when reasoning mode is activated
6. It improves the slider component to compute max values according to model-specific percentages
7. Thorough tests have been added to validate the calculations

## Step 4: Request User Confirmation

```xml
<ask_followup_question>
<question>Based on my review of PR #3627, I recommend approving this PR. Here's my justification:

1. The PR correctly fixes the thinking mode budget calculation for Claude 3.7 models
2. It properly implements the thinkingConfig.maxBudget property (64000) for Claude 3.7 models
3. It applies the appropriate percentage (50%) for the slider calculation
4. The changes are well-tested with comprehensive unit tests
5. The implementation is clean and follows the project's coding standards
6. The PR includes helpful screenshots demonstrating the fix

Would you like me to proceed with approving this PR?</question>
<options>["Yes, approve the PR", "No, I'd like to discuss further", "Let me review it myself first"]</options>
</ask_followup_question>
```

## Step 5: Inquire About Comment Drafting

```xml
<ask_followup_question>
<question>Would you like me to draft a comment for this PR that you can copy and paste?</question>
<options>["Yes, please draft a comment", "No, I'll handle the comment myself"]</options>
</ask_followup_question>
```

## Step 6: Reach a Conclusion

```bash
# Option 1: Simple one-line comment
gh pr review 3627 --approve --body "This PR looks good! It correctly fixes the thinking mode budget calculation for Claude 3.7 models."

# Option 2: Multi-line comment with proper whitespace formatting
cat << EOF | gh pr review 3627 --approve --body-file -
This PR looks good! It correctly fixes the thinking mode budget calculation for Claude 3.7 models.

I particularly like:
1. The proper implementation of thinkingConfig.maxBudget property (64000)
2. The appropriate percentage (50%) for the slider calculation
3. The comprehensive unit tests
4. The clean implementation that follows project coding standards

Great work!
EOF
```

</example_review_process>

<common_gh_commands>

# Common GitHub CLI Commands for PR Review

## Basic PR Commands

```bash
# List open PRs
gh pr list

# View a specific PR
gh pr view <PR-number>

# View PR with specific fields
gh pr view <PR-number> --json title,body,comments,files,commits

# Check PR status
gh pr status
```

## Diff and File Commands

```bash
# Get the full diff of a PR
gh pr diff <PR-number>

# List files changed in a PR
gh pr view <PR-number> --json files

# Check out a PR locally
gh pr checkout <PR-number>
```

## Review Commands

```bash
# Approve a PR (single-line comment)
gh pr review <PR-number> --approve --body "Your approval message"

# Approve a PR (multi-line comment with proper whitespace)
cat << EOF | gh pr review <PR-number> --approve --body-file -
Your multi-line
approval message with

proper whitespace formatting
EOF

# Request changes on a PR (single-line comment)
gh pr review <PR-number> --request-changes --body "Your feedback message"

# Request changes on a PR (multi-line comment with proper whitespace)
cat << EOF | gh pr review <PR-number> --request-changes --body-file -
Your multi-line
change request with

proper whitespace formatting
EOF

# Add a comment review (without approval/rejection)
gh pr review <PR-number> --comment --body "Your comment message"

# Add a comment review with proper whitespace
cat << EOF | gh pr review <PR-number> --comment --body-file -
Your multi-line
comment with

proper whitespace formatting
EOF
```

## Additional Commands

```bash
# View PR checks status
gh pr checks <PR-number>

# View PR commits
gh pr view <PR-number> --json commits

# Merge a PR (if you have permission)
gh pr merge <PR-number> --merge
```

</common_gh_commands>

<general_guidelines_for_commenting>
During PR reviews, communicate naturally and adopt a friendly reviewer demeanor. Maintain brevity, beginning by thanking the PR author and @ mentioning them.

Regardless of approval status, offer a brief summary of the modifications without excessive verbosity or certainty, maintaining humility by presenting it as your interpretation of the changes. Similar to my current communication style with you.

When you have suggestions or required changes, opt for requesting changes rather than approving the PR.

Inline code comments are valuable, but should only be used when you have particular insights about the code. Ensure you post those comments initially, then request changes in the PR with a concise comment outlining the overarching theme of your change requests.
</general_guidelines_for_commenting>

<example_comments_that_i_have_written_before>
<brief_approve_comment>
Looks good, though we should make this generic for all providers & models at some point
</brief_approve_comment>
<brief_approve_comment>
Will this work for models that may not match across OR/Gemini? Like the thinking models?
</brief_approve_comment>
<approve_comment>
This looks great! I like how you've handled the global endpoint support - adding it to the ModelInfo interface makes total sense since it's just another capability flag, similar to how we handle other model features.

The filtered model list approach is clean and will be easier to maintain than hardcoding which models work with global endpoints. And bumping the genai library was obviously needed for this to work.

Thanks for adding the docs about the limitations too - good for users to know they can't use context caches with global endpoints but might get fewer 429 errors.
</approve_comment>
<requesst_changes_comment>
This is awesome. Thanks @scottsus.

My main concern though - does this work for all the possible VS Code themes? We struggled with this initially which is why it's not super styled currently. Please test and share screenshots with the different themes to make sure before we can merge
</request_changes_comment>
<request_changes_comment>
Hey, the PR looks good overall but I'm concerned about removing those timeouts. Those were probably there for a reason - VSCode's UI can be finicky with timing.

Could you add back the timeouts after focusing the sidebar? Something like:

```typescript
await vscode.commands.executeCommand("claude-dev.SidebarProvider.focus")
await setTimeoutPromise(100) // Give UI time to update
visibleWebview = WebviewProvider.getSidebarInstance()
```

</request_changes_comment>
<request_changes_comment>
Heya @alejandropta thanks for working on this!

A few notes:
1 - Adding additional info to the environment variables is fairly problematic because env variables get appended to **every single message**. I don't think this is justifiable for a somewhat niche use case.
2 - Adding this option to settings to include that could be an option, but we want our options to be simple and straightforward for new users
3 - We're working on revisualizing the way our settings page is displayed/organized, and this could potentially be reconciled once that is in and our settings page is more clearly delineated.

So until the settings page is update, and this is added to settings in a way that's clean and doesn't confuse new users, I don't think we can merge this. Please bear with us.
</request_changes_comment>
<request_changes_comment>
Also, don't forget to add a changeset since this fixes a user-facing bug.

The architectural change is solid - moving the focus logic to the command handlers makes sense. Just don't want to introduce subtle timing issues by removing those timeouts.
</request_changes_comment>
</example_comments_that_i_have_written_before>

When a new PR arrives for review, I previously gathered context manually: reviewing the PR description, analyzing the diff, examining related files, and ultimately forming my assessment. Now my process is simply:

  1. Enter /pr-review.md in chat
  2. Provide the PR number
  3. Allow Sypha to manage the rest

My workflow leverages the gh command-line tool and Sypha's built-in ask_followup_question to:

  • Retrieve the PR description and comments
  • Analyze the diff
  • Inspect related files for context
  • Evaluate potential problems
  • Ask whether I want to approve it if everything checks out, including justification for the approval recommendation
  • Upon my affirmation, Sypha automatically approves the PR using the gh command

This has transformed my PR review process from a manual, multi-phase operation into a single command that delivers everything needed for an informed decision.

This represents just one example of a workflow file. Additional examples can be found in our prompts repository for inspiration.

Constructing Your Own Workflows

The elegance of workflows lies in their complete adaptability to your requirements. You can develop workflows for numerous repetitive tasks:

  • For release management, you could design a workflow that collects all merged PRs, generates a changelog, and manages version increments.
  • Project initialization is ideal for workflows. Execute a single command to establish your directory structure, install dependencies, and configure settings.
  • Need to generate a report? Build a workflow that aggregates statistics from various sources and formats them to your specifications. You can even create visualizations using a charting library and produce a presentation with a tool like slidev.
  • You can also employ workflows to compose team messages via an MCP server like Slack or Whatsapp following PR submission.

With Workflows, your creativity is the only boundary. The genuine power emerges from identifying those frustrating repetitive tasks you perform regularly.

If you can articulate something as "first I do X, then Y, then Z" - you've found an ideal workflow candidate.

Begin with a minor annoyance, transform it into a workflow, and continuously refine it. You'll be amazed at how much of your workday can be automated through this approach.

On this page