create-byan-agent 2.19.2 → 2.20.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 (49) hide show
  1. package/CHANGELOG.md +148 -0
  2. package/README.md +4 -4
  3. package/install/src/byan-v2/generation/templates/default-agent.md +1 -1
  4. package/install/templates/.claude/CLAUDE.md +1 -1
  5. package/install/templates/.claude/hooks/fd-phase-guard.js +2 -2
  6. package/install/templates/.claude/hooks/mantra-validate.js +16 -8
  7. package/install/templates/.claude/hooks/strict-scope-guard.js +25 -7
  8. package/install/templates/.claude/rules/native-workflows.md +32 -0
  9. package/install/templates/.claude/skills/byan-byan/SKILL.md +5 -5
  10. package/install/templates/.claude/skills/byan-mantra-audit/SKILL.md +53 -0
  11. package/install/templates/.claude/skills/byan-merise-agile/SKILL.md +2 -2
  12. package/install/templates/.claude/skills/byan-native-dev-story/SKILL.md +83 -0
  13. package/install/templates/.claude/workflows/INDEX.md +35 -0
  14. package/install/templates/.claude/workflows/check-implementation-readiness.js +280 -0
  15. package/install/templates/.claude/workflows/code-review.js +179 -0
  16. package/install/templates/.claude/workflows/create-excalidraw-dataflow.js +214 -0
  17. package/install/templates/.claude/workflows/create-excalidraw-diagram.js +188 -0
  18. package/install/templates/.claude/workflows/create-excalidraw-flowchart.js +225 -0
  19. package/install/templates/.claude/workflows/create-excalidraw-wireframe.js +192 -0
  20. package/install/templates/.claude/workflows/create-story.js +216 -0
  21. package/install/templates/.claude/workflows/dev-story.js +100 -0
  22. package/install/templates/.claude/workflows/document-project.js +455 -0
  23. package/install/templates/.claude/workflows/qa-automate.js +169 -0
  24. package/install/templates/.claude/workflows/quick-dev.js +273 -0
  25. package/install/templates/.claude/workflows/sprint-planning.js +261 -0
  26. package/install/templates/.claude/workflows/testarch-atdd.js +287 -0
  27. package/install/templates/.claude/workflows/testarch-automate.js +229 -0
  28. package/install/templates/.claude/workflows/testarch-ci.js +184 -0
  29. package/install/templates/.claude/workflows/testarch-framework.js +267 -0
  30. package/install/templates/.claude/workflows/testarch-nfr.js +316 -0
  31. package/install/templates/.claude/workflows/testarch-test-design.js +293 -0
  32. package/install/templates/.claude/workflows/testarch-test-review.js +321 -0
  33. package/install/templates/.claude/workflows/testarch-trace.js +316 -0
  34. package/install/templates/.githooks/pre-commit +49 -15
  35. package/install/templates/_byan/config.yaml +15 -5
  36. package/install/templates/_byan/mcp/byan-mcp-server/bin/byan-build-workflows.js +20 -0
  37. package/install/templates/_byan/mcp/byan-mcp-server/bin/byan-lint-workflows.js +57 -0
  38. package/install/templates/_byan/mcp/byan-mcp-server/lib/native-loop.js +39 -0
  39. package/install/templates/_byan/mcp/byan-mcp-server/lib/workflows-generator.js +149 -0
  40. package/install/templates/_byan/mcp/byan-mcp-server/lib/workflows-lint.js +113 -0
  41. package/install/templates/_byan/workflow/simple/byan/feature-workflow.md +14 -11
  42. package/install/templates/docs/native-workflows-contract.md +84 -0
  43. package/package.json +2 -2
  44. package/src/byan-v2/data/agent-scopes.json +46 -0
  45. package/src/byan-v2/data/mantras.json +194 -8
  46. package/src/byan-v2/generation/mantra-audit.js +147 -0
  47. package/src/byan-v2/generation/mantra-validator.js +56 -6
  48. package/src/byan-v2/generation/scope-resolver.js +102 -0
  49. package/src/byan-v2/generation/templates/default-agent.md +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,154 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ---
9
9
 
10
+ ## [Unreleased]
11
+
12
+ ## [2.20.0] - 2026-06-04
13
+
14
+ ### Changed - Mantra taxonomy v2: sdlc-ops split + creative family (corpus 64 -> 71)
15
+
16
+ The N2 embodiment audit surfaced two taxonomy biases. (1) sdlc-code conflated
17
+ code-craft with release/ops, so a dev agent was judged against release mantras it
18
+ never performs. (2) The corpus had no creative mantra, so the six CIS agents were
19
+ scored only against analytical principles that are the opposite of their craft.
20
+
21
+ - **sdlc-ops scope.** Six release/deploy mantras (M8 freeze, M16 semver, M17
22
+ changelog, M18 env parity, M19 CI/CD, M20 rollback) move from sdlc-code to a new
23
+ `sdlc-ops` scope. Deploy/ops agents (rachid, patnote, yanstaller, marc, codex,
24
+ claude) gain it; dev/architect shed it (they craft, not release).
25
+ - **Creative family (7 mantras, CR-1..CR-7).** A new `creative` scope + category,
26
+ derived from the real CIS personas: Diverge Before Converge (brainstorming),
27
+ Anchor in the Human Need (design-thinking), Reframe to the Root Cause
28
+ (problem-solving), Judge Ideas by New Value (innovation), Find the Authentic
29
+ Story (storytelling), Serve the Audience's Attention (presentation), Prototype-
30
+ Test-Pivot (iteration). The 6 CIS agents are now scored on their own craft.
31
+ - **scope-resolver** registers the two new scopes in `VALID_SCOPES` so they are
32
+ not silently dropped at resolution (the design's own Zero-Trust blocker).
33
+ - **Corpus 64 -> 71.** metadata recomputed (scopes, categories, priorityLevels);
34
+ the strict 12-mantra regime is byte-untouched. No-scope total tests updated to
35
+ 71; the all-five-scopes union test drops 60 -> 54 as the six ops mantras leave
36
+ sdlc-code. Keyword lists were cleaned of over-broad signals per an adversarial
37
+ review.
38
+
39
+ Measured (floor): dev sheds ops (applicable 42 -> 36), CIS agents gain matchable
40
+ mantras (brainstorming 45 -> 48, innovation-strategist 38 -> 59).
41
+
42
+ ### Changed - Domain-aware mantra validator (Option C: N1 anti-stub floor + N2 embodiment audit)
43
+
44
+ The mantra compliance bar was an all-64 keyword-density proxy with an 80% gate
45
+ that focused personas did not reach (measured median 11%, 0 of 120 gated files at
46
+ >= 80%): it implicitly graded each agent as a software-delivery agent, so a UX or
47
+ storyteller persona was failed for missing Scrum/Merise vocabulary. The gate
48
+ stayed green only through broad exemptions, masking the mis-fit. This reworks the
49
+ metric to score each persona only against the mantras that apply to it.
50
+
51
+ - **Taxonomy.** Each of the 64 mantras carries a `scope`
52
+ (`universal` | `sdlc-process` | `sdlc-code` | `sdlc-modeling` | `sdlc-test`) in
53
+ `mantras.json`. The four runtime-enforced mantras (IA-1, IA-9, IA-21, IA-23,
54
+ checked by hooks / fact-check rather than declared in a persona file) are
55
+ flagged `behavioral` and excluded from persona-file scoring.
56
+ - **Domain-aware validator.** `validate(def, { scope })` scores only the
57
+ applicable subset (universal + the persona's declared scope, behavioral
58
+ excluded); `totalMantras` becomes the applicable count. With no scope it scores
59
+ all 64 (legacy behavior preserved, existing tests untouched). A reusable
60
+ `applicableMantras(scope)` is exposed. Score bands moved to single constants.
61
+ - **Per-agent scope resolution.** `scope-resolver.js` resolves a persona to its
62
+ scope set, precedence explicit-frontmatter > per-agent map > module-derived >
63
+ `universal`, with `universal` force-unioned. The map lives in
64
+ `src/byan-v2/data/agent-scopes.json`.
65
+ - **Emoji-icon fix.** The no-emoji mantra (IA-23) excludes `icon="..."`
66
+ frontmatter attributes from its scan (an icon glyph is display metadata, not
67
+ pollution); a real emoji in the body is still caught.
68
+ - **Anti-stub floor, honestly named.** The pre-commit gate and Stop hook score the
69
+ canonical Gen3 persona sources (`_byan/agent/<name>/<name>.md`) domain-aware at a
70
+ floor of 30 (the real roster spans 34-73, median 50). It is an anti-stub /
71
+ anti-zombie floor, not a deep quality bar.
72
+ - **N2 embodiment audit (out-of-band).** `src/byan-v2/generation/mantra-audit.js` (`prepare` /
73
+ `score`) plus the `byan-mantra-audit` skill measure genuine embodiment via an
74
+ LLM judge, kept out of the commit path (the judgment is semantic).
75
+ - **Bugs fixed in passing.** B1: the stale `install/templates/.githooks/pre-commit`
76
+ mirror is re-synced (it lagged the source, missing the workflow-lint block). B2:
77
+ the gate no longer targets empty legacy dirs (`_byan/agents`, `_byan/bmb/agents`),
78
+ it targets the real sources. B3: the FD VALIDATE wording (SKILL, fd-phase-guard,
79
+ feature-workflow, GUIDE) is realigned to the floor, no longer asserting an
80
+ unreachable 80%. Config `categories` is revived as `scopes`.
81
+
82
+ New unit tests: scope filtering, behavioral exclusion, emoji-icon, scope-resolver,
83
+ N2 audit. Strict regime (12 mantras, byan-strict at 100%) untouched.
84
+
85
+ ### Added - Native workflow bridge, Phase 1 (Hybrid: gate outside, engine inside)
86
+
87
+ BYAN workflows are LLM-interpreted and human-gated; Claude Code's in-CLI Workflow
88
+ tool runs a deterministic JS script with no in-run human gate. Phase 1 ports the
89
+ non-gated subset (autonomous + deterministic pipeline) to the native tool, while
90
+ the gated majority stays markdown by design. Scope is coupled to target: broad
91
+ coverage (gated workflows) would need the Agent SDK and is parked (Phase 2).
92
+
93
+ - **F1 — registry + dual-path resolver.** `byan-build-workflows`
94
+ (`_byan/mcp/byan-mcp-server/bin/`, ESM, sibling to `byan-build-index`) reads
95
+ the workflow manifest and writes `.claude/workflows/INDEX.md` idempotently
96
+ (20 portable workflows: 11 autonomous + 9 pipeline). `resolveWorkflow(name)`
97
+ prefers `.claude/workflows/<name>.js`, else falls back to the markdown workflow
98
+ (Gen3-first dual-path).
99
+ - **F2 — pilot port `dev-story`.** `.claude/workflows/dev-story.js` runs the
100
+ red-green-refactor loop as a JS `while` loop with a real 3-cycle convergence
101
+ counter (replacing the doc-only "3 failures -> HALT" rule). The deterministic
102
+ core lives in `lib/native-loop.js` (unit-tested) and is mirrored inline since
103
+ the sandbox forbids imports. The script returns a structured verdict; the
104
+ `byan-native-dev-story` skill owns the human gate and records state via MCP.
105
+ - **F3 — enforcement bridge.** `byan-lint-workflows` fails if a
106
+ `.claude/workflows/*.js` imports/requires `lib/fd-state.js` (or the strict-mode
107
+ lib); wired into `.githooks/pre-commit` since the in-session hooks do not fire
108
+ inside a script. Contract documented in `docs/native-workflows-contract.md` and
109
+ `.claude/rules/native-workflows.md`.
110
+
111
+ 25 new unit tests (node --test). Mirrored into `install/templates/`.
112
+
113
+ - **F4 + F5 - the 19 remaining portable workflows ported.** Every autonomous
114
+ (10: create-story, qa-automate, the 8 testarch-*) and pipeline (9:
115
+ check-implementation-readiness, code-review, the 4 create-excalidraw-*,
116
+ document-project, quick-dev, sprint-planning) workflow now has a faithful
117
+ native `.claude/workflows/<name>.js` that mirrors its real source steps. Each
118
+ keeps human gates OUT of the script (returns a structured verdict), uses no
119
+ import/state-coupling/wall-clock/RNG, and passes `node --check` +
120
+ `byan-lint-workflows`. `.claude/workflows/INDEX.md` now reports 20/20 native
121
+ (11 autonomous + 9 pipeline). Mirrored into `install/templates/`.
122
+
123
+ - **F6 - native-workflow contract validator.** `byan-lint-workflows` now enforces
124
+ the full contract on every `.claude/workflows/*.js`: no state coupling
125
+ (comment-stripped), no wall-clock/RNG token anywhere in the raw text (the
126
+ launch validator rejects those even in comments or strings - the exact failure
127
+ a manual review caught while porting), a pure `export const meta` literal first,
128
+ and `node --check` syntax. `validateContract()` is exported and unit-tested
129
+ (clock-in-comment case included). Wired into the pre-commit gate. Speculative
130
+ brainstorm items (golden-file LLM diff, dry-run mode, schema-first frontmatter)
131
+ were dropped per Ockham.
132
+
133
+ ### Fixed - hygiene debts surfaced while porting (F7)
134
+
135
+ - **Dispatch matrix doc realigned to code.** The DISPATCH table in
136
+ `_byan/workflow/simple/byan/feature-workflow.md` advertised `<30 / 30-60 / >=60`
137
+ (Worker/Sonnet/Opus) which did not match `byan_dispatch` / `lib/dispatch.js`
138
+ (`main-thread <15` / `agent-subagent-worktree <40+parallel` / `mcp-worker-haiku
139
+ <40` / `main-thread-opus >=40`). The doc now mirrors the code, the single
140
+ source of truth.
141
+ - **Strict scope-guard mid-segment glob fixed.** `matchesPrefix` reduced a glob
142
+ to the literal lead before the first wildcard and then forced a `/` boundary,
143
+ so a mid-segment glob like `.claude/skills/byan-*/**` wrongly denied
144
+ `.claude/skills/byan-native-dev-story/...`. It now matches mid-segment globs as
145
+ a raw prefix while preserving the directory-boundary behavior (`_byan/**`
146
+ matches `_byan/x` but not `_byanX`). Tested in `strict-hooks.test.js`.
147
+
148
+ Two related items were investigated and deliberately left unchanged: retargeting
149
+ the mantra pre-commit bar onto canonical Gen3 agent sources does not help (those
150
+ sources also score below the 80% keyword-density bar - `byan` 73%, `dev` 38% - so
151
+ the bar itself, not its target, is the open question, left as a policy decision);
152
+ and the "FD state pushed to byan_web" claim is absent from the repo (FD state is
153
+ pure-local by design; only strict mode pushes to byan_web), so there was nothing
154
+ to fix.
155
+
156
+ ---
157
+
10
158
  ## [2.19.2] - 2026-06-02
11
159
 
12
160
  ### Fixed - `update-byan-agent update` is non-destructive, non-interactive, and local
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![Tests](https://img.shields.io/badge/tests-1444%2F1466-brightgreen.svg)](https://github.com/Yan-Acadenice/BYAN)
6
6
  [![Node](https://img.shields.io/badge/node-%3E%3D12.0.0-brightgreen.svg)](https://nodejs.org)
7
7
 
8
- **Créateur intelligent d'agents IA** | Merise Agile + TDD + 64 Mantras
8
+ **Créateur intelligent d'agents IA** | Merise Agile + TDD + 71 Mantras
9
9
 
10
10
  > Documentation en anglais disponible ici : [README-EN.md](./README-EN.md)
11
11
 
@@ -198,7 +198,7 @@ BYAN contient **27 agents spécialisés** organisés en **5 modules** :
198
198
 
199
199
  | Agent | Persona | Rôle | Cas d'usage typique |
200
200
  |-------|---------|------|---------------------|
201
- | **byan** | Builder | Créateur d'agents via interview intelligente (12 questions, 64 mantras). Intègre [FC] fact-check et [ELO] | Créer un agent spécialisé pour votre domaine |
201
+ | **byan** | Builder | Créateur d'agents via interview intelligente (12 questions, 71 mantras). Intègre [FC] fact-check et [ELO] | Créer un agent spécialisé pour votre domaine |
202
202
  | **fact-checker** | Scientifique | Fact-check d'assertions, audit de documents, analyse de chaînes de raisonnement | Vérifier une spec technique avant sprint |
203
203
  | **agent-builder** | Bond | Expert en construction d'agents BMAD-compliant | Construire un agent complexe manuellement |
204
204
  | **module-builder** | Morgan | Architecte de modules BYAN complets | Créer un nouveau module métier |
@@ -271,7 +271,7 @@ BYAN est organisé autour de quatre concepts fondamentaux qui interagissent ense
271
271
  Un agent est un spécialiste IA avec une identité définie. Il possède :
272
272
  - **Persona** : qui il est, son style de communication, ses forces
273
273
  - **Menu** : les actions disponibles, chacune liée à un workflow ou une commande
274
- - **Rules** : les contraintes absolues qu'il ne peut pas violer (les 64 mantras)
274
+ - **Rules** : les contraintes absolues qu'il ne peut pas violer (les 71 mantras)
275
275
  - **Capabilities** : ce qu'il peut faire, ce qu'il ne fait pas
276
276
 
277
277
  Les agents sont définis en Markdown avec des sections XML. Ils sont stockés dans `_byan/{module}/agents/` et exposés sur chaque plateforme via un wrapper léger (`.github/agents/`, `.claude/`, `.codex/prompts/`).
@@ -327,7 +327,7 @@ VOUS → @hermes "je veux créer un agent"
327
327
 
328
328
  ┌─────────────────────────────────────────────────────────┐
329
329
  │ AGENT (spécialiste IA) │
330
- │ Persona · Menu · Rules (64 mantras) · Capabilities │
330
+ │ Persona · Menu · Rules (71 mantras) · Capabilities │
331
331
  └────────────┬─────────────────────────┬───────────────────┘
332
332
  │ déclenche │ appelle
333
333
  ▼ ▼
@@ -16,7 +16,7 @@ You must fully embody this agent's persona and follow all activation instruction
16
16
  <rules>
17
17
  <r>Communicate in {communication_language}</r>
18
18
  <r>Stay in character until EXIT</r>
19
- <r>Apply Merise Agile + TDD + 64 mantras</r>
19
+ <r>Apply Merise Agile + TDD + 71 mantras</r>
20
20
  </rules>
21
21
  </activation>
22
22
 
@@ -1,6 +1,6 @@
1
1
  # BYAN - Builder of YAN
2
2
 
3
- > Projet propulse par BYAN (Merise Agile + TDD + 64 Mantras)
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
6
 
@@ -61,10 +61,10 @@ const PHASE_RULES = {
61
61
  ],
62
62
  VALIDATE: [
63
63
  'Run npm test. Zero regression on previously-passing tests.',
64
- 'MantraValidator >= 80% on changed agent/skill files. Fact-check any absolute claim.',
64
+ 'MantraValidator domain-aware >= 30 (anti-stub floor) on changed Gen3 persona sources. Fact-check any absolute claim.',
65
65
  'Decision is binary : OK -> DOC, KO -> REFACTOR. Persist via update({ patch: { validate_verdict: { status, blocking_issues } } }).',
66
66
  'Prefix every response with [FD:VALIDATE].',
67
- 'Exit : tests green + score >= 80% -> advance to DOC. Otherwise -> advance to REFACTOR.',
67
+ 'Exit : tests green + score >= 30 (anti-stub floor) -> advance to DOC. Otherwise -> advance to REFACTOR.',
68
68
  ],
69
69
  REFACTOR: [
70
70
  'Corrective loop only — no new features, no re-design. Address blocking_issues from VALIDATE.',
@@ -2,18 +2,20 @@
2
2
  /**
3
3
  * Stop hook — scans files changed in the last commit on the current branch,
4
4
  * runs MantraValidator on those that look like BYAN agent files, and warns
5
- * when any drops below the 80% mantra compliance threshold.
5
+ * when any drops below the domain-aware anti-stub floor.
6
6
  *
7
- * Scope: .md files under _byan/**, .github/agents/**, .claude/skills/**
8
- * (agent definitions). Non-blocking: never prevents Stop, only warns via
9
- * additionalContext.
7
+ * Scope: .md files under _byan/agent/**, .github/agents/**, .claude/skills/**.
8
+ * Domain-aware: each persona is scored only against its applicable mantras
9
+ * (scope-resolver), matching the blocking pre-commit gate. Non-blocking: never
10
+ * prevents Stop, only warns via additionalContext. Deep embodiment quality is
11
+ * the out-of-band semantic audit (src/byan-v2/generation/mantra-audit.js).
10
12
  */
11
13
 
12
14
  const fs = require('fs');
13
15
  const path = require('path');
14
16
  const { execSync } = require('child_process');
15
17
 
16
- const THRESHOLD = 80;
18
+ const THRESHOLD = 30;
17
19
  const projectDir = process.env.CLAUDE_PROJECT_DIR || process.cwd();
18
20
 
19
21
  function changedFiles() {
@@ -48,12 +50,15 @@ function looksLikeAgentFile(rel) {
48
50
  }
49
51
  }
50
52
 
51
- function runValidator(absPath) {
53
+ function runValidator(absPath, rel) {
52
54
  try {
53
55
  const MantraValidator = require(path.join(projectDir, 'src/byan-v2/generation/mantra-validator.js'));
56
+ const resolver = require(path.join(projectDir, 'src/byan-v2/generation/scope-resolver.js'));
54
57
  const content = fs.readFileSync(absPath, 'utf8');
58
+ const name = path.basename(rel).replace(/\.md$/, '');
59
+ const scopes = resolver.resolveAgentScopes({ name, content });
55
60
  const validator = new MantraValidator();
56
- const res = validator.validate(content);
61
+ const res = validator.validate(content, { scope: scopes });
57
62
  const score = Math.round((res.compliant.length / res.totalMantras) * 100);
58
63
  return { score, errors: res.errors || [], warnings: res.warnings || [] };
59
64
  } catch (err) {
@@ -65,10 +70,13 @@ const offenders = [];
65
70
  const files = changedFiles().filter(looksLikeAgentFile);
66
71
 
67
72
  for (const rel of files) {
73
+ if (/test|optimized|turbo-whisper/.test(rel)) continue;
68
74
  const abs = path.join(projectDir, rel);
69
75
  if (!fs.existsSync(abs)) continue;
70
- const r = runValidator(abs);
76
+ const r = runValidator(abs, rel);
71
77
  if (r.error) continue;
78
+ // score 0 = parse error / derived stub / non-persona : skip, not an offender.
79
+ if (r.score === 0) continue;
72
80
  if (r.score < THRESHOLD) {
73
81
  offenders.push({ file: rel, score: r.score, errors: r.errors.slice(0, 2) });
74
82
  }
@@ -27,15 +27,33 @@ function toRelative(filePath, root) {
27
27
 
28
28
  function matchesPrefix(rel, prefix) {
29
29
  let p = String(prefix).trim();
30
- // Glob-tolerant: reduce a glob to the literal directory part before the first
31
- // wildcard, then prefix-match. So "_byan/**" and "src/**/*.test.js" match
32
- // their subtree instead of being compared as a literal string (which never
33
- // matched, wrongly denying every write under a globbed allowed path). A prefix
34
- // with no wildcard keeps the exact + dir-prefix behavior unchanged.
30
+ // Glob-tolerant: reduce a glob to the literal part before the first wildcard,
31
+ // then prefix-match. So "_byan/**" and "src/**/*.test.js" match their subtree
32
+ // instead of being compared as a literal string (which never matched, wrongly
33
+ // denying every write under a globbed allowed path).
35
34
  const star = p.indexOf('*');
36
- if (star !== -1) p = p.slice(0, star);
35
+
36
+ // No wildcard: exact match or directory-prefix match.
37
+ if (star === -1) {
38
+ p = p.replace(/\/+$/, '');
39
+ if (p === '') return true;
40
+ return rel === p || rel.startsWith(p + '/');
41
+ }
42
+
43
+ // A wildcard whose preceding char is NOT "/" sits INSIDE a path segment
44
+ // (e.g. ".claude/skills/byan-*/**"). The literal lead before it must match as
45
+ // a raw prefix, with no "/" boundary forced after it - otherwise
46
+ // ".claude/skills/byan-native-dev-story/..." is wrongly denied because it does
47
+ // not start with ".claude/skills/byan-/".
48
+ const midSegment = star > 0 && p[star - 1] !== '/';
49
+ p = p.slice(0, star);
50
+ if (p === '') return true; // bare "*" / "**" -> matches everything
51
+ if (midSegment) return rel.startsWith(p);
52
+
53
+ // Directory-boundary wildcard (e.g. "_byan/**"): reduce to the dir and match
54
+ // exact-or-subtree so "_byan/**" matches "_byan/x" but not "_byanX".
37
55
  p = p.replace(/\/+$/, '');
38
- if (p === '') return true; // bare "**" / "*" -> matches everything
56
+ if (p === '') return true;
39
57
  return rel === p || rel.startsWith(p + '/');
40
58
  }
41
59
 
@@ -0,0 +1,32 @@
1
+ # Native Workflows — Rule
2
+
3
+ BYAN workflows can run on Claude Code's native Workflow tool. Only the
4
+ non-gated subset is portable (autonomous + deterministic pipeline); the gated
5
+ majority stays LLM-interpreted markdown. Scope is coupled to target: broad
6
+ coverage (gated workflows) would need the Agent SDK, which is parked (Phase 2).
7
+
8
+ ## Hybrid pattern — gate outside, engine inside
9
+
10
+ - The autonomous work runs in a `.claude/workflows/<name>.js` script.
11
+ - The human gate stays in an orchestrating skill on a real main-thread turn,
12
+ where the BYAN hooks fire.
13
+ - The script returns DATA; the skill owns completion and records state via MCP.
14
+
15
+ ## State-coupling rule (enforced)
16
+
17
+ A native workflow script mutates FD/strict state only through the `byan_fd_*` /
18
+ `byan_strict_*` MCP tools. Importing or requiring `lib/fd-state.js` (or the
19
+ `strict-mode` lib) from a script is forbidden. Enforcement:
20
+
21
+ - `node _byan/mcp/byan-mcp-server/bin/byan-lint-workflows.js` — fails on a
22
+ forbidden import/require in `.claude/workflows/*.js`.
23
+ - `.githooks/pre-commit` runs that linter, so a violation blocks the commit.
24
+
25
+ ## Registry + resolution
26
+
27
+ - Registry: `.claude/workflows/INDEX.md`, generated by
28
+ `node _byan/mcp/byan-mcp-server/bin/byan-build-workflows.js` from the manifest.
29
+ - Dual-path: `resolveWorkflow(name)` prefers `.claude/workflows/<name>.js`, else
30
+ falls back to the markdown workflow from the manifest.
31
+
32
+ Full detail: see `docs/native-workflows-contract.md`.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: byan-byan
3
- description: BYAN — Builder of YAN. Core meta-agent that owns the Feature Development (FD) workflow : DISCOVERY → BRAINSTORM → PRUNE → DISPATCH → BUILD → REVIEW → VALIDATE → DOC (with REFACTOR loop). Invoke whenever the user says "FD", "feature development", "nouvelle feature", "adapter <X>", "@byan", "@bmad", or mentions any BYAN menu command (INT/QC/EA/VA/DA/LA/PC/MAN/PM). Applies Merise Agile + TDD + 64 mantras. Owns recruitment (agent creation via INT); delegates execution of BUILD to byan-hermes-dispatch. Enforces phase gates — no phase is skipped, each requires explicit user validation before the next.
3
+ description: BYAN — Builder of YAN. Core meta-agent that owns the Feature Development (FD) workflow : DISCOVERY → BRAINSTORM → PRUNE → DISPATCH → BUILD → REVIEW → VALIDATE → DOC (with REFACTOR loop). Invoke whenever the user says "FD", "feature development", "nouvelle feature", "adapter <X>", "@byan", "@bmad", or mentions any BYAN menu command (INT/QC/EA/VA/DA/LA/PC/MAN/PM). Applies Merise Agile + TDD + 71 mantras. Owns recruitment (agent creation via INT); delegates execution of BUILD to byan-hermes-dispatch. Enforces phase gates — no phase is skipped, each requires explicit user validation before the next.
4
4
  ---
5
5
 
6
6
  # BYAN — Native FD Enforcement
@@ -90,12 +90,12 @@ Never call `byan_update_apply` without explicit user consent. That tool returns
90
90
  - **Who** : MantraValidator + jest/node test + `byan-fact-check` skill. No human judgement, only numbers.
91
91
  - **Checks** :
92
92
  - `npm test` : zero regression on pre-existing passing tests
93
- - MantraValidator ≥ 80 % on changed agent/skill files
93
+ - MantraValidator domain-aware 30 (anti-stub floor) on changed Gen3 persona sources (deep embodiment : `src/byan-v2/generation/mantra-audit.js`, out-of-band)
94
94
  - No emoji in code, commits, specs
95
95
  - Final fact-check on any absolute claim introduced in docs
96
96
  - **Decision** : binary. Persist via `byan_fd_update({ patch: { validate_verdict: { status, blocking_issues } } })`.
97
97
  - **Exit gate** :
98
- - `OK` (tests green + score ≥ 80% + fact-check OK) → advance to DOC.
98
+ - `OK` (tests green + score ≥ 30 anti-stub floor + fact-check OK) → advance to DOC.
99
99
  - `KO` → advance to REFACTOR.
100
100
 
101
101
  ### Phase 8a — DOC (if VALIDATE OK)
@@ -174,11 +174,11 @@ Use the MCP tools `byan_fd_start`, `byan_fd_advance`, `byan_fd_status`, `byan_fd
174
174
  - `INT` — intelligent interview (30-45 min, 4 phases) → create a new agent
175
175
  - `QC` — quick create (10 min, defaults)
176
176
  - `EA` — edit existing agent
177
- - `VA` — validate agent against 64 mantras
177
+ - `VA` — validate agent against 71 mantras
178
178
  - `DA-AGENT` — delete agent with backup
179
179
  - `LA` — list all agents
180
180
  - `PC` — show project context
181
- - `MAN` — 64 mantras reference
181
+ - `MAN` — 71 mantras reference
182
182
  - `PM` — party mode
183
183
  - `EXIT` — dismiss
184
184
 
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: byan-mantra-audit
3
+ description: Semantic embodiment audit of a BYAN persona against its applicable mantras. Out-of-band, LLM-judged, kept out of the commit gate.
4
+ ---
5
+
6
+ # BYAN Mantra Embodiment Audit (N2)
7
+
8
+ This skill runs the deep, semantic half of mantra validation, the layer above the
9
+ deterministic anti-stub floor enforced at commit time. The pre-commit gate asks
10
+ "does this persona contain its domain vocabulary"; this skill asks "does this
11
+ persona genuinely EMBODY each applicable mantra", judged by you (the LLM), not by
12
+ keyword presence. It runs on demand, outside the commit path.
13
+
14
+ ## When to run
15
+
16
+ - Auditing a persona's quality beyond the deterministic anti-stub floor.
17
+ - After authoring or editing an agent, to check real embodiment of its mantras.
18
+ - As a CI / review step, out-of-band. Not as a commit gate (the judgment is
19
+ semantic and non-deterministic, so it must stay out of the commit path).
20
+
21
+ ## Protocol (hybrid: deterministic CLI, semantic judgment)
22
+
23
+ 1. PREPARE (deterministic). Build the judgment packet for the target persona:
24
+ ```
25
+ node src/byan-v2/generation/mantra-audit.js prepare <path/to/agent.md>
26
+ ```
27
+ It resolves the persona's scope (scope-resolver), lists only the applicable
28
+ mantras, and emits a rubric plus the persona text. Add `--json` for the raw packet.
29
+
30
+ 2. JUDGE (you, this turn). For each mantra in the packet decide `embodied`,
31
+ `partial`, or `absent`. Judge embodiment, not vocabulary: a mantra is embodied
32
+ when the persona's role, instructions, and red-lines enact the principle, even
33
+ if the exact keyword is absent. Write the verdicts to a JSON file:
34
+ `{ "<mantraId>": "embodied" | "partial" | "absent", ... }`.
35
+
36
+ 3. SCORE (deterministic):
37
+ ```
38
+ node src/byan-v2/generation/mantra-audit.js score <path/to/agent.md> <verdicts.json>
39
+ ```
40
+ It returns the embodiment score and the embodied / partial / absent / unjudged
41
+ breakdown.
42
+
43
+ 4. REPORT. Present the embodiment score, the absent mantras, and concrete
44
+ suggestions to raise embodiment, what the persona should ENACT, not which
45
+ keyword to insert.
46
+
47
+ ## Boundaries
48
+
49
+ - Advisory quality insight, not a gate. It does not block commits.
50
+ - The deterministic floor (pre-commit gate, Stop hook) and this semantic audit are
51
+ complementary: the floor catches stubs cheaply; this measures real quality deeply.
52
+ - Keep judgments honest: default to `partial` or `absent` when the persona only
53
+ alludes to a mantra without enacting it.
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: byan-merise-agile
3
- description: Methodologie Merise Agile + TDD enrichie de 64 mantras. Invoquer pour conception logicielle (MCD/MCT, data dictionary first, cross-validation), creation PRD/epics/stories, Ockham's Razor sur decisions d'archi, conventions de commit BYAN (type: description, zero emoji), ou quand l'utilisateur evoque BMAD/Merise/phases SDLC (Analyse/Planning/Solutioning/Implementation).
3
+ description: Methodologie Merise Agile + TDD enrichie de 71 mantras. Invoquer pour conception logicielle (MCD/MCT, data dictionary first, cross-validation), creation PRD/epics/stories, Ockham's Razor sur decisions d'archi, conventions de commit BYAN (type: description, zero emoji), ou quand l'utilisateur evoque BMAD/Merise/phases SDLC (Analyse/Planning/Solutioning/Implementation).
4
4
  ---
5
5
 
6
6
  # Methodologie Merise Agile + TDD
7
7
 
8
- BYAN utilise la methodologie Merise Agile enrichie de 64 mantras.
8
+ BYAN utilise la methodologie Merise Agile enrichie de 71 mantras.
9
9
 
10
10
  ## Principes Fondamentaux
11
11
 
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: byan-native-dev-story
3
+ description: Orchestrating conductor for the native dev-story workflow. Runs the autonomous red-green-refactor engine (.claude/workflows/dev-story.js) via the Workflow tool, then presents its verdict at a human gate and records FD/strict state via MCP. This is the Hybrid pattern incarnate - gate OUTSIDE the script, engine INSIDE.
4
+ ---
5
+
6
+ # byan-native-dev-story - Conductor (gate outside, engine inside)
7
+
8
+ You are the human-gated conductor for the native dev-story workflow. The
9
+ autonomous work runs in `.claude/workflows/dev-story.js` (the in-CLI Workflow
10
+ tool); YOU own the human gate and the auditable state. This split is the whole
11
+ point of Phase 1: the engine is native and deterministic, the gate stays on a
12
+ real main-thread turn where the BYAN hooks fire.
13
+
14
+ ## Why this skill exists
15
+
16
+ A launched Workflow script is autonomous and cannot pause mid-run to ask a
17
+ human, and the main-thread enforcement hooks do not fire inside it. So the
18
+ script must not decide completion or mutate BYAN state on its own. It returns
19
+ DATA; this skill turns that data into a gated decision.
20
+
21
+ ## Protocol
22
+
23
+ ### 1. Resolve the workflow (dual-path)
24
+
25
+ Prefer the native script. If `.claude/workflows/dev-story.js` exists, use it.
26
+ Otherwise fall back to the markdown workflow from the manifest
27
+ (`_byan/workflow/simple/4-implementation/dev-story/workflow.yaml`). The
28
+ programmatic resolver is `resolveWorkflow('dev-story')` in
29
+ `_byan/mcp/byan-mcp-server/lib/workflows-generator.js`.
30
+
31
+ ### 2. (If inside an FD or strict session) read state via MCP
32
+
33
+ State mutations go through the MCP tools ONLY - direct writes to `fd-state.json`
34
+ or `.byan-strict/` are out of bounds:
35
+
36
+ - FD: `byan_fd_status` to read the phase; a dev-story run is BUILD-phase work.
37
+ - Strict: if a strict session is engaged, the story implementation is in scope;
38
+ do not lock a second scope here.
39
+
40
+ ### 3. Run the engine
41
+
42
+ Invoke the Workflow tool:
43
+
44
+ ```
45
+ Workflow({ name: 'dev-story', args: { story: '<path-or-key, or omit for next ready-for-dev>' } })
46
+ ```
47
+
48
+ The script runs the red-green-refactor loop with a real 3-cycle convergence
49
+ counter (`lib/native-loop.js` `convergenceGuard`) and returns a structured
50
+ verdict:
51
+
52
+ ```json
53
+ { "workflow": "dev-story", "story": "...",
54
+ "status": "review-ready | aborted-no-convergence | in-progress",
55
+ "green": true, "cycles": 2, "maxCycles": 3, "blocking": [],
56
+ "reason": "green", "needsHumanGate": true }
57
+ ```
58
+
59
+ ### 4. HUMAN GATE (mandatory - do not skip)
60
+
61
+ Present the verdict to the user and HALT for a decision. Do not auto-advance.
62
+
63
+ - `status: review-ready` (green) - summarize cycles + files touched; ask the
64
+ user to approve moving the story to **review**. Only on approval, record the
65
+ transition via MCP, then stop.
66
+ - `status: aborted-no-convergence` - the engine hit the 3-cycle cap without
67
+ green. Surface the `blocking` issues verbatim. Propose REFACTOR (targeted
68
+ fixes, re-run) or, if mis-scoped, a return to PRUNE. Leave the story not-done.
69
+ - `status: in-progress` - report remaining work; ask whether to continue.
70
+
71
+ ### 5. Record state via MCP (only after the gate)
72
+
73
+ After the user decides, record the outcome through `byan_fd_*` / `byan_strict_*`
74
+ so the audit trail stays in the MCP authority. State files are mutated through
75
+ the MCP tools, not by direct edit.
76
+
77
+ ## Invariants
78
+
79
+ - The script returns data; THIS skill owns completion and state. (Enforcement
80
+ contract: see `docs/native-workflows-contract.md`.)
81
+ - The human gate stays on a real main-thread turn, outside the script.
82
+ - Dual-path: native `.js` preferred, markdown fallback. No silent downgrade.
83
+ - No emoji in outputs (IA-23).
@@ -0,0 +1,35 @@
1
+ # BYAN Native Workflows
2
+
3
+ > Registre des workflows portables vers l'outil Workflow natif de Claude Code.
4
+ > Genere automatiquement — ne pas editer a la main. Source : `_byan/_config/workflow-manifest.csv`.
5
+ > Regenerer : `node _byan/mcp/byan-mcp-server/bin/byan-build-workflows.js`.
6
+ >
7
+ > Resolution dual-path : le skill prefere `.claude/workflows/<name>.js` s'il existe,
8
+ > sinon il retombe sur le workflow markdown du manifest. Les workflows gated (a gate
9
+ > humain par etape) restent markdown interprete — ils ne sont pas portables.
10
+
11
+ ## autonomous (11)
12
+
13
+ - `create-story` — native — source `_byan/workflow/simple/4-implementation/create-story/workflow.yaml`
14
+ - `dev-story` — native — source `_byan/workflow/simple/4-implementation/dev-story/workflow.yaml`
15
+ - `qa-automate` — native — source `_byan/workflow/simple/qa/automate/workflow.yaml`
16
+ - `testarch-atdd` — native — source `_byan/workflow/simple/testarch/atdd/workflow.yaml`
17
+ - `testarch-automate` — native — source `_byan/workflow/simple/testarch/automate/workflow.yaml`
18
+ - `testarch-ci` — native — source `_byan/workflow/simple/testarch/ci/workflow.yaml`
19
+ - `testarch-framework` — native — source `_byan/workflow/simple/testarch/framework/workflow.yaml`
20
+ - `testarch-nfr` — native — source `_byan/workflow/simple/testarch/nfr-assess/workflow.yaml`
21
+ - `testarch-test-design` — native — source `_byan/workflow/simple/testarch/test-design/workflow.yaml`
22
+ - `testarch-test-review` — native — source `_byan/workflow/simple/testarch/test-review/workflow.yaml`
23
+ - `testarch-trace` — native — source `_byan/workflow/simple/testarch/trace/workflow.yaml`
24
+
25
+ ## pipeline (9)
26
+
27
+ - `check-implementation-readiness` — native — source `_byan/workflow/simple/3-solutioning/check-implementation-readiness/workflow.md`
28
+ - `code-review` — native — source `_byan/workflow/simple/4-implementation/code-review/workflow.yaml`
29
+ - `create-excalidraw-dataflow` — native — source `_byan/workflow/simple/excalidraw-diagrams/create-dataflow/workflow.yaml`
30
+ - `create-excalidraw-diagram` — native — source `_byan/workflow/simple/excalidraw-diagrams/create-diagram/workflow.yaml`
31
+ - `create-excalidraw-flowchart` — native — source `_byan/workflow/simple/excalidraw-diagrams/create-flowchart/workflow.yaml`
32
+ - `create-excalidraw-wireframe` — native — source `_byan/workflow/simple/excalidraw-diagrams/create-wireframe/workflow.yaml`
33
+ - `document-project` — native — source `_byan/workflow/simple/document-project/workflow.yaml`
34
+ - `quick-dev` — native — source `_byan/workflow/simple/bmad-quick-flow/quick-dev/workflow.md`
35
+ - `sprint-planning` — native — source `_byan/workflow/simple/4-implementation/sprint-planning/workflow.yaml`