Skip to content

feat(acp): wire ACP create_artifact to the document model pipeline #148

Description

@paulbreuler

Problem

The ACP create_artifact tool in src/acp/tools.ts returns a delegation message without actually creating any files. Agents calling it via ACP get no artifact back.

Current behavior

async create_artifact(req) {
  return { ok: true, message: 'Artifact creation delegated to AI agent', request: req };
}

Expected behavior

create_artifact calls the same generateArtifactHandler logic used by the generate_artifact MCP tool — creating the file via the IDocument pipeline and returning the path, id, and content.

Acceptance criteria

  • create_artifact({ type, title, planId?, description?, personaPath?, primer? }) — writes the artifact file and returns { ok, id, type, title, path, content }
  • Fires the artifact:created hook event after writing
  • Supports all four artifact types: persona, journey, spec, agent
  • Returns a structured error for unknown types or missing required fields (e.g. planId for agent type)
  • Tests cover: persona creation, agent creation with primer injection, missing required field error

Files to modify

  • src/acp/tools.ts — call generateArtifactHandler or extract shared logic into a service
  • src/tools/generate-artifact.ts — consider extracting core logic into src/cli/generate-artifact.ts for reuse
  • tests/acp/tools.test.ts — add artifact creation tests with temp workspace

Related

  • src/tools/generate-artifact.ts — existing MCP tool implementation
  • src/documents/Persona, Journey, Spec, AgentTask document model
  • src/hooks/runner.ts — hook event firing

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