@ikon85/agent-workflow-kit 0.15.0 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,6 +44,19 @@ the matching GitHub release contain the same artifact.
44
44
  resume the transaction through the update API's `resumeFrom` option. Do not
45
45
  copy staged files into the consumer by hand.
46
46
 
47
+ 5. Check the optional project census after the update:
48
+
49
+ ```sh
50
+ python3 .claude/hooks/drift-guard.py --census-status
51
+ ```
52
+
53
+ When the report names a newer census builder or `refresh_required`, advise
54
+ the user to run `$census-update`. The kit updater must never overwrite a
55
+ consumer-owned census, profile, local scanner, decision, or override. A
56
+ missing, disabled, unactivated, or temporarily unavailable census remains a
57
+ visible manual-walk condition and does not invalidate an otherwise verified
58
+ kit update.
59
+
47
60
  ## State contract
48
61
 
49
62
  The update API reports `checking -> preview/awaiting_decision -> staging ->
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: setup-workflow
3
- description: "Scaffolds the project layer the portable workflow skills assume — issue tracker, triage labels, domain-doc layout, GitHub-Projects board field-IDs, spec-self-critique + spec-completeness seeds, workflow overview, and the deploy target. Writes `docs/agents/*`, `docs/conventions/spec-completeness.md`, and the `## Workflow` / `## Agent skills` / `## Prod` blocks in CLAUDE.md/AGENTS.md. Idempotent: a re-run reconciles per file/section and never overwrites filled content. Run once after installing the skills (or `npx <pkg> init`), or when a skill reports missing project-layer context. Adapted from Matt Pocock's `setup-matt-pocock-skills` (MIT)."
3
+ description: "Scaffolds the project layer the portable workflow skills assume — issue tracker, triage labels, domain-doc layout, board field IDs, spec seeds, workflow overview, optional census choice, and deploy target. Writes `docs/agents/*`, `docs/conventions/spec-completeness.md`, and the `## Workflow` / `## Agent skills` / `## Prod` blocks in CLAUDE.md/AGENTS.md. Idempotent: a re-run reconciles per file/section and never overwrites filled content. Run once after installing the skills (or `npx <pkg> init`), or when a skill reports missing project-layer context. Adapted from Matt Pocock's `setup-matt-pocock-skills` (MIT)."
4
4
  disable-model-invocation: true
5
5
  ---
6
6
 
@@ -25,6 +25,7 @@ This is a prompt-driven skill, not a deterministic script. Explore, present what
25
25
  | `## Workflow` in CLAUDE.md **and** AGENTS.md | generic entry-point map seeded from [workflow-overview.md](./workflow-overview.md) (Section F + Write) |
26
26
  | `## Agent skills` + `## Prod` in CLAUDE.md **and** AGENTS.md | one-line pointers + deploy target (Sections C/G + Write) |
27
27
  | `.github/workflows/agent-workflow-kit-update.yml` | optional tested Kit update pull request for GitHub consumers (Section A2) |
28
+ | `docs/agents/census.md` | optional-census choice, paths, state, and safe disable contract seeded from [census.md](./census.md) (Section A3) |
28
29
 
29
30
  ## Idempotency contract — read before writing anything
30
31
 
@@ -54,6 +55,7 @@ Read the current state; don't assume. For every target file, read its first line
54
55
  - `CLAUDE.md` and `AGENTS.md` at the repo root — which exist? Do they already have a `## Workflow` / `## Agent skills` / `## Prod` block?
55
56
  - `CONTEXT.md`, `CONTEXT-MAP.md`, `docs/adr/` — domain-doc layout.
56
57
  - `docs/agents/`, `docs/agents/skills/`, `docs/conventions/` — prior output of this skill.
58
+ - `docs/agents/census.md`, `.census/profile.json`, `.census/active.json` — an existing census choice or consumer-owned census to adopt.
57
59
  - `gh auth status` (if GitHub) — is `gh` authenticated, and with which scopes?
58
60
 
59
61
  ### 2. Section A — Issue tracker
@@ -105,6 +107,34 @@ For GitLab, local, other, or an unknown provider, give only a provider-neutral e
105
107
 
106
108
  **Conditional board-write note (only when the GitHub tracker uses a managed board):** if Section D ends with `board-sync.md` at `mode: github-projects-v2`, add one line to `issue-tracker.md`: *"Board writes (item-add, status/wave/cluster field edits, sub-issue links) go through the board-sync helper, not bare `gh issue create`/`gh project item-*`."* Do **not** add this for GitLab, local, other, or `mode: none`.
107
109
 
110
+ ### 2b. Section A3 — Optional project census
111
+
112
+ > A project census is an optional, consumer-owned map that counts product
113
+ > surfaces and lists behavior families separately. It can make later plans and
114
+ > handoffs more complete, but setup cannot honestly claim coverage before the
115
+ > repository has been scanned and verified.
116
+
117
+ Read [census.md](./census.md) in full before presenting the choice. If
118
+ `docs/agents/census.md` already records `yes`, `later`, or `no`, adopt that
119
+ choice and do not prompt again on an ordinary setup rerun. Also adopt an
120
+ existing, explicitly documented census path. If no choice exists, ask in plain
121
+ language: *"Should setup prepare the optional project census now?"* Offer
122
+ exactly:
123
+
124
+ - **Yes** — create or adopt the project layer and minimal enabled profile, run
125
+ only the shipped self-test, and report the honest `bootstrap` / "not yet
126
+ meaningful" state. Do not scan, activate, or install a hook or gate.
127
+ - **Later** — record a deferral. Create no census profile, hook, or gate; a
128
+ later explicit `census-update` invocation may activate without setup.
129
+ - **No** — record the opt-out as `disabled`. Create no census profile, hook, or
130
+ gate and do not prompt again unless the user explicitly changes the choice.
131
+
132
+ Use the complete `missing / yes / later / no / existing / explicit-enable /
133
+ disable` matrix in the seed. A later explicit `census-update` invocation may
134
+ activate without rerunning setup. Disable enforcement first, but retain every
135
+ consumer-owned profile, scanner, test, and active snapshot unless the user
136
+ separately approves deletion. Repeated runs are no-ops after reconciliation.
137
+
108
138
  ### 3. Section B — Triage labels
109
139
 
110
140
  > When `triage` processes an incoming issue it applies labels (or your tracker's equivalent). It needs strings you've actually configured, or it creates duplicates.
@@ -182,6 +212,14 @@ Seed `docs/agents/code-review.md` from [code-review.md](./code-review.md) — th
182
212
 
183
213
  For each `docs/...` file: obey the idempotency contract (the "Idempotency contract" section). Prepend the sentinel with the resolved `state` (and `mode` for board-sync).
184
214
 
215
+ For `docs/agents/census.md`, seed [census.md](./census.md), prepend the normal
216
+ sentinel, and record the selected choice directly below it as
217
+ `<!-- census: choice=<yes|later|no> -->`. On adoption, also record the discovered
218
+ repository-relative profile and active-snapshot paths. Never overwrite a
219
+ pre-existing consumer-owned census file. `yes`, `later`, `no`, and an adopted
220
+ existing census are terminal for ordinary setup reruns. Only an explicit user
221
+ request changes a recorded choice.
222
+
185
223
  For the **`## Workflow`**, **`## Agent skills`**, and **`## Prod`** blocks, reconcile per section in **both** CLAUDE.md and AGENTS.md that exist:
186
224
 
187
225
  - If **both** files exist → write/update the block in **both** (keep them coherent — Codex is a first-class surface).
@@ -0,0 +1,83 @@
1
+ # Optional project census
2
+
3
+ The census is a consumer-owned, counted map of product surfaces and behavior
4
+ families. It is optional. Setup records only the user's choice; `census-update`
5
+ does the factual scan, resolves ambiguity, verifies a candidate, and activates
6
+ the result transactionally.
7
+
8
+ ## Setup state matrix
9
+
10
+ | State or choice | Setup action | Observable result on repeat |
11
+ |---|---|---|
12
+ | `missing` | Explain the census in plain language and ask `yes / later / no`; do not infer an answer. | Ask again only while no choice has been recorded; write no hook or gate. |
13
+ | `yes` | Create the minimal consumer-owned profile, or adopt the existing documented profile path. Set `enabled: true`, keep the active snapshot absent, run only the shipped census self-test, and report `bootstrap` / "not yet meaningful". | Adopt the same profile byte-for-byte; do not rescan, activate, or add another self-test. |
14
+ | `later` | Record a retryable deferral outside the active profile. | Leave census files, hooks, and gates absent; an ordinary setup rerun is a no-op, while an explicit `census-update` may activate later. |
15
+ | `no` | Record an explicit opt-out with census state `disabled`. | Keep the opt-out and do not create census files, hooks, or gates. |
16
+ | `existing` | Adopt the repository's explicitly documented profile and active-snapshot paths without replacing consumer-owned content. Derive its state through the public census API. | Preserve every existing byte and report the derived state. |
17
+ | `explicit-enable` | On a later explicit `census-update` invocation, let that skill scan, decide, verify, and transactionally activate without rerunning setup. | An unchanged verified census reports `current` and performs no write. |
18
+ | `disable` | Set the profile to `enabled: false` transactionally and remove census hooks/gates from enforcement. | Stay `disabled`; retain consumer-owned profiles, scanners, tests, and snapshots unless the user separately approves their deletion. |
19
+
20
+ ## Deterministic setup effects
21
+
22
+ The table below is the machine-checkable reference contract for setup. Its
23
+ ordered `operations` are the only effects the setup proof may execute. Choice
24
+ persistence always means `docs/agents/census.md`: the normal setup sentinel is
25
+ the first line and `<!-- census: choice=<yes|later|no> -->` is the second.
26
+ Paths under `retain` are consumer-owned evidence. Enforcement operations refer
27
+ only to kit-owned wiring documented by the consumer; they are not permission to
28
+ invent another census engine.
29
+
30
+ ```json census-setup-effects
31
+ [
32
+ {"state":"missing","actor":"setup","choice":"none","operations":[],"retain":[],"repeat":"no-write"},
33
+ {"state":"yes","actor":"setup","choice":"yes","operations":["reconcile-choice-doc","reconcile-minimal-profile","derive-state","run-foundation-self-test"],"retain":[],"repeat":"no-write"},
34
+ {"state":"later","actor":"setup","choice":"later","operations":["reconcile-choice-doc"],"retain":[],"repeat":"no-write"},
35
+ {"state":"no","actor":"setup","choice":"no","operations":["reconcile-choice-doc","derive-state"],"retain":[],"repeat":"no-write"},
36
+ {"state":"existing","actor":"setup","choice":"recorded","operations":["adopt-choice-doc","derive-state"],"retain":["choice-doc","profile","active","scanner","scanner-test"],"repeat":"no-write"},
37
+ {"state":"explicit-enable","actor":"census-update","choice":"recorded","operations":["delegate-census-update","run-census-update-contract"],"retain":["choice-doc","profile","active","scanner","scanner-test"],"repeat":"no-write"},
38
+ {"state":"disable","actor":"census-update","choice":"recorded","operations":["remove-kit-hook","remove-kit-gate","update-profile-disabled","derive-state"],"retain":["choice-doc","profile-unknown-keys","active","scanner","scanner-test"],"repeat":"no-write"}
39
+ ]
40
+ ```
41
+
42
+ ## Bootstrap profile
43
+
44
+ When `yes` creates the default `.census/profile.json`, write the deterministic
45
+ profile shape documented by `census-update`: `schemaVersion: 1`, `enabled:
46
+ true`, and empty `decisions`, `localScanners`, and `overrides` arrays. Do not
47
+ create `.census/active.json`. Its absence is the evidence that the honest state
48
+ is `bootstrap`, not `current`.
49
+
50
+ Before writing, check for an existing repository convention and adopt it. A
51
+ pre-existing profile remains consumer-owned: preserve unknown keys and do not
52
+ replace its decisions. Never derive `current` from file presence; use
53
+ `resolveCensusState` from `scripts/census/index.mjs`.
54
+
55
+ Run the focused `scripts/census/state.test.mjs` census foundation self-test
56
+ already shipped with the kit.
57
+ A passing self-test proves the mechanism is available, not that this repository
58
+ has been scanned. Setup must not install pre-commit, pre-push, CI, planning, or
59
+ handoff gates for `yes`, `later`, or `no`.
60
+
61
+ ## Later activation and disable
62
+
63
+ `later` and `no` are setup choices, not partially active censuses. A later,
64
+ explicit `census-update` invocation is the sole activation route. Setup
65
+ delegates this route to the shipped `census-update` contract and its focused
66
+ `scripts/test_census_update_contract.test.mjs` proof; it does not reproduce
67
+ activation, snapshots, or enforcement. Setup itself never calls `activateCensus`.
68
+
69
+ Disable follows the ordered contract: remove the kit-owned hook, remove the
70
+ kit-owned gate, then atomically replace only the profile's `enabled` value with
71
+ `false`, preserving unknown keys, and verify `disabled` through
72
+ `resolveCensusState`. Enforcement removal must finish before any profile
73
+ mutation. Treat the choice document, local scanners, their tests, the profile,
74
+ and the active snapshot as consumer-owned evidence. List those files and ask
75
+ for separate deletion approval; without that approval, retain them.
76
+ Setup never deletes consumer-owned files as part of disable.
77
+
78
+ ## Setup report
79
+
80
+ Report the choice, adopted or created paths, derived state, self-test result,
81
+ and whether enforcement changed. Name every action skipped on an idempotent
82
+ rerun. Never claim surface coverage during setup: only `census-update` can
83
+ produce a verified `X of Y` result.
@@ -76,6 +76,24 @@ gh project item-list 1 --owner <owner> --limit 500 --format json # check targe
76
76
  - `<!-- prd-source-id: <id> -->` + `<!-- prd-content-fp: <hash> -->` (see step 3).
77
77
  5. **Mode B label normalization:** if the reused issue carries wrong/multiple `type:*`, missing `priority:*`, `ready-for-agent`, or `needs-info` → **normalize onto the PRD contract** (exactly one `type:*`, one `priority:*`, no `ready-for-agent`/`needs-info`). Exception per the discriminator (§2): `type:cluster` always, or Wave **without** `wave-stub` → **no** normalization, **hard stop** (step 2); a `wave-stub`-labeled Stufe-1p target normalizes normally — it is a valid Mode B target.
78
78
 
79
+ ### Census freshness before a cross-cutting lock
80
+
81
+ When the PRD claims completeness across several product surfaces, run
82
+ `python3 .claude/hooks/drift-guard.py --census-status` before the board write.
83
+ An activated census reporting `refresh_required` means the cross-cutting PRD
84
+ must not be locked: run `$census-update`, resolve every open surface, and retry.
85
+ `disabled`, `no_census`, `bootstrap`, or `offline` stays visible and fail-open;
86
+ perform and report the existing manual walk instead. This gate does not apply
87
+ to an orthogonal, surface-local PRD.
88
+
89
+ A justified change-local override may acknowledge only a proven mechanical
90
+ false positive. It must carry `scope: "this change"`, a non-empty `reason`, and
91
+ the exact `topologyFingerprint` reported as `change_binding` by the current
92
+ status check. That binding is valid only for those freshly scanned topology
93
+ facts; a later topology change makes the persisted override stale. The
94
+ override never changes scanner facts, builder/topology fingerprints, open
95
+ verdicts, or state resolution, and therefore cannot green real drift.
96
+
79
97
  ## 4b. Program-PRD body (mode=program)
80
98
 
81
99
  mode=program writes the Program-PRD per `.claude/skills/to-prd/PROGRAM-PRD-FORMAT.md` instead of the `<prd-template>` below — a **parallel** grammar for the program altitude, not a replacement (a Feature-PRD keeps using `<prd-template>` unchanged). It carries: the `## Scope` chapter with stable Scope-Item IDs (`S1`, `S2`, …), the machine-parsable `## Wellenplan` table (`Welle | Status | Name | Phase | Slices | Gate | covers`), the `## Phasen-Gates` checklist (only when the program uses phases), the `## Slices` per-slice detail chapter (one `####` section per planned slice, per `SLICE-METADATA-FORMAT.md`'s grammar), and the Abbruch-Konvention. `scripts/program_graph.py` (`board-sync.py validate-graph`) is the parser — to-prd writes the shape, it does not itself validate the graph (that is `to-waves`'s job, run once the Program-PRD exists).