# Content repurposing workflow blueprint

## Trigger and termination

- Trigger: `{source_id, source_version, approval_id, rights_version}` becomes approved for repurposing.
- Success: approved derivative has a reconciled publication record or an explicitly approved draft-only terminal state.
- Stop: revoked source/rights approval, unsupported claim, invalid channel brief, expired editor authority or owner-issued stop.

## State model

`received -> claim_extraction -> claim_review -> ready -> drafting -> validating -> editorial_review -> publication_approval -> publishing -> published`

Alternatives: `returned`, `rejected`, `withdrawn`, `stopped`, `superseded`. Approval never occurs in the drafting step.

## Data contract

- Source: ID, version, hash, approval and canonical location.
- Claim: ID, text, exact source span, citation, qualification, allowed transformations and approval.
- Rights: material ID, owner/consent, allowed channels, expiry and restrictions.
- Brief: version, channel, audience, format, length, voice, desired action and prohibited moves.
- Asset: ID, source/claim/brief versions, draft, validation results, reviewer, publication IDs and correction state.

## Ordered steps and actors

1. **Trigger:** receive approved source version.
2. **AI (bounded):** extract claims/spans or mark ambiguous.
3. **Human:** approve reusable claims and rights.
4. **Code:** select approved claims for one brief and compute asset key.
5. **AI (bounded):** draft without new facts, quotes or outcomes.
6. **Code:** validate lineage, labels, prohibited terms and duplicate keys.
7. **Human:** edit/approve exact asset and publication.
8. **Code:** publish idempotently and retain effect IDs.
9. **Human + code:** correct or withdraw through linked assets when needed.

## Idempotency, retry and rollback

- Key: `asset:{source_id}:{source_version}:{channel}:{brief_version}:{variant_key}`.
- Key each publish effect by asset/version/destination. Reconcile returned IDs before retry.
- A changed draft creates a new version, not an overwritten approved artifact.
- Rollback pauses scheduled effects and withdraws/replaces published assets through recorded destination IDs.

## Permissions and sensitive data

Drafting reads approved source/claim fields only. Publishing credentials are unavailable to the drafting step. Exclude private customer/personal data from prompts and test with fictitious fixtures. Restrict withdrawal to named editors/owners.

## Exception routes

- Unsupported/ambiguous claim -> source editor.
- Quote or media rights gap -> rights owner.
- Channel-policy failure -> channel editor.
- Partial publish -> operations owner.
- Source correction/withdrawal -> all linked asset owners.
- No owner -> safe stop.

## Acceptance tests

1. Unapproved source cannot trigger drafting.
2. Claim without source span cannot enter a draft.
3. Qualification such as “may” cannot become “will.”
4. Quote without exact text/rights is rejected.
5. Drafting step cannot publish or self-approve.
6. Duplicate event creates no duplicate asset/publication.
7. Partial publish retries only missing destinations.
8. Source withdrawal finds and pauses every linked scheduled asset.

## Audit record

Retain source/claim/rights/brief versions, prompts or generation configuration where appropriate, validations, drafts, edits, approvals, publication IDs, retries, corrections and withdrawal events.
