Available Routines
| Routine | Trigger | Purpose |
|---|---|---|
| Bootstrap | nightshift install (new workspace) | Configures workspace based on user intent |
How Routines Work
Each routine follows a common pattern:- Initialization: Nightshift sets up the environment and launches an OpenCode server
- User Input (Optional): A routine may collect necessary information from the user
- Agent Execution: The agent receives a specialized prompt and executes autonomously
- Event Streaming (Optional): There could be modes where a user will want to se the output of an Agent Routine in real time
- Completion: The routine finishes
Building Custom Routines
Routines are built on top of the OpenCode SDK. The key components are:@opencode-ai/sdk/v2- Client for communicating with the OpenCode server- Event subscription - Stream events like
message.part.updated,question.asked,session.idle - Permission handling - Auto-approve or prompt for tool permissions
- UI callbacks - Display agent output in a custom interface
