Skip to content

Conversation

@robch
Copy link
Owner

@robch robch commented Aug 22, 2025

No description provided.

@robch
Copy link
Owner Author

robch commented Aug 22, 2025

Comprehensive Review of CYCOD Custom Tools Specification

The specification presents a well-designed framework for extending CYCOD with user-defined shell-based tools. Here's a summary of the key strengths and areas for enhancement from multiple reviews:

Key Strengths

  • Strong alignment with CYCOD principles (scope system, command patterns, security model)
  • Powerful functional capabilities (multi-step architecture, output referencing, conditional execution)
  • Well-structured documentation

Key Enhancement Areas

  • Parameter handling (validation, transformation, complex types)
  • Command execution (security, platform-specific behavior, environment variables)
  • Error handling and recovery
  • Tool composition and reusability
  • Documentation and usability enhancements

I'll add specific comments to relevant sections. Please see the uber-critique document for full details.

- name: step2
bash: command {PARAM}

# Parameters
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parameter Handling Enhancement Opportunities

  1. Type Processing and Validation

    • Consider adding validation rules for parameters (min/max for numbers, patterns for strings)
    • Add parameter transformation capabilities before substitution
  2. Enhanced Documentation

    • Parameter descriptions could include examples and detailed help
  3. Complex Parameter Types

    • Consider supporting object/nested parameters for advanced use cases

See the uber-critique document for specific YAML examples of these enhancements.

Copy link
Owner Author

@robch robch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Starting a detailed review of the Custom Tools Specification

@robch
Copy link
Owner Author

robch commented Aug 22, 2025

Parameter Handling Enhancement Opportunities (Lines 54-75)

  1. Type Processing and Validation

    • Consider adding validation rules for parameters (min/max for numbers, patterns for strings)
    • Add parameter transformation capabilities before substitution
  2. Enhanced Documentation

    • Parameter descriptions could include examples and detailed help
  3. Complex Parameter Types

    • Consider supporting object/nested parameters for advanced use cases

Example enhancement:

parameters:
  COUNT:
    type: number
    description: Count of items
    validation:
      minimum: 1
      maximum: 100
    transform: "Math.floor"  # Transform function to apply
    format: "--count={value}"  # How parameter appears in command

@robch
Copy link
Owner Author

robch commented Aug 22, 2025

Command Execution Enhancement Opportunities (Lines 76-77)

  1. Security Considerations

    • The specification should address parameter escaping to prevent command injection
  2. Platform-Specific Behavior

    • Consider supporting platform-specific command variations beyond just compatibility tags
  3. Environment Variables

    • Add support for setting and managing environment variables for tool execution

Example enhancement:

commands:
  default: find {DIRECTORY} -name "{PATTERN}"
  platforms:
    windows: powershell -Command "Get-ChildItem -Path '{DIRECTORY}' -Filter '{PATTERN}' -Recurse"
    unix: find {DIRECTORY} -name "{PATTERN}"

environment:
  variables:
    HTTP_PROXY: "{PROXY_URL}"
    DEBUG: "1"
  inherit: true  # Inherit parent process environment

@robch
Copy link
Owner Author

robch commented Aug 22, 2025

Error Handling Enhancement Opportunities (Lines 138-153)

  1. Advanced Error Recovery

    • Consider more sophisticated recovery options (retries, fallbacks)
  2. Output Management

    • Add specifications for handling large outputs or streaming capabilities

Example enhancement:

steps:
  - name: risky-step
    bash: command
    error-handling:
      retry:
        attempts: 3
        delay: 1000  # milliseconds
      fallback: alternative-command {PARAM}

  - name: generate-large-output
    bash: large-output-command
    output:
      max-size: 10MB  # Limit output capture size
      truncation: true  # Whether to truncate if exceeded
      streaming: true  # Stream output rather than buffering

@robch
Copy link
Owner Author

robch commented Aug 22, 2025

Tool Composition and Reusability (Suggested New Section)

The specification currently lacks explicit support for:

  1. Tool Composition

    • Allow tools to reference or use other tools
  2. Tool Discovery

    • Consider more sophisticated discovery mechanisms (categories, tags, keywords)
  3. Tool Versioning

    • Add mechanism for versioning and compatibility tracking

Example enhancement:

steps:
  - name: use-git-clone
    use-tool: git-clone
    with:
      URL: "{REPO_URL}"
      DIRECTORY: "{WORKSPACE}"

metadata:
  category: file-management
  subcategory: search
  tags: [files, search, find]
  keywords: [locate, search, find, pattern]

version: 1.0.0
min-cycod-version: "1.2.0"
changelog:
  - version: 1.0.0
    changes: "Initial release"

@robch
Copy link
Owner Author

robch commented Aug 22, 2025

Implementation Considerations (Suggested New Section)

Consider adding sections on:

  1. Tool Testing

    • Built-in ways to test tools before using them
  2. Resource Management

    • Specifications for resource constraints and cleanup
  3. Interactive Mode

    • Support for tools that require interactive input

Example enhancement:

tests:
  - name: basic-test
    parameters:
      PATTERN: "*.txt"
      DIRECTORY: "test-data"
    expected:
      exit-code: 0
      output-contains: "test-data/sample.txt"

resources:
  timeout: 60000  # milliseconds
  max-memory: 512MB
  cleanup:
    - delete-temp-files: true
    - final-command: "docker rm {CONTAINER_ID}"

interactive: true  # Tool may prompt for user input
interactive-options:
  timeout: 30000  # How long to wait for user input
  default-response: "y"  # Default if no input provided

@robch
Copy link
Owner Author

robch commented Aug 22, 2025

Documentation and Usability Enhancements

  1. Best Practices

    • Consider adding a dedicated section on creating effective tools
    • Include tool design principles, parameter naming conventions, error handling patterns
  2. Advanced Examples

    • Add more diverse examples to illustrate advanced features:
      • Complex error handling
      • Sophisticated parameter validation
      • Cross-platform compatibility
      • Integration with other systems

These improvements would help users create more robust and effective custom tools.


Parameter types include:
- `string`: Text values
- `number`: Numeric values
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding support for parameter validation rules. For example:

parameters:
  COUNT:
    type: number
    description: Count of items
    validation:
      minimum: 1
      maximum: 100

Copy link
Owner Author

@robch robch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are some line-specific suggestions to enhance the specification:

@robch
Copy link
Owner Author

robch commented Aug 22, 2025

Line-Specific Enhancement Suggestions

Based on our review, here are specific line-based suggestions that could be made through the GitHub web interface:

  1. Parameter Types (lines 121-126):

  2. Error Handling (lines 140-144):

  3. Platform Support (lines 132-134):

  4. Step Output References (lines 264-279):

These specific enhancements could be added as line comments in the GitHub web interface.

@robch
Copy link
Owner Author

robch commented Aug 22, 2025

Line-Specific Enhancement Suggestions

Based on our review, here are specific line-based suggestions that could be made through the GitHub web interface:

  1. Parameter Types (lines 121-126):

  2. Error Handling (lines 140-144):

  3. Platform Support (lines 132-134):

  4. Step Output References (lines 264-279):

These specific enhancements could be added as line comments in the GitHub web interface.

@robch
Copy link
Owner Author

robch commented Aug 22, 2025

Line-Specific Enhancement Suggestions

Based on our review, here are specific line-based suggestions that would be ideal to add directly to specific parts of the code through the GitHub web interface:

  1. Parameter Types (lines 121-126): Add validation rules for each parameter type
  2. Error Handling (lines 140-144): Add retry mechanisms and fallback options
  3. Platform Support (lines 132-134): Add platform-specific command variations
  4. Step Output References (lines 264-279): Add output management options

See the uber-critique document for detailed YAML examples of these enhancements.

Copy link
Owner Author

@robch robch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are some line-specific suggestions for enhancing the Custom Tools Specification

- `number`: Numeric values
- `boolean`: True/false values
- `array`: List of values

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parameter Types Enhancement: Consider adding validation rules for each parameter type. For example:

parameter-types:
  string: 
    validation: [pattern, min-length, max-length]
  number:
    validation: [minimum, maximum, multiple-of]
  boolean:
    validation: [allowed-values]
  array:
    validation: [min-items, max-items, unique-items]


```yaml
ignore-errors: false # Whether to continue even if the tool fails
```
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error Handling Enhancement: Consider adding more sophisticated recovery options like retries and fallbacks:

error-handling:
  retry:
    attempts: 3
    delay: 1000  # milliseconds
  fallback: alternative-command {PARAM}
  report: true  # Whether to include detailed error reports

```yaml
platforms: [windows, linux, macos] # Only include platforms the tool works on
tags: [category1, category2, read] # Tags for categorization and security
```
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Platform Support Enhancement: Consider supporting platform-specific command variations beyond just compatibility tags:

platforms: 
  windows:
    command: powershell -Command "Get-ChildItem -Path '{DIRECTORY}'"
  linux:
    command: find {DIRECTORY} -type f
  macos:
    command: find {DIRECTORY} -type f

- `{step1.output}` - Standard output from the step
- `{step1.error}` - Standard error from the step
- `{step1.exit-code}` - Exit code from the step

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Output Management Enhancement: Add specifications for handling large outputs or streaming capabilities:

output-options:
  format: json|text|raw  # Output format
  max-size: 10MB         # Maximum capture size
  streaming: true        # Whether to stream output
  transform: jq '.items' # Transform before passing to next step

Copy link
Owner Author

@robch robch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional line-specific suggestions based on the comprehensive review

description: Another parameter
required: false
default: 5

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enhanced Parameter Documentation: Consider adding examples and more detailed help for parameters:

parameters:
  PATTERN:
    type: string
    description: File pattern to match
    examples: ["*.txt", "log*.log"]
    detailed-help: |
      A glob pattern that follows standard shell conventions.
      Use * as a wildcard for any characters.
      Examples: *.txt, log-*.log, data-????.csv

- `number`: Numeric values
- `boolean`: True/false values
- `array`: List of values

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Complex Parameter Types: Consider supporting object/nested parameters for advanced use cases:

parameters:
  CONFIG:
    type: object
    properties:
      server:
        type: string
      port:
        type: number

- `write`: Tools that modify files or data
- `run`: Tools that execute other commands or scripts

If no security tag is provided, the tool is considered high-risk and requires explicit approval.
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security Considerations: Consider addressing parameter escaping to prevent command injection:

parameters:
  QUERY:
    type: string
    description: Search query
    security:
      escape-shell: true  # Automatically escape shell metacharacters

run-condition: "{step2.exit-code} == 0" # Condition for when to run this step

- name: step2
bash: command {PARAM}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tool Composition: Consider adding support for tools to reference other tools:

steps:
  - name: use-git-clone
    use-tool: git-clone
    with:
      URL: "{REPO_URL}"
      DIRECTORY: "{WORKSPACE}"

working-directory: ~/path # Working directory
platforms: [windows, linux, macos] # Supported platforms
tags: [tag1, tag2, read] # Categories and security tags
ignore-errors: false # Whether to continue if a step fails
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tool Discovery and Versioning: Consider adding metadata for better tool discovery and version tracking:

metadata:
  category: file-management
  subcategory: search
  tags: [files, search, find]
  keywords: [locate, search, find, pattern]

version: 1.0.0
min-cycod-version: "1.2.0"
changelog:
  - version: 1.0.0
    changes: "Initial release"

cycod help tools
```

## Examples
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tool Testing: Consider adding built-in ways to test tools:

tests:
  - name: basic-test
    parameters:
      PATTERN: "*.txt"
      DIRECTORY: "test-data"
    expected:
      exit-code: 0
      output-contains: "test-data/sample.txt"

cycod help tools
```

## Examples
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resource Management: Consider adding specifications for resource constraints and cleanup:

resources:
  timeout: 60000  # milliseconds
  max-memory: 512MB
  cleanup:
    - delete-temp-files: true
    - final-command: "docker rm {CONTAINER_ID}"

cycod help tools
```

## Examples
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interactive Mode: Consider adding support for tools that require interactive input:

interactive: true  # Tool may prompt for user input
interactive-options:
  timeout: 30000  # How long to wait for user input
  default-response: "y"  # Default if no input provided

Copy link
Owner Author

@robch robch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final line-specific suggestion about environment variables


# Optional settings
timeout: 60000 # Timeout in milliseconds
working-directory: ~/path # Working directory
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Environment Variables: Consider adding support for setting and managing environment variables for tool execution:

environment:
  variables:
    HTTP_PROXY: "{PROXY_URL}"
    DEBUG: "1"
  inherit: true  # Inherit parent process environment

robch added 3 commits August 21, 2025 17:48
This commit introduces a new documentation file containing examples of custom tools for GitHub PR reviews. The tools include:

1. **PR Summary Comment Tool**: Adds a top-level comment to a PR.
2. **PR Section Comment Tool**: Adds comments referencing specific sections of code.
3. **PR Line Comment Tool**: Adds line-specific comments to a PR.
4. **Advanced PR Multi-Comment Tool**: Allows adding multiple types of comments in a single command.

Each tool is accompanied by detailed YAML configurations and usage examples, enhancing the review process with structured commenting capabilities.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants