Understanding Tasks
Learn what tasks are in Sypha, how they work, and how to create effective prompts for better results.
What are Tasks?
The majority of users engage with Sypha via tasks - the core unit of work powering every coding session. Whether you're developing a new feature, resolving a bug, restructuring code, or exploring a codebase, all interactions with Sypha occur within a task's context. A task encapsulates a complete conversation and work session between you and the AI agent, initiated through prompts - the directives you supply to communicate what you aim to achieve. Tasks function as self-contained work sessions capturing your entire dialogue with Sypha, encompassing all code modifications, command executions, and decisions reached throughout.
This methodology ensures your work remains organized, traceable, and resumable. Every task maintains its own isolated context, enabling simultaneous work on multiple projects without confusion. The elegance of Sypha's task system resides in its flexibility and persistence, delivering a collaborative coding session where you supply the direction through prompts, and Sypha executes your vision with precision.
Key Characteristics
Every task in Sypha:
- Has a unique identifier: Each task receives its own ID and dedicated storage directory
- Contains the full conversation: All messages, tool usage, and results are retained
- Tracks resources used: Token consumption, API expenditures, and execution duration are monitored
- Can be interrupted and resumed: Tasks preserve their state across VSCode sessions
- Creates checkpoints: File modifications are tracked through Git-based snapshots
- Enables documentation: Tasks can be exported as markdown for team documentation
- Provides cost management: Resource tracking facilitates monitoring of API usage and expenses
These capabilities transform Sypha from merely a coding tool into a comprehensive development agent comprehending the complete lifecycle of your work.
Creating Tasks with Prompts
Tasks originate with prompts - your directives to Sypha. The quality of your outcomes relies significantly on how you articulate what you desire.
Prompt Components
A properly structured prompt typically encompasses:
- Goal: The outcome you wish to accomplish
- Context: Background details and constraints
- Requirements: Particular features or functionality sought
- Preferences: Technology selections, coding style, etc.
- Examples: References to guide the implementation
Want to master the art of prompting?
Deep dive into Module 1: "Prompting" in Sypha Learn to become an expert at creating effective prompts. The module covers:
- Structured prompting techniques
- Context optimization strategies
- Common prompting patterns
- Advanced prompt engineering
- Real-world examples and exercises
Good prompting skills lead to faster task completion, more accurate results, fewer iterations needed, and better code quality.
Task Execution Modes
Sypha functions in two distinct modes that structure your workflow:
- Plan Mode: For information collection, discussing methodologies, and formulating strategies without implementing changes
- Act Mode: For actual implementation where Sypha performs file modifications, executes commands, and utilizes tools
→ Learn more about Plan and Act modes to comprehend when and how to utilize each mode effectively.
Task Resources
Each task utilizes resources that are monitored:
- Tokens: The volume of text processed (input and output)
- API Costs: Monetary expense based on the model and token consumption
- Time: Duration from initiation to completion
- Checkpoints: Quantity of file state snapshots generated
Common Task Patterns
Code Generation
Create a TypeScript function that validates email addresses using regex.
Include unit tests using Jest and handle edge cases like international domains.Bug Fixing
@terminal The app crashes when clicking the submit button.
Fix the error and ensure proper error handling is in place.Refactoring
Refactor the authentication logic in @auth.ts to use async/await
instead of callbacks. Maintain all existing functionality.Feature Implementation
Add a dark mode toggle to the settings page. Use the existing theme
context and persist the preference to localStorage.Task Resumption
Among Sypha's powerful capabilities is the ability to resume interrupted tasks:
When Tasks Get Interrupted
- You halt a long-running task
- An error arises requiring intervention
- You need to transition to another task
Resuming a Task
- Access the task from history
- Sypha loads the complete conversation
- File states are verified against checkpoints
- The task proceeds with awareness of the interruption
- You can supply additional context if required
Understanding Task Context
Tasks preserve context throughout their lifecycle:
- Conversation History: All prior messages and responses
- File Changes: Monitored modifications and their sequence
- Tool Results: Output from commands and operations
- Checkpoint States: Snapshots of file states at critical junctures
This context enables Sypha to:
- Comprehend what has been accomplished
- Preserve consistency in approach
- Resume work intelligently
- Learn from previous attempts
→ Learn more about Context Management to comprehend how Sypha manages and optimizes context across tasks.
Comprehending how tasks operate is fundamental to utilizing Sypha effectively. With carefully crafted prompts and an understanding of the task lifecycle, you can harness Sypha's full potential to accelerate your development workflow.