# Ingest Triage

Classify and resolve conflicts detected during bundle ingest (structural duplicates...

- Repository: https://github.com/Kaelio/ktx (1627 stars)
- Category: Engineering
- License: Apache-2.0
- Last updated: 2026-10-22
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add Kaelio/ktx --skill ingest_triage -g -a claude-code -y`
Codex: `npx skills add Kaelio/ktx --skill ingest_triage -g -a codex -y`
Cursor: `npx skills add Kaelio/ktx --skill ingest_triage -g -a cursor -y`
Gemini CLI: `npx skills add Kaelio/ktx --skill ingest_triage -g -a gemini-cli -y`

## Description

Classify and resolve conflicts detected during bundle ingest (structural duplicates, definitional contradictions, near-duplicate clusters, re-ingest changes, evictions).

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Ingest Triage - conflict classification and resolution

This skill is loaded in two contexts:
- By a Stage 3 WorkUnit agent when `sl_discover`, deterministic projection
  output, existing project memory, or prior provenance overlaps with what the
  current WorkUnit is about to write.
- By the Stage 4 reconciliation agent for cross-WorkUnit sweeps, accepted patch
  overlap, and eviction decisions.

Apply the rules below before every write that could collide with an existing artifact.

## Decision tree

1. **Is this the same artifact I'm producing now, or a different one with the same name?**
   Read both. If names match and content matches (modulo whitespace): no conflict - skip the write, the prior one stands.

2. **If content differs, is it an expression-only change (e.g. a different `sql:` body for the same measure name, same grain, same columns)?**
   Re-ingest change (expression-only): silently replace via `sl_edit_source`. No flag.

3. **If the difference is structural - grain, columns, filter, join shape - is the current bundle the re-ingest of a previously-ingested bundle (i.e. `priorProvenance` has a row for this raw file and artifact)?**
   Re-ingest change (semantic break): replace + flag. Record in the IngestReport's `conflicts_resolved` list with `flagged_for_human: true`.

4. **If reconciliation sees accepted patches from this same job with no
prior-sync row, check for same-ingest contradictions:**

The rest: https://github.com/Kaelio/ktx/blob/HEAD/packages/cli/src/skills/ingest_triage/SKILL.md
