Skip to content

Improve subagent position and representation of artifacts #60

Description

@williamthorsen

Problem

The Factory visualization currently shows at most one artifact box per phase (architecture, planning, implementation). We can't see who produced which artifacts or how many there are.

Current limitations

  • buildArtifacts() creates at most 3 artifacts (one each for architecture, planning, implementation), collapsing multiple planning artifacts into a single box
  • artifactPosition() returns a single fixed position per station — no support for multiple artifacts at one station
  • Artifact size (15x15) is hardcoded in ArtifactActor
  • Phases codeSimplifier and holisticReview are ignored despite having artifact fields in the data model
  • Positioning uses magic numbers (+30 x-offset, -60 y-offset) rather than named constants

Proposed solution

Create a visual box for each individual artifact, with configurable constants for size, position, and spacing:

  • Position of the agent can be specified relative to the center of the station
  • Position of the first artifact can be specified relative to the center of the station and its primary y coordinate
  • Size of each artifact is specified in a { height: number, width: number } constant; use the same units as those used for other dimensions in the Factory
  • Gap between artifacts is specified in a constant

Multiple artifacts at the same station are arranged horizontally (left-to-right).

The eventual goal (out of scope for this ticket) is to allow the user to view any of the artifacts by clicking on its box.

Key design decisions

Dual-source data strategy: The CanonicalRunStatus has artifact data in two places:

  1. Top-level artifacts: ArtifactEntry[] (v2 format) — rich metadata per artifact with filename, agent, phase, etc.
  2. Per-phase fields (e.g., architecture.artifact, planning.artifacts[]) — simpler, always present

Use the top-level array when populated (one visual box per entry), falling back to phase fields for v1 compatibility. The fallback now also covers codeSimplifier and holisticReview.

Horizontal layout: Artifacts at the same station are arranged in a horizontal row. With default sizing (12px width + 4px gap = 16px per artifact), 5 artifacts span 80px — well within the 150px station spacing.

Acceptance criteria

  • Each individual artifact in the run data produces its own visual box (not one box per phase)
  • Artifact box dimensions use a named { width, height } constant (not hardcoded in the actor)
  • Gap between artifacts at the same station uses a named constant
  • First artifact position relative to station center uses named offset constants
  • codeSimplifier and holisticReview artifacts are rendered when present
  • All existing tests pass; new tests cover multi-artifact positioning and dual-source logic
  • When CanonicalRunStatus.artifacts (top-level array) is populated, it is used as primary data source
  • Falls back to phase-specific fields when top-level array is undefined

Files to modify

File Change
packages/factory/src/client/game/layout/platform-layout.ts Add layout constants, update artifactPosition signature, expose artifactSize
packages/factory/src/client/game/mappers/run-to-scene.ts Add indexAtStation to ArtifactConfig, rewrite buildArtifacts() with dual-source logic
packages/factory/src/client/game/actors/ArtifactActor.ts Accept optional size, add color entries for simplifier/holistic
packages/factory/src/client/game/scenes/FactoryScene.ts Update rendering to use new artifactPosition signature
packages/factory/src/client/game/layout/__tests__/platform-layout.test.ts Update and add artifact position tests
packages/factory/src/client/game/actors/__tests__/ArtifactActor.test.ts Add size and color tests
packages/factory/src/client/game/mappers/__tests__/run-to-scene.test.ts Add comprehensive multi-artifact tests

Metadata

Metadata

Labels

featureAdded or improved external functionalityscope:factory

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions