create-byan-agent 2.20.1 → 2.22.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 (94) hide show
  1. package/CHANGELOG.md +131 -0
  2. package/install/templates/.claude/CLAUDE.md +21 -1
  3. package/install/templates/.claude/rules/byan-agents.md +1 -0
  4. package/install/templates/.claude/rules/hermes-dispatcher.md +1 -0
  5. package/install/templates/.claude/rules/team-doctrine.md +102 -0
  6. package/install/templates/.claude/skills/byan-byan/SKILL.md +10 -5
  7. package/install/templates/.claude/skills/byan-byan-test/SKILL.md +1 -1
  8. package/install/templates/.claude/skills/byan-hermes-dispatch/SKILL.md +11 -8
  9. package/install/templates/.claude/skills/byan-orchestrate/SKILL.md +3 -3
  10. package/install/templates/.claude/skills/byan-suitability/SKILL.md +71 -0
  11. package/install/templates/.claude/workflows/create-excalidraw-dataflow.js +2 -2
  12. package/install/templates/.claude/workflows/create-excalidraw-diagram.js +2 -2
  13. package/install/templates/.claude/workflows/create-excalidraw-flowchart.js +2 -2
  14. package/install/templates/.claude/workflows/create-excalidraw-wireframe.js +2 -2
  15. package/install/templates/.claude/workflows/dev-story.js +1 -1
  16. package/install/templates/.claude/workflows/document-project.js +3 -1
  17. package/install/templates/.githooks/pre-commit +20 -2
  18. package/install/templates/.github/agents/bmad-agent-byan.md +1056 -10
  19. package/install/templates/.github/agents/bmad-agent-skeptic.md +7 -5
  20. package/install/templates/_bmad/bmb/agents/agent-builder.md +5 -5
  21. package/install/templates/_bmad/bmb/agents/byan-test.md +8 -8
  22. package/install/templates/_bmad/bmb/agents/byan.md +8 -8
  23. package/install/templates/_bmad/bmb/agents/marc.md +11 -11
  24. package/install/templates/_bmad/bmb/agents/module-builder.md +6 -6
  25. package/install/templates/_bmad/bmb/agents/patnote.md +8 -8
  26. package/install/templates/_bmad/bmb/agents/rachid.md +10 -10
  27. package/install/templates/_bmad/bmb/agents/workflow-builder.md +7 -7
  28. package/install/templates/_bmad/bmb/workflows/byan/quick-create-workflow.md +2 -2
  29. package/install/templates/_bmad/bmb/workflows/byan/templates/base-agent-template.md +1 -1
  30. package/install/templates/_bmad/bmb/workflows/byan/validate-agent-workflow.md +1 -1
  31. package/install/templates/_bmad/core/agents/carmack.md +2 -2
  32. package/install/templates/_byan/_config/agent-manifest.csv +1 -0
  33. package/install/templates/_byan/agent/agent-builder/agent-builder.md +20 -0
  34. package/install/templates/_byan/agent/analyst/analyst.md +21 -0
  35. package/install/templates/_byan/agent/architect/architect.md +21 -0
  36. package/install/templates/_byan/agent/bmad-master/bmad-master.md +23 -0
  37. package/install/templates/_byan/agent/brainstorming-coach/brainstorming-coach.md +21 -0
  38. package/install/templates/_byan/agent/byan/byan.md +24 -0
  39. package/install/templates/_byan/agent/byan-flat/byan.md +23 -0
  40. package/install/templates/_byan/agent/byan-test/byan-test.md +19 -0
  41. package/install/templates/_byan/agent/byan-test-flat/byan-test.md +20 -0
  42. package/install/templates/_byan/agent/carmack/carmack.md +22 -0
  43. package/install/templates/_byan/agent/claude/claude.md +21 -0
  44. package/install/templates/_byan/agent/codex/codex.md +21 -0
  45. package/install/templates/_byan/agent/creative-problem-solver/creative-problem-solver.md +21 -0
  46. package/install/templates/_byan/agent/design-thinking-coach/design-thinking-coach.md +21 -0
  47. package/install/templates/_byan/agent/dev/dev.md +20 -0
  48. package/install/templates/_byan/agent/drawio/drawio.md +21 -0
  49. package/install/templates/_byan/agent/expert-merise-agile/expert-merise-agile.md +21 -0
  50. package/install/templates/_byan/agent/fact-checker/fact-checker.md +21 -0
  51. package/install/templates/_byan/agent/forgeron/forgeron.md +22 -0
  52. package/install/templates/_byan/agent/innovation-strategist/innovation-strategist.md +21 -0
  53. package/install/templates/_byan/agent/jimmy/jimmy.md +23 -0
  54. package/install/templates/_byan/agent/marc/marc.md +21 -0
  55. package/install/templates/_byan/agent/marc-flat/marc.md +23 -0
  56. package/install/templates/_byan/agent/mike/mike.md +23 -0
  57. package/install/templates/_byan/agent/module-builder/module-builder.md +20 -0
  58. package/install/templates/_byan/agent/patnote/patnote.md +21 -0
  59. package/install/templates/_byan/agent/pm/pm.md +21 -0
  60. package/install/templates/_byan/agent/presentation-master/presentation-master.md +21 -0
  61. package/install/templates/_byan/agent/quick-flow-solo-dev/quick-flow-solo-dev.md +19 -0
  62. package/install/templates/_byan/agent/quinn/quinn.md +19 -0
  63. package/install/templates/_byan/agent/rachid/rachid.md +21 -0
  64. package/install/templates/_byan/agent/rachid-flat/rachid.md +22 -0
  65. package/install/templates/_byan/agent/skeptic/skeptic.md +23 -0
  66. package/install/templates/_byan/agent/sm/sm.md +21 -0
  67. package/install/templates/_byan/agent/storyteller/storyteller.md +21 -0
  68. package/install/templates/_byan/agent/tao/tao.md +22 -0
  69. package/install/templates/_byan/agent/tea/tea.md +23 -0
  70. package/install/templates/_byan/agent/tech-writer/tech-writer.md +21 -0
  71. package/install/templates/_byan/agent/test-dynamic/test-dynamic.md +19 -0
  72. package/install/templates/_byan/agent/turbo-whisper/turbo-whisper.md +22 -0
  73. package/install/templates/_byan/agent/turbo-whisper-integration/turbo-whisper-integration.md +21 -0
  74. package/install/templates/_byan/agent/ux-designer/ux-designer.md +20 -0
  75. package/install/templates/_byan/agent/workflow-builder/workflow-builder.md +20 -0
  76. package/install/templates/_byan/agent/yanstaller/yanstaller.md +23 -0
  77. package/install/templates/_byan/bmb/config.yaml +36 -2
  78. package/install/templates/_byan/config.yaml +28 -0
  79. package/install/templates/_byan/core/activation/soul-activation.md +35 -0
  80. package/install/templates/_byan/mcp/byan-mcp-server/bin/byan-suitability.js +50 -0
  81. package/install/templates/_byan/mcp/byan-mcp-server/lib/dispatch.js +63 -11
  82. package/install/templates/_byan/mcp/byan-mcp-server/lib/native-tiers.js +112 -0
  83. package/install/templates/_byan/mcp/byan-mcp-server/lib/suitability-feeder.js +45 -0
  84. package/install/templates/_byan/mcp/byan-mcp-server/lib/suitability-store.js +102 -0
  85. package/install/templates/_byan/mcp/byan-mcp-server/lib/suitability.js +234 -0
  86. package/install/templates/_byan/mcp/byan-mcp-server/lib/workflows-lint.js +72 -2
  87. package/install/templates/_byan/mcp/byan-mcp-server/package.json +9 -3
  88. package/install/templates/_byan/mcp/byan-mcp-server/server.js +64 -1
  89. package/install/templates/_byan/worker/workers.md +71 -1
  90. package/install/templates/_byan/workflow/simple/byan/soul-memory-update.md +25 -3
  91. package/install/templates/docs/native-workflows-contract.md +109 -0
  92. package/package.json +1 -1
  93. package/src/byan-v2/dispatcher/complexity-scorer.js +6 -0
  94. package/src/byan-v2/dispatcher/task-router.js +5 -0
package/CHANGELOG.md CHANGED
@@ -9,6 +9,137 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [2.22.0] - 2026-06-09
13
+
14
+ ### Changed - byan_dispatch routes the model tier by task nature, not by size
15
+
16
+ `byan_dispatch` fused two unrelated decisions into one route string
17
+ (`mcp-worker-haiku`, `main-thread-opus`): a short sequential task was downgraded
18
+ to haiku purely on its length, and a long one was pinned up to opus. That is the
19
+ size-driven mis-tiering the native-workflow doctrine (`native-tiers.js`) was built
20
+ to forbid, so the two routers disagreed. This decouples the two axes and makes
21
+ `native-tiers.js` the single source of truth for the model tier across both worlds.
22
+
23
+ - **Two independent axes.** `dispatch.js` now returns
24
+ `{ score, strategy, nature, tier, model, parallelizable, reasoning }`. STRATEGY
25
+ (where the work runs: `main-thread` / `agent-subagent-worktree` / `mcp-worker`)
26
+ stays derived from the scalar score + `parallelizable`. TIER (which model) is
27
+ derived from the task NATURE, decoupled from size.
28
+ - **One source of truth.** `dispatch.js` imports `classifyLeaf` / `tierFor` /
29
+ `TIER_MODEL` directly from `native-tiers.js` — a one-way dependency toward the
30
+ tier authority rather than a duplicated rule. Only an `exploration` nature
31
+ downgrades to `haiku`; `implementation` / `verification` / `analysis` (and any
32
+ unmatched task) stay `deep` (inherit the session model). No pin-up to opus.
33
+ - **Conservative by default.** An optional `nature` arg sets the tier directly;
34
+ absent or invalid, the task text is classified, whose own default is
35
+ `implementation` (deep) — so a miss protects the work instead of downgrading it.
36
+ - **Consumers realigned.** The `byan_dispatch` tool schema gains an optional
37
+ `nature` enum; the three consuming skills (byan-byan Phase 4, byan-hermes-dispatch
38
+ step 3, byan-orchestrate) read `strategy` + `model` from the new shape. The
39
+ fused-route strings are dropped from the live routing path.
40
+ - 22 dispatch unit tests pin the contract (no downgrade for protected natures,
41
+ exploration to haiku, no pin-up, conservative fallback, strategy preserved across
42
+ the score bands) plus the hermes-e2e non-regression. Template re-synced.
43
+
44
+ ### Known debt
45
+
46
+ The legacy fused-route vocabulary (`mcp-worker-haiku` / `main-thread-opus`) still
47
+ appears in two doctrine docs (`_byan/worker/workers.md`,
48
+ `_byan/workflow/simple/byan/feature-workflow.md`) and a dead, unreferenced parallel
49
+ router (`src/core/dispatcher/execution-router.js` + its test). These have no live
50
+ consumer and are scoped to a follow-up cleanup.
51
+
52
+ ## [2.21.0] - 2026-06-08
53
+
54
+ ### Added - Template fidelity sync (the published package matches its CHANGELOG)
55
+
56
+ Only `install/templates/` ships on npm (`package.json` `files[]`), but the dev
57
+ code lives at root `_byan/` and `.claude/`. With no mechanism to mirror root into
58
+ the template, the template had drifted: 81 stale files had accumulated across
59
+ several chantiers, so the routing and ledger work below existed at root yet was
60
+ absent from the package a user would install. This adds the missing mechanism and
61
+ re-aligns the template.
62
+
63
+ - **Sync tool** `_byan/mcp/byan-mcp-server/lib/template-sync.js` +
64
+ `bin/byan-sync-template.js`: re-syncs every file already in the template from its
65
+ root twin, adds an explicit target list, and excludes runtime seeds
66
+ (`_byan/memoire/**`). The mirrored perimeter is the template itself rather than a
67
+ walk of root, so dev-only files do not leak into the package. `--check` reports
68
+ drift and exits non-zero without writing.
69
+ - **First-run result.** 79 stale files re-synced and the 7 missing routing/ledger
70
+ artifacts added, so the shipped `server.js` registers the `byan_suitability`
71
+ tools and the downgraded workflows ship as intended. Runtime seeds left
72
+ untouched.
73
+ - **Anti-recidive gate.** A fourth pre-commit gate runs `byan-sync-template.js
74
+ --check` and blocks a commit whose template has drifted from root. It is a no-op
75
+ for an installed user (the tool is dev-only, so the gate self-disables there).
76
+ - 19 unit tests: idempotence, exclusion of runtime seeds, drift detection,
77
+ atomic-copy rollback, and perimeter tightness. Guide in
78
+ `docs/template-fidelity.md`.
79
+
80
+ ### Added - Model routing for native workflows (tier the leaves, keep heavy ones inherited)
81
+
82
+ The 20 native-workflow scripts (`.claude/workflows/*.js`) all ran every `agent()`
83
+ leaf on the session model (Opus by default): the read-the-file leaf paid the same
84
+ tier as the implement-and-verify leaf. This wires BYAN's complexity doctrine into
85
+ the Workflow tool's `opts.model` lever, conservatively.
86
+
87
+ - **Single source of truth** `_byan/mcp/byan-mcp-server/lib/native-tiers.js`: the
88
+ tier vocabulary (`cheap`/`balanced`/`deep`), a label-driven leaf classifier, and
89
+ the model map. `deep` is an OMISSION (inherit the session model), not a pin — we
90
+ only ever route DOWN, and only exploration leaves.
91
+ - **Anti-downgrade guard** in `workflows-lint.js` (`modelRoutingViolations`),
92
+ folded into `validateContract`, so `byan-lint-workflows` and the pre-commit gate
93
+ reject any protected (implement/verify/analysis) leaf carrying a downgrade or any
94
+ unknown model literal.
95
+ - **Conservative application.** Of 19 exploration-labelled leaves, only 5 are
96
+ downgraded to `haiku` (`dev-story:load-story` + the 4 excalidraw
97
+ `load-resources`). An adversarial review pass (3 skeptics) caught 4 candidates
98
+ whose output feeds a downstream gate/score without a re-read
99
+ (`document-discovery`, `parse-epics`, the two `discover-tests`); those were
100
+ reverted to `deep`.
101
+ - **Regression guard** `test/native-routing-integration.test.js` pins the invariant
102
+ on the shipped scripts. Contract documented in `docs/native-workflows-contract.md`.
103
+
104
+ ### Added - Model-suitability ledger (advisory learning layer above the routing floor)
105
+
106
+ The static routing floor does not widen itself. The suitability ledger learns,
107
+ per `(model x leaf)`, whether a cheap model proved adequate, and advises keep /
108
+ watch / demote — above the floor, with a human deciding. It does not edit routing
109
+ and the linter floor stays the hard gate.
110
+
111
+ - **Math** `_byan/mcp/byan-mcp-server/lib/suitability.js`: a Beta-Bernoulli
112
+ posterior, pure and deterministic (no clock/RNG/IO). The verdict reads the
113
+ credible LOWER bound, so a thin sample stays `watch` (a high mean over 3 runs
114
+ is not `keep-cheap`); `keep-cheap` needs roughly 30 clean outcomes.
115
+ - **Store** `lib/suitability-store.js`: the sole write path, atomic tmp+rename,
116
+ best-effort no-op that does not throw or corrupt the ledger on a failed write.
117
+ - **Feeder** `lib/suitability-feeder.js`: maps an adversarial-panel verdict to a
118
+ binary outcome (at least half refute = flagged).
119
+ - **MCP tools** `byan_suitability_record` / `byan_suitability_report`, **CLI**
120
+ `bin/byan-suitability.js` (read-only), and **skill** `byan-suitability` (the
121
+ hybrid wiring: the script returns DATA, the skill records via MCP).
122
+ - 38 unit tests. Auto-promotion is deferred (phase 2) so a hot-hand streak cannot
123
+ slip a downgrade past human review.
124
+
125
+ ### Changed - Widened the safe-downgrade set (5 -> 11 leaves)
126
+
127
+ An adversarial panel (one skeptic per leaf, each asked to PROVE the leaf is
128
+ analysis) re-judged 6 deep exploration leaves whose output is re-read or
129
+ re-synthesized by a later Opus step. The 6 cleared as genuine reads and now run
130
+ on haiku, doubling the downgraded set:
131
+
132
+ - document-project: scan-existing-docs (renamed from existing-docs) and source-tree
133
+ - the four excalidraw context leaves: read-context (wireframe), read-requirements
134
+ (flowchart), context-scan (dataflow), parse-spec-intent (diagram)
135
+
136
+ Five labels were honestly renamed so the deterministic classifier reads them as
137
+ exploration; a leaf the panel found to be genuine analysis would have stayed deep.
138
+ The 4 earlier reverts (document-discovery, parse-epics, the two discover-tests)
139
+ were re-checked with token net-math and stay deep: adding a re-read is net-negative
140
+ or marginal there. native-routing-integration.test.js floor raised 1 -> 11; the
141
+ panel verdicts seed the suitability ledger.
142
+
12
143
  ## [2.20.1] - 2026-06-04
13
144
 
14
145
  ### Fixed - Post-audit hotfix (adversarial self-audit of 2.20.0)
@@ -3,6 +3,7 @@
3
3
  > Projet propulse par BYAN (Merise Agile + TDD + 71 Mantras)
4
4
  > Installer: `npx create-byan-agent`
5
5
  > GitHub: https://github.com/Yan-Acadenice/BYAN
6
+ > Carte du systeme de fichiers (agents, workflows, commandes, projets): voir `_byan/INDEX.md` (genere par `byan-build-index`)
6
7
 
7
8
  ## Hermes - Dispatcher Universel
8
9
 
@@ -37,10 +38,29 @@ Voir @.claude/rules/hermes-dispatcher.md pour les commandes Hermes.
37
38
  - Simplicite d'abord - Rasoir d'Ockham (Mantra #37)
38
39
  - Challenge Before Confirm - Valider avant d'accepter (Mantra IA-16)
39
40
 
41
+ ## L'agent dans l'equipe BYAN
42
+
43
+ Les agents BYAN forment une equipe — leurs personnalites complementaires se renforcent. Diversifier la personnalite, c'est elargir la surface de competence collective.
44
+
45
+ Mantras = regles d'action qui operationnalisent les valeurs issues de soul + tao. Chaine : Soul/Tao -> Valeurs -> Mantras -> Comportement.
46
+
47
+ ```
48
+ Soul (identite)
49
+ + Tao (voix)
50
+ -> Valeurs (lignes rouges, convictions)
51
+ -> Mantras (regles d'action)
52
+ -> Comportement
53
+ ```
54
+
55
+ Cette chaine s'incarne dans chaque agent ; l'equipe complete la couvre dans toutes ses dimensions.
56
+
57
+ Doctrine d'equipe complete (template role-in-team, analogie orchestre, principes de complementarite) : voir @.claude/rules/team-doctrine.md
58
+
40
59
  ## Commandes Utiles
41
60
 
42
61
  - `@hermes` → Dispatcher universel (recommandations, routage, pipelines)
43
62
  - Agent disponibles: voir @.claude/rules/byan-agents.md
63
+ - Doctrine d'equipe: voir @.claude/rules/team-doctrine.md
44
64
  - Methodologie: voir @.claude/rules/merise-agile.md
45
65
  - Systeme de confiance epistemique: voir @.claude/rules/elo-trust.md
46
66
  - Protocol fact-check scientifique: voir @.claude/rules/fact-check.md
@@ -88,6 +108,6 @@ Protocole : lock du scope -> build complet -> self-verify >= 3 passes -> complet
88
108
  - Outils MCP : `byan_strict_lock_scope`, `byan_strict_self_verify`, `byan_strict_complete`, `byan_strict_status`, `byan_strict_abort`, `byan_strict_suggest`
89
109
  - Activation : `byan_fd_start strict:true`, skill `byan-strict`, ou mots-cles (prod, client, livrable...)
90
110
  - Filet final : `.githooks/pre-commit` bloque le commit si une session strict est engagee mais non completee
91
- - Persistance : sessions poussees vers l'API byan_web (autorite ; local = miroir/fallback offline)
111
+ - Persistance : sessions poussees vers l'API byan_web (autorite ; local = miroir/fallback offline) via `lib/strict-sync.js` ; migration `033` + `routes/strict-sessions.js` cote byan_web
92
112
 
93
113
  Detail complet : voir @.claude/rules/strict-mode.md
@@ -65,6 +65,7 @@
65
65
  | `quick-spec` | Spec rapide conversationnelle |
66
66
  | `quick-dev` | Dev rapide (brownfield) |
67
67
  | `elo-workflow` | Consulter et gerer le score ELO (via menu [ELO] du BYAN) |
68
+ | `byan-sync-rules` | Regenerer les artefacts du mode strict depuis strict-mode.yaml |
68
69
 
69
70
  ## Comment Invoquer un Agent
70
71
 
@@ -34,6 +34,7 @@ Quand un utilisateur decrit une tache, Hermes recommande le bon agent:
34
34
  | creer agent, workflow, module | byan (Builder) |
35
35
  | brainstorm, idees, innovation | brainstorming-coach (Carson) |
36
36
  | optimiser, tokens, performance | carmack (Optimizer) |
37
+ | prod, livrable, complet, anti-downgrade | skill byan-strict (Strict Mode) |
37
38
 
38
39
  ## Pipelines Predefinies
39
40
 
@@ -0,0 +1,102 @@
1
+ # Doctrine d'equipe BYAN
2
+
3
+ > Tout agent BYAN est un membre d'equipe avant d'etre un specialiste.
4
+ > Sa singularite n'a de sens que par contraste avec ses pairs.
5
+
6
+ ## Enonces canoniques
7
+
8
+ **1. L'equipe avant l'individu.**
9
+ Les agents BYAN forment une equipe — leurs personnalites complementaires se renforcent. Diversifier la personnalite, c'est elargir la surface de competence collective.
10
+
11
+ **2. La chaine doctrinale.**
12
+ Mantras = regles d'action qui operationnalisent les valeurs issues de soul + tao. Chaine : Soul/Tao -> Valeurs -> Mantras -> Comportement.
13
+
14
+ ## Schema de la chaine
15
+
16
+ ```
17
+ Soul (identite)
18
+ + Tao (voix)
19
+ -> Valeurs (lignes rouges, convictions)
20
+ -> Mantras (regles d'action)
21
+ -> Comportement
22
+ -> Equipe (N agents complementaires)
23
+ <- orchestre par Hermes (dispatcher)
24
+ ```
25
+
26
+ ## Analogie orchestre
27
+
28
+ | Element BYAN | Equivalent musical |
29
+ |--------------|--------------------|
30
+ | Soul | Le musicien (identite) |
31
+ | Tao | Le timbre (signature sonore) |
32
+ | Valeurs | L'ethique de l'interpretation |
33
+ | Mantras | Les techniques de jeu |
34
+ | Equipe | L'orchestre (N voix complementaires) |
35
+ | Hermes | Le chef d'orchestre (dispatch) |
36
+ | Workflows | La partition |
37
+
38
+ Un soliste isole peut briller. Un orchestre couvre toutes les frequences. BYAN est un orchestre — chaque agent occupe une frequence specifique, complementaire des autres.
39
+
40
+ ## Principes de complementarite
41
+
42
+ 1. **Singularite obligatoire** — Deux agents ne peuvent pas avoir le meme role. Si un agent existe deja pour la tache, ne pas en creer un nouveau : enrichir l'existant.
43
+ 2. **Couverture totale** — L'equipe complete doit couvrir l'ensemble du cycle (analyse, planning, dev, test, docs, innovation, meta).
44
+ 3. **Voix distinctes** — Le tao d'un agent doit le distinguer auditivement des autres (registre, signatures, vocabulaire).
45
+ 4. **Convictions explicites** — Les valeurs (lignes rouges) doivent etre nommees, pas implicites.
46
+
47
+ ## Quand activer la doctrine
48
+
49
+ - **Party-mode** : invocation parallele de plusieurs agents — chacun apporte sa frequence propre
50
+ - **Multi-agent dispatch** : Hermes choisit en fonction du role, pas du hasard
51
+ - **Brainstorm collaboratif** : la diversite de personnalites genere plus d'angles
52
+ - **Creation d'agent** : verifier qu'il n'y a pas redondance avec un membre existant
53
+
54
+ ## Template canonique : section role-in-team
55
+
56
+ Tout agent BYAN primaire doit contenir une section `## Mon role dans l'equipe BYAN` structuree ainsi :
57
+
58
+ ```markdown
59
+ ## Mon role dans l'equipe BYAN
60
+
61
+ **Persona** : {{nom de la persona, ex: Mary, Winston, Amelia}}
62
+ **Frequence** : {{une phrase qui resume la voix singuliere de l'agent}}
63
+ **Specialite** : {{ce que cet agent fait que personne d'autre ne fait aussi bien}}
64
+
65
+ **Mes complementaires directs** :
66
+ - `@{{agent-X}}` — {{relation : avant moi, apres moi, en parallele, en miroir}}
67
+ - `@{{agent-Y}}` — {{relation}}
68
+
69
+ **Quand m'invoquer** :
70
+ - {{scenario 1 declencheur}}
71
+ - {{scenario 2 declencheur}}
72
+
73
+ **Quand NE PAS m'invoquer** :
74
+ - {{cas ou un autre agent est plus adapte}} → preferer `@{{autre-agent}}`
75
+ ```
76
+
77
+ ### Regles de remplissage
78
+
79
+ 1. **Persona** : extraite du frontmatter `description` ou du soul.md (champ `persona`/`nom`).
80
+ 2. **Frequence** : 1 phrase, derivee du tao.md (registre, signatures verbales). Si pas de tao : extraire du soul.md.
81
+ 3. **Specialite** : 1 phrase qui distingue cet agent de tous les autres. Si on peut la dire d'un autre agent, c'est rate.
82
+ 4. **Complementaires** : minimum 2, maximum 4. Lister les agents avec qui celui-ci collabore en pipeline ou en parallele.
83
+ 5. **Quand m'invoquer** : 2 a 4 scenarios concrets (mots-cles utilisateur).
84
+ 6. **Quand NE PAS m'invoquer** : minimum 1 cas avec redirection explicite.
85
+
86
+ ### Anti-pattern
87
+
88
+ ```markdown
89
+ ## Mon role dans l'equipe BYAN
90
+
91
+ Je suis un agent BYAN. Je fais des trucs utiles.
92
+ Invoquez-moi quand vous avez besoin de moi.
93
+ ```
94
+
95
+ C'est du generique. Un agent qui ne sait pas se distinguer de ses pairs n'a pas sa place dans l'orchestre.
96
+
97
+ ## References
98
+
99
+ - Activation soul/tao : `_byan/core/activation/soul-activation.md`
100
+ - Soul de BYAN (createur du systeme) : `_byan/soul.md`
101
+ - Hermes dispatcher : `.claude/rules/hermes-dispatcher.md`
102
+ - Liste complete des agents : `.claude/rules/byan-agents.md`
@@ -56,11 +56,16 @@ Never call `byan_update_apply` without explicit user consent. That tool returns
56
56
 
57
57
  ### Phase 4 — DISPATCH
58
58
  - **Who** : you + user. Route each feature to the right BYAN component.
59
- - **Decision table** per feature :
60
- - **Score < 15** inline main-thread, no subagent
61
- - **Score 15-39 parallelizable** → agent-subagent-worktree (use `byan_dispatch` MCP tool to verify)
62
- - **Score 15-39 sequential** → mcp-worker-haiku
63
- - **Score 40** → main-thread-opus or delegate to `byan-hermes-dispatch`
59
+ - **Decision table** per feature — TWO independent axes (`byan_dispatch` returns both) :
60
+ - **Strategy** (WHERE it runs), from the score :
61
+ - **Score < 15** → inline main-thread, no subagent
62
+ - **Score 15-39 parallelizable** → agent-subagent-worktree
63
+ - **Score 15-39 sequential** → mcp-worker
64
+ - **Score ≥ 40** → main-thread (heavy) or delegate to `byan-hermes-dispatch`
65
+ - **Model tier** (WHICH model), from the task NATURE — not its size (`byan_dispatch` returns it as `model`, via native-tiers, the single source of truth) :
66
+ - nature `exploration` (load/read/scan/list/parse/fetch...) → `haiku`
67
+ - nature `implementation` / `verification` / `analysis` / unknown → deep = **inherit the session model**
68
+ - Keep protected work (verify/analysis/implement) off haiku regardless of size ; no pin-up to opus. Pass an explicit `nature` to `byan_dispatch` when you know it.
64
69
  - **Output** : a table `{ feature → specialist → model → strategy → estimated_tokens }`.
65
70
  - **If no specialist matches** : halt. Ask user whether to run INT (agent recruitment) first. Do NOT fallback silently to general-purpose.
66
71
  - **Exit gate** : user validates the mapping.
@@ -8,5 +8,5 @@ description: BYAN Test - Token Optimized Version (-46%)
8
8
  ## Rules
9
9
 
10
10
  - This is a TEST version of BYAN optimized for token reduction (-46%)
11
- - Full agent: _byan/agent/byan-test/byan-test.md (new layout); if absent, _byan/*/agents/byan-test.md (legacy layout). 116 lines vs 215 original
11
+ - Full agent: _byan/bmb/agents/byan-test.md (116 lines vs 215 original)
12
12
  - Original BYAN still available via bmad-agent-byan
@@ -50,18 +50,19 @@ Match keywords against the routing table below. Pick the single best match. If n
50
50
 
51
51
  ### 3. Pick the execution strategy (MCP call)
52
52
 
53
- Call the `byan_dispatch` MCP tool with `{ task: <goal>, parallelizable: <bool> }`. It returns `{ strategy, score, reasoning }` where strategy is one of :
53
+ Call the `byan_dispatch` MCP tool with `{ task: <goal>, parallelizable: <bool>, nature?: <leaf-type> }`. It returns `{ score, strategy, nature, tier, model, reasoning }` TWO independent axes :
54
54
 
55
- - `main-thread` do it inline, no delegation
56
- - `agent-subagent-worktree` — spawn Agent tool with isolation worktree
57
- - `mcp-worker-haiku` — spawn Agent tool with Haiku model, no worktree
58
- - `main-thread-opus` — keep in the current thread (don't delegate, Opus needed)
55
+ - **strategy** (WHERE it runs), from the score :
56
+ - `main-thread` — do it inline, no delegation
57
+ - `agent-subagent-worktree` — spawn Agent tool with isolation worktree
58
+ - `mcp-worker` — spawn Agent tool, no worktree
59
+ - **model** (WHICH model), from the task NATURE via native-tiers, not its size : `haiku` (exploration only) or `null` = deep (inherit the session model). Pass an explicit `nature` (`exploration`/`implementation`/`verification`/`analysis`) when you know it; protected natures stay off haiku.
59
60
 
60
61
  ### 4. Spawn the work
61
62
 
62
- Depending on strategy :
63
+ Depending on strategy (apply the returned `model` whenever you spawn) :
63
64
 
64
- **`main-thread` or `main-thread-opus`** : do not spawn. Execute inline yourself.
65
+ **`main-thread`** : do not spawn. Execute inline yourself — the work runs on the session model.
65
66
 
66
67
  **`agent-subagent-worktree`** : call the Agent tool with :
67
68
  ```
@@ -76,7 +77,9 @@ prompt: |
76
77
  When done, write a concise report (< 200 words).
77
78
  ```
78
79
 
79
- **`mcp-worker-haiku`** : same Agent tool call but without `isolation`, and add `model: "haiku"` in the prompt's instruction block if the receiving subagent honors it.
80
+ **`mcp-worker`** : same Agent tool call but without `isolation`. Set the Agent's `model` to the returned `model` — `haiku` for exploration nature, otherwise omit `model` to inherit the session model. The tier follows the task nature, not its size.
81
+
82
+ For any spawned strategy : pass `model` to the Agent tool when it is non-null; omit it when null so the subagent inherits the session model.
80
83
 
81
84
  ### 5. Specialist stub path lookup
82
85
 
@@ -9,7 +9,7 @@ You compose three existing building blocks into one multi-role flow :
9
9
 
10
10
  | Block | Role |
11
11
  |-------|------|
12
- | `byan_dispatch` MCP tool | Per-task execution strategy (main-thread / agent-subagent-worktree / mcp-worker-haiku / main-thread-opus) + complexity score |
12
+ | `byan_dispatch` MCP tool | Per-task strategy (main-thread / agent-subagent-worktree / mcp-worker) from the score + model tier by NATURE (haiku for exploration, else inherit the session model) + complexity score |
13
13
  | `byan-hermes-dispatch` skill | Specialist lookup (architect, dev, analyst, …) from a routing table |
14
14
  | `party-mode-native` workflow | Parallel spawn via Agent tool + worktree + coordination JSON |
15
15
 
@@ -42,7 +42,7 @@ Use this a priori mapping — override only if the task clearly needs more :
42
42
  | architect, quinn, tea, creative-problem-solver | opus | Deep reasoning, trade-offs |
43
43
  | carmack, rachid, marc, patnote | haiku | Narrow mechanical tasks |
44
44
 
45
- Then call `byan_dispatch` with each role's goal to get a complexity score. If the score demands a different tier (score >= 40bump to opus ; score < 15inline, no subagent), **override the default for that role**.
45
+ Then call `byan_dispatch` with each role's goal (and `nature` when known). Use its `score` for the STRATEGY only (score < 15inline, no subagent ; 15-39 subagent/worker ; ≥ 40 keep the heavy role in the main thread) and its nature-based `model` as the tier signal. The score sets WHERE the role runs, not WHICH model — keep protected roles (verify/analysis/implement) off haiku regardless of size, and avoid pinning a role up to opus on size alone. The per-role table above is the a-priori floor; `byan_dispatch`'s nature `model` refines it.
46
46
 
47
47
  ### 3. Compute the execution plan
48
48
 
@@ -69,7 +69,7 @@ Group roles by `parallelizable_with` graph. For each parallel cluster :
69
69
 
70
70
  - If cluster has N > 1 roles AND all use `agent-subagent-worktree` strategy → use the **party-mode-native** workflow : `coordination.initSession(roles, …)`, then dispatch all Agent tool calls in a single message.
71
71
  - If cluster has N = 1 OR strategy = `main-thread` → execute inline in the current turn.
72
- - If strategy = `mcp-worker-haiku` → spawn an Agent tool call WITHOUT worktree (faster boot, single-turn).
72
+ - If strategy = `mcp-worker` → spawn an Agent tool call WITHOUT worktree (faster boot, single-turn) ; set the Agent's model to the role's nature-based `model` (haiku for exploration, omit otherwise to inherit the session model).
73
73
 
74
74
  For each Agent tool call, the prompt must start with :
75
75
  ```
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: byan-suitability
3
+ description: Advisory model-suitability ledger — record adversarial verdicts, read learned ratings, human decides downgrades
4
+ ---
5
+
6
+ # BYAN Model-Suitability Ledger (advisory)
7
+
8
+ This skill operates the model-suitability ledger: a registry, keyed by
9
+ `(model x leaf)`, that learns from outcomes whether a CHEAP model is safe on a
10
+ given workflow leaf. It is the learning layer that sits ABOVE the static
11
+ conservative default and the linter floor — it does not weaken either. It only
12
+ advises; a human decides whether to keep, watch, or demote a downgrade.
13
+
14
+ ## What this is NOT
15
+
16
+ - It does not edit `.claude/workflows/*.js`. Zero auto-edit of routing.
17
+ - It does not touch the linter floor (`workflows-lint.js`). The floor still
18
+ blocks a protected-leaf downgrade at commit time, regardless of the ledger.
19
+ - It does not auto-promote or auto-demote. The verdict is a recommendation for a
20
+ human, not an action. (Auto-promotion is a deferred phase-2 capability and was
21
+ deliberately killed in design review: a hot-hand streak must not slip a
22
+ downgrade past human review.)
23
+
24
+ ## The math (why a thin sample does not say "keep")
25
+
26
+ Each `(model x leaf)` pair holds a Beta-Bernoulli posterior over the cheap
27
+ model's adequacy rate. The verdict reads the credible interval, not the point
28
+ estimate:
29
+
30
+ - `keep-cheap` — the credible LOWER bound is at or above the keep threshold
31
+ (default 0.85). Only sustained success earns this (~30 clean outcomes).
32
+ - `demote` — the credible UPPER bound is at or below the demote threshold
33
+ (default 0.70). Clear evidence the cheap model fails too often.
34
+ - `watch` — anything in between, including every thin sample. A wide interval
35
+ (low n) lands here, so "92% over 3 runs" reads as `watch`, not `keep-cheap`.
36
+
37
+ The report surfaces the lower bound and `n` by design, not a bare percentage,
38
+ because the same point estimate means different things at n=3 and n=300.
39
+
40
+ ## Wiring — feeder B (the hybrid pattern)
41
+
42
+ The signal is the adversarial VALIDATE pass: N skeptics (an odd panel, e.g. 3)
43
+ each try to REFUTE that the cheap model is adequate on one downgraded leaf. A
44
+ leaf is flagged (cheap inadequate) when at least half refute.
45
+
46
+ A `.claude/workflows/*.js` script cannot call MCP tools or write state (the
47
+ sandbox / state-coupling rule). So the wiring is hybrid:
48
+
49
+ 1. The adversarial pass returns its per-leaf verdicts as DATA:
50
+ `[{ model, leafId, refutedVotes, totalVotes }, ...]`.
51
+ 2. On the main-thread turn (where MCP tools fire), map each verdict to an
52
+ outcome with `verdictsToOutcomes` from
53
+ `_byan/mcp/byan-mcp-server/lib/suitability-feeder.js`
54
+ (`success = the cheap model survived the panel`).
55
+ 3. For each outcome, call the MCP tool `byan_suitability_record`
56
+ (`{ model, leafId, success, source: 'adversarial-pass' }`). This is the only
57
+ write path to the ledger; `record` is best-effort and does not throw.
58
+
59
+ ## Reading the ledger
60
+
61
+ - MCP: `byan_suitability_report` (optional `model` filter) — returns advisory
62
+ rows, most-actionable first, each with the lower bound, `n`, and a verdict.
63
+ - CLI: `node _byan/mcp/byan-mcp-server/bin/byan-suitability.js [--model haiku] [--json]`
64
+ — the same data, read-only.
65
+
66
+ ## Honest caveat
67
+
68
+ Today only a handful of exploration leaves are downgraded, and all are already
69
+ cheap, so the ledger produces little actionable signal in the short term. This
70
+ is foundation — an evidence rail for when the workflow leaf-set grows — not an
71
+ immediate token win. Do not oversell a `keep-cheap` on a thin `n`.
@@ -98,7 +98,7 @@ const context = await agent(
98
98
  `Request level=${JSON.stringify(level)}; requirements=${JSON.stringify(requirements)}. ` +
99
99
  `Report which of (level, processes, data stores, external entities) are clear and which are missing. ` +
100
100
  `Per the source, if ALL requirements are clear we may skip directly to structure planning.`,
101
- { label: 'context-analysis', phase: 'CONTEXT' }
101
+ { label: 'context-scan', model: 'haiku', phase: 'CONTEXT' }
102
102
  )
103
103
 
104
104
  // --- Steps 1-4: Level, Requirements, Theme, Plan structure -----------------
@@ -129,7 +129,7 @@ const resources = await agent(
129
129
  `- helpers: ${HELPERS} (standard DFD notation + Excalidraw element shapes)\n` +
130
130
  `Report the element templates (process ellipse, data-store rectangle/parallel-lines, external-entity ` +
131
131
  `rectangle, labeled-arrow) and the color/stroke values you will apply. Plan structure: ${JSON.stringify(plan)}`,
132
- { label: 'load-resources', phase: 'RESOURCES' }
132
+ { label: 'load-resources', phase: 'RESOURCES', model: 'haiku' }
133
133
  )
134
134
 
135
135
  // --- Step 6: Build DFD Elements --------------------------------------------
@@ -63,7 +63,7 @@ const analysis = await agent(
63
63
  `From this, extract and report a normalized structured intent: the resolved diagram type, the exhaustive list of ` +
64
64
  `components/entities, the exhaustive list of relationships (with direction), and the notation rules that apply ` +
65
65
  `for that type. If the spec is contradictory or missing a relationship endpoint, flag it explicitly (do not invent).`,
66
- { label: 'contextual-analysis', phase: 'ANALYZE' }
66
+ { label: 'parse-spec-intent', model: 'haiku', phase: 'ANALYZE' }
67
67
  )
68
68
 
69
69
  // --- Source step 5: Plan Diagram Structure ---------------------------------
@@ -89,7 +89,7 @@ const resources = await agent(
89
89
  `Merge the chosen theme into the template. Theme = ${JSON.stringify(theme)}.\n` +
90
90
  `Report the resolved template skeleton, the available library items, and the merged theme color map ` +
91
91
  `(component fill, database fill, service fill, border/accent stroke, text stroke #1e1e1e, arrow stroke).`,
92
- { label: 'load-resources', phase: 'LOAD-RESOURCES' }
92
+ { label: 'load-resources', phase: 'LOAD-RESOURCES', model: 'haiku' }
93
93
  )
94
94
 
95
95
  // --- Source step 7: Build Diagram Elements ---------------------------------
@@ -102,7 +102,7 @@ const context = await agent(
102
102
  `decisionPoints=${JSON.stringify(decisionPoints)} outputFile=${JSON.stringify(outputFile)} ` +
103
103
  `theme=${theme ? 'provided' : 'none (will default to Professional Blue palette)'}.\n` +
104
104
  `Do NOT ask questions — those were answered at the human gate. Just confirm the understanding in 2-3 lines.`,
105
- { label: 'context-restate', phase: 'CONTEXT' }
105
+ { label: 'read-requirements', model: 'haiku', phase: 'CONTEXT' }
106
106
  )
107
107
 
108
108
  // === STEP 4 (PLAN) ==========================================================
@@ -127,7 +127,7 @@ const resources = await agent(
127
127
  `Merge the theme colors (${theme ? JSON.stringify(theme) : 'Professional Blue default: fill #e3f2fd, accent #1976d2, decision #fff3e0, text #1e1e1e'}) ` +
128
128
  `onto the template. Report which template fields the flowchart will use and the resolved color palette. ` +
129
129
  `If a file is missing, say so explicitly — do not invent its contents.`,
130
- { label: 'load-resources', phase: 'RESOURCES' }
130
+ { label: 'load-resources', phase: 'RESOURCES', model: 'haiku' }
131
131
  )
132
132
 
133
133
  // === STEP 6 (BUILD) =========================================================
@@ -87,7 +87,7 @@ const context = await agent(
87
87
  `device=${JSON.stringify(device)}, theme=${JSON.stringify(theme)}, output=${JSON.stringify(outputFile)}.\n` +
88
88
  `Restate these requirements cleanly and flag any that are still ambiguous (do NOT ask the user — ` +
89
89
  `this engine runs headless; surface ambiguity as a note for the gate).`,
90
- { label: 'context', phase: 'CONTEXT' }
90
+ { label: 'read-context', model: 'haiku', phase: 'CONTEXT' }
91
91
  )
92
92
 
93
93
  // --- STEP 5: Plan Wireframe Structure --------------------------------------
@@ -110,7 +110,7 @@ const resources = await agent(
110
110
  `- the chosen theme: ${JSON.stringify(theme)} (use a theme.json if one exists).\n` +
111
111
  `Summarize the wireframe template primitives, the relevant library elements, the theme color tokens, ` +
112
112
  `and the element-creation constraints from helpers (grid 20px, containerId on text, grouping).`,
113
- { label: 'load-resources', phase: 'LOAD' }
113
+ { label: 'load-resources', phase: 'LOAD', model: 'haiku' }
114
114
  )
115
115
 
116
116
  // --- STEP 7: Build Wireframe Elements --------------------------------------
@@ -54,7 +54,7 @@ const loaded = await agent(
54
54
  `Read the COMPLETE story file. Parse Story, Acceptance Criteria, Tasks/Subtasks, Dev Notes, File List, Status. ` +
55
55
  `Identify the FIRST incomplete task (unchecked [ ]). Report the story key and that task. ` +
56
56
  `If no story is found or the file is inaccessible, say so explicitly (do not invent one).`,
57
- { label: 'load-story', phase: 'LOAD' }
57
+ { label: 'load-story', phase: 'LOAD', model: 'haiku' }
58
58
  )
59
59
 
60
60
  phase('RGR')
@@ -94,7 +94,8 @@ const existingDocs = await agent(
94
94
  'and the owning part id when multi-part. ' +
95
95
  'Do NOT ask the user for extra focus areas — that is a human gate; just return the inventory.',
96
96
  {
97
- label: 'existing-docs',
97
+ label: 'scan-existing-docs',
98
+ model: 'haiku',
98
99
  phase: 'EXISTING_DOCS',
99
100
  schema: {
100
101
  type: 'object',
@@ -212,6 +213,7 @@ const sourceTree = await agent(
212
213
  'Produce the content for source-tree-analysis.md.',
213
214
  {
214
215
  label: 'source-tree',
216
+ model: 'haiku',
215
217
  phase: 'SOURCE_TREE',
216
218
  schema: {
217
219
  type: 'object',
@@ -1,8 +1,9 @@
1
1
  #!/usr/bin/env bash
2
- # BYAN pre-commit hook. Three gates run in order:
2
+ # BYAN pre-commit hook. Four gates run in order:
3
3
  # 1. Strict Mode gate : block if a strict session is engaged but not completed.
4
4
  # 2. Native-workflow lint : block if a .claude/workflows/*.js couples to state.
5
- # 3. Mantra floor : block if a Gen3 persona source scores below the floor.
5
+ # 3. Template fidelity : block if install/templates/ drifted from root.
6
+ # 4. Mantra floor : block if a Gen3 persona source scores below the floor.
6
7
  #
7
8
  # Install :
8
9
  # git config core.hooksPath .githooks
@@ -63,6 +64,23 @@ if [ -f "$WF_LINT" ]; then
63
64
  fi
64
65
  fi
65
66
 
67
+ # Template fidelity gate — only install/templates/ ships on npm (package.json
68
+ # files[]), but the dev code lives at root _byan/ and .claude/. Without a sync the
69
+ # template drifts, and a published version can promise features its package does
70
+ # not contain. This gate blocks a commit whose template has drifted from root on
71
+ # any mirrored path; runtime seeds under _byan/memoire/ are excluded. Re-sync with
72
+ # the apply command, then restage. No-op if the tool is absent.
73
+ TEMPLATE_SYNC="_byan/mcp/byan-mcp-server/bin/byan-sync-template.js"
74
+ if [ -f "$TEMPLATE_SYNC" ]; then
75
+ if ! node "$TEMPLATE_SYNC" --check --root "$(git rev-parse --show-toplevel)"; then
76
+ echo ""
77
+ echo "Commit blocked : install/templates/ has drifted from root."
78
+ echo "Re-sync with 'node $TEMPLATE_SYNC' then restage the template, or bypass"
79
+ echo "with 'git commit --no-verify' (emergency only)."
80
+ exit 1
81
+ fi
82
+ fi
83
+
66
84
  if [ ! -f "$VALIDATOR" ]; then
67
85
  exit 0
68
86
  fi