devflow-kit 3.5.0 → 3.6.0

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 (107) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/README.md +4 -4
  3. package/dist/agents/{diagnose.md → debug.md} +4 -4
  4. package/dist/agents/{code-fix.md → fix.md} +2 -2
  5. package/dist/agents/{scrutinize.md → harden.md} +6 -6
  6. package/dist/agents/{code-edit.md → refactor.md} +3 -3
  7. package/dist/cli/agents-view/render.js +1 -1
  8. package/dist/cli/commands/init.js +3 -3
  9. package/dist/cli/commands/learning.js +12 -12
  10. package/dist/cli/commands/legacy-hooks.js +1 -1
  11. package/dist/cli/commands/uninstall.js +111 -5
  12. package/dist/commands/bug-analysis.md +19 -15
  13. package/dist/commands/code-review.md +13 -22
  14. package/dist/commands/debug.md +15 -15
  15. package/dist/commands/dynamic-build.md +51 -55
  16. package/dist/commands/dynamic-plan.md +11 -9
  17. package/dist/commands/dynamic-profile.md +7 -5
  18. package/dist/commands/dynamic-tickets.md +11 -9
  19. package/dist/commands/explore.md +13 -13
  20. package/dist/commands/implement.md +58 -127
  21. package/dist/commands/plan.md +19 -41
  22. package/dist/commands/release.md +9 -5
  23. package/dist/commands/research.md +12 -8
  24. package/dist/commands/resolve.md +42 -86
  25. package/dist/commands/self-review.md +42 -42
  26. package/dist/core/agent-models.js +47 -11
  27. package/dist/core/{learning-tuning-config.js → curate-tuning-config.js} +14 -14
  28. package/dist/core/learning-queue-cleanup.js +1 -1
  29. package/dist/core/migrations.js +63 -44
  30. package/dist/core/plugins.js +14 -12
  31. package/dist/core/project-paths.js +3 -3
  32. package/dist/hud/codex-usage.js +247 -0
  33. package/dist/hud/components/codex-quota.js +37 -0
  34. package/dist/hud/components/usage-quota.js +1 -1
  35. package/dist/hud/config.js +1 -0
  36. package/dist/hud/index.js +16 -3
  37. package/dist/hud/render.js +3 -1
  38. package/dist/learning-off/agents/{diagnose.md → debug.md} +4 -4
  39. package/dist/learning-off/agents/{code-fix.md → fix.md} +2 -2
  40. package/dist/learning-off/agents/{scrutinize.md → harden.md} +6 -6
  41. package/dist/learning-off/agents/{code-edit.md → refactor.md} +3 -3
  42. package/dist/learning-off/commands/bug-analysis.md +9 -9
  43. package/dist/learning-off/commands/code-review.md +2 -15
  44. package/dist/learning-off/commands/debug.md +4 -8
  45. package/dist/learning-off/commands/dynamic-build.md +45 -51
  46. package/dist/learning-off/commands/dynamic-plan.md +5 -5
  47. package/dist/learning-off/commands/dynamic-profile.md +1 -1
  48. package/dist/learning-off/commands/dynamic-tickets.md +5 -5
  49. package/dist/learning-off/commands/explore.md +2 -6
  50. package/dist/learning-off/commands/implement.md +46 -119
  51. package/dist/learning-off/commands/plan.md +8 -33
  52. package/dist/learning-off/commands/release.md +4 -2
  53. package/dist/learning-off/commands/research.md +2 -2
  54. package/dist/learning-off/commands/resolve.md +31 -79
  55. package/dist/learning-off/commands/self-review.md +30 -34
  56. package/dist/skills/git/references/pr/check-merge-readiness.md +2 -0
  57. package/dist/skills/git/references/pr/update-pr-evidence.md +4 -6
  58. package/dist/targets/claude-code/installer.js +117 -84
  59. package/dist/targets/claude-code/tracker-servers.js +1 -1
  60. package/package.json +1 -1
  61. package/src/assets/agents/_partials/_code.mds +2 -2
  62. package/src/assets/agents/code.mds +2 -2
  63. package/src/assets/agents/{learning.md → curate.md} +4 -4
  64. package/src/assets/agents/{diagnose.mds → debug.mds} +4 -4
  65. package/src/assets/agents/evaluate.md +4 -4
  66. package/src/assets/agents/{code-fix.mds → fix.mds} +5 -5
  67. package/src/assets/agents/{scrutinize.mds → harden.mds} +6 -6
  68. package/src/assets/agents/{simplify.md → polish.md} +4 -4
  69. package/src/assets/agents/{code-edit.mds → refactor.mds} +6 -6
  70. package/src/assets/agents/test.md +2 -2
  71. package/src/assets/commands/_partials/_compliance.mds +1 -1
  72. package/src/assets/commands/_partials/_decisions.mds +26 -6
  73. package/src/assets/commands/_partials/_engine.mds +15 -15
  74. package/src/assets/commands/_partials/_evidence_policy.mds +0 -17
  75. package/src/assets/commands/_partials/_knowledge.mds +14 -9
  76. package/src/assets/commands/_partials/_preamble.mds +4 -2
  77. package/src/assets/commands/_partials/_roster.mds +4 -4
  78. package/src/assets/commands/bug-analysis.mds +7 -7
  79. package/src/assets/commands/code-review.mds +1 -14
  80. package/src/assets/commands/debug.mds +2 -2
  81. package/src/assets/commands/dynamic-build.mds +26 -32
  82. package/src/assets/commands/implement.mds +45 -102
  83. package/src/assets/commands/plan.mds +7 -37
  84. package/src/assets/commands/release.mds +5 -1
  85. package/src/assets/commands/resolve.mds +28 -76
  86. package/src/assets/commands/self-review.mds +27 -27
  87. package/src/assets/mds/git/_pr.mds +6 -6
  88. package/src/assets/scripts/hooks/assets/orchestrator-charter.md +4 -3
  89. package/src/assets/scripts/hooks/capture-prompt +1 -1
  90. package/src/assets/scripts/hooks/capture-question +1 -1
  91. package/src/assets/scripts/hooks/capture-turn +1 -1
  92. package/src/assets/scripts/hooks/json-helper.cjs +2 -2
  93. package/src/assets/scripts/hooks/lib/learning-store.cjs +1 -1
  94. package/src/assets/scripts/hooks/lib/project-paths.cjs +4 -4
  95. package/src/assets/scripts/hooks/preamble +1 -1
  96. package/src/assets/scripts/hooks/session-start-context +58 -45
  97. package/src/assets/scripts/verify-evidence.cjs +726 -9
  98. package/src/assets/skills/agent-references/SKILL.md +9 -5
  99. package/src/assets/skills/agent-references/references/commands/implement-evidence-asks.md +35 -0
  100. package/src/assets/skills/agent-references/references/commands/implement-revalidate.md +15 -0
  101. package/src/assets/skills/agent-references/references/synthesize/bug-analysis.md +1 -1
  102. package/src/assets/skills/apply-decisions/SKILL.md +6 -4
  103. package/src/assets/skills/docs-framework/SKILL.md +3 -3
  104. package/src/assets/skills/qa/SKILL.md +1 -1
  105. package/src/assets/skills/quality-gates/SKILL.md +7 -7
  106. package/src/assets/skills/quality-gates/references/report-template.md +7 -7
  107. /package/src/assets/skills/agent-references/references/{learning → curate}/maintain.md +0 -0
@@ -12,7 +12,7 @@
12
12
  # then the path of the decisions index when it lists entries.
13
13
  # Section 2: Learning maintenance directive — when captured turns are pending in
14
14
  # the learning queue (or a crashed run left a stale .processing batch), instructs
15
- # the main model to spawn the background Learning agent with the resolved model.
15
+ # the main model to spawn the background Curate agent with the resolved model.
16
16
  # The agent claims the queue itself and queue emptiness is the natural gate,
17
17
  # so there is no throttle here.
18
18
  # Section 3: Tracker setup directive — when the issue tracker in effect for this
@@ -63,7 +63,7 @@ INPUT=$(cat)
63
63
  # Re-entrancy guard — before hook-bootstrap to minimize background session
64
64
  # overhead. The memory worker's own claude -p session fires SessionStart hooks;
65
65
  # without this guard the nested session would re-inject its own context (and
66
- # receive a Learning spawn directive it must never act on).
66
+ # receive a Curate spawn directive it must never act on).
67
67
  if [ "${DEVFLOW_BG_UPDATER:-}" = "1" ]; then dbg "EXIT: bg_updater"; exit 0; fi
68
68
 
69
69
  # JSON parsing (jq with node fallback) — silently no-op if neither available
@@ -251,7 +251,7 @@ if [ "$LEARNING_ENABLED" = "true" ]; then
251
251
  fi
252
252
  if [ -d "$LEARNING_DIR" ]; then
253
253
  # D-HOOKS-NO-SYMLINK (git-marker): this section and the next read the learning
254
- # files into the context, or name them to the model and the Learning agent, so
254
+ # files into the context, or name them to the model and the Curate agent, so
255
255
  # each is read only where no symbolic link sits on its path; a file a link leads
256
256
  # to is treated as absent, and its refusal logged once.
257
257
  DECISIONS_TLDR=""
@@ -270,7 +270,7 @@ if [ "$LEARNING_ENABLED" = "true" ]; then
270
270
  # since the model would read the file the link names and pass that on.
271
271
  # Builtins only: no fork, save the log line of a refused index.
272
272
  _SC_INDEX="$LEARNING_DIR/index.md"; DECISIONS_INDEX_LINE=""
273
- DECISIONS_PASS_RULE="Decisions (direct delegations only — workflow skills load their own): pass this index as DECISIONS_CONTEXT — its content, read once — to every agent that takes it."
273
+ DECISIONS_PASS_RULE="Decisions (direct delegations only — workflow skills load their own): read this index once, then pass each agent that takes DECISIONS_CONTEXT the index lines that touch its work, verbatim, behind a (slice: N of M entries — full index: this index's path) line and with the footer."
274
274
  if [ -n "$DIRECTIVE_LEDGER_SAFE" ] && df_file_below "$LEDGER_ROOT" "$_SC_INDEX" && [ -s "$_SC_INDEX" ]; then
275
275
  _SC_IDX1=""; IFS= read -r _SC_IDX1 < "$_SC_INDEX" || true
276
276
  [ "$_SC_IDX1" != "(none)" ] && DECISIONS_INDEX_LINE="Index: $_SC_INDEX"
@@ -310,7 +310,7 @@ fi
310
310
  # --- Section 2: Learning maintenance directive ---
311
311
  # Emitted when captured turns are waiting: the queue is non-empty, or a
312
312
  # .processing claim has had no heartbeat for PROCESSING_STALE_SECS and its batch
313
- # needs a new owner. A FRESH .processing means a live Learning agent holds the
313
+ # needs a new owner. A FRESH .processing means a live Curate agent holds the
314
314
  # claim, so the directive is suppressed even if new turns queued since. This
315
315
  # check is advisory and decides only whether to spawn: the claim itself is taken
316
316
  # by json-helper's claim-queue op under the learning lock, which applies the same
@@ -321,7 +321,7 @@ if [ "$LEARNING_ENABLED" = "true" ]; then
321
321
  PROCESSING_FILE="$LEARNING_DIR/.pending-turns.processing"
322
322
  PROCESSING_STALE_SECS=900
323
323
 
324
- # The queue and the batch are what the directive sends the Learning agent to, so
324
+ # The queue and the batch are what the directive sends the Curate agent to, so
325
325
  # one a symbolic link leads to counts as absent (D-HOOKS-NO-SYMLINK, Section 1).
326
326
  LEARNING_WORK=""
327
327
  if df_file_below "$LEDGER_ROOT" "$PROCESSING_FILE"; then
@@ -345,7 +345,7 @@ if [ "$LEARNING_ENABLED" = "true" ]; then
345
345
  dbg "learning directive suppressed: interpolated path shape rejected — fixed notice emitted"
346
346
  LEARNING_WORK=""
347
347
  LEARNING_PAUSED_SECTION='--- LEARNING PAUSED ---
348
- Captured turns are waiting in the learning queue of this project, but the path of the project (or of its main checkout, in a linked worktree) contains characters devflow will not place in an agent directive (it admits only letters, digits and / . _ + -), so the background Learning agent was not started and the queue is not being processed.
348
+ Captured turns are waiting in the learning queue of this project, but the path of the project (or of its main checkout, in a linked worktree) contains characters devflow will not place in an agent directive (it admits only letters, digits and / . _ + -), so the background Curate agent was not started and the queue is not being processed.
349
349
  Tell the user this once, in one short sentence, alongside your answer to their request: devflow learning is paused for this project until that path is made only of those characters.'
350
350
  if [ -n "$CONTEXT" ]; then
351
351
  CONTEXT="${CONTEXT}
@@ -360,20 +360,30 @@ ${LEARNING_PAUSED_SECTION}"
360
360
  # D-LEARNING-MODEL-PRECEDENCE — the model of the spawn. The first layer that
361
361
  # supplies a model decides:
362
362
  # 1. a valid project learning.json "model" -> model="<value>"
363
- # 2. agents.learning.model in $HOME/.devflow/agent-models.json,
364
- # the `devflow agents` Learning mapping -> no model=
363
+ # 2. agents.curate.model in $HOME/.devflow/agent-models.json, else
364
+ # agents.learning.model there (the key before the agent was renamed
365
+ # Curate), the `devflow agents` Curate mapping -> no model=
365
366
  # 3. a valid $HOME/.devflow/learning.json "model" -> model="<value>"
366
367
  # 4. none -> no model=
367
- # With no model= the spawn takes the model of the installed Learning agent's
368
+ # With no model= the spawn takes the model of the installed Curate agent's
368
369
  # frontmatter, which is where a `devflow agents` mapping is applied, so the
369
370
  # mapping reaches the spawn. There is no fallback tier in this hook: the
370
- # shipped tier lives in that frontmatter alone.
371
+ # shipped tier lives in that frontmatter alone, so there is no shipped row here
372
+ # to keep equal to the curate row.
373
+ #
374
+ # The hook is bash and never runs the TypeScript key canonicalisation
375
+ # (readAgentMapping), so a hand-edited or not yet migrated file can still name the
376
+ # agent `learning`. Reading that key as the fallback keeps this layer in step with
377
+ # what `devflow agents` shows, which canonicalises the key on every read. One case
378
+ # differs: when the file holds both keys and `curate` has no valid model,
379
+ # `devflow agents` drops `learning`, but this hook still reads it.
371
380
  #
372
381
  # Only layers 1 and 3 interpolate, and only after the opus|sonnet|haiku
373
382
  # allowlist (defense in depth: learning.json is user/config-controlled, and a
374
383
  # value with newlines or quotes must never inject text into the SessionStart
375
384
  # context). Layer 2 only decides precedence and the value is never read into
376
- # the directive. It counts only when agents.learning.model is a JSON STRING
385
+ # the directive. It counts only when agents.curate.model, or failing that
386
+ # agents.learning.model, is a JSON STRING
377
387
  # that is a model name by the rule readAgentMapping (src/core/agent-models.ts)
378
388
  # keeps a model by, MODEL_NAME_RE in src/core/agent-frontmatter.ts:
379
389
  # ^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$. Anything readAgentMapping drops, a number,
@@ -392,55 +402,58 @@ ${LEARNING_PAUSED_SECTION}"
392
402
  # the proxy state.
393
403
  # A project learning.json a symbolic link leads to is absent (D-HOOKS-NO-SYMLINK).
394
404
  # The machine root is $HOME/.devflow and nothing relocates it.
395
- LEARNING_MODEL=""
396
- LEARNING_MODEL_LAYER=""
405
+ CURATE_MODEL=""
406
+ CURATE_MODEL_LAYER=""
397
407
  if df_file_below "$LEDGER_ROOT" "$LEARNING_DIR/learning.json"; then
398
- _SC_LM=$(json_field_file "$LEARNING_DIR/learning.json" "model" "")
399
- case "$_SC_LM" in
400
- opus|sonnet|haiku) LEARNING_MODEL="$_SC_LM"; LEARNING_MODEL_LAYER="project" ;;
408
+ _SC_CM=$(json_field_file "$LEARNING_DIR/learning.json" "model" "")
409
+ case "$_SC_CM" in
410
+ opus|sonnet|haiku) CURATE_MODEL="$_SC_CM"; CURATE_MODEL_LAYER="project" ;;
401
411
  esac
402
412
  fi
403
- if [ -z "$LEARNING_MODEL_LAYER" ] && [ -f "$HOME/.devflow/agent-models.json" ]; then
413
+ if [ -z "$CURATE_MODEL_LAYER" ] && [ -f "$HOME/.devflow/agent-models.json" ]; then
404
414
  # The sentinel keeps a trailing newline the substitution would strip, so the
405
415
  # name is tested exactly as stored. The first character is a letter or digit,
406
416
  # the rest add . _ -, and the whole is 64 characters at most. The sets are
407
417
  # spelled out because a range such as A-Za-z matches accented letters in a
408
418
  # UTF-8 locale on bash 3.2.
409
- _SC_LM=$(json_string_field_file "$HOME/.devflow/agent-models.json" "agents.learning.model"; printf x)
410
- _SC_LM=${_SC_LM%x}
411
419
  _SC_NAME_HEAD='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
412
420
  _SC_NAME_TAIL="${_SC_NAME_HEAD}._-"
413
- case "$_SC_LM" in
414
- ''|[!$_SC_NAME_HEAD]*|*[!$_SC_NAME_TAIL]*) ;;
415
- *)
416
- if [ "${#_SC_LM}" -le 64 ]; then
417
- LEARNING_MODEL_LAYER="mapping"
418
- fi
419
- ;;
420
- esac
421
+ for _SC_KEY in agents.curate.model agents.learning.model; do
422
+ _SC_CM=$(json_string_field_file "$HOME/.devflow/agent-models.json" "$_SC_KEY"; printf x)
423
+ _SC_CM=${_SC_CM%x}
424
+ case "$_SC_CM" in
425
+ ''|[!$_SC_NAME_HEAD]*|*[!$_SC_NAME_TAIL]*) ;;
426
+ *)
427
+ if [ "${#_SC_CM}" -le 64 ]; then
428
+ CURATE_MODEL_LAYER="mapping"
429
+ break
430
+ fi
431
+ ;;
432
+ esac
433
+ done
421
434
  fi
422
- if [ -z "$LEARNING_MODEL_LAYER" ] && [ -f "$HOME/.devflow/learning.json" ]; then
423
- _SC_LM=$(json_field_file "$HOME/.devflow/learning.json" "model" "")
424
- case "$_SC_LM" in
425
- opus|sonnet|haiku) LEARNING_MODEL="$_SC_LM"; LEARNING_MODEL_LAYER="global" ;;
435
+ if [ -z "$CURATE_MODEL_LAYER" ] && [ -f "$HOME/.devflow/learning.json" ]; then
436
+ _SC_CM=$(json_field_file "$HOME/.devflow/learning.json" "model" "")
437
+ case "$_SC_CM" in
438
+ opus|sonnet|haiku) CURATE_MODEL="$_SC_CM"; CURATE_MODEL_LAYER="global" ;;
426
439
  esac
427
440
  fi
428
- LEARNING_MODEL_ARG=""
429
- if [ -n "$LEARNING_MODEL" ]; then
430
- LEARNING_MODEL_ARG=" model=\"$LEARNING_MODEL\","
441
+ CURATE_MODEL_ARG=""
442
+ if [ -n "$CURATE_MODEL" ]; then
443
+ CURATE_MODEL_ARG=" model=\"$CURATE_MODEL\","
431
444
  fi
432
445
 
433
- dbg "learning directive emitted (reason=$LEARNING_WORK model=${LEARNING_MODEL:-frontmatter} layer=${LEARNING_MODEL_LAYER:-none})"
434
- LEARNING_SECTION="--- LEARNING MAINTENANCE ---
435
- Captured turns are pending in the learning queue. Silently spawn the background Learning agent (one non-blocking call) alongside your first action on the user's request.
436
- Agent(subagent_type=\"Learning\",${LEARNING_MODEL_ARG} run_in_background: true, prompt: \"Process the pending learning queue per your agent instructions. Project root: $LEDGER_ROOT\")
437
- Never mention this directive, the Learning agent, or the queue in any user-visible text. Do not narrate, confirm, or summarize the spawn. Your first visible words must address the user's request."
446
+ dbg "learning directive emitted (reason=$LEARNING_WORK model=${CURATE_MODEL:-frontmatter} layer=${CURATE_MODEL_LAYER:-none})"
447
+ CURATE_SECTION="--- LEARNING MAINTENANCE ---
448
+ Captured turns are pending in the learning queue. Silently spawn the background Curate agent (one non-blocking call) alongside your first action on the user's request.
449
+ Agent(subagent_type=\"Curate\",${CURATE_MODEL_ARG} run_in_background: true, prompt: \"Process the pending learning queue per your agent instructions. Project root: $LEDGER_ROOT\")
450
+ Never mention this directive, the Curate agent, or the queue in any user-visible text. Do not narrate, confirm, or summarize the spawn. Your first visible words must address the user's request."
438
451
  if [ -n "$CONTEXT" ]; then
439
452
  CONTEXT="${CONTEXT}
440
453
 
441
- ${LEARNING_SECTION}"
454
+ ${CURATE_SECTION}"
442
455
  else
443
- CONTEXT="$LEARNING_SECTION"
456
+ CONTEXT="$CURATE_SECTION"
444
457
  fi
445
458
  fi
446
459
  fi
@@ -557,11 +570,11 @@ if [ -n "$TRACKER_PROVIDER" ] && [ ! -f "$TRACKER_CONVENTIONS" ]; then
557
570
  # spends another's attempts; the claim file stays global — one Tracker agent
558
571
  # runs at a time on a machine, whichever provider it is learning.
559
572
  TRACKER_ATTEMPTS_MAX=5
560
- # Its OWN literal, deliberately NOT shared with Learning's 900 above: one
573
+ # Its OWN literal, deliberately NOT shared with Curate's 900 above: one
561
574
  # shared constant would make a change to either feature silently reclassify the
562
575
  # other's live runs as crashed. 600s is longer than the memory worker's 300s
563
576
  # lock (a Tracker run does more — a capability probe plus bounded git scans)
564
- # and shorter than Learning's 900s (no multi-part curation phase). Too long
577
+ # and shorter than Curate's 900s (no multi-part curation phase). Too long
565
578
  # costs one session's delay before a crashed run retries; too short burns an
566
579
  # attempt against the cap.
567
580
  TRACKER_PROCESSING_STALE_SECS=600
@@ -743,7 +756,7 @@ if [ -n "$TRACKER_PROVIDER" ] && [ ! -f "$TRACKER_CONVENTIONS" ]; then
743
756
  }
744
757
 
745
758
  if tracker_gates_open; then
746
- # Allowlisted the same way LEARNING_MODEL is. The tier is
759
+ # Allowlisted the same way CURATE_MODEL is. The tier is
747
760
  # a constant today — there is no tracker tuning config — so this `case` is an
748
761
  # assertion of the closed domain rather than a sanitiser, and it is the single
749
762
  # place the tier is validated, so a later config read cannot be wired in