review-state: Artifacts accumulate with duplicates and lack relevance ordering #200
Labels
No labels
agent-ready
bug
contract
documentation
duplicate
enhancement
good first issue
help wanted
invalid
needs-human
needs-input
question
wontfix
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/iw-cli#200
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The
review-state update --append-artifactmechanism has two issues that degrade the dashboard experience during multi-phase workflows:1. Duplicate artifacts from blind append
ReviewStateUpdater.mergeArraywithArrayMergeMode.Appendblindly concatenates new items — no deduplication by path. The ag-implement workflow appends the same artifact from multiple transition points:"implement:Start Implementation:ag-implement"get appended every phase in Step 6bAfter a few phases, the artifacts array has multiple identical entries.
2. No relevance signal — current phase artifacts buried at bottom
Even without duplicates, a 5-phase issue accumulates ~15+ artifacts in chronological order. The artifacts the reviewer needs NOW (current phase context, review packet) are at the bottom, requiring scrolling past all historical artifacts.
Proposed Solution
Part 1: Upsert semantics for append
Change
--append-artifact(and--append-badge,--append-action) to deduplicate by natural key:pathidlabelWhen an item with the same key already exists, replace it in-place rather than creating a duplicate.
Part 2: Attention artifacts
Add a separate top-level
attention_artifactsarray (2-3 items) toreview-state.jsonalongside the fullartifactsarray. This separates "what you should look at now" from "full history":attention_artifactsprominently at the topartifactslist available for browsing (collapsed or secondary)attention_artifactsat each phase transition with only the current phase's key documentsNew CLI flags:
--attention-artifact "label:path"(replace mode) to set the current attention set.Affected Code
.iw/core/model/ReviewStateUpdater.scala—mergeArrayfunction (line 166-186).iw/commands/review-state/update.scala— CLI flag parsingschemas/review-state.schema.json— addattention_artifactsfieldNotes
--append-artifactcalls just stop producing duplicatesartifactsarray accumulation is intentional for reviewer context — we're adding a relevance layer on top, not removing the historyMeasured data on the de-duplication key, from IW-436 (2026-09-01).
IW-436 defect 2 gave
ReviewStateUpdater.mergeArrayakeyFieldand used it to de-duplicateavailable_actions(onid) andbadges(onlabel). Artifacts were deliberately left out, and this issue is where that decision needs settling.Why
labelcannot be the keyproject-management/issues/IW-206/review-state.jsonholdslabelcolliding two different ways at once:Phase 1 Contextentries share bothlabelandpath— a genuine duplicate, the thing this issue asks to remove.Review Packetentries sharelabelbut point at different files — a legitimate collision, not a duplicate.Keying on
labelalone would collapse the second pair and destroy the phase-1 review packet's only reference.Nothing in the schema, the validator or
ReviewStateBuilder/ReviewStateUpdaterdistinguishes the two shapes; both are valid by every check the tool owns. 9 of the 55 cards underproject-management/hold a duplicate artifactlabel.The question this leaves
Should
--append-artifactkey onpath, onlabel+path, or stay as it is?Implementation note for whichever answer is chosen:
mergeArray'skeyFieldas added by IW-436 keys on a single string field, so alabel+pathkey needs a small generalisation.Recorded during IW-436; see
project-management/issues/IW-436/LESSONS.mdentry 12.Seen again on 2026-09-16 while working IW-556:
dx-create-tasks --forcerunsreview-state update --append-artifact "Tasks:…/tasks.md=output"on a card that already holds that exact artifact, and the card ended with two identical "Tasks" entries. It was repaired by hand with--artifact(replace list). Any--forceregeneration step hits this, not only multi-phase transitions.IW-715 (PR #717) closes the artifacts part of this issue:
--append-artifactis now keyed bypath, so a second append of the same path replaces the entry in place. The key is in the sharedmerge, so the phase commands (phase-start,phase-pr,phase-merge,phase-advance,ci-gate) dedupe the same way.Intake: needs-input
1. Do we still want Part 2, a separate
attention_artifactslist that the workflow sets?Part 1 is done.
771e37ba(IW-715) makes--append-artifactreplace an entry that has the samepath.995a11b0(IW-436) does the same for actions onidand badges onlabel. Issue #351 (open) "incorporates #200". Its question 2, option a, puts the current-phase artifacts first, from thephasefield that the card already holds, with no schema change.--attention-artifactflag and a dashboard block. #351 must then use the field or ignore it.Recommended: a): #351 gets the same result from data that the card already holds, and it changes less.
2. If Part 2 goes ahead, does this issue change the iw-cli side only?
The issue asks for changes to the ag-implement and ag-implementation-workflow skills. These skills are not in this repository. They are in the dev-docs plugin. The dashboard shows one flat list now (WorktreeCardRenderer.scala#L934-L949).
Recommended: a): each change stays in the repository that holds its code.
Answer in a comment on this issue, per number, for example "1: a", or in your own words; intake reads it on its next iteration.