Skip to content

feat: configurable protocol injection with independent task/plan templates #63

@jerfowler

Description

@jerfowler

Summary

Make the hardcoded PROTOCOL_CONTEXT configurable with separate, independent templates for tasks (INIT.md) and plans (PLAN.md), allowing each to be enabled/disabled and customized independently.

Current Problem

  • Single hardcoded protocol message for everything
  • Cannot turn off injection
  • Cannot customize per file type
  • No dynamic content support

Solution: Simple Protocol Config Tool

Tool: protocol_config

protocol_config({
  action: "get" | "set" | "reset",

  // For "set" - all optional, only set what you want to change
  task?: {
    enabled?: boolean,      // Turn task injection on/off
    template?: string       // Custom template for INIT.md
  },
  plan?: {
    enabled?: boolean,      // Turn plan injection on/off
    template?: string       // Custom template for PLAN.md
  }
})

Simple Examples

// Get current config
protocol_config({ action: "get" })

// Turn off task injection, keep plan injection
protocol_config({
  action: "set",
  task: { enabled: false }
})

// Set custom plan template only
protocol_config({
  action: "set",
  plan: {
    template: "## Plan for {{taskName}}\nAgent: {{agentName}}\n[Custom instructions...]"
  }
})

// Different templates for each
protocol_config({
  action: "set",
  task: { template: "Task template..." },
  plan: { template: "Plan template..." }
})

// Reset everything to defaults
protocol_config({ action: "reset" })

Template Variables

Simple interpolation support:

  • {{taskId}} - Task ID
  • {{taskName}} - Task name
  • {{agentName}} - Agent name
  • {{timestamp}} - Creation time
  • {{taskType}} - delegation/self/subtask

Storage

File: comm/.config/protocol.json

{
  "task": {
    "enabled": true,
    "template": "task template content..."
  },
  "plan": {
    "enabled": true,
    "template": "plan template content..."
  }
}

Implementation

  1. Check config in create-task.ts before appending to INIT.md
  2. Check config in submit-plan.ts before appending to PLAN.md
  3. Create simple ProtocolConfigManager class
  4. Auto-create config with defaults if missing (not fallback to hardcoded)

Acceptance Criteria

  • Single tool with simple interface
  • Task and plan templates fully independent
  • Each can be enabled/disabled separately
  • Config persists in comm/.config/protocol.json
  • Config file auto-created with defaults if missing
  • Variable interpolation works
  • 95% test coverage

Benefits

  • Simple: One tool, clear parameters
  • Independent: Task and plan don't affect each other
  • Flexible: Turn on/off, customize, or use defaults
  • Clean: No complex options or dependencies
  • Explicit: Config file always exists (no hidden defaults)

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions