Gestion d'index de runs

VérifiéSûr

Met à jour déterministiquement index.json avec status, last_flow et updated_at. Opérations idempotentes garantissant des diffs stables pour le versioning.

Spar Skills Guide Bot
DeveloppementIntermédiaire
2002/06/2026
Claude Code
#runs-index#demoswarm#index-json#status-update#deterministic-writes

Recommandé pour

Notre avis

Met à jour de manière déterministe les champs status, last_flow et updated_at dans le fichier .runs/index.json via un script shim.

Points forts

  • Écritures déterministes avec diffs stables et tri garantis
  • Mise à jour par run_id sans création de fichier
  • Utilisation sécurisée via un script shim qui gère la résolution
  • Surface d'écriture minimale limitée à trois champs

Limites

  • Ne peut pas créer .runs/index.json s'il n'existe pas
  • Réservé aux agents de nettoyage et de préparation listés
  • Ne lit pas l'index (skill en écriture seule)
Quand l'utiliser

Lors de la mise à jour du statut d'un run après une étape de préparation ou de nettoyage.

Quand l'éviter

Pour créer un nouvel enregistrement ou lire des informations dans l'index.

Analyse de sécurité

Sûr
Score qualité88/100

The skill only invokes a controlled script (demoswarm.sh) with fixed arguments to safely update status fields in a JSON file. No destructive commands, network activity, or injection vectors are exposed beyond what the script itself may contain, and the skill description emphasizes deterministic, idempotent writes.

Aucun point d'attention détecté

Exemples

Update run status after cleanup
Update the index status for run 'feat-auth' to 'VERIFIED' with last_flow 'signal' using the demoswarm shim.
Idempotent status update
Upsert the status of run 'fix-bug' in .runs/index.json to 'FAILED' with last_flow 'build' and the current timestamp, using the demoswarm index command.

name: runs-index description: "Update index.json status. Use for: upsert index.json, update status/last_flow/updated_at. Deterministic writes - stable diffs, no creation. Use only in run-prep and *-cleanup agents. Invoke via bash .claude/scripts/demoswarm.sh index upsert-status." allowed-tools: Bash, Read, Write

Runs Index Skill

Deterministic updates to .runs/index.json. Write-bearing but with minimal surface.

Invocation

Always invoke via the shim:

bash .claude/scripts/demoswarm.sh index upsert-status [options]

Do not set PATH or call helpers directly. The shim handles resolution.


Operating Invariants

Repo root only

  • Assume working directory is repo root.
  • All paths are repo-root-relative.

Minimal ownership

This skill only updates:

  • status
  • last_flow
  • updated_at

Other fields (canonical_key, issue_number, pr_number, etc.) are owned by run-prep, signal-run-prep, and gh-issue-manager.

Stable diffs

  • Upsert by run_id (update in place, not append)
  • Preserve existing ordering
  • Output is sorted for stable git diffs

Allowed Users

Only these agents may use this skill:

  • run-prep
  • signal-run-prep
  • signal-cleanup
  • plan-cleanup
  • build-cleanup
  • gate-cleanup
  • deploy-cleanup
  • wisdom-cleanup

Command Reference

| Command | Purpose | | --------------------- | ------------------------------- | | index upsert-status | Update run status in index.json |


Quick Example

# Update index after signal cleanup
bash .claude/scripts/demoswarm.sh index upsert-status \
  --index ".runs/index.json" \
  --run-id "feat-auth" \
  --status "VERIFIED" \
  --last-flow "signal" \
  --updated-at "$(bash .claude/scripts/demoswarm.sh time now)"
# stdout: ok

Contract Rules

  1. stdout: ok on success, error message on failure
  2. exit code: 0 on success, non-zero on failure
  3. Idempotent: Running twice with same args produces same result
  4. No creation: If .runs/index.json doesn't exist, fail (run-prep owns creation)

Index Schema Reference

{
  "version": 1,
  "runs": [
    {
      "run_id": "feat-auth",
      "canonical_key": "gh-456",
      "task_key": "feat-auth",
      "task_title": "Add OAuth2 login",
      "issue_number": 456,
      "pr_number": null,
      "updated_at": "2025-12-11T22:15:00Z",
      "status": "VERIFIED",
      "last_flow": "signal"
    }
  ]
}

This skill only updates: status, last_flow, updated_at.


For Agent Authors

In cleanup agents:

  1. Use runs-index for index updates (no inline jq)
  2. Handle missing index — if .runs/index.json is missing, add a blocker and do not create it
  3. Use runs-derive for reading — this skill is write-only

Example pattern in cleanup agent:

# Get current timestamp
TIMESTAMP=$(bash .claude/scripts/demoswarm.sh time now)

# Update index
bash .claude/scripts/demoswarm.sh index upsert-status \
  --index ".runs/index.json" \
  --run-id "$RUN_ID" \
  --status "$STATUS" \
  --last-flow "signal" \
  --updated-at "$TIMESTAMP"

Installation

The Rust implementation is preferred. Install to repo-local directory:

cargo install --path tools/demoswarm-runs-tools --root .demoswarm

The shim will automatically resolve in order:

  1. .demoswarm/bin/demoswarm (repo-local install, preferred)
  2. demoswarm on PATH (global install)
  3. cargo run fallback (dev environments)
  4. Python fallback (legacy)
Skills similaires