Skip to content

[Phase 4] Workspace Hooks: Template Variable Rendering #395

Description

@frankbria

Summary

Add template variable rendering to hook scripts so they can reference task/workspace context dynamically.

Parent issue: #392

Scope

Add to core/hooks.py

  1. Template rendering function:

    def render_hook_template(script: str, context: dict[str, str]) -> str
  2. Supported variables:

    • {{task_id}} — current task ID
    • {{task_title}} — current task title
    • {{task_status}} — current task status
    • {{workspace_path}} — absolute workspace path
    • {{batch_id}} — batch ID (if in batch execution, else empty)
    • {{engine}} — execution engine (react/plan)
  3. Rendering rules (following Symphony's strict approach):

    • Unknown variables raise an error (strict mode)
    • Empty/None values render as empty string
    • No nested template evaluation
  4. Integrate rendering into run_hook() before shell execution

Acceptance Criteria

  • All 6 template variables render correctly
  • Unknown variables raise TemplateRenderError
  • None values render as empty string
  • Unit tests for all variable substitutions and error cases

Dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestphase-4.3Phase 4.3: Workspace Lifecycle Hooks Systemsymphony-inspiredInspired by OpenAI Symphony spec analysis

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions