Goal
Implement a lifecycle state machine for artifacts governed by market signals, debate
outcomes, and quality gates. Artifacts progress through states based on quality evidence,
not arbitrary decisions.
Lifecycle States
| State | Entry Condition | Exit Conditions |
|---|
draft | Artifact created | Pass gate → listed; Fail gate → rejected |
listed | Passed quality gates | Price > 0.7 for 7d → validated; Price < 0.3 → flagged |
validated | Sustained high price | Challenge debate initiated → challenged |
flagged | Price drop or conflicting evidence | Debate defense → listed; No recovery 14d → deprecated |
challenged | Active quality debate | Defense succeeds → validated; Defense fails → deprecated |
deprecated | Failed defense or prolonged low price | Manual appeal → challenged |
rejected | Failed initial quality gate | Fix and resubmit → draft |
Acceptance Criteria
☑ Add lifecycle_state TEXT DEFAULT 'draft' to artifacts table (already in DB)
☑ Add lifecycle_changed_at TEXT for tracking state duration (already in DB)
☑ transition_lifecycle(artifact_id, new_state, reason) function
☑ All transitions logged to edit_history with structured reason
☑ Invalid transitions rejected (can't go from draft to validated directly)
☑ API: GET /api/artifacts/lifecycle-summary — counts by state
☑ API: POST /api/artifact/{id}/transition — manual transition (governance override)
☑ Lifecycle state shown on artifact detail pages with visual indicator
☑ Deprecated artifacts excluded from search results by default (but queryable)
☐ Automatic transitions triggered by: (requires exch-qm-01-MEXT + exch-qm-05-GATE)
- Quality gate results (draft → listed/rejected)
- Market price thresholds (listed → validated/flagged)
- Debate initiation/outcomes (validated → challenged, challenged → validated/deprecated)
- Time-based (flagged 14d → deprecated)
Dependencies
exch-qm-01-MEXT — Market prices needed for threshold-based transitions
exch-qm-05-GATE — Quality gates needed for draft → listed transition
Dependents
exch-qm-07-DASH — Dashboard shows lifecycle distribution
Work Log
- 2026-04-25: Implemented core lifecycle infrastructure. Added
LIFECYCLE_STATES and
LIFECYCLE_TRANSITIONS constants to
artifact_registry.py. Implemented
transition_lifecycle() function with state validation, artifact update, and
edit_history audit logging. Added
GET /api/artifacts/lifecycle-summary endpoint
returning counts for all 7 states. Added
POST /api/artifacts/{artifact_id}/transition endpoint for governance override. Added lifecycle badge to artifact detail pages (colored
dot + label per state). Added
include_deprecated filter to artifacts gallery. Fixed
validated transition rule (only
challenged per spec — prior worktree incorrectly added
flagged). Commits: 467c83eb0.