# d360-distiller

The **seed-to-skill distillation pipeline**. It compiles Rosetta's
governed Data 360 knowledge — the curated patterns, architectural
decisions, and anti-patterns of the canonical seed corpus — into
**task-level, happy-path builder skills** that run on Salesforce's own
`d360_*` MCP tool surface.

This is the knowledge flywheel's last mile: expertise that entered the
graph under governance leaves it as something a builder can actually
run. Each emitted skill walks one proven implementation path (say,
standing up a customer-360 foundation, or taking a segment to
activation) step by step against the real Data 360 tools — and is
**runtime self-contained**: the consuming team runs it in their own
Claude Code or Cowork session against the `d360_*` surface alone, with
no Rosetta dependency.

Because the skills are **compiled projections, never hand-authored**,
they inherit the properties of the knowledge they came from: every
skill carries its provenance (a colophon tracing it to the exact
patterns, decisions, and bindings it was compiled from), refuses every
destructive tool, pairs every create with a verification read-back,
and wears a **draft/UNVERIFIED banner until it has passed its own live
sandbox validation** — the banner flips only by re-render after a
passing smoke test, never by hand. When the underlying knowledge
improves, re-render and the skills follow.

## Command → skill routing

All five commands route to the single pipeline skill
**`seed-to-skill-distillation`** (`skills/seed-to-skill-distillation/`):

| Command | Pipeline stage(s) |
|---|---|
| `/d360-distiller:bind` | Stage 2 — author/refresh `references/tool-bindings.md` from the real d360 tool JSON schemas, diffing the prose reference |
| `/d360-distiller:audit` | Stages 1+3 — re-derive the roster from graph topology; bidirectional coverage audit → the D360-team gap report |
| `/d360-distiller:render` | Stages 4+5 — compile skills from graph + bindings, skills-lint inline (the one-time hand reference render was the WP-B gate, not a command) |
| `/d360-distiller:validate` | Stage 6 tiers 1–2 — standalone skills-lint + mock-surface rehearsal (tier 3 sandbox smoke is operator-driven, recorded in the verification ledger) |
| `/d360-distiller:run-all` | The ordered pipeline, pausing at gates |

## The six-path roster (DT-RX-025 Q-B-1, ratified)

1. `customer-360-foundation` — cp-g-014 → cp-g-015 (ADR-G-002/003) — **reference render**
2. `segment-to-activation` — cp-g-011 → cp-g-007 (ADR-G-005)
3. `zero-copy-federation` — cp-g-018 → cp-g-003 → cp-g-004 → cp-g-020 (ADR-G-003)
4. `unstructured-to-ai-grounding` — cp-g-009 (ADR-G-005)
5. `insight-and-semantic-layer` — cp-g-013 + cp-g-016 (ADR-G-005; single skill at v0.1)
6. `data-graph-real-time-action` — cp-g-005 → cp-g-008 (ADR-G-002/005)

Non-toolable patterns (cp-g-001/002/010/016) distill into §0 preflight gates
inside every emitted skill — never standalone skills.

## Posture (the ADR-PA-012 cardinal invariants)

- **Read-only against the graph.** Seed mode's allow-list: `rosetta_query`,
  `rosetta_get_pattern`, `rosetta_get_a_d_r`, plus a fenced X-C2 seed-read
  of `db/seeds/03g–10g` for the wire-gap fields only (until the DT-RX-025
  Q-D extension ships). `db/seeds/` is off `main` since the
  switch release, so the seed-read takes the files at `SEEDS_REF` (default
  `v0.27.0`, the frozen baseline tag) or under `SEEDS_DIR=<dir>`. Library
  mode (below) has no allow-list: it calls no `rosetta_*` tool at all.
  Every rosetta write tool REJECTED.
- **Compiled projections.** Emitted skills are never hand-edited (sole
  exception: the one-time WP-B bootstrap render). Defect → fix
  bindings/graph → re-render.
- **Destructive-surface rejection.** Every emitted skill REJECTS all
  `d360_*_delete` tools; every create pairs with a verify read-back.
- **Verification honesty.** draft/UNVERIFIED banner until the skill's own
  D360 sandbox smoke passes; banner state lives in
  `references/verification-ledger.yaml`, flipped only by re-render.
- **Runtime self-containment.** Emitted skills carry no Rosetta MCP
  dependency — they run in the consuming team's Claude Code / Cowork
  session against the `d360_*` surface alone.

## Library mode (0.2.0)

`LIBRARY_DIR=<rosetta-deploy clone> LIBRARY_REF=<commit or tag>` on
`audit`, `render` or `run-all` reads the corpus from one `rosetta-deploy`
release projection instead of the live graph or the frozen seeds
(`rosetta-deploy` `SM-RDEP-001` `E3-S2-WP1`; platform `E3-S5-WP24`):

- Every read is `git -C <LIBRARY_DIR> show <LIBRARY_REF>:<path>`; the
  clone's working tree is never read or changed.
- Each `CP/`, `ADR/`, `EF/` and `BI/` file is checked against the sha256
  that `release-manifest.json` records for it at that ref; a mismatch
  stops the run. Every `ef-g` and `bi-g` id in the tool bindings must
  resolve to a file.
- No `rosetta_*` tool and no seed-read. `SKILL.md` § Library field map
  says which file field carries each value the seed mode took from MCP
  or the seeds.
- The colophon names the library commit and the snapshot in place of
  QueryTrace ids, for example `rosetta-deploy 31f4df3 files (CP, ADR, EF,
  BI), snapshot content-2026-10-15-v1.1.0` and `snapshot
  content-2026-10-15-v1.1.0 @ sha256 f567f0d8fb5cf1b4 (library read; no
  QueryTrace)`.
- It is not a degraded run, and the draft banner stays until a sandbox
  smoke passes, as in seed mode.

Seed mode, the default, is unchanged.

## Outputs

Runs land under `outputs/plugins/d360-distiller/<run-id>/` (ADR-PA-008;
gitignored; never auto-promoted): rendered skills, schema-diff report,
coverage audit, lint verdicts, rehearsal transcripts, run `MANIFEST.md`
carrying the `read-only: no write tool invoked` attestation. Delivery into
`d360-advisory-framework` is an operator-driven handoff under that repo's
DT-D360-005 intake — never a push from this plugin.

## Status

- **WP-A** — `references/tool-bindings.md` v0.1.1 authored +
  both-direction coverage audit done; **A-AT1 / A-AT4 stay OPEN** —
  pending receipt of the official d360 tool JSON schemas
  (see `references/tool-schemas/README.md`);
  bindings provenance stays `prose-reference-DRAFT`, and per
  workplan §9 the pipeline never ships as final until the
  schema-confirmation pass runs.
- **WP-B** — **DONE.** The `customer-360-foundation` hand render
  passed the shape-ratification HARD GATE (**RATIFIED 2026-07-03 by
  Vernon Keenan**; recorded in the evidence DT gate ledger +
  dt-pa-006 §Ratification); emit templates extracted to
  `skills/seed-to-skill-distillation/templates/`.
- **WP-C** — **DONE 2026-07-05.** Fixture-instantiation compiler
  (C-AT1 byte-identical vs the ratified render), skills-lint at nine
  checks (red-team closure 7/7), five roster renders live with
  tier-1 lint PASS (draft/UNVERIFIED per scope), mock-surface
  rehearsal PASS on the provisional oracle.
- **WP-D** — **PENDING**: live sandbox validation not yet run
  (D-AT1..D-AT5).
- **Library mode (0.2.0, E3-S5-WP24)** — specified; the first library
  render of the six paths is `rosetta-deploy` `E3-S2-WP1`'s.

## Governance record

Authorized by cross-repo
`rosetta-meta/decision-traces/DT-RX-025-d360-seed-to-skill-distillation.md`
(RATIFIED 2026-07-02) and plugin-lane
`dt-pa-006`
(RATIFIED 2026-07-03 → ADR-PA-012, implementation-gated). Built under
manifest WP **E3-S5-WP21**
(`docs/workplans/e3-s5-wp21-d360-distiller-workplan.md`); library mode
is manifest WP **E3-S5-WP24**. The seed
corpus it compiles from: `db/seeds/03g–10g` at `v0.27.0` (20 ContextPatterns, 5
ADRs, 12 EngineFunctions, 15 BusinessIntents, 89 SourceArtifacts), or in
library mode their files in a `rosetta-deploy` release.
The real d360 tool JSON schemas are the binding oracle, never the
prose reference.

- **License:** Proprietary — © 2026 Keenan Vision LLC (see the repo
  LICENSE)
