create-byan-agent 2.41.0 → 2.44.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 (77) hide show
  1. package/CHANGELOG.md +144 -0
  2. package/install/bin/byan-handoff.js +139 -0
  3. package/install/bin/byan-kanban.js +1 -1
  4. package/install/bin/create-byan-agent-v2.js +133 -112
  5. package/install/lib/byan-leantime-integration.js +2 -2
  6. package/install/lib/byan-web-integration.js +5 -5
  7. package/install/lib/claude-native-setup.js +11 -11
  8. package/install/lib/codex-native-setup.js +96 -4
  9. package/install/lib/exchange/agent-packager.js +1 -1
  10. package/install/lib/mcp-extensions/gdrive.js +5 -5
  11. package/install/lib/mcp-extensions/index.js +5 -5
  12. package/install/lib/phase2-chat.js +21 -21
  13. package/install/lib/platforms/claude-code.js +2 -2
  14. package/install/lib/project-agents-generator.js +4 -4
  15. package/install/lib/project-handoff.js +300 -0
  16. package/install/lib/rtk-integration.js +81 -14
  17. package/install/lib/staging-consent.js +1 -1
  18. package/install/lib/subagent-generator.js +2 -3
  19. package/install/lib/utils/logger.js +4 -4
  20. package/install/lib/utils/node-detector.js +1 -1
  21. package/install/lib/yanstaller/agent-launcher.js +1 -1
  22. package/install/lib/yanstaller/index.js +11 -116
  23. package/install/lib/yanstaller/platform-selector.js +11 -11
  24. package/install/src/byan-v2/dispatcher/task-router.js +1 -1
  25. package/install/src/index.js +1 -1
  26. package/install/src/webui/api.js +0 -13
  27. package/install/src/webui/chat/bridge.js +1 -1
  28. package/install/src/webui/chat/cli-detector.js +1 -1
  29. package/install/templates/.claude/CLAUDE.md +16 -0
  30. package/install/templates/.claude/rules/native-workflows.md +22 -14
  31. package/install/templates/.claude/settings.json +24 -24
  32. package/install/templates/.claude/skills/byan-byan/SKILL.md +14 -0
  33. package/install/templates/.claude/skills/byan-codex/SKILL.md +7 -0
  34. package/install/templates/.codex/skills/byan/SKILL.md +77 -0
  35. package/install/templates/_byan/COMPLETION-REPORT.md +0 -1
  36. package/install/templates/_byan/INDEX.md +6 -2
  37. package/install/templates/_byan/_config/workflow-manifest.csv +1 -1
  38. package/install/templates/_byan/core/activation/soul-activation.md +3 -3
  39. package/install/templates/_byan/mcp/byan-mcp-server/bin/byan-lint-workflows.js +6 -3
  40. package/install/templates/_byan/mcp/byan-mcp-server/lib/native-tiers.js +35 -17
  41. package/install/templates/_byan/mcp/byan-mcp-server/lib/workflows-lint.js +38 -0
  42. package/install/templates/_byan/mcp/byan-mcp-server/skill-bundles-manifest.json +2 -2
  43. package/install/templates/_byan/worker/workers.md +1 -1
  44. package/install/templates/_byan/workflow/simple/byan/project-handoff-workflow.md +90 -0
  45. package/install/templates/dist/skill-bundles/byan-byan.zip +0 -0
  46. package/install/templates/dist/skill-bundles/byan-codex.zip +0 -0
  47. package/install/templates/docs/codex-auto-delegation.md +140 -0
  48. package/package.json +2 -1
  49. package/src/byan-v2/dispatcher/task-router.js +1 -1
  50. package/src/byan-v2/lib/layout-resolver.js +3 -6
  51. package/install/lib/yanstaller/installer.js +0 -138
  52. package/install/lib/yanstaller/interviewer.js +0 -88
  53. package/install/lib/yanstaller/recommender.js +0 -102
  54. package/install/lib/yanstaller/troubleshooter.js +0 -89
  55. package/install/lib/yanstaller/validator.js +0 -198
  56. package/install/lib/yanstaller/wizard.js +0 -109
  57. package/install/src/byan-v2/dispatcher/task-tool-interface-mock.js +0 -134
  58. package/install/src/byan-v2/dispatcher/task-tool-interface.js +0 -123
  59. package/install/templates/_bmad/bmb/agents/agent-builder.md +0 -59
  60. package/install/templates/_bmad/bmb/agents/byan-test.md +0 -116
  61. package/install/templates/_bmad/bmb/agents/byan.md +0 -215
  62. package/install/templates/_bmad/bmb/agents/marc.md +0 -303
  63. package/install/templates/_bmad/bmb/agents/module-builder.md +0 -60
  64. package/install/templates/_bmad/bmb/agents/patnote.md +0 -495
  65. package/install/templates/_bmad/bmb/agents/rachid.md +0 -184
  66. package/install/templates/_bmad/bmb/agents/workflow-builder.md +0 -61
  67. package/install/templates/_bmad/bmb/workflows/byan/data/mantras.yaml +0 -272
  68. package/install/templates/_bmad/bmb/workflows/byan/data/templates.yaml +0 -59
  69. package/install/templates/_bmad/bmb/workflows/byan/delete-agent-workflow.md +0 -657
  70. package/install/templates/_bmad/bmb/workflows/byan/edit-agent-workflow.md +0 -688
  71. package/install/templates/_bmad/bmb/workflows/byan/interview-workflow.md +0 -753
  72. package/install/templates/_bmad/bmb/workflows/byan/quick-create-workflow.md +0 -450
  73. package/install/templates/_bmad/bmb/workflows/byan/templates/base-agent-template.md +0 -79
  74. package/install/templates/_bmad/bmb/workflows/byan/validate-agent-workflow.md +0 -676
  75. package/install/templates/_bmad/core/agents/carmack.md +0 -238
  76. package/src/byan-v2/dispatcher/task-tool-interface-mock.js +0 -134
  77. package/src/byan-v2/dispatcher/task-tool-interface.js +0 -123
@@ -3,7 +3,7 @@
3
3
  > Carte du systeme de fichiers BYAN. Genere automatiquement — ne pas editer a la main.
4
4
  > Source : `_byan/_config/*-manifest.csv` + scan `_byan/projet/`. Regenerer : `byan-build-index`.
5
5
 
6
- ## Agents (26)
6
+ ## Agents (28)
7
7
 
8
8
  ### bmb
9
9
  - `agent-builder` — Agent Building Expert — `_byan/agent/agent-builder/agent-builder.md`
@@ -18,6 +18,8 @@
18
18
  - `architect` — Architect — `_byan/agent/architect/architect.md`
19
19
  - `dev` — Developer Agent — `_byan/agent/dev/dev.md`
20
20
  - `expert-merise-agile` — Expert Merise Agile - Assistant de Conception & Rédaction — `_byan/agent/expert-merise-agile/expert-merise-agile.md`
21
+ - `jimmy` — Spécialiste Documentation Technique & Processus Internes — `_byan/agent/jimmy/jimmy.md`
22
+ - `mike` — Gestionnaire de Projet — Spécialiste Leantime — `_byan/agent/mike/mike.md`
21
23
  - `pm` — Product Manager — `_byan/agent/pm/pm.md`
22
24
  - `quick-flow-solo-dev` — Quick Flow Solo Dev — `_byan/agent/quick-flow-solo-dev/quick-flow-solo-dev.md`
23
25
  - `quinn` — QA Engineer — `_byan/agent/quinn/quinn.md`
@@ -41,10 +43,11 @@
41
43
  ### tea
42
44
  - `tea` — Master Test Architect and Quality Advisor — `_byan/agent/tea/tea.md`
43
45
 
44
- ## Workflows (45)
46
+ ## Workflows (47)
45
47
 
46
48
  ### bmb
47
49
  - `agent` — Tri-modal workflow for creating, editing, and validating BMAD Core compliant agents — `_byan/workflow/simple/agent/workflow.md`
50
+ - `byan-benchmark` — DATA-only benchmark engine for any decision fork: options x weighted-criteria matrix + best-first reco + dissent — `_byan/workflow/simple/bmb/byan-benchmark/workflow.md`
48
51
  - `module` — Quad-modal workflow for creating BMAD modules (Brief + Create + Edit + Validate) — `_byan/workflow/simple/module/workflow.md`
49
52
  - `turbo-whisper-configure` — Configure Turbo Whisper API, hotkeys, and preferences — `_byan/workflow/simple/turbo-whisper/configure-workflow.md`
50
53
  - `turbo-whisper-docker-setup` — Setup self-hosted faster-whisper-server with Docker for privacy and cost-free transcription — `_byan/workflow/simple/turbo-whisper/docker-setup-workflow.md`
@@ -86,6 +89,7 @@
86
89
  ### core
87
90
  - `brainstorming` — Facilitate interactive brainstorming sessions using diverse creative techniques and ideation methods — `_byan/workflow/simple/brainstorming/workflow.md`
88
91
  - `party-mode` — Orchestrates group discussions between all installed BMAD agents, enabling natural multi-agent conversations — `_byan/workflow/simple/party-mode/workflow.md`
92
+ - `project-handoff` — Export/import portable Markdown project state between Claude Code and Codex — `_byan/workflow/simple/byan/project-handoff-workflow.md`
89
93
 
90
94
  ### tea
91
95
  - `teach-me-testing` — Multi-session learning companion that teaches testing progressively through 7 structured sessions with state persistence — `_byan/workflow/simple/testarch/teach-me-testing/workflow.md`
@@ -45,4 +45,4 @@ name,description,module,path
45
45
  "turbo-whisper-docker-setup","Setup self-hosted faster-whisper-server with Docker for privacy and cost-free transcription","bmb","_byan/workflow/simple/turbo-whisper/docker-setup-workflow.md"
46
46
  "turbo-whisper-integrate","Integrate Turbo Whisper with GitHub Copilot CLI, Claude Code, and Codex platforms","bmb","_byan/workflow/simple/turbo-whisper/integrate-workflow.md"
47
47
  "byan-benchmark","DATA-only benchmark engine for any decision fork: options x weighted-criteria matrix + best-first reco + dissent","bmb","_byan/workflow/simple/bmb/byan-benchmark/workflow.md"
48
-
48
+ "project-handoff","Export/import portable Markdown project state between Claude Code and Codex","core","_byan/workflow/simple/byan/project-handoff-workflow.md"
@@ -144,14 +144,14 @@ Il n'est PAS un worker isole — il est un orchestrateur dans l'ecosysteme BMAD.
144
144
 
145
145
  L'agent peut executer n'importe quel workflow BMAD :
146
146
  - Via commande : `@bmad-{module}-{workflow}` (ex: `@bmad-bmm-create-prd`)
147
- - Via menu handler : `exec="{project-root}/_bmad/{module}/workflows/{workflow}/workflow.md"`
148
- - Manifeste : `{project-root}/_bmad/_config/workflow-manifest.csv`
147
+ - Via menu handler : `exec="{project-root}/_byan/{module}/workflows/{workflow}/workflow.md"`
148
+ - Manifeste : `{project-root}/_byan/_config/workflow-manifest.csv`
149
149
 
150
150
  ### Deleguer a d'autres Agents
151
151
 
152
152
  L'agent peut invoquer n'importe quel agent specialise :
153
153
  - Via commande : `@bmad-agent-{name}` (ex: `@bmad-agent-bmm-dev`)
154
- - Via manifeste : `{project-root}/_bmad/_config/agent-manifest.csv`
154
+ - Via manifeste : `{project-root}/_byan/_config/agent-manifest.csv`
155
155
  - L'agent delegue reprend le controle — l'agent courant se retire
156
156
 
157
157
  ### Acceder aux Contextes
@@ -2,7 +2,7 @@
2
2
  import fs from 'node:fs';
3
3
  import path from 'node:path';
4
4
  import { execFileSync } from 'node:child_process';
5
- import { validateContract, untieredExplorationViolations } from '../lib/workflows-lint.js';
5
+ import { validateContract, untieredExplorationViolations, untieredAnalysisViolations } from '../lib/workflows-lint.js';
6
6
 
7
7
  // Validate native workflow scripts under .claude/workflows/ against the full
8
8
  // contract (state-coupling + clock/RNG + meta-literal) AND node --check syntax.
@@ -57,10 +57,13 @@ for (const file of files) {
57
57
  }
58
58
  }
59
59
 
60
- // Non-blocking tiering advisory: exploration leaves that run deep.
60
+ // Non-blocking tiering advisory: exploration + analysis leaves that run deep.
61
61
  for (const a of untieredExplorationViolations(src)) {
62
62
  advisories.push({ file, ...a });
63
63
  }
64
+ for (const a of untieredAnalysisViolations(src)) {
65
+ advisories.push({ file, ...a });
66
+ }
64
67
  }
65
68
 
66
69
  // Tiering advisory is informational only — it never changes the exit code.
@@ -71,7 +74,7 @@ if (advisories.length) {
71
74
  }
72
75
  } else {
73
76
  process.stdout.write(
74
- `[byan-lint-workflows] advisory: ${advisories.length} exploration leaf(s) run deep (rerun with --advise to list; keep deep if they bear a gate/judgment, else add model: 'haiku')\n`
77
+ `[byan-lint-workflows] advisory: ${advisories.length} downgrade-eligible leaf(s) run deep (rerun with --advise to list; exploration -> model: 'haiku', analysis -> model: 'sonnet', or keep deep if genuinely hard)\n`
75
78
  );
76
79
  }
77
80
  }
@@ -26,10 +26,13 @@ export const TIERS = Object.freeze({ CHEAP: 'cheap', BALANCED: 'balanced', DEEP:
26
26
  //
27
27
  // deep MUST be null. Omitting opts.model lets the leaf inherit whatever model the
28
28
  // session runs (Opus by default, but Sonnet if the user chose Sonnet). We never
29
- // PIN UP pinning a leaf to a fixed high tier would override the user's session
30
- // choice and could silently DOWNGRADE a Sonnet/Opus session's heavy leaf. Only
31
- // cheap/balanced carry a value: exploration leaves get cheap, explicit mech-
32
- // leaves get balanced, nothing else ever gets one.
29
+ // PIN UP (nothing is ever forced to opus). cheap/balanced carry a value:
30
+ // exploration leaves get cheap (haiku); explicit mech- leaves AND analysis leaves
31
+ // get balanced (sonnet). Analysis routing to balanced is a deliberate downgrade of
32
+ // the session model for judgment-but-not-frontier work (score/rank/assess/nfr/
33
+ // coverage/recommend) — the heaviest workflow prompts, which rarely need the top
34
+ // model; the 'deep-' label prefix opts a hard analysis leaf back to the session
35
+ // model. VERIFICATION and IMPLEMENTATION still inherit (deep).
33
36
  //
34
37
  // Values are the harness model-selection aliases (same set as the Agent tool:
35
38
  // 'haiku' | 'sonnet' | 'opus'). They are version-independent. If a future
@@ -37,11 +40,14 @@ export const TIERS = Object.freeze({ CHEAP: 'cheap', BALANCED: 'balanced', DEEP:
37
40
  // flags every script literal that drifts from it, so the fan-out stays bounded.
38
41
  export const TIER_MODEL = Object.freeze({ cheap: 'haiku', balanced: 'sonnet', deep: null });
39
42
 
40
- // Leaf task-type taxonomy. EXPLORATION and MECHANICAL are the two
41
- // downgrade-safe classes; the other three are protected (never downgraded).
42
- // MECHANICAL is verification whose outcome is binary and judgment-free (JSON
43
- // parses, schema matches, lint passes, a test suite exits 0) — it earns the
44
- // balanced tier. Semantic/adversarial verification stays VERIFICATION (deep).
43
+ // Leaf task-type taxonomy. EXPLORATION (cheap) and MECHANICAL + ANALYSIS
44
+ // (balanced) are the downgrade classes; VERIFICATION and IMPLEMENTATION stay
45
+ // protected (deep, inherit the session model). MECHANICAL is verification whose
46
+ // outcome is binary and judgment-free (JSON parses, schema matches, lint passes,
47
+ // a test suite exits 0). ANALYSIS bears judgment (score/rank/assess/design/nfr/
48
+ // coverage) but rarely the frontier reasoning that needs the top model, so it
49
+ // auto-routes to balanced (sonnet) — escapable per-leaf via the 'deep-' prefix.
50
+ // Semantic/adversarial VERIFICATION stays deep (a wrong check corrupts silently).
45
51
  export const LEAF_TYPES = Object.freeze({
46
52
  EXPLORATION: 'exploration',
47
53
  MECHANICAL: 'mechanical',
@@ -57,6 +63,14 @@ export const LEAF_TYPES = Object.freeze({
57
63
  // script to it (a mech- leaf must carry model: 'sonnet', nothing else).
58
64
  export const MECHANICAL_PREFIX = 'mech-';
59
65
 
66
+ // DEEP_PREFIX is the ANALYSIS escape hatch. Analysis auto-routes to balanced
67
+ // (sonnet); a 'deep-' label prefix opts a specific analysis leaf back OUT of that
68
+ // downgrade and onto the protected deep default (inherit the session model), for
69
+ // genuinely frontier reasoning. Parallel to MECHANICAL_PREFIX: an explicit
70
+ // authoring act the linter honours. 'deep-assess-architecture' rides the session
71
+ // model; 'assess-architecture' rides sonnet. The prefix wins over keyword class.
72
+ export const DEEP_PREFIX = 'deep-';
73
+
60
74
  // Label keyword sets, matched as substrings on the leaf LABEL (not the prompt —
61
75
  // see classifyLeaf). Protected sets are checked first so any protected signal
62
76
  // beats an exploration signal (conservative: when in doubt, do not downgrade).
@@ -66,7 +80,7 @@ export const MECHANICAL_PREFIX = 'mech-';
66
80
  // check/review/gate/audit/assert/lint; a leaf that runs tests is labelled
67
81
  // 'verify-*' in practice.
68
82
  const VERIFICATION_KEYWORDS = ['verify', 'validate', 'check', 'assert', 'gate', 'lint', 'audit', 'review'];
69
- const ANALYSIS_KEYWORDS = ['analy', 'design', 'architect', 'assess', 'evaluate', 'strategy', 'risk', 'nfr', 'recommend', 'judge', 'score', 'coverage'];
83
+ const ANALYSIS_KEYWORDS = ['analy', 'design', 'architect', 'assess', 'evaluate', 'strategy', 'risk', 'nfr', 'recommend', 'judge', 'score', 'coverage', 'synthes'];
70
84
  const IMPLEMENTATION_KEYWORDS = ['implement', 'build', 'write', 'generate', 'create', 'dev', 'rgr', 'refactor', 'fix', 'scaffold', 'save', 'optimize', 'aggregate', 'report', 'present', 'plan', 'map', 'select', 'subprocess', 'sub-'];
71
85
  const EXPLORATION_KEYWORDS = ['load', 'read', 'scan', 'list', 'parse', 'detect', 'discover', 'fetch', 'lookup', 'source-tree', 'mode-detection'];
72
86
 
@@ -85,9 +99,11 @@ function matchesAny(text, keywords) {
85
99
  export function classifyLeaf(leaf) {
86
100
  const label = String((leaf && leaf.label) || '').toLowerCase();
87
101
  if (!label) return LEAF_TYPES.IMPLEMENTATION;
88
- // Explicit opt-in beats every keyword class: 'mech-validate-json' contains a
89
- // verification keyword, but the author's declared intent is the signal.
102
+ // Explicit opt-in prefixes beat every keyword class (the author's declared
103
+ // intent is the signal): mech- -> balanced; deep- -> the protected deep default
104
+ // (the analysis escape hatch, classified as the deep IMPLEMENTATION bucket).
90
105
  if (label.startsWith(MECHANICAL_PREFIX)) return LEAF_TYPES.MECHANICAL;
106
+ if (label.startsWith(DEEP_PREFIX)) return LEAF_TYPES.IMPLEMENTATION;
91
107
  if (matchesAny(label, VERIFICATION_KEYWORDS)) return LEAF_TYPES.VERIFICATION;
92
108
  if (matchesAny(label, ANALYSIS_KEYWORDS)) return LEAF_TYPES.ANALYSIS;
93
109
  if (matchesAny(label, IMPLEMENTATION_KEYWORDS)) return LEAF_TYPES.IMPLEMENTATION;
@@ -95,14 +111,16 @@ export function classifyLeaf(leaf) {
95
111
  return LEAF_TYPES.IMPLEMENTATION;
96
112
  }
97
113
 
98
- // tierFor(taskType) -> a TIERS value. Conservative auto-routing: EXPLORATION
99
- // downgrades to cheap, MECHANICAL to balanced, every other type stays deep.
100
- // BALANCED is reachable ONLY through the explicit mech- label opt-in (see
101
- // MECHANICAL_PREFIX) never through keyword classification so automation
102
- // still cannot land it on judgment-bearing work.
114
+ // tierFor(taskType) -> a TIERS value. Auto-routing: EXPLORATION -> cheap (haiku);
115
+ // MECHANICAL and ANALYSIS -> balanced (sonnet); VERIFICATION and IMPLEMENTATION
116
+ // stay deep (inherit the session model). MECHANICAL reaches balanced only through
117
+ // the explicit mech- opt-in; ANALYSIS reaches it by keyword classification (it is
118
+ // the judgment-but-not-frontier class), with the deep- prefix as the per-leaf
119
+ // escape back to deep. No path ever lands opus (no pin-up).
103
120
  export function tierFor(taskType) {
104
121
  if (taskType === LEAF_TYPES.EXPLORATION) return TIERS.CHEAP;
105
122
  if (taskType === LEAF_TYPES.MECHANICAL) return TIERS.BALANCED;
123
+ if (taskType === LEAF_TYPES.ANALYSIS) return TIERS.BALANCED;
106
124
  return TIERS.DEEP;
107
125
  }
108
126
 
@@ -181,6 +181,18 @@ export function modelRoutingViolations(src) {
181
181
  }
182
182
  continue;
183
183
  }
184
+ // ANALYSIS floors at balanced (sonnet), like MECHANICAL: sonnet is its tier,
185
+ // haiku sits below it. Analysis auto-routes to sonnet (tierFor); a 'deep-'
186
+ // labelled analysis classifies as IMPLEMENTATION and never reaches here.
187
+ if (cls === LEAF_TYPES.ANALYSIS) {
188
+ if (model !== TIER_MODEL.balanced) {
189
+ out.push({
190
+ id: 'analysis-below-tier',
191
+ msg: `analysis leaf '${label}' carries '${model}' but the analysis tier is '${TIER_MODEL.balanced}' (sonnet); haiku sits below it — prefix the label 'deep-' to keep a hard analysis on the session model instead`,
192
+ });
193
+ }
194
+ continue;
195
+ }
184
196
  out.push({
185
197
  id: 'protected-leaf-downgraded',
186
198
  msg: `leaf '${label}' is protected (${cls}) but carries downgrade model '${model}'; only exploration (read/load/parse/detect) and explicit mech- leaves may downgrade (STRICT-2 No Downgrade)`,
@@ -274,6 +286,32 @@ export function untieredExplorationViolations(src) {
274
286
  return out;
275
287
  }
276
288
 
289
+ // The ANALYSIS half of the same non-blocking advisory. An analysis-labelled leaf
290
+ // that pins no downgrade model runs on the session model (Opus, esp. under a
291
+ // high-effort session) for judgment-but-not-frontier work — the single biggest
292
+ // source of the all-Opus workflow pattern. Surfaces 'add model: sonnet' (or the
293
+ // 'deep-' prefix to keep it deep on purpose). Same permissive-classifier caveat
294
+ // as exploration, so it ships as ADVISORY, not a hard contract rule: the human
295
+ // owns whether a given analysis leaf is truly frontier-hard.
296
+ export function untieredAnalysisViolations(src) {
297
+ const code = stripComments(src);
298
+ const out = [];
299
+ let m;
300
+ LABEL_RE.lastIndex = 0;
301
+ while ((m = LABEL_RE.exec(code))) {
302
+ const label = m[2];
303
+ if (classifyLeaf({ label }) !== LEAF_TYPES.ANALYSIS) continue;
304
+ const objText = sameOptsObjectText(code, m.index, m.index + m[0].length);
305
+ if (!objectHasDowngradeModel(objText)) {
306
+ out.push({
307
+ id: 'untiered-analysis',
308
+ msg: `analysis leaf '${label}' pins no downgrade model; add model: 'sonnet' so judgment-but-not-frontier analysis does not run on the session model (token waste), or prefix the label 'deep-' to keep it on the session model deliberately`,
309
+ });
310
+ }
311
+ }
312
+ return out;
313
+ }
314
+
277
315
  // Shared parsing primitive — every statically-labelled opts object with its
278
316
  // order-independent model (or null). This is the ONE place that knows how to
279
317
  // read agent() opts out of a script source; tier-script.js (the per-leaf
@@ -94,7 +94,7 @@
94
94
  "name": "byan-byan",
95
95
  "module": "core",
96
96
  "tier": "connector-bound",
97
- "sourceHash": "a0d73cf82fcf228965de722e7d01c785ae79a6382975e3045b4eeb902633062a"
97
+ "sourceHash": "6798beb68df9831e0b9bf3ca17100174316c51b2671d96b2ef5bff6def4eabc7"
98
98
  },
99
99
  "byan-byan-v2": {
100
100
  "name": "byan-byan-v2",
@@ -154,7 +154,7 @@
154
154
  "name": "byan-codex",
155
155
  "module": "core",
156
156
  "tier": "standalone",
157
- "sourceHash": "0f0d7a1108a43a0c0c8093cc5600bc2649d6766c6ae94c2a2a9dafa315180627"
157
+ "sourceHash": "32f2ae4a9bfe7a0f90f2ca9787e472c57b847bc36ac9bc6fa0050af70c0af27c"
158
158
  },
159
159
  "byan-drawio": {
160
160
  "name": "byan-drawio",
@@ -496,7 +496,7 @@ src/
496
496
  - **Worker Pool Implementation:** `src/core/worker-pool/worker-pool.js`
497
497
  - **Dispatcher Logic:** `src/byan-v2/dispatcher/`
498
498
  - **Launcher Workers:** `_byan/worker/launchers/README.md`
499
- - **Architecture:** `_bmad-output/conception/01-vision-et-principes.md`
499
+ - **Architecture:** `_byan-output/conception/01-vision-et-principes.md`
500
500
 
501
501
  ---
502
502
 
@@ -0,0 +1,90 @@
1
+ ---
2
+ name: project-handoff
3
+ description: "Export/import portable Markdown project state between Claude Code and Codex"
4
+ version: "1.0.0"
5
+ module: byan
6
+ phases: 4
7
+ ---
8
+
9
+ # BYAN Project Handoff Workflow
10
+
11
+ ## Purpose
12
+
13
+ Use this workflow when a BYAN session must move between Claude Code and Codex,
14
+ usually because one assistant is close to a usage limit. The handoff artifact is
15
+ a Markdown file under `_byan-output/handoffs/`; it is portable repo state, not
16
+ native assistant memory.
17
+
18
+ ## Contract
19
+
20
+ - Source of truth: repository files plus `_byan/` and `_byan-output/`.
21
+ - Artifact: `_byan-output/handoffs/<timestamp>-<from>-to-<to>-<task>.md`.
22
+ - Format: human-readable Markdown with a parseable `json byan-handoff` block.
23
+ - Direction: Claude -> Codex and Codex -> Claude use the same format.
24
+ - Native memories (`~/.claude`, `~/.codex`) may help locally but are not needed
25
+ to resume.
26
+
27
+ ## Commands
28
+
29
+ Export from the current assistant:
30
+
31
+ ```bash
32
+ byan-handoff export --from claude --to codex \
33
+ --task "current feature" \
34
+ --summary "what happened so far" \
35
+ --next "first action for the next assistant"
36
+ ```
37
+
38
+ Import on the next assistant:
39
+
40
+ ```bash
41
+ byan-handoff latest --from claude --prompt
42
+ ```
43
+
44
+ Or import a specific file:
45
+
46
+ ```bash
47
+ byan-handoff import _byan-output/handoffs/<file>.md --prompt
48
+ ```
49
+
50
+ ## Phase 1: Export
51
+
52
+ 1. Re-read the active request and any locked BYAN strict scope.
53
+ 2. Run `byan-handoff export` with explicit `--from`, `--to`, `--task`,
54
+ `--summary`, and at least one `--next`.
55
+ 3. Add useful optional details:
56
+ - `--decision "..."` for architectural or product decisions.
57
+ - `--command "..."` for tests or checks already run.
58
+ - `--blocker "..."` for gaps, failures, or risks.
59
+ - `--note "..."` for context the next assistant should not rediscover.
60
+ 4. Report the generated file path to the user.
61
+
62
+ ## Phase 2: Transfer
63
+
64
+ The user opens the same repository with the other assistant. No hidden copy step
65
+ is required when both assistants share the same working tree. If the handoff is
66
+ moving to another machine, copy the Markdown file with the repo or paste its
67
+ `Resume Prompt` section.
68
+
69
+ ## Phase 3: Import
70
+
71
+ 1. Run `byan-handoff latest --from <source> --prompt` or
72
+ `byan-handoff import <file> --prompt`.
73
+ 2. Treat the printed prompt as the starting context.
74
+ 3. Inspect the listed files before editing.
75
+ 4. Check `_byan-output/fd-state.json` and strict status if the handoff names an
76
+ active FD.
77
+
78
+ ## Phase 4: Continue
79
+
80
+ 1. Continue from the `Next Actions` section.
81
+ 2. Update the same FD rather than starting a parallel one unless the handoff says
82
+ the old FD is complete or aborted.
83
+ 3. Before switching back, create a new handoff in the opposite direction.
84
+
85
+ ## Validation Checklist
86
+
87
+ - [ ] Handoff file exists under `_byan-output/handoffs/`.
88
+ - [ ] `byan-handoff latest --from <source> --prompt` prints a usable resume prompt.
89
+ - [ ] The next assistant inspected files listed in `Files Touched`.
90
+ - [ ] Any strict-mode gaps are surfaced, not hidden.
@@ -0,0 +1,140 @@
1
+ # Codex Auto-Delegation
2
+
3
+ Hand delegable work to Codex on your **ChatGPT subscription** (no API credit)
4
+ when Claude nears its 5h limit — automatically, from inside Claude Code.
5
+
6
+ This is the native, opt-in layer on top of the Codex load-balancer pool
7
+ (`docs/loadbalancer-multipool.md`). It does not replace judgment: only delegable
8
+ work crosses the line.
9
+
10
+ ## What it does
11
+
12
+ Every turn, a `UserPromptSubmit` hook estimates how much of the Claude 5h window
13
+ you have burned and looks at the task you just asked for. If the task is
14
+ delegable (code / mechanical) — or if you are over the pressure threshold — BYAN
15
+ injects a one-line advisory nudge proposing you hand it to Codex via
16
+ `codex:codex-rescue --model gpt-5.4`. You still decide, and you still verify
17
+ Codex's output before commit.
18
+
19
+ Three triggers, in priority order:
20
+
21
+ 1. **Pressure** — estimated Claude 5h usage `>= threshold` (default **80%**) ->
22
+ propose offloading **everything** delegable this session.
23
+ 2. **Nature** — the request looks like delegable coding work -> propose handing
24
+ **that** task over. Works with no gauge at all.
25
+ 3. **Perf** (opt-in, off by default) — a configurable forces table says Codex is
26
+ reputed stronger for this kind of task. See "Perf routing" below.
27
+
28
+ **The red line** (held): only delegable natures are proposed. Judgment,
29
+ analysis, soul and verification stay on Claude.
30
+
31
+ ## Enable it
32
+
33
+ At install (`npx create-byan-agent`), the Codex step asks:
34
+
35
+ > Add Codex as a backup pool?
36
+
37
+ Before that optional backup-pool prompt, the yanstaller performs the native Codex
38
+ setup whenever Codex is selected (Codex-only or Claude+Codex):
39
+
40
+ 1. it writes the BYAN MCP entry into `~/.codex/config.toml`;
41
+ 2. it installs BYAN's native Codex skills into `~/.codex/skills`, including the
42
+ `byan` entrypoint skill used by `$byan`;
43
+ 3. it keeps the project-local `.codex/prompts/` stubs for backward
44
+ compatibility.
45
+
46
+ If `~/.codex` does not exist yet, the yanstaller creates it because Codex was
47
+ explicitly selected.
48
+
49
+ Those are separate from auto-delegation. Without the native skills, Codex may
50
+ have the MCP server wired but still fail to expose `$byan` / BYAN skill
51
+ invocations on a fresh machine.
52
+
53
+ Answer yes to the backup-pool prompt and it links your local Codex (the
54
+ `codex login` session — your ChatGPT subscription, **not** an API key) and writes
55
+ `_byan/_config/autodelegate.json`, which **arms** the hook. Without that file the
56
+ hook is a silent no-op (disarmed by default).
57
+
58
+ Non-interactive install: set `BYAN_CODEX_AUTODELEGATE=1`.
59
+
60
+ If Codex is not linked yet, the installer prints the device-flow to run on the
61
+ machine (needed on a headless server, where the default localhost browser
62
+ redirect fails):
63
+
64
+ ```
65
+ codex login --device-auth
66
+ ```
67
+
68
+ then re-run the installer.
69
+
70
+ ### The entitled model (why gpt-5.4)
71
+
72
+ On a ChatGPT subscription the OpenAI backend rejects every `-codex`-suffixed
73
+ model (`gpt-5-codex`, `gpt-5.x-codex`) — those ids are API-key only. The plain
74
+ `gpt-5.x` family (e.g. `gpt-5.4`) is the entitled one. That is why the invocation
75
+ pins `--model gpt-5.4`. See `src/loadbalancer/providers/codex-provider.js`
76
+ (`resolveCodexModel`).
77
+
78
+ ## Configure it
79
+
80
+ `_byan/_config/autodelegate.json`:
81
+
82
+ | Key | Default | Meaning |
83
+ |-----|---------|---------|
84
+ | `enabled` | `true` (once written) | Master switch. Delete the file or set `false` to disarm. |
85
+ | `threshold` | `80` | Pressure percentage that flips to "offload everything delegable". |
86
+ | `budget` | `null` | Your plan's rough token ceiling for the 5h window. Without it, `pct` is null and only the nature trigger fires (see caveat). |
87
+ | `invocation` | `codex:codex-rescue --model gpt-5.4` | What the nudge tells BYAN to run. |
88
+ | `perfRouting` | `false` | Enable the perf trigger. |
89
+ | `perfForces` | `[]` | The forces table (see below). |
90
+
91
+ Session escape hatch: `touch .byan-codex-autodelegate/off` silences the nudge
92
+ without editing the config; remove it to re-enable.
93
+
94
+ ## The honest caveats
95
+
96
+ - **The 5h gauge is an ESTIMATE, not Anthropic's number.** No provider exposes a
97
+ machine-readable 5h quota; `/usage` fetches the authoritative figure live and
98
+ does not persist it. The estimator sums the real per-message token counts from
99
+ your local transcripts (`~/.claude/projects/*/*.jsonl`) over the rolling 5h
100
+ window, weighting cache reads at 0.1 (they are billed roughly a tenth and
101
+ repeat every turn). It is proportional, not exact — and `pct` is only computed
102
+ when you set a `budget`. Without a budget, delegation runs on the nature
103
+ trigger alone.
104
+ - **`~/.claude` is a native accelerator, not a source of truth** (PORTABLE-3).
105
+ If it is absent the estimator degrades to `pct: null` and the feature falls
106
+ back to nature-based delegation. The feature keeps working.
107
+ - **Perf routing is a heuristic below the L2 floor.** "Model X is better at task
108
+ Y" is a performance claim; BYAN's fact-check floor for performance is L2 (a
109
+ reproducible benchmark). A community arena such as designarena.ai is weaker
110
+ than that. So the forces table ships empty — it asserts nothing until you
111
+ populate it, and every match is tagged `heuristic`, not presented as measured.
112
+
113
+ ## Perf routing (opt-in)
114
+
115
+ Set `perfRouting: true` and fill `perfForces` with entries:
116
+
117
+ ```json
118
+ {
119
+ "perfRouting": true,
120
+ "perfForces": [
121
+ { "category": "bulk-refactor", "pattern": "rename across|codemod", "favors": "codex" }
122
+ ]
123
+ }
124
+ ```
125
+
126
+ `pattern` is a case-insensitive regex matched against your request. `favors:
127
+ "codex"` pushes a delegation nudge even below the pressure threshold. Populate it
128
+ from your own benchmarks, or from an arena taken as a weak signal — BYAN tags it
129
+ heuristic either way.
130
+
131
+ ## Files
132
+
133
+ | Piece | File |
134
+ |-------|------|
135
+ | Usage estimator | `.claude/hooks/lib/usage-estimator.js` |
136
+ | Decision core + nudge | `.claude/hooks/lib/autodelegate-decision.js` |
137
+ | Perf routing | `.claude/hooks/lib/perf-routing.js` |
138
+ | Hook | `.claude/hooks/codex-autodelegate.js` |
139
+ | Installer opt-in | `install/lib/codex-autodelegate-setup.js` |
140
+ | Native Codex MCP + skills setup | `install/lib/codex-native-setup.js` |
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "create-byan-agent",
3
- "version": "2.41.0",
3
+ "version": "2.44.0",
4
4
  "description": "BYAN v2.8 - Intelligent AI agent creator with ELO trust system + scientific fact-check + Hermes universal dispatcher + native Claude Code integration (hooks, skills, MCP server). Multi-platform (Claude Code, Codex). Merise Agile + TDD + 71 Mantras. ~54% LLM cost savings.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
7
7
  "create-byan-agent": "./install/bin/create-byan-agent-v2.js",
8
8
  "byan-v2": "./install/bin/create-byan-agent-v2.js",
9
9
  "byan-cleanup": "./install/bin/byan-cleanup.js",
10
+ "byan-handoff": "./install/bin/byan-handoff.js",
10
11
  "byan-ledger": "./install/bin/byan-ledger.js",
11
12
  "byan-kanban": "./install/bin/byan-kanban.js",
12
13
  "update-byan-agent": "./update-byan-agent/bin/update-byan-agent.js"
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * TaskRouter - Routes tasks based on complexity
3
- * Integrates ComplexityScorer + TaskToolInterface
3
+ * Integrates ComplexityScorer
4
4
  *
5
5
  * Thresholds:
6
6
  * - < 30: task-tool only
@@ -10,7 +10,7 @@
10
10
  //
11
11
  // This module is the single READ-side authority: "where does logical thing X
12
12
  // physically live?". It answers Gen3-first, then falls back through the real
13
- // on-disk Gen2 variants (flat AND per-module) and finally Gen1 (_bmad/). Every
13
+ // on-disk Gen2 variants (flat AND per-module). Every
14
14
  // lookup is a pure existence check — no writes, no side effects — so it is
15
15
  // idempotent and additive: before migration it finds Gen2, after migration it
16
16
  // finds Gen3, during migration either works. That is what lets the FS migrator
@@ -68,8 +68,7 @@ function locate(root, gen3rel, gen2rel) {
68
68
 
69
69
  // Resolve an agent source file by name. Gen3 _byan/agent/<name>/<name>.md (or
70
70
  // agent.md) first, then Gen2 flat _byan/agents/<name>.md, then Gen2 per-module
71
- // _byan/<module>/agents/<name>.md, then Gen1 _bmad/<module>/agents/<name>.md.
72
- // Returns {path, rel, layout} or null.
71
+ // _byan/<module>/agents/<name>.md. Returns {path, rel, layout} or null.
73
72
  function resolveAgent(name, opts = {}) {
74
73
  const root = resolveProjectRoot(opts.projectRoot);
75
74
  const candidates = [
@@ -78,7 +77,6 @@ function resolveAgent(name, opts = {}) {
78
77
  { rel: `_byan/agents/${name}.md`, layout: 'gen2-flat' },
79
78
  ];
80
79
  for (const m of MODULES) candidates.push({ rel: `_byan/${m}/agents/${name}.md`, layout: 'gen2-module' });
81
- for (const m of MODULES) candidates.push({ rel: `_bmad/${m}/agents/${name}.md`, layout: 'gen1' });
82
80
  return firstExisting(root, candidates);
83
81
  }
84
82
 
@@ -95,7 +93,6 @@ function agentDirs(opts = {}) {
95
93
  push('_byan/agent', 'gen3', true);
96
94
  push('_byan/agents', 'gen2-flat', false);
97
95
  for (const m of MODULES) push(`_byan/${m}/agents`, 'gen2-module', false);
98
- for (const m of MODULES) push(`_bmad/${m}/agents`, 'gen1', false);
99
96
  return out;
100
97
  }
101
98
 
@@ -105,7 +102,7 @@ function isSoulSibling(fileName) {
105
102
 
106
103
  // Discover all agents across layouts. Returns [{name, path, rel, layout}],
107
104
  // deduped by name with the highest-priority directory winning (Gen3 > flat >
108
- // module > gen1). Soul/tao siblings are not agents and are skipped.
105
+ // module). Soul/tao siblings are not agents and are skipped.
109
106
  function listAgents(opts = {}) {
110
107
  const root = resolveProjectRoot(opts.projectRoot);
111
108
  const seen = new Map();