Skip to content

refactor: unify RunContract prompt rendering across service and CLI runtime #115

@devkade

Description

@devkade

Summary

Unify RunContract prompt rendering across the Pi service path and the CLI runtime path so both surfaces are driven by the same semantic contract renderer.

Parent roadmap: #114
Track: A — RunContract Harness core
Tier: 1 — actionable now

Problem

RunContract is becoming the shared harness surface, but prompt composition is still split between KapiService.buildWorkflowPrompt and the CLI runtime buildRuntimePrompt path. That creates drift between interactive Pi workflow guidance and Kapi CLI worker/runtime prompts.

Proposal

Add a shared renderer module for contract/workflow prompts and route both service and CLI prompt composition through it while preserving current public behavior.

Scope

  • Introduce a shared semantic renderer for workflow/RunContract prompt content.
  • Keep KapiService.buildWorkflowPrompt as a compatibility wrapper if useful.
  • Move CLI runtime prompt construction onto the same renderer path.
  • Preserve current prompt intent, skill hints, evidence expectations, and mode-specific guidance.
  • Add regression tests for both service and CLI prompt output.

Non-goals

  • No rename of WorkflowState, WorkflowDefinition, or existing workflow APIs.
  • No durable RunContract schema or storage migration.
  • No GitHub/PR/kapi-agent/Ragna semantics in core rendering.
  • No broad Kapi→Ilchul identifier rename.

Acceptance criteria

  • Service workflow prompts and CLI runtime prompts share a common renderer path.
  • Existing public command/API behavior remains backward-compatible.
  • RunContract/core renderer code stays free of GitHub/PR/kapi-agent/Ragna/Discord-specific semantics.
  • Tests cover both service prompt rendering and CLI runtime prompt rendering.
  • npm run verify passes.

Verification

  • Run targeted prompt/CLI tests.
  • Run npm run verify.
  • Search new core renderer code for adapter-specific terms such as GitHub, pullRequest, kapiAgent, Ragna, and Discord.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions