gstack-game icon indicating copy to clipboard operation
gstack-game copied to clipboard

feat: add artifact browser — users can't see what prior skills produced

Open fagemx opened this issue 8 months ago • 4 comments

Problem

Skills write artifacts to `~/.gstack/projects/{slug}/` and downstream skills auto-read them. But users have no visibility into:

  • What artifacts exist
  • Which skill produced each one
  • Whether artifacts are stale (from a different branch or old session)

Current Behavior

Artifact chaining happens silently. If a user runs `/prototype-slice-plan`, it reads upstream artifacts from `/game-review` and `/balance-review` — but the user doesn't know which artifacts were found or how old they are.

Expected Behavior

A way to inspect artifact state, either:

  • A `/artifacts` command that lists all artifacts with timestamps and source skills
  • Or each skill's preamble output includes "Found N upstream artifacts: [list]"

Why It Matters

Without visibility, users can't tell if downstream skills are working from current or stale data. Running skills in the wrong order produces confusing results with no explanation.

Priority

P1


Created from deep review of skill ecosystem

fagemx avatar Mar 25 '26 06:03 fagemx

Phase 1: Research — Artifact Browser (Issue #8)

Problem Statement

Users cannot see what prior skills produced. After running /game-review, /balance-review, /game-ideation, etc., the artifacts are stored in ~/.gstack/projects/{slug}/ but there is no user-facing way to list, inspect, or understand what exists. Each skill independently discovers artifacts it cares about, but the user has no overview.

Artifact Storage Mechanism

Location: ~/.gstack/projects/{slug}/ (set as $_PROJECTS_DIR in preamble)

Created by preamble (every skill):

mkdir -p ~/.gstack/projects/$_SLUG
_PROJECTS_DIR=~/.gstack/projects/$_SLUG

Naming convention: {user}-{branch}-{artifact-type}-{YYYYMMDD-HHMMSS}.md

Complete Artifact Type Inventory

Skill Artifact Type Slug Example Filename
game-ideation concept alice-main-concept-20260325-143000.md
game-review game-review alice-main-game-review-20260325-143000.md
balance-review balance-report alice-main-balance-report-20260325-143000.md
player-experience player-walkthrough alice-main-player-walkthrough-20260325-143000.md
game-direction direction-review alice-main-direction-review-20260325-143000.md
pitch-review pitch-review alice-main-pitch-review-20260325-143000.md
game-eng-review eng-review alice-main-eng-review-20260325-143000.md
game-ux-review ux-review alice-main-ux-review-20260325-143000.md
game-qa qa-report alice-main-qa-report-20260325-143000.md
game-debug debug-report alice-main-debug-report-20260325-143000.md
game-retro retro alice-main-retro-20260325-143000.md
game-docs release-docs alice-main-release-docs-20260325-143000.md
game-visual-qa visual-qa alice-main-visual-qa-20260325-143000.md
game-codex codex-review alice-main-codex-review-20260325-143000.md
asset-review asset-review alice-main-asset-review-20260325-143000.md
playtest playtest-plan alice-main-playtest-plan-20260325-143000.md
game-import gdd-import alice-main-gdd-import-20260325-143000.md
gameplay-implementation-review impl-review alice-main-impl-review-20260325-143000.md
feel-pass feel-pass alice-main-feel-pass-20260325-143000.md
build-playability-review playability alice-main-playability-20260325-143000.md
prototype-slice-plan slice-plan alice-main-slice-plan-20260325-143000.md
implementation-handoff handoff alice-main-handoff-20260325-143000.md

Total: 22 artifact types across 22 skills (careful, guard, unfreeze produce no artifacts).

Supersession Chain

When a skill produces a new artifact and a prior one exists, it writes Supersedes: {prior filename} at the top. This creates a revision chain per artifact type.

Current Discovery Mechanism

Each skill has an Artifact Discovery section that runs ls -t $_PROJECTS_DIR/*-{type}-*.md for the specific artifact types it cares about. Discovery is:

  • Per-skill, not global -- each skill only looks for artifacts relevant to its own context
  • Implicit -- users see discovered artifacts only as side output during skill startup
  • Incomplete -- no skill lists ALL artifacts; each checks 2-4 types max

Cross-Skill Dependency Graph (Discoverable by)

Producer Consumers
game-review balance-review, player-experience, game-direction, game-ship
balance-review player-experience, game-review, game-direction, game-ux-review
player-experience balance-review, game-review, game-direction, game-ux-review
game-ideation game-review, game-direction, pitch-review, game-import
game-direction pitch-review, game-eng-review, prototype-slice-plan
pitch-review game-direction
game-eng-review gameplay-implementation-review, implementation-handoff
game-ux-review game-ship, game-qa, game-retro
game-qa game-ship, game-retro, build-playability-review
gameplay-implementation-review game-ship, game-eng-review, game-qa, feel-pass
prototype-slice-plan implementation-handoff, gameplay-implementation-review, build-playability-review, feel-pass
implementation-handoff feel-pass, gameplay-implementation-review, build-playability-review
feel-pass build-playability-review, game-qa, game-debug, game-ship
build-playability-review game-qa, game-ship, game-retro
playtest game-qa, build-playability-review, game-retro
game-debug game-qa, game-retro
game-retro game-ship
game-codex game-ship, gameplay-implementation-review
asset-review game-ship, game-visual-qa
game-visual-qa game-ship, game-qa
game-docs game-ship

Existing Tooling Gap

  • gstack-review-log -- logs structured JSON to {branch}-reviews.jsonl (skill invocation metadata, not artifact content)
  • gstack-review-read -- reads the review log JSONL and config, but is not used by any skill template
  • No tool exists to list, search, or summarize the .md artifact files in $_PROJECTS_DIR

Key Findings

  1. 22 artifact types follow a consistent {user}-{branch}-{type}-{datetime}.md naming convention
  2. No global view exists -- users must manually ls ~/.gstack/projects/{slug}/
  3. Supersession chains exist but are not surfaced (which is the latest? which are stale?)
  4. Review log (JSONL) tracks skill invocations but not artifact file paths
  5. gstack-review-read exists but is unused -- potential foundation to build on
  6. Cross-skill discovery is hardcoded per skill, not centralized

fagemx avatar Mar 25 '26 06:03 fagemx

Phase 2: Innovate — Artifact Browser (Issue #8)

Approach A: New /artifacts Skill

What: A dedicated skill (skills/artifacts/SKILL.md.tmpl) that users invoke via /artifacts. It lists all artifacts in $_PROJECTS_DIR with metadata: source skill, timestamp, branch, user, staleness, supersession status, and which downstream skills would consume each.

How it works:

  1. Preamble runs as usual (sets $_PROJECTS_DIR)
  2. Bash block lists all .md files in $_PROJECTS_DIR, parses filenames for metadata
  3. Presents a formatted table via AskUserQuestion with options: read an artifact, show dependency graph, filter by branch/skill/date, delete stale artifacts
  4. Can detect staleness: if GDD was modified after the last game-review artifact, flag it as potentially stale

Pros:

  • Full interactive experience -- user can browse, read, compare, clean up
  • Follows existing skill pattern (.tmpl, {{PREAMBLE}}, tests pass)
  • Can include the dependency graph so users understand the workflow
  • Natural place to add "suggested next skill" based on what's missing

Cons:

  • Requires invoking a skill just to see what exists -- adds friction
  • 23rd skill increases project surface area
  • Users must know /artifacts exists to use it

Effort: ~2 hours implementation, ~1 hour testing


Approach B: Enhanced Preamble with Artifact Summary

What: Add an "Artifact Inventory" block to skills/shared/preamble.md that runs on every skill startup. It lists all existing artifacts with timestamps and staleness indicators.

How it works:

  1. After mkdir -p ~/.gstack/projects/$_SLUG, add a block that does ls -lt $_PROJECTS_DIR/*.md and formats output
  2. Every skill now shows "Here's what exists" before starting its own work
  3. Passive discovery -- no new skill to invoke

Pros:

  • Zero friction -- users see artifacts automatically
  • No new skill to maintain
  • Every skill benefits immediately

Cons:

  • Preamble becomes longer (already 80 lines) -- adds noise to every skill invocation
  • No interactivity -- just a dump of filenames
  • Cannot browse, read, or compare artifacts
  • Clutters skill startup for users who don't care about prior artifacts
  • Cannot do staleness detection without making preamble even heavier
  • Preamble runs in bash -- variable state doesn't persist to Claude's context effectively

Effort: ~30 minutes implementation


Approach C: New bin/gstack-artifacts Utility + Preamble Integration

What: A new bin utility (bin/gstack-artifacts) that handles artifact listing, filtering, and staleness detection. The preamble calls it with a compact summary mode. A new /artifacts skill uses it in full interactive mode.

How it works:

  1. bin/gstack-artifacts is a standalone bash script that:
    • Lists all artifacts in $_PROJECTS_DIR with parsed metadata
    • Supports --summary (compact one-liner per artifact for preamble use)
    • Supports --full (detailed table with staleness, supersession, downstream consumers)
    • Supports --filter skill=game-review or --filter branch=main
    • Detects staleness by comparing artifact timestamps against GDD/source file mtime
    • Identifies supersession chains (latest vs. outdated)
  2. Preamble adds one line: "$_GG_BIN/gstack-artifacts" --summary 2>/dev/null -- shows a compact artifact count
  3. /artifacts skill calls gstack-artifacts --full and provides interactive browsing

Pros:

  • Clean separation: utility does the work, skill provides the UX
  • Preamble integration is lightweight (one line, compact output)
  • Utility is testable independently
  • Follows existing pattern: gstack-review-read already exists for log reading
  • Future-proof: other tools/scripts can call gstack-artifacts too
  • Staleness detection lives in one place, not duplicated across skills

Cons:

  • Most implementation effort (utility + skill + preamble change)
  • Two new files to maintain (utility + skill template)
  • Need to keep artifact type registry in sync as new skills are added

Effort: ~3-4 hours implementation, ~1 hour testing


Recommendation: Approach C (Utility + Skill)

Why C over A: The utility is reusable. Other skills could call gstack-artifacts --check game-review to verify a dependency exists, replacing the ad-hoc ls -t $_PROJECTS_DIR/*-game-review-*.md pattern currently duplicated across 15+ skills.

Why C over B: Passive-only (B) doesn't solve the core problem -- users need to browse and understand their artifacts, not just see a list flash by during startup.

Why the extra effort is worth it: The artifact type registry (22 types) encoded in a utility becomes a single source of truth. When new skills are added, only the utility needs updating. Currently each skill hardcodes its own discovery globs, which is fragile.

fagemx avatar Mar 25 '26 06:03 fagemx

Phase 3: Implementation Plan — Artifact Browser (Issue #8)

Recommended approach: C (bin utility + skill + preamble integration)


Step 1: Create bin/gstack-artifacts

File: bin/gstack-artifacts

A bash utility that reads ~/.gstack/projects/{slug}/ and outputs structured artifact information.

Interface:

Usage: gstack-artifacts [--summary|--full|--json] [--filter key=value] [--check type]

Options:
  --summary     Compact one-line-per-type output (for preamble)
  --full        Detailed table with timestamps, staleness, chains (default)
  --json        JSON output for programmatic use
  --filter      Filter by: skill=, branch=, user=, after=YYYY-MM-DD
  --check TYPE  Exit 0 if artifact of TYPE exists, 1 if not (for skill discovery)

Artifact type registry (embedded in the script as an associative array):

# Maps artifact-type slug -> producing skill name
declare -A ARTIFACT_SKILLS=(
  [concept]=game-ideation
  [game-review]=game-review
  [balance-report]=balance-review
  [player-walkthrough]=player-experience
  [direction-review]=game-direction
  [pitch-review]=pitch-review
  [eng-review]=game-eng-review
  [ux-review]=game-ux-review
  [qa-report]=game-qa
  [debug-report]=game-debug
  [retro]=game-retro
  [release-docs]=game-docs
  [visual-qa]=game-visual-qa
  [codex-review]=game-codex
  [asset-review]=asset-review
  [playtest-plan]=playtest
  [gdd-import]=game-import
  [impl-review]=gameplay-implementation-review
  [feel-pass]=feel-pass
  [playability]=build-playability-review
  [slice-plan]=prototype-slice-plan
  [handoff]=implementation-handoff
)

Staleness detection: Compare artifact mtime against docs/gdd.md (or latest commit touching docs/). If GDD is newer than a review artifact, mark it [STALE?].

Supersession: For each type, identify the latest artifact and any superseded versions.

--summary output example:

Artifacts: 5 types, 8 files (3 stale)
  concept (2) | game-review (1, STALE?) | balance-report (2) | direction-review (1) | eng-review (2)

--full output example:

Artifact Inventory for my-game (branch: main)
================================================
  Type               Latest                                      Age     Status
  concept            alice-main-concept-20260320-100000.md        5d      current
                     alice-main-concept-20260315-090000.md        10d     superseded
  game-review        alice-main-game-review-20260318-140000.md    7d      STALE? (GDD updated 20260322)
  balance-report     alice-main-balance-report-20260322-110000.md 3d      current
  direction-review   alice-main-direction-review-20260319-160000.md 6d    current
  eng-review         alice-feat-eng-review-20260321-090000.md     4d      current (branch: feat)
================================================
Missing (never run): player-walkthrough, pitch-review, ux-review, qa-report, ...

--check mode: Used by other skills to replace hardcoded ls -t patterns:

# Before (current, in each skill):
PREV_REVIEW=$(ls -t $_PROJECTS_DIR/*-game-review-*.md 2>/dev/null | head -1)

# After (optional migration, not required for v1):
PREV_REVIEW=$("$_GG_BIN/gstack-artifacts" --check game-review 2>/dev/null)

Acceptance criteria:

  • [ ] gstack-artifacts --summary outputs compact artifact summary
  • [ ] gstack-artifacts --full outputs detailed table
  • [ ] gstack-artifacts --json outputs parseable JSON
  • [ ] gstack-artifacts --check {type} returns filepath or exit 1
  • [ ] Staleness detection works against docs/gdd.md mtime
  • [ ] Supersession chain identified correctly (latest vs. older)
  • [ ] Handles empty $_PROJECTS_DIR gracefully
  • [ ] Script is executable and follows existing bin/ conventions

Step 2: Create /artifacts Skill

File: skills/artifacts/SKILL.md.tmpl

Frontmatter:

---
name: artifacts
description: "Browse and manage artifacts from prior skill runs. Shows what exists, what's stale, what's missing, and suggests next skills to run."
user_invocable: true
---

Sections:

  1. Preamble ({{PREAMBLE}})
  2. Artifact Inventory -- runs gstack-artifacts --full, presents table
  3. Interactive Browse -- AskUserQuestion with options:
    • A) Read a specific artifact (select from list)
    • B) Show dependency graph (which skills feed into which)
    • C) Show what's missing (suggest next skills based on gaps)
    • D) Clean up stale/superseded artifacts
    • E) Filter by branch or date range
  4. Suggested Next Skill -- Based on what exists and what's missing, recommend the most valuable next skill. For example: "You have a concept and game-review but no balance-review. Your game-review flagged economy issues. Run /balance-review next."
  5. Cleanup -- If user selects D, list superseded artifacts and confirm deletion one at a time (ASK, not AUTO -- these are user files).

Template structure follows existing patterns:

  • AUTO/ASK/ESCALATE classification
  • Anti-sycophancy (no "great collection of artifacts!")
  • AskUserQuestion format with Re-ground, Simplify, Recommend, Options
  • Review Log at the end

This skill produces NO artifact of its own -- it is a read-only browser.

Acceptance criteria:

  • [ ] Template has valid frontmatter
  • [ ] {{PREAMBLE}} included
  • [ ] bun run build generates SKILL.md
  • [ ] bun test passes (all 11 + new template)
  • [ ] Interactive browsing works via AskUserQuestion
  • [ ] Dependency graph is accurate (matches research phase table)
  • [ ] Suggested next skill logic is sound

Step 3: Add Compact Artifact Summary to Preamble

File: skills/shared/preamble.md

Change: After the _PROJECTS_DIR line, add:

# Artifact summary (compact)
[ -n "$_GG_BIN" ] && "$_GG_BIN/gstack-artifacts" --summary 2>/dev/null || true

This adds one line of output to every skill startup showing what artifacts exist. It is non-blocking (|| true) and only runs if $_GG_BIN is found.

The preamble prose section ("Shared artifact directory...") gets an added line:

Run `/artifacts` for a full interactive artifact browser.

Acceptance criteria:

  • [ ] Preamble still under 90 lines
  • [ ] Summary output is compact (1-2 lines max)
  • [ ] Graceful degradation if gstack-artifacts doesn't exist yet
  • [ ] bun run build regenerates all 22 SKILL.md files
  • [ ] bun test passes

Step 4: Update CLAUDE.md and DEVELOPMENT.md

  • Add artifacts to the skill directory listing in CLAUDE.md
  • Add gstack-artifacts to the bin utility listing
  • Document the artifact type registry

Commit Plan (bisect-friendly)

  1. Commit 1: Add bin/gstack-artifacts utility (standalone, no dependencies)
  2. Commit 2: Add skills/artifacts/SKILL.md.tmpl + run bun run build
  3. Commit 3: Update skills/shared/preamble.md + run bun run build (regenerates all 22 skills)
  4. Commit 4: Update CLAUDE.md and DEVELOPMENT.md

Scope & Future Work

In scope for this issue:

  • bin/gstack-artifacts with --summary, --full, --json, --check
  • /artifacts skill template
  • Preamble compact summary
  • Documentation updates

Out of scope (future issues):

  • Migrating existing skills' Artifact Discovery sections to use gstack-artifacts --check (would touch all 22 skills -- separate PR)
  • Review log integration (linking JSONL entries to artifact files)
  • Artifact content indexing (searching inside artifacts)

Estimated Effort

Step Time
bin/gstack-artifacts 2h
/artifacts skill template 1.5h
Preamble update + rebuild 30m
Documentation 30m
Testing + polish 30m
Total ~5h

fagemx avatar Mar 25 '26 06:03 fagemx

Revised Plan: Artifact Browser (Issue #8)

Review Findings

Original plan (Approach C) is technically sound but over-engineered for current stage:

  • No active users yet — don't know if interactive browsing is a real need
  • 22 skills' ls -t globs work fine — nothing is broken
  • 5 hours for a feature with unvalidated demand

Revised: Two-Phase Delivery

Phase 1 (this issue): Preamble compact summary — 30 min

One change: Add 3 lines to skills/shared/preamble.md after _PROJECTS_DIR setup:

# Artifact summary
_ARTIFACT_COUNT=$(ls "$_PROJECTS_DIR"/*.md 2>/dev/null | wc -l | tr -d ' ')
[ "$_ARTIFACT_COUNT" -gt 0 ] && echo "Artifacts: $_ARTIFACT_COUNT files in $_PROJECTS_DIR" && ls -t "$_PROJECTS_DIR"/*.md 2>/dev/null | head -5 | while read f; do echo "  $(basename "$f")"; done

What users see (on every skill startup):

Artifacts: 8 files in ~/.gstack/projects/my-game
  alice-main-game-review-20260325-143000.md
  alice-main-balance-report-20260322-110000.md
  alice-main-concept-20260320-100000.md
  alice-main-direction-review-20260319-160000.md
  alice-main-eng-review-20260318-090000.md

What this solves:

  • Users can SEE that prior artifacts exist (currently invisible)
  • Latest 5 shown = most relevant context
  • Zero friction — no skill to invoke, no tool to learn

What this doesn't solve (intentionally deferred):

  • Interactive browsing
  • Staleness detection
  • Dependency graph visualization
  • Cleanup of superseded artifacts

Verification:

  • [ ] Preamble stays under 90 lines
  • [ ] Output is 0 lines when no artifacts exist (graceful empty)
  • [ ] bun run build regenerates all 26 skills
  • [ ] bun test passes

Commit: Single commit — feat(preamble): show artifact summary on skill startup

Phase 2 (follow-up issue, only if needed): Full utility + skill

Only create if users report:

  • "I need to search/filter artifacts" → bin/gstack-artifacts
  • "I want to browse interactively" → /artifacts skill
  • "I need staleness detection" → --check mode in utility

The original Approach C plan remains valid for Phase 2 — just deferred.

Why this change

Ship the smallest thing that makes artifacts visible. Validate demand before investing 5 hours. The original plan's research and innovate phases are still valuable — they document the full artifact ecosystem for when Phase 2 is needed.

fagemx avatar Mar 25 '26 06:03 fagemx