Skip to content

Run-scoped artifact identity for subagent writes #15

@Whamp

Description

@Whamp

Parent PRD

#1

What to build

Implement run-scoped artifact identity for subagent outputs. Subagents should continue writing logical names such as context.md, while the framework stores those artifacts under a unique namespace keyed by the subagent run id. Repeated writes to the same logical artifact name within a single subagent run should update that run-scoped artifact rather than creating ambiguous sibling files. This slice should cover the end-to-end artifact identity path needed by the parent PRD's solution and implementation decisions.

Acceptance criteria

  • A subagent can write a logical artifact name like context.md and the stored artifact path is namespaced by the unique subagent run id.
  • Repeated writes to the same logical artifact name within one subagent run update the same run-scoped artifact identity rather than creating versioned siblings.
  • read_artifact(...) can resolve the stored namespaced artifact correctly using the surfaced artifact name.
  • Pure tests cover artifact namespace resolution and duplicate-write behavior.

Implementation approach

  • Pass PI_ARTIFACT_RUN_ID and PI_ARTIFACT_SESSION_DIR env vars to subagent processes
  • write_artifact uses these to store under <parentSessionDir>/artifacts/<runId>/
  • read_artifact searches run-scoped directories in addition to session-scoped ones
  • Pure tests for namespace resolution and duplicate-write idempotency

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions