Deco
decocms

prompt_read

Read a prompt template from the current scope

Overview

Reads a prompt template from the current scope. Supports scope inheritance like resources (project inherits from org, agent inherits from project+org). Prompt templates provide reusable instructions and workflows.

Availability

  • Tasks: ✓ Available
  • Subtasks: ✓ Available

Signature

 prompt_read(
  prompt_name: string,
  options?: RangeOptions
)

type RangeOptions = {
  lineStart?: number
  lineEnd?: number
} 

Parameters

Parameter Type Required Description
prompt_name string Required Name of the prompt template
options RangeOptions Optional Line range options
options.lineStart number Optional Starting line number (default: 0)
options.lineEnd number Optional Ending line number (default: 20)

Returns

Prompt template content and metadata:

  • content: The prompt template text
  • name: Prompt template name
  • metadata: Additional prompt information

Behavior

  • Supports scope inheritance (same as resource_read ):
    • Project prompts inherit from organization prompts
    • Agent prompts inherit from project + organization prompts
  • Set both options.lineStart and options.lineEnd to 0 to read entire prompt
  • Default behavior (no options) reads first 20 lines (lines 0-20)
  • Line numbers are zero-indexed

Example Usage

Read Entire Prompt

 // Read entire code review prompt
prompt_read("code-review-workflow", { lineStart: 0, lineEnd: 0 }) 

Read Specific Lines

 // Read lines 5-15 of deployment prompt
prompt_read("deployment-steps", { lineStart: 5, lineEnd: 15 }) 

Read Beginning of Prompt

 // Read first 20 lines (default)
prompt_read("bug-fix-workflow") 

Workflow Templates

 // Read feature development workflow
prompt_read("feature-workflow", { lineStart: 0, lineEnd: 0 })

// Read bug triage workflow
prompt_read("bug-triage", { lineStart: 0, lineEnd: 0 })

// Read code review checklist
prompt_read("review-checklist", { lineStart: 0, lineEnd: 0 }) 

Use Cases

Workflow Execution

Follow standardized workflows:

 // Read deployment workflow
const workflow = prompt_read("deploy-to-production", { lineStart: 0, lineEnd: 0 })

// Execute each step in the workflow
// ... workflow execution logic 

Template Reuse

Use prompt templates for consistent task execution:

 // Read bug fix template
const template = prompt_read("bug-fix-template", { lineStart: 0, lineEnd: 0 })

// Apply template structure to current bug
// ... bug fix logic 

Domain-Specific Instructions

Access specialized instructions:

 // Read security review prompt
const securityPrompt = prompt_read("security-review", { lineStart: 0, lineEnd: 0 })

// Perform security review using the prompt
// ... security review logic 

Scope Inheritance

Prompts follow scope hierarchy (same as resources):

  1. Agent scope: Inherits from project + organization
  2. Project scope: Inherits from organization
  3. Organization scope: Base level prompts

When reading a prompt, the system searches from most specific (agent) to least specific (organization) scope.

Prompt Template Format

Prompt templates typically include:

  • Instructions: Step-by-step guidance
  • Context: Background information needed
  • Examples: Sample inputs/outputs
  • Checklist: Items to verify

Example prompt template structure:

 # Feature Development Workflow

## Instructions
1. Review the feature requirements
2. Design the implementation approach
3. Write tests first (TDD)
4. Implement the feature
5. Run all tests
6. Create pull request

## Context
- Follow the coding standards in coding-guidelines.md
- Ensure test coverage > 80%
- Document public APIs

## Checklist
- [ ] Tests written and passing
- [ ] Documentation updated
- [ ] No breaking changes 

Found an error or want to improve this page?

Edit this page