Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"name": "dk-workflows",
"source": "./",
"description": "dk-workflows",
"version": "1.1.23"
"version": "1.2.0"
}
]
}
2 changes: 1 addition & 1 deletion .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dk-workflows",
"version": "1.1.23",
"version": "1.2.0",
"description": "Portable repository workflows, configurable reviewers, and guarded drafting.",
"author": {
"name": "Dmitry Kropachev"
Expand Down
2 changes: 1 addition & 1 deletion .codex-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dk-workflows",
"version": "1.1.23",
"version": "1.2.0",
"description": "Portable repository workflows, configurable reviewers, and guarded drafting.",
"author": {
"name": "Dmitry Kropachev"
Expand Down
7 changes: 7 additions & 0 deletions PROVENANCE.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,12 @@
"source": "local-skills/shared",
"commit": "57382c9a8cf574e221891b6777d4ea8892956266"
}
],
"owned_changes": [
{
"source": "dk-code-factory/dk-workflows",
"version": "1.2.0",
"description": "Incremental preparation, conclusion graph, immutable evidence lineage, refresh validation and regression coverage."
}
]
}
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# dk-workflows

Independent MIT plugin for Claude Code and Codex. Version 1.1.23.
Independent MIT plugin for Claude Code and Codex. Version 1.2.0.

## Install

Expand Down Expand Up @@ -226,3 +226,12 @@ schedule an update. All later manifest reads use that retained copy, including
when the host removes the original installation during lookup. Entry failures
without a usable runtime receipt stop work; offline release checks still return
a retained runtime and token and remain nonblocking.

Preparation v2 retains stable conclusion dependencies and immutable evidence snapshots.
`prepare --previous-preparation FILE` compares complete Git entries and governing
sources, reuses proven unchanged conclusions, and batches affected conclusions into
one reassessment. Identical and supported operational refreshes use zero model calls;
`--full-analysis` requests full reassessment. The refresh report exposes changed inputs,
affected/reused IDs and actual call counts. Review coverage, session identities, CI,
Decisions synchronization and iteration budgets retain their existing gates. See
[the preparation artifact contract](runtime/dk-pr-decisions/references/preparation.md).
2 changes: 2 additions & 0 deletions claude/skills/dk-pr-decisions/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ Use Claude Code native agents and tools. `${CLAUDE_PLUGIN_ROOT}` is this plugin
Before work, read [the lifecycle procedure](../../../common/lifecycle.md), then run its entry command with `--host claude`. Retain its returned token and follow its structured action. Always run its completion command with that token in a finalization step, including on failure or interruption.

Read [the shared procedure](../../../runtime/dk-pr-decisions/procedure.md) and perform the requested workflow. Resolve paths beginning with `PLUGIN_ROOT/` against this plugin's root. Preserve the shared procedure's validation and publication guards.

On preparation refresh, select the active artifact with `prepare --previous-preparation FILE`; follow [the incremental preparation contract](../../../runtime/dk-pr-decisions/references/preparation.md). Preserve review budgets and exact session/coverage gates.
2 changes: 2 additions & 0 deletions claude/skills/dk-pr-iter/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ Use Claude Code native agents and tools. `${CLAUDE_PLUGIN_ROOT}` is this plugin
Before work, read [the lifecycle procedure](../../../common/lifecycle.md), then run its entry command with `--host claude`. Retain its returned token and follow its structured action. Always run its completion command with that token in a finalization step, including on failure or interruption.

Read [the coordinator entry](../../../runtime/dk-pr-iter/procedure.md), then read each linked stage contract before acting in that stage. Give child agents only their assigned role contracts and pinned evidence paths. Resolve paths beginning with `PLUGIN_ROOT/` against this plugin's root. Preserve the shared procedure's validation and publication guards.

On preparation refresh, select the active artifact with `prepare --previous-preparation FILE`; follow [the incremental preparation contract](../../../runtime/dk-pr-decisions/references/preparation.md). Preserve review budgets and exact session/coverage gates.
2 changes: 2 additions & 0 deletions claude/skills/dk-pr-review/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ Use Claude Code native agents and tools. `${CLAUDE_PLUGIN_ROOT}` is this plugin
Before work, read [the lifecycle procedure](../../../common/lifecycle.md), then run its entry command with `--host claude`. Retain its returned token and follow its structured action. Always run its completion command with that token in a finalization step, including on failure or interruption.

Read [the shared procedure](../../../runtime/dk-pr-review/procedure.md) and perform the requested workflow. Resolve paths beginning with `PLUGIN_ROOT/` against this plugin's root. Preserve the shared procedure's validation and publication guards.

On preparation refresh, select the active artifact with `prepare --previous-preparation FILE`; follow [the incremental preparation contract](../../../runtime/dk-pr-decisions/references/preparation.md). Preserve review budgets and exact session/coverage gates.
2 changes: 2 additions & 0 deletions codex/skills/dk-pr-decisions/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ Use this Codex session and native subagents when available. Use the loaded skill
Before work, read [the lifecycle procedure](../../../common/lifecycle.md), then run its entry command with `--host codex`. Retain its returned token and follow its structured action. Always run its completion command with that token in a finalization step, including on failure or interruption.

Read [the shared procedure](../../../runtime/dk-pr-decisions/procedure.md) and perform the requested workflow. Resolve paths beginning with `PLUGIN_ROOT/` against this plugin's root. Preserve the shared procedure's validation and publication guards.

On preparation refresh, select the active artifact with `prepare --previous-preparation FILE`; follow [the incremental preparation contract](../../../runtime/dk-pr-decisions/references/preparation.md). Preserve review budgets and exact session/coverage gates.
2 changes: 2 additions & 0 deletions codex/skills/dk-pr-iter/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ Use this Codex session and native subagents when available. Use the loaded skill
Before work, read [the lifecycle procedure](../../../common/lifecycle.md), then run its entry command with `--host codex`. Retain its returned token and follow its structured action. Always run its completion command with that token in a finalization step, including on failure or interruption.

Read [the coordinator entry](../../../runtime/dk-pr-iter/procedure.md), then read each linked stage contract before acting in that stage. Give child agents only their assigned role contracts and pinned evidence paths. Resolve paths beginning with `PLUGIN_ROOT/` against this plugin's root. Preserve the shared procedure's validation and publication guards.

On preparation refresh, select the active artifact with `prepare --previous-preparation FILE`; follow [the incremental preparation contract](../../../runtime/dk-pr-decisions/references/preparation.md). Preserve review budgets and exact session/coverage gates.
2 changes: 2 additions & 0 deletions codex/skills/dk-pr-review/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ Use this Codex session and native subagents when available. Use the loaded skill
Before work, read [the lifecycle procedure](../../../common/lifecycle.md), then run its entry command with `--host codex`. Retain its returned token and follow its structured action. Always run its completion command with that token in a finalization step, including on failure or interruption.

Read [the shared procedure](../../../runtime/dk-pr-review/procedure.md) and perform the requested workflow. Resolve paths beginning with `PLUGIN_ROOT/` against this plugin's root. Preserve the shared procedure's validation and publication guards.

On preparation refresh, select the active artifact with `prepare --previous-preparation FILE`; follow [the incremental preparation contract](../../../runtime/dk-pr-decisions/references/preparation.md). Preserve review budgets and exact session/coverage gates.
6 changes: 3 additions & 3 deletions runtime/dk-pr-decisions/references/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ All former top-level command results now live under `data`; publication results

## Preparation and combined publication

`prepare --input-manifest FILE --output-dir PRIVATE_DIR` delegates to
`prepare --input-manifest FILE --output-dir PRIVATE_DIR [--previous-preparation FILE] [--full-analysis]` delegates to
`scripts/preparation.py` without a discussion scan or any publication. It preserves
this API v2 envelope; `data` contains `artifact`, `preparation_id` and `readiness`.
The artifact has its own `preparation_version: 1`; read
this API v2 envelope; `data` contains `artifact`, `preparation_id`, `readiness` and a `refresh` report.
The artifact has its own `preparation_version: 2`; read
[the preparation contract](preparation.md) for complete evidence, semantic analysis,
question retention, placement, proportionate tests, and downstream gates.
`verified: true` retains its original provenance/freshness meaning.
Expand Down
135 changes: 135 additions & 0 deletions runtime/dk-pr-decisions/references/preparation-contract.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Preparation data contract

Use with [the preparation procedure](preparation.md). Return JSON only. Evidence
references name indexed original sources, optionally with locators (`production/0#L42`).
All strings below are nonempty unless stated otherwise; evidence arrays are nonempty.

## Initial response

Return `{"analysis": ANALYSIS, "graph": NODES}`. Analysis contains:

| Field | Required content |
| --- | --- |
| `boundaries` | Nonempty conclusion arrays for `correctness`, `remediation_depth`, `performance`, `compatibility`, `complexity`. Cover supported cases/exclusions, allowed depth, relevant workloads/limits, supported interfaces/environments and justified design costs. |
| `placement` | Conclusions for `production`, `tests`, `reuse`, `entrypoints`, `dependencies`, each with a nonempty `locations` string array. |
| `test_strategy` | Nonempty array: string fields `behavior`, `existing`, `missing`, `level`, `location`, `command`, `rationale`, `limitation`, plus `evidence`. Use `none` when applicable. Level: `inspection`, `unit`, `integration`, `system`, `performance`. |
| `questions` | Open prior questions and resolved contradictions, using the shape below. Empty is valid. |
| `reviewer_addenda` | Each configured reviewer name mapped to tailored instructions. |
| `worker_instructions` | Boundaries, selected remedy, principal code/test locations, helpers, scenarios, commands and stopping criteria. |
| `completion_criteria` | Required behavior, placement, sufficient validation, compatibility and cumulative complexity. |
| `sync_required`, `sync_reason` | Boolean and explanation; empty reason allowed only when false. |

A conclusion has `text`, `agreement`, boolean `material`, `rationale`, `evidence`.
Agreement: `established` (explicitly agreed), `interpretation` (grounded routine choice),
or `proposal` (unsettled). Material proposals and open material questions produce
`needs_decision`; required unpublished synchronization produces `sync_pending`.

Questions require `id`, `status` (`open` or `resolved`), boolean `material`,
`statements`, `affected_work`, `recommendation`, `proposed_changes`, `evidence`,
and at least two `options`, each with `choice`, `benefits`, `costs`. A resolved
question also needs `resolution` citing the exact answer or applicable precedence/
supersession and reasoning. Preserve open IDs; graph updates cannot settle choices.

`NODES` has exactly one node per analysis conclusion:

```json
{"location":"/boundaries/correctness/0","depends_on":[],
"paths":[{"path":"src","kind":"subtree"}],"sources":["production/0"],"decisions":[]}
```

Locations are JSON pointers: each boundary, placement, test, question, reviewer
addendum, worker/completion string, and combined `/sync_required` value
`{"sync_required":false,"sync_reason":""}`. Escape reviewer names as JSON pointers.
Initial edges use locations; runtime assigns stable `c-…` IDs and stores nodes by ID.
Each node needs supporting paths, sources or dependencies. Sources are input keys;
Decisions are existing authoritative IDs. Paths are normalized repository-relative
whole `file` or `subtree` watches; `.` permits a root subtree. Cover absent-file
assumptions; no globs, symbol/line watches, call graphs or similarity matching.
Runtime adds governing source watches and reviewer/worker/completion dependencies
on governing conclusions; AI supplies other relevant edges.

## Reassessment response

Return exactly `dispositions`, `additions`, `impacts` arrays:

```json
{"dispositions":[{"id":"c-ID","action":"retain","reason":"Inspected evidence"}],
"additions":[],"impacts":[{"change":"path:new.py","affected":[],"rationale":"Inspected impact"}]}
```

- Each affected/additionally affected existing node and every dependent needs one
disposition: `id`, `action`, `reason`. `retain` preserves its value exactly;
`replace` requires `value`; `remove` retires the ID. Only replace supplies a value.
- Optional `watches` replaces all fields: `depends_on`, `paths`, `sources`, `decisions`.
Existing edges use stable IDs. Dependents must explicitly rewire removed targets.
- Additions require `location`, `value`, `watches`, `reason`. List locations append
with `/boundaries/DIMENSION/-`, `/test_strategy/-`, `/questions/-`; singleton slots
must be absent. Added governing conclusions require guidance dispositions.
- New or updated nodes may depend on `addition:N`, the response's zero-based addition
index in canonical decimal without leading zeros. Forward edges and cycles work;
runtime preallocates stable IDs and resolves references before validation. Stored
IDs survive replacement; retired IDs cannot return. Runtime rebuilds list indexes.
- Each unmapped change requires `change`, `affected` existing IDs (possibly empty),
`rationale`. Repeated `affected` IDs are coalesced. Missing mappings never prove
irrelevance. Invalid or dangling references, repeated `impacts[].change` or
`dispositions[].id` entries, ID collisions, missing dispositions or lost open
questions block.

If impact cannot be bounded, return only
`{"full_reassessment":true,"reason":"Why impact cannot be bounded"}`.
The one full fallback uses the same disposition protocol for all existing nodes;
a full phase cannot escalate again. Explanations belong in the refresh report.

## Evidence normalization

Repository sources match relative paths; known GitHub records match stable IDs.
Opaque inputs keep exact byte hashes and path identities. A `complete` field in
application data declares no fetch completeness. Supported collectors enforce theirs.
Unknown fields, source additions/removals, authorship, text, nested order and precedence
remain significant. Exact supported exceptions:

- Context transport paths, head and local-checkout status are operational; metadata
ignores `headRefOid`, Decisions ignore only record `head_sha` (`data.head_sha` in
an envelope), patches derive from Git. All other Decisions envelope fields govern.
Manifest locations are transport, with each source compared separately. Reviewer
descriptors compare structurally; verified prior preparation supplies lineage.
- Complete inline feedback uses integer `schemaVersion:1`, `threads`/`items` and
validated `threadsSha256`/`itemsSha256`. Conversation has no version marker,
`reviews`/`comments`/`items` and validated `sha256`. Only known collection order,
JSON formatting and supported thread `isResolved` are operational. Unknown fields
retain content/order, including other schemas' collection/hash names. All original
text records remain required; new, edited, removed, bot or self-authored text governs.
- Integer `preparation_history_version:1` requires `governing` and `operational`
objects. Integer `evidence_version:1` requires `governing`, permits `operational`
and supports stable `source_id` across relocation. Other marker types stay opaque.
Keep choices, questions, constraints, unanswered requests and supersession under
`governing`; unknown fields govern. Excluded operational fields are nonnegative
integer `cycles`/`cycle_retries`/`repairs`/`reruns`, string `head_sha`/`run_id`/
`checked_at`, known CI `status`, and `publication_receipts` arrays with string
`url`/`head_sha`/`sha256`/`outcome`/`timestamp`/`artifact`/`kind` fields only.
Unknown receipt fields keep the collection governing. Known statuses: `pending`,
`queued`, `in_progress`, `success`, `failure`, `neutral`, `cancelled`, `skipped`,
`timed_out`. Operational state never changes Decisions or review-session identity.

## Stored artifact and verification

Immutable `preparation_version:2` artifacts retain `analysis`, graph/retired IDs,
input fingerprints, reviewer descriptors, readiness, PR/base/head/body/Decisions
identity, parent path/ID/hash and migration provenance. Snapshots are fingerprinted
and read-only outside the repo. Historical validation checks retained integrity and
graph structure; current gates also check live inputs and current mandatory rules.
Migration preserves original v1 storage and grants no coverage or cycle budget.

Artifact and API `refresh` report mode, changed paths/sources, unmapped changes,
binding/identity changes, affected/reused conclusions, explanations and actual
`model_call_count`, including corrections. Dependency metadata and refresh explanations
remain outside binding analysis. Tree-equivalent review reuse preserves original
provenance only when existing scope/rules/Decisions/instruction/base checks pass.

Completion verification has `verification_version:1`, current `preparation_id`,
`pr_url`, `head_sha`, and `checks` for `behavior`, `placement`, `test_sufficiency`,
`compatibility`, `complexity`. Each check contains boolean `satisfied`, `rationale`,
and nonempty `evidence`: `{"path":"ABSOLUTE_PATH","sha256":"FILE_HASH"}`.
Inspection reports, code and test results qualify; missing, false or stale evidence
blocks completion. Both stages use the same current preparation, verification and
mutable run record; an immutable history snapshot cannot replace live choices.
Loading
Loading