@gobing-ai/knowledge-kit 0.1.17 → 0.1.20

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.
Files changed (95) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/board/daily-voice/index.js +40 -7
  3. package/dist/index.js +8428 -4448
  4. package/package.json +1 -1
  5. package/plugins/generations/image-gen/README.md +31 -31
  6. package/plugins/generations/image-gen/assets/sample/provenance.json +314 -0
  7. package/plugins/generations/image-gen/config.example.yaml +3 -0
  8. package/plugins/generations/image-gen/dist/index.js +154 -14
  9. package/plugins/generations/image-gen/presets/SOURCE.md +65 -0
  10. package/plugins/generations/image-gen/scripts/eval-style-presets.ts +513 -0
  11. package/plugins/generations/image-gen/scripts/gen-samples.ts +57 -7
  12. package/plugins/generations/image-gen/src/presets.ts +6 -5
  13. package/plugins/generations/image-gen/src/providers/h3-local.ts +196 -0
  14. package/plugins/generations/image-gen/src/providers/types.ts +11 -1
  15. package/plugins/kk/config.example.yaml +7 -2
  16. package/plugins/kk/decisions/extract/ai-news.yaml +5 -2
  17. package/plugins/kk/plugin.json +1 -1
  18. package/plugins/kk/publish-presets/chinese-article.json +8 -2
  19. package/plugins/kk/publish-presets/daily-ai-voice-migration.json +1 -1
  20. package/plugins/kk/publish-presets/daily-ai-voice.json +57 -16
  21. package/plugins/kk/publish-presets/itc-main.json +36 -9
  22. package/plugins/kk/publish-presets/technical-article.json +8 -2
  23. package/plugins/kk/schedules/kk-daily-ai-voice3.cron.tmpl +8 -9
  24. package/plugins/kk/schedules/kk-daily-publish3-cn-peak.cron.tmpl +13 -19
  25. package/plugins/kk/schedules/kk-daily-publish3-overseas.cron.tmpl +11 -9
  26. package/plugins/kk/scripts/daily-stages.ts +238 -14
  27. package/plugins/kk/scripts/daily-triage-core.ts +43 -25
  28. package/plugins/kk/scripts/daily-triage.ts +1 -1
  29. package/plugins/kk/skills/image-authoring/SKILL.md +7 -3
  30. package/plugins/kk/skills/image-authoring/references/providers.md +27 -0
  31. package/plugins/kk/skills/image-authoring/references/style-extraction.md +1 -1
  32. package/plugins/kk/skills/publish/SKILL.md +15 -2
  33. package/plugins/kk/skills/web-automation/SKILL.md +31 -1
  34. package/plugins/kk/workflows/kk-article-generate.yaml +485 -0
  35. package/plugins/kk/workflows/kk-collect.yaml +8 -4
  36. package/plugins/kk/workflows/kk-daily-ai-voice.yaml +2 -1
  37. package/plugins/kk/workflows/kk-daily-ai-voice2.yaml +4 -2
  38. package/plugins/kk/workflows/kk-daily-safety.yaml +5 -7
  39. package/plugins/kk/workflows/kk-news-generate.yaml +410 -0
  40. package/plugins/kk/workflows/kk-publish.yaml +236 -0
  41. package/plugins/publishings/bilibili-pub/dist/profile-check.js +49 -10
  42. package/plugins/publishings/cnblogs-pub/dist/profile-check.js +60 -10
  43. package/plugins/publishings/csdn-pub/dist/profile-check.js +60 -10
  44. package/plugins/publishings/infoq-pub/dist/profile-check.js +60 -10
  45. package/plugins/publishings/jike-pub/dist/profile-check.js +60 -10
  46. package/plugins/publishings/juejin-pub/dist/profile-check.js +60 -10
  47. package/plugins/publishings/linkedin-pub/dist/index.js +43 -6
  48. package/plugins/publishings/linkedin-pub/dist/profile-check.js +92 -15
  49. package/plugins/publishings/linkedin-pub/src/index.ts +52 -6
  50. package/plugins/publishings/shipinhao-pub/dist/index.js +391 -32
  51. package/plugins/publishings/shipinhao-pub/dist/profile-check.js +52 -11
  52. package/plugins/publishings/shipinhao-pub/plugin.json +1 -1
  53. package/plugins/publishings/shipinhao-pub/src/audio-flow.ts +393 -0
  54. package/plugins/publishings/shipinhao-pub/src/flow.ts +243 -14
  55. package/plugins/publishings/shipinhao-pub/src/selectors.ts +13 -0
  56. package/plugins/publishings/sspai-pub/dist/profile-check.js +60 -10
  57. package/plugins/publishings/substack-pub/dist/profile-check.js +60 -10
  58. package/plugins/publishings/surfdash-pub/dist/index.js +50 -8
  59. package/plugins/publishings/surfdash-pub/src/index.ts +59 -8
  60. package/plugins/publishings/surfdash-pub/src/topic-claims.ts +34 -3
  61. package/plugins/publishings/threads-pub/dist/index.js +9196 -296
  62. package/plugins/publishings/threads-pub/dist/profile-check.js +21139 -0
  63. package/plugins/publishings/threads-pub/package.json +3 -1
  64. package/plugins/publishings/threads-pub/plugin.json +6 -1
  65. package/plugins/publishings/threads-pub/src/index.ts +8 -1
  66. package/plugins/publishings/threads-pub/src/post-rail.ts +357 -0
  67. package/plugins/publishings/threads-pub/src/profile-check.ts +17 -0
  68. package/plugins/publishings/wechatmp-pub/dist/index.js +454 -81
  69. package/plugins/publishings/wechatmp-pub/dist/profile-check.js +401 -102
  70. package/plugins/publishings/wechatmp-pub/src/flow.ts +42 -4
  71. package/plugins/publishings/wechatmp-pub/src/index.ts +142 -102
  72. package/plugins/publishings/wechatmp-pub/src/profile-check.ts +36 -58
  73. package/plugins/publishings/weibo-pub/dist/index.js +136 -22
  74. package/plugins/publishings/weibo-pub/dist/profile-check.js +61 -11
  75. package/plugins/publishings/weibo-pub/src/index.ts +208 -22
  76. package/plugins/publishings/x-pub/dist/index.js +263 -43
  77. package/plugins/publishings/x-pub/dist/profile-check.js +63 -11
  78. package/plugins/publishings/x-pub/src/index.ts +15 -1
  79. package/plugins/publishings/x-pub/src/post-rail.ts +334 -0
  80. package/plugins/publishings/xhs-pub/dist/index.js +193 -201
  81. package/plugins/publishings/xhs-pub/dist/profile-check.js +380 -85
  82. package/plugins/publishings/xhs-pub/src/automation-guard.ts +2 -3
  83. package/plugins/publishings/xhs-pub/src/flow.ts +177 -205
  84. package/plugins/publishings/xhs-pub/src/index.ts +65 -59
  85. package/plugins/publishings/xhs-pub/src/modes.ts +1 -1
  86. package/plugins/publishings/xhs-pub/src/page.ts +2 -2
  87. package/plugins/publishings/xhs-pub/src/profile-check.ts +86 -150
  88. package/plugins/publishings/xiaoyuzhou-pub/dist/profile-check.js +60 -10
  89. package/plugins/kk/scripts/daily-scheduled-run.ts +0 -581
  90. package/plugins/kk/scripts/voice3-publish-window.ts +0 -206
  91. package/plugins/kk/workflows/kk-daily-ai-voice3.yaml +0 -903
  92. package/plugins/kk/workflows/kk-daily-publish3.yaml +0 -353
  93. package/plugins/kk/workflows/kk-itc-author.yaml +0 -484
  94. package/plugins/kk/workflows/kk-itc-publish-tail.yaml +0 -112
  95. package/plugins/kk/workflows/kk-itc.yaml +0 -291
@@ -1,903 +0,0 @@
1
- ---
2
- name: kk-daily-ai-voice3
3
- kind: dag
4
- description: >-
5
- The generate half of voice3 (design docs/design/kk-daily-ai-voice3.md §4, task 0324): topic →
6
- QC/translate → drafts → content safety → operator review → audio ∥ images → quality, then the
7
- generate-side channel payloads (`social-write` + `daily-bundle-variants`) and the frozen
8
- `bundle.json` that `kk-daily-publish3` consumes. It publishes nothing: every channel decision and
9
- every send lives in the publish preset and the publish workflow, which is why this graph carries
10
- no `xhs_*` / `wechat_*` / `publish_enabled` switch. Production since the 2026-11-05 cutover (§8);
11
- it still runs in voice2's namespace (work dir, store selections, prepare ledger) by design (§11).
12
-
13
- vars:
14
-
15
- # ---- voice3 additions (task 0324 R4) ----
16
- # `auto_publish` launches publish3 nested when true; off by default exactly like voice2's
17
- # publish_enabled, and the operator turns it on in the schedule entry after the shadow period.
18
- # Card-series authoring/rendering (billed image generation). Turned on by default for XHS 上传图文.
19
- cards_enabled: "true"
20
- # Card count (voice2's `xhs_cards`, minus the channel name): the card plan targets this many.
21
- cards: "6"
22
- auto_publish: "false"
23
- publish_window: "after-generate"
24
- publish_preset: ""
25
- publish_dummy: "false"
26
- # 0334 R7: opt-in live consent channel, forwarded verbatim to the nested publish3
27
- # `live_channels`. Empty by default — this variable alone can never produce a live send
28
- # (ADR-022: only an operator launch that sets it, with tokens the plan stage validates
29
- # against the window, promotes rows; `publish_dummy=true` and a non-empty token list
30
- # refuse each other at plan time).
31
- publish_live_channels: ""
32
- # Composed by the `prepare` node (`kk daily prepare`), then read back into vars through the
33
- # single-node read chain below — shell actions cannot set vars, and a concurrent `setVars` merge
34
- # is last-writer-wins, so the DAG exchanges data by fixed paths under work_dir, never by vars.
35
- work_dir: ""
36
- # Digits-only run-date stamp the artifact names carry; projected from <work_dir>/run-date.txt.
37
- run_date: ""
38
- # Store extract window (kk store extract --window). The old workflow's ingestion window was
39
- # intrinsic to the fan-in; here it is the pool's freshness bound (kk-collect refreshes every 6h).
40
- window: "24h"
41
- language: "zh"
42
- voice_profile: "robin-news"
43
- # Voice driver switch — voxcpm (voxcpm-tts) | gemini (gemini-tts) | voicebox (voice-gen)
44
- # | ominivoice (omni-voice-gen). The generate tier below mirrors the fallback order, and the
45
- # fit/duration gates take their spoken-char rate from this var — switching drivers here is enough.
46
- # 2026-10-20 (operator decision): voxcpm STAYS the primary. It is audibly echoey - a 40 ms periodic
47
- # reflection on renders longer than ~30 s plus a pause floor only 16-22 dB below speech, measured by
48
- # `kk stage audio-quality` on every episode's raw model output since 10-15 (cepstrum 40 ms @ 26-31 dB
49
- # / pauseFloor -16..-22 dB, versus gemini's 20-25 ms @ 19-20 dB / -34..-37 dB) - and no exposed knob
50
- # (cfg_value, inference_timesteps, normalize, denoise) or usable checkpoint fixes it (VoxCPM1.5:
51
- # 80 ms @ 31 dB; VoxCPM-0.5B loses the lattice but measures -15.5 dB at 16 kHz). The operator keeps
52
- # the local driver for its speed and cost and will monitor it episode by episode until a proper fix
53
- # exists; flipping this one var to "gemini" is the escape hatch (measured dry: 20-25 ms / -34..-37 dB)
54
- # at the price of a 1h47m-2h21m remote render.
55
- vdriver: "voxcpm"
56
- intro_music: "~/.config/kk/voices/AI每日资讯_8秒播客片头.mp3"
57
- surfdash_root: "/Users/robin/xprojects/surfdash"
58
- title: ""
59
- skip_review: "false"
60
- transcode_mp3: "true"
61
- podcast_artist: "Robin Min"
62
- podcast_album: "咸话咸说"
63
- cover_enabled: "true"
64
- cover_provider: "minimax"
65
- cover_model: "image-01"
66
- cover_fallback: ""
67
- # 0219 R3: image-gen vendor fallback for the XHS render; "" restores strict fail-fast.
68
- xhs_fallback: "true"
69
- xhs_style: "xhs-knowledge"
70
- xhs_provider: "minimax"
71
- xhs_model: "image-01"
72
- # The 合集 tag a channel payload carries is that channel's preset `options` (the shipped preset
73
- # pins 「每日AI资讯」), not a generate-side var: voice3 does not know which channels exist.
74
- plan_max_items: "20"
75
- curate_enabled: "true"
76
- script_write_enabled: "true"
77
- plugins_path: ""
78
- # Content-safety budget and platforms, forwarded to the nested kk-daily-safety state machine.
79
- safety_max_revise: "2"
80
- safety_platforms: "xiaoyuzhou,apple-podcasts,wechatmp"
81
- agent: "inline"
82
- # 0238 R2: executor for the `-retry` siblings of the two hard-fail agent.run producers. The
83
- # siblings declare `role: reviewer` (capable-1), two rungs above the primary's `scribe`, so the
84
- # default `inline` resolves the retry above any rung the primary reaches by climbing past an
85
- # unusable cheap executor (ac5-live-1). The operator may still pin a known-good executor here.
86
- agent_retry: "inline"
87
- # QC pins — lockstep with episode-plan-gen's DEFAULT_FILTER_CONFIG (env wins), same as voice1.
88
- qc_categories: "ai-news,ai-technical,ai-research,ai-industry"
89
- qc_min_quality: "2"
90
- qc_min_importance: "3"
91
- qc_min_urgency: "2"
92
- qc_min_impact: "1"
93
- qc_min_episode_items: "8"
94
- episode_min_minutes: "15"
95
- # 2026-10-09 operator decision: ingest bodies are spoken in full and today's pools render 22-46
96
- # minutes at the current item counts, so the 20-minute ceiling refused real episodes before any
97
- # TTS request. The pair drives the pre-spend estimates (`daily-qc-content`'s pool gate, and
98
- # `daily-generate`'s script gate, which measures the authored VoiceScript) and the measured gate
99
- # in `daily-episode-duration`.
100
- episode_max_minutes: "25"
101
- # Run id, injected by spur at launch (0674 R5/R8) — the selections / ledger / mark-published
102
- # identity. A shell command may only reference declared vars.
103
- __runId: ""
104
- # Executed definition digest, injected by spur at launch (G8 §9). The Board capture compares it
105
- # with the named definition and records the topology only on exact agreement.
106
- __definitionDigest: ""
107
-
108
- # One action per node (engine: DagNodeDef.action), no back-edges (ADR-031). A node whose deps are
109
- # ALL skipped is skipped; a done+skipped mix proceeds — which is how the empty-pool path still
110
- # reaches run-report and ledger (they list `extract` in dependsOn, G11 R3).
111
- #
112
- # NODES ARE DECLARED IN TOPOLOGICAL ORDER (every node after all of its `dependsOn`). The engine
113
- # settles skips in one sweeping pass over this list, in declaration order, and stops as soon as a
114
- # pass finds no ready node — a node declared before a dependency that becomes `skipped` later in
115
- # that same pass stays `pending` and the run ends `dag-unreachable-nodes` instead of `done`.
116
- #
117
- # Fail-fast is the other half: any failed node fails the run, so every non-blocking channel (xhs,
118
- # wechat, locales) keeps its exit-0-on-soft-failure kk stage. `onError: continue` sits where voice1 had
119
- # it (cover-brief, script-write) and, since 0238 R2, on the two hard-fail agent.run producers
120
- # (plan-translate, article-write), whose `-retry` siblings below carry the loud second attempt.
121
- # Wave-level waiting is the accepted ceiling (design §6): a node starts when its own deps settle,
122
- # but its whole wave is awaited before the next wave is dispatched.
123
- nodes:
124
- - id: prepare
125
- description: >-
126
- Sync the workflow ledger and compose today's workspace: `kk daily prepare` writes the effective
127
- work_dir to .spur/runs/kk-daily-ai-voice2/work-dir.txt, the run date to <work_dir>/run-date.txt,
128
- the artifact directories and the safety revise budget. `kk ledger sync` records runs that
129
- already finished without a ledger row (failed ones included) — a fail-fast DAG never reaches
130
- its own `ledger` node, so the next run's prepare is the backfill (design §7).
131
- The `daily-preflight` stage runs FIRST: the scheduler executes this checkout's YAML while
132
- `kk stage` resolves its stage runner from the installed package, so a run whose YAML names a
133
- stage the installed runner lacks must fail here, naming the stage, instead of 29 minutes later
134
- inside the nested safety machine (2026-10-20: `unknown stage: daily-safety-verdict`, nothing
135
- published).
136
- action:
137
- kind: shell
138
- options:
139
- command: >-
140
- kk stage daily-preflight plugins/kk/workflows/kk-daily-ai-voice3.yaml
141
- plugins/kk/workflows/kk-daily-safety.yaml
142
- plugins/kk/workflows/kk-daily-publish3.yaml
143
- && kk daily prepare --workflow kk-daily-ai-voice2 --run-date "${vars.run_date}" --ledger-sync
144
- --run "${vars.__runId}" --definition-digest "${vars.__definitionDigest}"
145
- --setting window="${vars.window}" --setting language="${vars.language}" --setting vdriver="${vars.vdriver}"
146
- --setting skip_review="${vars.skip_review}" --setting transcode_mp3="${vars.transcode_mp3}"
147
- --setting cover_enabled="${vars.cover_enabled}" --setting curate_enabled="${vars.curate_enabled}"
148
- --setting script_write_enabled="${vars.script_write_enabled}" --setting plan_max_items="${vars.plan_max_items}"
149
- --setting safety_max_revise="${vars.safety_max_revise}" --setting qc_min_quality="${vars.qc_min_quality}"
150
- --setting qc_min_importance="${vars.qc_min_importance}" --setting qc_min_urgency="${vars.qc_min_urgency}"
151
- --setting qc_min_impact="${vars.qc_min_impact}" --setting qc_min_episode_items="${vars.qc_min_episode_items}"
152
- --setting episode_min_minutes="${vars.episode_min_minutes}" --setting episode_max_minutes="${vars.episode_max_minutes}"
153
-
154
- - id: read-work-dir
155
- description: "Project the effective work_dir into vars (single-node wave: nothing has fanned out yet)"
156
- dependsOn: [prepare]
157
- action:
158
- kind: file.read.into-var
159
- options:
160
- path: .spur/runs/kk-daily-ai-voice2/work-dir.txt
161
- var: work_dir
162
-
163
- - id: read-run-date
164
- description: "Project the digits-only run-date stamp into vars (single-node wave, after work_dir is known)"
165
- dependsOn: [read-work-dir]
166
- action:
167
- kind: file.read.into-var
168
- options:
169
- path: ${vars.work_dir}/run-date.txt
170
- var: run_date
171
-
172
- # 20261012: a dead browser session must be named BEFORE the run's ~40 minutes of generation, not
173
- # after. On 2026-10-12 the saved MP session was refused server-side (unexpired cookies, but the
174
- # console served its QR login and /cgi-bin/home carried no token), so `wechat-publish` failed soft
175
- # at the very end and the operator only learned it by noticing the missing draft. A leaf off the
176
- # head chain on purpose: `extract` keeps `read-run-date` as its only dependency, so the head chain
177
- # stays single-node waves, and nothing depends on this node — it warns, it never routes.
178
-
179
- - id: session-preflight
180
- description: >-
181
- Probe each enabled publish channel's saved browser session up front and WARN when one is
182
- dead, naming the operator action. The probe set is derived from the publish PRESET (0325), not
183
- from workflow vars: this workflow no longer knows which channels exist. Warning-only by
184
- construction (onError: continue) — the channel's own publish receipt stays the authority.
185
- dependsOn: [read-run-date]
186
- action:
187
- kind: shell
188
- options:
189
- command: >-
190
- kk stage run publish-matrix-check "${vars.work_dir}" --all-windows
191
- || echo "session-preflight: a publish channel's saved session was refused — fix it with: kk bot login <channel>"
192
- onError: continue
193
-
194
- - id: extract
195
- description: >-
196
- Select today's episode pool from the kk store: the ai-news topic profile over the labels
197
- kk-collect wrote, minus every story already selected or published for the ai-news topic (the
198
- store's `selections` ledger, written by the `select` node below). Writes
199
- <work_dir>/10-collect/pool.json (the fan-in blended.json shape) and prints {count}. An empty
200
- pool writes [] and exits 0 — the run's no-content path, not a failure. The `daily-extract`
201
- stage widens the window (×2, ×3, capped at 72h) only when the configured window's pool cannot
202
- reach `episode_min_minutes` (2026-10-19): a published episode consumes more stories than a day
203
- of collection supplies, so the tight window alone closed 2026-10-18/19 as no-content while
204
- older unselected items sat in the store.
205
- dependsOn: [read-run-date]
206
- action:
207
- kind: shell
208
- options:
209
- command: >-
210
- kk stage daily-extract "${vars.work_dir}" ai-news "${vars.window}" "${vars.episode_min_minutes}" "${vars.vdriver}"
211
-
212
- - id: plan
213
- description: >-
214
- Score/dedup/select + annotate the pool into the episode plan (episode-plan-gen; annotate rides
215
- inside planEpisode). The labels extract inlined into metadata replace its keyword re-scoring.
216
- Guarded on the pool: an empty pool skips the whole content subtree, and run-report/ledger
217
- still run.
218
- dependsOn: [extract]
219
- condition:
220
- kind: shell
221
- options:
222
- command: 'kk store pool-count "${vars.work_dir}/10-collect/pool.json" --min 1'
223
- action:
224
- kind: shell
225
- options:
226
- command: >-
227
- kk stage daily-plan "${vars.work_dir}" "${vars.run_date}" "${vars.plugins_path}" "${vars.plan_max_items}" "${vars.curate_enabled}"
228
-
229
- - id: qc-content
230
- description: >-
231
- Content QC: filter the plan's annotated candidates by category allowlist + score thresholds
232
- (episode-plan-gen --mode filter). Writes 21-plan/<date>_04_quality-control-content_candidates.json,
233
- whose length guards the whole content fan-out below — a pool that filtered to zero items ends
234
- the run as no-content instead of building an empty episode. The stage also applies the
235
- pre-spend floor gate (2026-10-12): a kept pool whose estimated spoken length cannot reach
236
- `episode_min_minutes` is emptied here, so a thin day closes as no-content instead of paying
237
- for a synthesis pass that `daily-episode-duration` then refuses.
238
- dependsOn: [plan]
239
- action:
240
- kind: shell
241
- options:
242
- command: >-
243
- kk stage daily-qc-content "${vars.work_dir}" "${vars.run_date}" "${vars.plugins_path}" "${vars.qc_categories}" "${vars.qc_min_quality}" "${vars.qc_min_importance}" "${vars.qc_min_urgency}" "${vars.qc_min_impact}" "${vars.qc_min_episode_items}" "${vars.episode_min_minutes}" "${vars.vdriver}"
244
-
245
- # One guard for the whole pool (0324 R3; 0329 F01/F15): it sits right after `qc-content`, in
246
- # front of every token reader, and NEVER exits non-zero — in this engine a failed dependency
247
- # never releases its dependents, so a failing gate on an empty pool wedges the graph into
248
- # dag-unreachable and turns a thin day into a failed run. The token carries the verdict
249
- # instead: PASS opens the content fan-out, EMPTY makes every token-gated node skip, and the
250
- # run still closes `done` with a no-content run report.
251
- - id: pool-gate
252
- description: >-
253
- The single pool guard (0324 R3, 0329): `kk store pool-count --min 1` over the candidates
254
- file that `qc-content` wrote, recorded once as a token at
255
- `.spur/run/<runId>-pool-gate.status`. A token, not a bare dependency, because the engine
256
- skips a node only when ALL its dependencies were skipped — so a failed gate beside a done
257
- dependency would still admit the node. The gate itself always exits 0 (0329: an empty pool
258
- is a no-content day, not a failed run).
259
- dependsOn: [qc-content]
260
- action:
261
- kind: shell
262
- options:
263
- command: >-
264
- OUT=".spur/run/${vars.__runId}-pool-gate.status";
265
- mkdir -p "$(dirname "$OUT")";
266
- if kk store pool-count "${vars.work_dir}/21-plan/${vars.run_date}_04_quality-control-content_candidates.json" --min 1;
267
- then echo PASS > "$OUT";
268
- else echo EMPTY > "$OUT"; rm -f "${vars.work_dir}/bundle.json"; fi
269
-
270
- - id: select
271
- description: >-
272
- Record today's planned set in the store's topic-scoped `selections` ledger (0228). It runs at
273
- QC, the moment the run has committed to its episode set, so the cross-day exclusion no longer
274
- depends on the DAG reaching its tail: a run that fails, pauses at review or skips publish still
275
- excludes what it planned. Guarded on the QC candidates — a pool that filtered to zero items
276
- selects nothing.
277
- dependsOn: [qc-content, pool-gate]
278
- condition:
279
- kind: shell
280
- options:
281
- # 0324 R3: the pool verdict is `pool-gate`'s token, never a repeated `kk store pool-count`.
282
- command: 'test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS'
283
- action:
284
- kind: shell
285
- options:
286
- command: >-
287
- kk store select --topic ai-news --workflow kk-daily-ai-voice2 --run "${vars.__runId}"
288
- --in "${vars.work_dir}/21-plan/${vars.run_date}_04_quality-control-content_candidates.json"
289
-
290
- # ---- editorial pipeline: curate -> script-write (master) -> script -> editorial-render (0345) ----
291
-
292
- - id: script-style
293
- description: "Snapshot the shipped kk:news-editorial skill and zh style contract into the work dir (20-editorial/news-editorial/ + 24-script/<date>_08_script-write_style.md)"
294
- dependsOn: [qc-content, pool-gate]
295
- condition:
296
- kind: shell
297
- options:
298
- # 0324 R3: the pool verdict is `pool-gate`'s token, never a repeated `kk store pool-count`.
299
- command: 'test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS'
300
- action:
301
- kind: shell
302
- options:
303
- command: >-
304
- kk stage daily-script-style "${vars.work_dir}" "${vars.run_date}"
305
-
306
- - id: curate
307
- description: "0345 R7: curate QC candidates into kept translated plan.json + _03_curate_excluded.json via kk:news-editorial mode `curate`; onError: continue — curate-check/curate-fix/curate-final below validate and recover"
308
- dependsOn: [qc-content, script-style, pool-gate]
309
- condition:
310
- kind: shell
311
- options:
312
- command: >-
313
- test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS
314
- && test "${vars.curate_enabled}" = "true"
315
- && ! (test -s "${vars.work_dir}/21-plan/${vars.run_date}_03_plan_plan.json" && test -s "${vars.work_dir}/21-plan/${vars.run_date}_03_curate_excluded.json")
316
- action:
317
- kind: agent.run
318
- onError: continue
319
- options:
320
- role: scribe
321
- agent: ${vars.agent}
322
- timeoutMs: 600000
323
- # ADR-115 error tier: keep this prompt <= 1000 chars.
324
- input: |
325
- Follow mode `curate` in ${vars.work_dir}/20-editorial/news-editorial/SKILL.md (read references/selection.md and references/style-contract.zh.md first).
326
- --in ${vars.work_dir}/21-plan/${vars.run_date}_04_quality-control-content_candidates.json (metadata.docs is the candidate Doc[]; don't edit it)
327
- --out-plan ${vars.work_dir}/21-plan/${vars.run_date}_03_plan_plan.json
328
- --out-excluded ${vars.work_dir}/21-plan/${vars.run_date}_03_curate_excluded.json
329
- Deliver both JSON files with your file-write tool (headless agy sandbox blocks shell writes).
330
- expectFile: ${vars.work_dir}/21-plan/${vars.run_date}_03_plan_plan.json
331
- allowAppend: false
332
-
333
- - id: curate-check
334
- description: "0345 R8: validate the curate split, unwrap any Content envelope, and dedup near-duplicate titles; writes _03_curate_errors.json on failure"
335
- dependsOn: [qc-content, script-style, curate, pool-gate]
336
- condition:
337
- kind: shell
338
- options:
339
- command: 'test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS'
340
- action:
341
- kind: shell
342
- onError: continue
343
- options:
344
- command: >-
345
- kk stage daily-curate-check "${vars.work_dir}" "${vars.run_date}"
346
-
347
- - id: curate-fix
348
- description: "0345 R8: one targeted kk:news-editorial `curate --fix` pass on curate-check errors"
349
- dependsOn: [curate-check, pool-gate]
350
- condition:
351
- kind: shell
352
- options:
353
- command: >-
354
- test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS
355
- && test -s "${vars.work_dir}/21-plan/${vars.run_date}_03_curate_errors.json"
356
- action:
357
- kind: agent.run
358
- onError: continue
359
- options:
360
- role: reviewer
361
- agent: ${vars.agent_retry}
362
- timeoutMs: 600000
363
- # ADR-115 error tier: keep this prompt <= 1000 chars.
364
- input: |
365
- Follow mode `curate --fix` in ${vars.work_dir}/20-editorial/news-editorial/SKILL.md (read references/selection.md and references/style-contract.zh.md first).
366
- --in ${vars.work_dir}/21-plan/${vars.run_date}_04_quality-control-content_candidates.json (metadata.docs is the candidate Doc[]; don't edit it)
367
- --fix ${vars.work_dir}/21-plan/${vars.run_date}_03_curate_errors.json
368
- --out-plan ${vars.work_dir}/21-plan/${vars.run_date}_03_plan_plan.json
369
- --out-excluded ${vars.work_dir}/21-plan/${vars.run_date}_03_curate_excluded.json
370
- Deliver both corrected JSON files with your file-write tool.
371
- expectFile: ${vars.work_dir}/21-plan/${vars.run_date}_03_plan_plan.json
372
- allowAppend: false
373
-
374
- - id: curate-final
375
- description: "0345 R8: final curate validation; falls back to untranslated candidates with [] exclusions if still invalid"
376
- dependsOn: [curate-check, curate-fix, pool-gate]
377
- condition:
378
- kind: shell
379
- options:
380
- command: 'test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS'
381
- action:
382
- kind: shell
383
- options:
384
- command: >-
385
- kk stage daily-curate-check "${vars.work_dir}" "${vars.run_date}" --final
386
-
387
- - id: script-write
388
- description: "Author the master script plan (intro/outro, lead/insight/card per doc id, cover, cards, social, excluded) from the curated plan via agent.run; onError: continue — a failed plan falls back to templates (F613, 0345 R9/R10)"
389
- dependsOn: [script-style, curate-final, pool-gate]
390
- condition:
391
- kind: shell
392
- options:
393
- # 0324 R3: the pool verdict is `pool-gate`'s token, never a repeated `kk store pool-count`.
394
- command: >-
395
- test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS
396
- && test "${vars.script_write_enabled}" = "true"
397
- && test "${vars.language}" = "zh"
398
- && ! test -s "${vars.work_dir}/24-script/${vars.run_date}_08_script-write_plan.json"
399
- action:
400
- kind: agent.run
401
- onError: continue
402
- options:
403
- role: scribe
404
- agent: ${vars.agent}
405
- timeoutMs: 600000
406
- # ADR-115 error tier: keep this prompt <= 1000 chars.
407
- input: |
408
- Follow mode `write` in ${vars.work_dir}/20-editorial/news-editorial/SKILL.md (ADR-045: the kk:news-editorial skill owns selection, balance, style contract and the master output shape; read its references first).
409
- --in ${vars.work_dir}/21-plan/${vars.run_date}_03_plan_plan.json (don't edit it)
410
- --excluded ${vars.work_dir}/21-plan/${vars.run_date}_03_curate_excluded.json
411
- --out ${vars.work_dir}/24-script/${vars.run_date}_08_script-write_plan.json
412
- Output only the JSON file.
413
- expectFile: ${vars.work_dir}/24-script/${vars.run_date}_08_script-write_plan.json
414
- allowAppend: false
415
-
416
- - id: script-check
417
- description: "0345 R4: dry-run the dailynews-gen validator on the script plan; writes _08_script-write_errors.json when it is missing or rejected"
418
- dependsOn: [script-style, script-write, pool-gate]
419
- condition:
420
- kind: shell
421
- options:
422
- command: >-
423
- test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS
424
- && test "${vars.script_write_enabled}" = "true"
425
- && test "${vars.language}" = "zh"
426
- action:
427
- kind: shell
428
- onError: continue
429
- options:
430
- command: >-
431
- kk stage daily-script-check "${vars.work_dir}" "${vars.run_date}" "${vars.plugins_path}"
432
-
433
- - id: script-write-fix
434
- description: "0345 R4: one targeted kk:news-editorial `write --fix` pass on validator errors; onError: continue — still-rejected plans fall back to templates"
435
- dependsOn: [script-check, curate-final, pool-gate]
436
- condition:
437
- kind: shell
438
- options:
439
- command: >-
440
- test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS
441
- && test -s "${vars.work_dir}/24-script/${vars.run_date}_08_script-write_errors.json"
442
- action:
443
- kind: agent.run
444
- onError: continue
445
- options:
446
- role: scribe
447
- agent: ${vars.agent_retry}
448
- timeoutMs: 600000
449
- # ADR-115 error tier: keep this prompt <= 1000 chars.
450
- input: |
451
- Follow mode `write --fix` in ${vars.work_dir}/20-editorial/news-editorial/SKILL.md (read its references first).
452
- --in ${vars.work_dir}/21-plan/${vars.run_date}_03_plan_plan.json (don't edit it)
453
- --excluded ${vars.work_dir}/21-plan/${vars.run_date}_03_curate_excluded.json
454
- Previous plan (may be absent): ${vars.work_dir}/24-script/${vars.run_date}_08_script-write_plan.json
455
- --fix ${vars.work_dir}/24-script/${vars.run_date}_08_script-write_errors.json
456
- --out ${vars.work_dir}/24-script/${vars.run_date}_08_script-write_plan.json (overwrite it with the full corrected plan)
457
- Output only the JSON file.
458
- expectFile: ${vars.work_dir}/24-script/${vars.run_date}_08_script-write_plan.json
459
- allowAppend: false
460
-
461
- - id: editorial-judge
462
- description: "0345 R11: advisory kk:content-judge evaluation of the script plan under the news-balance rubric; nothing depends on it for control flow"
463
- dependsOn: [script-check, script-write-fix, curate-final, pool-gate]
464
- condition:
465
- kind: shell
466
- options:
467
- command: >-
468
- test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS
469
- && test -s "${vars.work_dir}/24-script/${vars.run_date}_08_script-write_plan.json"
470
- action:
471
- kind: agent.run
472
- onError: continue
473
- options:
474
- role: reviewer
475
- agent: ${vars.agent}
476
- timeoutMs: 600000
477
- # ADR-115 error tier: keep this prompt <= 1000 chars.
478
- input: |
479
- You are an LLM-as-judge evaluating a daily news script plan for the knowledge-kit pipeline.
480
- Content to evaluate: ${vars.work_dir}/24-script/${vars.run_date}_08_script-write_plan.json
481
- Plan docs reference: ${vars.work_dir}/21-plan/${vars.run_date}_03_plan_plan.json
482
- Rubric: news-balance
483
- Output verdict to: ${vars.work_dir}/24-script/${vars.run_date}_08_editorial-judge_verdict.json
484
- Load the rubric definition from plugins/kk/skills/content-judge/references/rubrics.md (section: news-balance) and the contract from plugins/kk/skills/content-judge/SKILL.md.
485
- Evaluate the script plan against every criterion in news-balance (news-first, commentary-share, no-restatement, tech-depth, ordering).
486
- Write the verdict JSON (with confidence HIGH | MEDIUM | LOW) to ${vars.work_dir}/24-script/${vars.run_date}_08_editorial-judge_verdict.json.
487
- expectFile: ${vars.work_dir}/24-script/${vars.run_date}_08_editorial-judge_verdict.json
488
- allowAppend: false
489
-
490
- - id: script
491
- description: >-
492
- Compile the episode plan Doc[] into structured broadcast VoiceScript YAML Content. Depends on
493
- `curate-final` so the node still runs when the plan-authoring nodes were disabled or skipped (the
494
- builder falls back to templates) — but not when the whole content branch is skipped.
495
- dependsOn: [curate-final, script-style, script-write, script-check, script-write-fix, pool-gate]
496
- condition:
497
- kind: shell
498
- options:
499
- # 0324 R3: the pool verdict is `pool-gate`'s token, never a repeated `kk store pool-count`.
500
- command: 'test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS'
501
- action:
502
- kind: shell
503
- options:
504
- command: >-
505
- kk stage daily-script "${vars.work_dir}" "${vars.run_date}" "${vars.plugins_path}" "${vars.language}" "${vars.title}" "${vars.voice_profile}" "${vars.episode_max_minutes}" "${vars.vdriver}"
506
-
507
- - id: editorial-render
508
- description: "0345 R10: deterministically render the prose article body, cover brief, XHS card plan and social posts from the master script plan and curated plan"
509
- dependsOn: [script, curate-final, pool-gate]
510
- condition:
511
- kind: shell
512
- options:
513
- command: 'test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS'
514
- action:
515
- kind: shell
516
- options:
517
- command: >-
518
- kk stage daily-editorial-render "${vars.work_dir}" "${vars.run_date}" "${vars.cards_enabled}" "${vars.cards}"
519
-
520
- - id: article
521
- description: >-
522
- Generate the dated daily article Content from the episode plan and rendered article body (daily-article-gen).
523
- dependsOn: [qc-content, curate-final, editorial-render, pool-gate]
524
- condition:
525
- kind: shell
526
- options:
527
- # 0324 R3: the pool verdict is `pool-gate`'s token, never a repeated `kk store pool-count`.
528
- command: 'test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS'
529
- action:
530
- kind: shell
531
- options:
532
- command: >-
533
- kk stage daily-article "${vars.work_dir}" "${vars.run_date}" "${vars.plugins_path}"
534
-
535
- - id: cover
536
- description: "Render the daily cover through the pinned quasi-news podcast presets (F614, 0349: daily-news-podcast-cover x quasi-news-podcast)"
537
- dependsOn: [editorial-render, pool-gate]
538
- condition:
539
- kind: shell
540
- options:
541
- command: >-
542
- test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS
543
- && test "${vars.cover_enabled}" = "true"
544
- && test ! -f "${vars.work_dir}/23-cover/${vars.run_date}_07_cover_cover.png"
545
- action:
546
- kind: shell
547
- options:
548
- command: >-
549
- kk stage daily-cover "${vars.work_dir}" "${vars.run_date}" "${vars.plugins_path}" "${vars.cover_provider}" "${vars.cover_model}" "${vars.cover_fallback}"
550
-
551
- - id: cover-normalize
552
- description: "Normalize the rendered cover (dimensions/format pins) so every consumer sees the same asset"
553
- dependsOn: [cover]
554
- action:
555
- kind: shell
556
- options:
557
- command: >-
558
- kk stage daily-cover-normalize "${vars.work_dir}" "${vars.run_date}"
559
-
560
- # ---- content safety: a nested state machine (no sub-workflow action exists; ADR-031) ----
561
-
562
- - id: safety
563
- description: >-
564
- Content safety as a nested state machine (kk-daily-safety.yaml): review → judge → bounded
565
- revise loop → clean|block. It blocks here (and only here), so a non-zero exit means the drafts
566
- must not publish — `block` or an integrity failure. The launcher vars the parent run exports
567
- are stripped at the nested-spur boundary (the same two `NESTED_SPUR_UNSET` vars the stage
568
- runner strips, kk-workflow-stages.ts): without it `spur workflow run` refuses to start inside
569
- an active run. voice3 always runs the gate: it is the only check between an LLM draft and a
570
- published post.
571
- dependsOn: [article, script]
572
- action:
573
- kind: shell
574
- options:
575
- command: >-
576
- env -u SPUR_WORKFLOW_RUN_ACTIVE -u SPUR_EXPECTED_DEFINITION_DIGEST
577
- spur workflow run plugins/kk/workflows/kk-daily-safety.yaml
578
- --vars "{\"work_dir\":\"${vars.work_dir}\",\"run_date\":\"${vars.run_date}\",\"safety_max_revise\":\"${vars.safety_max_revise}\",\"safety_platforms\":\"${vars.safety_platforms}\",\"agent\":\"${vars.agent}\",\"agent_retry\":\"${vars.agent_retry}\"}"
579
- --quiet --no-plan
580
-
581
- - id: review
582
- description: >-
583
- Operator review of the safety-gated drafts: `pause: true` stops the run here and RESUME is the
584
- approval (the engine marks a paused node done on resume, so this node carries no action);
585
- cancelling the run is the rejection. Same contract as voice1's HITL confirmation, now a node
586
- instead of a state. Skipped when skip_review=true or when there is nothing to publish.
587
- dependsOn: [safety]
588
- pause: true
589
- condition:
590
- kind: shell
591
- options:
592
- command: 'test "${vars.skip_review}" != "true"'
593
-
594
- # ---- audio branch ----
595
- # wrap-docs must be DECLARED BEFORE generate: the DAG requires nodes in topological order, and
596
- # generate consumes wrap-docs's _10_wrap-docs_docs.json as its TTS input (0212 dogfood finding —
597
- # an edge to a later-declared node wedges the dispatcher with generate never dispatched).
598
-
599
- - id: wrap-docs
600
- description: "Wrap VoiceScript into Doc[] input for the voice generator plugin (the generate-side variant input)"
601
- dependsOn: [script, review, pool-gate]
602
- condition:
603
- kind: shell
604
- options:
605
- # 0324 R3: the pool verdict is `pool-gate`'s token, never a repeated `kk store pool-count`.
606
- command: 'test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS'
607
- action:
608
- kind: shell
609
- options:
610
- command: >-
611
- kk stage daily-wrap-docs "${vars.work_dir}" "${vars.run_date}" "${vars.voice_profile}"
612
-
613
- - id: generate
614
- description: "Voice tier, primary driver (vars.vdriver — voxcpm; its 40 ms lattice is known and monitored, see the vdriver comment). onError: continue — the fallback siblings below are the loud chain (same pattern as 0238 R2)."
615
- # wrap-docs is a data dependency, not a sibling: daily-generate reads its _10_wrap-docs_docs.json
616
- # as the TTS input. Without this edge the two nodes race in the same wave (0212 dogfood finding).
617
- dependsOn: [script, safety, review, wrap-docs, pool-gate]
618
- condition:
619
- kind: shell
620
- options:
621
- # 0324 R3: the pool verdict is `pool-gate`'s token, never a repeated `kk store pool-count`.
622
- command: 'test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS'
623
- action:
624
- kind: shell
625
- onError: continue
626
- options:
627
- command: >-
628
- OMNIVOICE_SPEED=1.06 kk stage daily-generate "${vars.work_dir}" "${vars.run_date}" "${vars.plugins_path}" "${vars.transcode_mp3}" "${vars.vdriver}" "1" "${vars.episode_max_minutes}" "${vars.episode_min_minutes}"
629
-
630
- # Driver fallback chain (2026-10-15, operator decision): voxcpm -> gemini -> omni. Each sibling
631
- # runs the same stage with a pinned driver; its condition re-checks the pool AND that NO upstream
632
- # driver left a valid, passing whole-document Content (the stage stamps metadata.generator with
633
- # its plugin id and the cache ignores foreign-driver sections, so a failed attempt can neither be
634
- # relabeled nor mix voices). Non-final siblings continue on error; the last one is loud.
635
-
636
- - id: generate-fallback
637
- description: "Voice tier fallback 1: gemini (gemini-tts) when the primary driver left no valid Content — the measured-dry escape hatch from voxcpm's lattice"
638
- dependsOn: [generate, pool-gate]
639
- condition:
640
- kind: shell
641
- options:
642
- # 0324 R3: the pool verdict is `pool-gate`'s token, never a repeated `kk store pool-count`.
643
- command: >-
644
- test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS
645
- && ! jq -e '(.metadata.generator == "kk:voxcpm-tts" or .metadata.generator == "kk:gemini-tts") and .metadata.qc.passed == true' "${vars.work_dir}/30-audio/${vars.run_date}_11_generate_content.json"
646
- action:
647
- kind: shell
648
- onError: continue
649
- options:
650
- command: >-
651
- kk stage daily-generate "${vars.work_dir}" "${vars.run_date}" "${vars.plugins_path}" "${vars.transcode_mp3}" "gemini" "1" "${vars.episode_max_minutes}" "${vars.episode_min_minutes}"
652
-
653
- - id: generate-fallback2
654
- description: "Voice tier fallback 2 (last, loud): omni-voice-gen when neither voxcpm nor gemini delivered"
655
- dependsOn: [generate-fallback, pool-gate]
656
- condition:
657
- kind: shell
658
- options:
659
- # 0324 R3: the pool verdict is `pool-gate`'s token, never a repeated `kk store pool-count`.
660
- command: >-
661
- test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS
662
- && ! jq -e '(.metadata.generator == "kk:voxcpm-tts" or .metadata.generator == "kk:gemini-tts" or .metadata.generator == "kk:omni-voice-gen") and .metadata.qc.passed == true' "${vars.work_dir}/30-audio/${vars.run_date}_11_generate_content.json"
663
- action:
664
- kind: shell
665
- options:
666
- command: >-
667
- OMNIVOICE_SPEED=1.06 kk stage daily-generate "${vars.work_dir}" "${vars.run_date}" "${vars.plugins_path}" "${vars.transcode_mp3}" "ominivoice" "1" "${vars.episode_max_minutes}" "${vars.episode_min_minutes}"
668
-
669
- # 0329 F15: a script-gate refusal produces no audio, but the sting must not fail the day —
670
- # the refusal artifact admits intro (and duration closes the run as no-content on it).
671
- - id: intro
672
- description: "Prepend the 8s intro sting (intro_music var; empty = skip), update duration/audioPath"
673
- dependsOn: [generate, generate-fallback, generate-fallback2]
674
- condition:
675
- kind: shell
676
- options:
677
- command: >-
678
- test -f "${vars.work_dir}/30-audio/${vars.run_date}_11_generate_content.json"
679
- -o -f "${vars.work_dir}/30-audio/${vars.run_date}_11_generate_content_duration-refusal.json"
680
- action:
681
- kind: shell
682
- options:
683
- command: >-
684
- kk stage daily-intro "${vars.work_dir}" "${vars.run_date}" "${vars.intro_music}"
685
-
686
- # ---- advisory voice audit (2026-10-16): never fails the run ----
687
- # The 20261015 episode shipped 59 different speakers because an instruct-mode profile pins none,
688
- # and nothing but a human listening caught it. This grades the final render by per-segment median
689
- # F0 (a speaker change swings it tens of Hz) and prints the table plus a PASS/FAIL line. It is
690
- # deliberately advisory: `|| true` keeps its non-zero exit out of the run, and onError covers a
691
- # missing venv (the check needs librosa from the voxcpm plugin's environment).
692
-
693
- - id: voice-audit
694
- description: "Advisory speaker-consistency audit of the joined episode (warn-only, never fails the run)"
695
- dependsOn: [intro]
696
- condition:
697
- kind: shell
698
- options:
699
- command: >-
700
- test -f "${vars.work_dir}/30-audio/${vars.run_date}_11_generate_content.json"
701
- action:
702
- kind: shell
703
- options:
704
- command: >-
705
- kk stage daily-voice-audit "${vars.work_dir}" "${vars.run_date}" "${vars.plugins_path}"
706
- onError: continue
707
-
708
- - id: duration
709
- description: "Measured duration gate: under episode_min_minutes the run refuses and closes as no-content (refusal artifact + emptied candidates + publish-path invalidation, exit 0 — 0266/0329); above episode_max_minutes it still fails loud. Duration is authoritative."
710
- dependsOn: [intro]
711
- action:
712
- kind: shell
713
- options:
714
- command: >-
715
- kk stage daily-episode-duration "${vars.work_dir}" "${vars.run_date}" "${vars.episode_min_minutes}" "${vars.episode_max_minutes}" "${vars.vdriver}" "${vars.__runId}"
716
-
717
- - id: quality
718
- description: >-
719
- Print the daily QC table (daily-quality-report) and then gate on it (0329 F23): the print
720
- alone never gated anything — a 41/100 episode sailed into show-notes, the bundle and the
721
- publish windows. The verdict stage fails loud when the generator's audio qc verdict is
722
- missing or `passed` is false, so a bad episode dies here instead of at a tier-0 send.
723
- dependsOn: [duration, wrap-docs, pool-gate]
724
- condition:
725
- kind: shell
726
- options:
727
- # 0324 R3: the pool verdict is `pool-gate`'s token, never a repeated `kk store pool-count`.
728
- command: 'test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS'
729
- action:
730
- kind: shell
731
- options:
732
- command: >-
733
- kk stage daily-quality-report "${vars.work_dir}" "${vars.run_date}"
734
- && kk stage run daily-quality-verdict "${vars.work_dir}" "${vars.run_date}"
735
-
736
- - id: show-notes
737
- description: >-
738
- Render timeline show notes from the episode plan — content, not publishing: the publish half
739
- ships them as the episode variant's `metadata.showNotes`, and the link placeholders stay
740
- unresolved until a send resolves them.
741
- dependsOn: [quality, pool-gate]
742
- condition:
743
- kind: shell
744
- options:
745
- # 0324 R3: the pool verdict is `pool-gate`'s token, never a repeated `kk store pool-count`.
746
- command: 'test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS'
747
- action:
748
- kind: shell
749
- options:
750
- command: >-
751
- kk stage daily-show-notes "${vars.work_dir}" "${vars.run_date}" "${vars.plugins_path}" "${vars.title}"
752
-
753
- # 0329 F02: voice3 lost daily-publish-prep in the migration (voice2 keeps it at its :704), so
754
- # `31-publish/<date>_13_publish-prep_content.json` — the episode variant's source — was never
755
- # written by this workflow, and a freeze only succeeded against a stale same-day voice2 prep
756
- # file. Rebuilt per the voice2 template: after duration (it reads the generate content's
757
- # mp3Path, and ID3 stamps must land on the final post-intro MP3), pool-gated so a refused
758
- # episode packages nothing.
759
- - id: publish-prep
760
- description: >-
761
- Package the publish-ready episode Content (ID3 tags on the final post-intro MP3, cover
762
- path, article link) into 31-publish/<date>_13_publish-prep_content.json — the episode
763
- variant's source for bundle-variants.
764
- dependsOn: [duration, article, safety, pool-gate]
765
- condition:
766
- kind: shell
767
- options:
768
- # 0324 R3: the pool verdict is `pool-gate`'s token, never a repeated `kk store pool-count`.
769
- command: 'test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS'
770
- action:
771
- kind: shell
772
- options:
773
- command: >-
774
- kk stage daily-publish-prep "${vars.work_dir}" "${vars.run_date}" "${vars.podcast_artist}" "${vars.podcast_album}"
775
- - id: cards-render
776
- description: "Render the card series through the pinned xhs-card/xhs-knowledge presets, attach the episode cover last and pair every image with its numbered line (0235 note_scope=episode); onError: continue — the publish node names the missing series and stays soft"
777
- dependsOn: [editorial-render, review, pool-gate]
778
- # Each card node keeps its own switch: without it a run with cards_enabled=false would
779
- # re-package a stale same-day 25-xhs/ series. The pool guard is `pool-gate`'s alone in voice3 (0324 R3).
780
- condition:
781
- kind: shell
782
- options:
783
- command: 'test "${vars.cards_enabled}" = "true" && test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS'
784
- action:
785
- kind: shell
786
- onError: continue
787
- options:
788
- command: >-
789
- kk stage daily-xhs-render "${vars.work_dir}" "${vars.run_date}" "${vars.plugins_path}" "${vars.cards}" "${vars.xhs_style}" "${vars.xhs_provider}" "${vars.xhs_model}" "${vars.xhs_fallback}" "episode"
790
-
791
- # ---- generate-side payloads and the frozen bundle (0324 R2/R3) ----
792
-
793
- - id: bundle-variants
794
- description: >-
795
- Build the channel payloads from the run's own artifacts (0327 builders): `30-variants/<key>`
796
- for article / episode / cards plus the channel-specific keys and the social posts, all with
797
- `{{article_url}}` / `{{podcast_url}}` placeholders because nothing is published yet. 0329
798
- F16: depends on every producer it reads (the 0324 file order alone was not a guarantee),
799
- wipes stale variants first, and follows the cards/cover switches so a disabled producer's
800
- variant is a skip, not a stale re-read.
801
- dependsOn: [quality, editorial-render, publish-prep, cover-normalize, cards-render, pool-gate]
802
- condition:
803
- kind: shell
804
- options:
805
- # 0324 R3: the pool verdict is `pool-gate`'s token, never a repeated `kk store pool-count`.
806
- command: 'test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS'
807
- action:
808
- kind: shell
809
- options:
810
- command: >-
811
- kk stage run daily-bundle-variants "${vars.work_dir}" "${vars.run_date}" "${vars.plugins_path}"
812
- "${vars.cards_enabled}" "${vars.cover_enabled}"
813
-
814
- - id: safety-variants
815
- description: >-
816
- Final-variant safety review through the same nested kk-daily-safety machine (0331): the
817
- manifest stage registers every `30-variants/*.content.json` first, then the machine runs in
818
- the variants scope (`safety_scope_dir=4-safety-variants` re-roots its stages, guards and
819
- prompts; the drafts review above is untouched). On an admitted outcome the machine leaves
820
- `4-safety-variants/safety.json` — status, exclusion record and the sha256 of every reviewed
821
- variant's current bytes — which publish-matrix-bundle freezes into the bundle so live
822
- launches and social edits are gated on exactly the reviewed bytes. Fails closed: a block or
823
- an integrity failure fails this node (the drafts scope's non-zero = never publish contract).
824
- dependsOn: [bundle-variants, pool-gate]
825
- condition:
826
- kind: shell
827
- options:
828
- # 0324 R3: the pool verdict is `pool-gate`'s token, never a repeated `kk store pool-count`.
829
- command: 'test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS'
830
- action:
831
- kind: shell
832
- options:
833
- command: >-
834
- kk stage run daily-safety-manifest "${vars.work_dir}" "${vars.run_date}" &&
835
- env -u SPUR_WORKFLOW_RUN_ACTIVE -u SPUR_EXPECTED_DEFINITION_DIGEST
836
- spur workflow run plugins/kk/workflows/kk-daily-safety.yaml
837
- --vars "{\"work_dir\":\"${vars.work_dir}\",\"run_date\":\"${vars.run_date}\",\"safety_max_revise\":\"${vars.safety_max_revise}\",\"safety_platforms\":\"${vars.safety_platforms}\",\"agent\":\"${vars.agent}\",\"agent_retry\":\"${vars.agent_retry}\",\"safety_scope_dir\":\"4-safety-variants\"}"
838
- --quiet --no-plan
839
-
840
- - id: bundle-freeze
841
- description: >-
842
- Freeze `bundle.json` (0321 `BundleSchema`): every `30-variants/*` file with its sha256 plus the
843
- episode title, so the publish half can run later, or three times a day, against exactly these
844
- bytes. Fails when the article or episode variant is missing — a bundle never advertises what
845
- generate did not produce. 0329 F15: token-gated, so a refused episode never freezes — the
846
- duration gate also drops this run's bundle.json on a refusal. 0331: after safety-variants, so
847
- the freeze reads the review's evidence (or the bundle stays without it, on a skipped run).
848
- dependsOn: [bundle-variants, safety-variants, pool-gate]
849
- condition:
850
- kind: shell
851
- options:
852
- # 0324 R3: the pool verdict is `pool-gate`'s token, never a repeated `kk store pool-count`.
853
- command: 'test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS'
854
- action:
855
- kind: shell
856
- options:
857
- command: >-
858
- case "${vars.publish_preset}" in '') ARGS='' ;; *) ARGS="--preset ${vars.publish_preset}" ;; esac;
859
- kk stage run publish-matrix-bundle "${vars.work_dir}" --run-date "${vars.run_date}" --run-id "${vars.__runId}" $ARGS
860
-
861
- - id: generation-report
862
- description: "The generate half's report (the publish half writes its own, per window). 0329 F15: real run-report flags — the phantom skip flag made every invocation exit 1; the pool/candidates/qc inputs are what let the report record a no-content close. Depends on pool-gate beside bundle-freeze: pool-gate always completes, so the report (and the ledger after it) also land on a no-content close — the design requires the report reachable from extract/QC/no-content, not only bundle-freeze."
863
- dependsOn: [bundle-freeze, pool-gate]
864
- action:
865
- kind: shell
866
- options:
867
- command: >-
868
- kk daily run-report --work-dir "${vars.work_dir}" --run-date "${vars.run_date}"
869
- --pool "${vars.work_dir}/10-collect/pool.json"
870
- --candidates "${vars.work_dir}/21-plan/${vars.run_date}_04_quality-control-content_candidates.json"
871
- --plugins-path "${vars.plugins_path}"
872
- --qc-min-quality "${vars.qc_min_quality}" --qc-min-importance "${vars.qc_min_importance}"
873
- --qc-min-urgency "${vars.qc_min_urgency}" --qc-min-impact "${vars.qc_min_impact}"
874
-
875
- - id: publish
876
- description: >-
877
- Nested `kk-daily-publish3` launch when `auto_publish=true` (0324 R4): the after-generate
878
- window against the bundle this run just froze. The launcher vars are stripped at the nested
879
- boundary (the same two voice2 strips for the safety machine), and the nested run's exit code is
880
- surfaced — a failed publish window is a failed generate run's last step, never a silent one.
881
- dependsOn: [generation-report, pool-gate]
882
- condition:
883
- kind: shell
884
- options:
885
- command: 'test "${vars.auto_publish}" = "true" && test "$(cat ".spur/run/${vars.__runId}-pool-gate.status" 2>/dev/null)" = PASS'
886
- action:
887
- kind: shell
888
- options:
889
- command: >-
890
- env -u SPUR_WORKFLOW_RUN_ACTIVE -u SPUR_EXPECTED_DEFINITION_DIGEST
891
- spur workflow run plugins/kk/workflows/kk-daily-publish3.yaml
892
- --vars "{\"work_dir\":\"${vars.work_dir}\",\"run_date\":\"${vars.run_date}\",\"window\":\"${vars.publish_window}\",\"preset\":\"${vars.publish_preset}\",\"dummy\":\"${vars.publish_dummy}\",\"live_channels\":\"${vars.publish_live_channels}\"}"
893
-
894
- - id: ledger
895
- description: >-
896
- Backfill the voice3 ledger with every finished run it does not record yet (an in-run
897
- `kk ledger append` of this run always refuses with `kk.ledger.run.running`; the scheduled
898
- wrapper's post-run sync records this one). `|| true` — bookkeeping never fails a generation.
899
- dependsOn: [generation-report, publish]
900
- action:
901
- kind: shell
902
- options:
903
- command: 'kk ledger sync --workflow kk-daily-ai-voice3 || true'