create-byan-agent 2.19.1 → 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 (52) hide show
  1. package/CHANGELOG.md +188 -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
  50. package/update-byan-agent/bin/update-byan-agent.js +67 -72
  51. package/update-byan-agent/lib/apply-update.js +202 -0
  52. package/update-byan-agent/package.json +1 -1
@@ -0,0 +1,84 @@
1
+ # Native Workflows — Contract (Phase 1)
2
+
3
+ > How BYAN workflows run on Claude Code's native Workflow tool, and the rules a
4
+ > native workflow script must respect. Phase 1 of the native-workflow bridge.
5
+
6
+ ## The two execution models
7
+
8
+ | | BYAN markdown/YAML workflow | Native (in-CLI Workflow tool) |
9
+ |---|---|---|
10
+ | Engine | the LLM interprets step files | a deterministic JS script |
11
+ | Human gate | a menu/HALT per step | none in-run (autonomous once launched) |
12
+ | Enforcement hooks | fire on the main-thread turn | do not fire inside the script |
13
+
14
+ A launched Workflow script is autonomous and runs OUTSIDE the conversation turn.
15
+ It cannot pause mid-run to ask a human, and the BYAN main-thread hooks
16
+ (`fd-phase-guard`, `strict-scope-guard`, `strict-stop-guard`, `mantra-validate`)
17
+ do not fire for work done inside it. That single fact drives the whole contract.
18
+
19
+ ## What is portable, and what is not
20
+
21
+ Only workflows whose steps run WITHOUT a per-step human gate are portable. The
22
+ read-based classification of the 45-workflow manifest gives three buckets
23
+ (source of truth: `_byan/mcp/byan-mcp-server/lib/workflows-generator.js`):
24
+
25
+ - **autonomous** (11) — `dev-story`, `create-story`, `qa-automate`, the 8
26
+ `testarch-*`. Run to completion with only error HALTs.
27
+ - **pipeline** (9) — `sprint-planning`, `code-review`, `document-project`,
28
+ `check-implementation-readiness`, `quick-dev`, the 4 `create-excalidraw-*`.
29
+ Deterministic multi-stage, minimal interaction.
30
+ - **gated** (25) — the `create-*` authoring flows, the CIS coaching workflows,
31
+ `party-mode`, the builders, etc. Their defining feature is a human menu per
32
+ step, so they stay LLM-interpreted markdown. They are out of scope for a
33
+ native port.
34
+
35
+ The registry of portable workflows is generated into `.claude/workflows/INDEX.md`
36
+ by `byan-build-workflows` (run: `node _byan/mcp/byan-mcp-server/bin/byan-build-workflows.js`).
37
+
38
+ ## Dual-path resolution
39
+
40
+ `resolveWorkflow(name)` prefers the native script `.claude/workflows/<name>.js`
41
+ when it exists, and otherwise falls back to the markdown workflow path from the
42
+ manifest. This is the same Gen3-first dual-path idea used for agent stubs:
43
+ adding a native script is additive, and removing it falls back cleanly.
44
+
45
+ ## The Hybrid rule — gate outside, engine inside
46
+
47
+ The gated parts of a workflow stay in a skill on a real main-thread turn (where
48
+ the hooks fire); only the autonomous work runs inside the native script.
49
+
50
+ - The script returns DATA (a structured verdict). It does not decide completion.
51
+ - The orchestrating skill (e.g. `byan-native-dev-story`) owns the human gate and
52
+ records FD/strict state via the MCP tools.
53
+
54
+ ## The state-coupling rule (enforced)
55
+
56
+ A native workflow script must respect:
57
+
58
+ 1. It returns data; it does not mutate BYAN platform state on its own.
59
+ 2. FD and strict state are mutated only through the `byan_fd_*` / `byan_strict_*`
60
+ MCP tools. Importing or requiring `lib/fd-state.js` (or the `strict-mode` lib)
61
+ from a script is forbidden, and a direct write to `fd-state.json` /
62
+ `.byan-strict/` is out of bounds.
63
+ 3. The story file (or any workflow artifact) the script produces is fine to
64
+ write — that is the product, not platform state.
65
+
66
+ This rule is enforced two ways, because the in-session hooks do not fire inside
67
+ a script:
68
+
69
+ - **`byan-lint-workflows`** (`node _byan/mcp/byan-mcp-server/bin/byan-lint-workflows.js`)
70
+ scans `.claude/workflows/*.js` and fails on a forbidden import/require.
71
+ - **the pre-commit gate** (`.githooks/pre-commit`) runs that linter, so a
72
+ coupling violation blocks the commit. Bypass is `git commit --no-verify`
73
+ (emergency only).
74
+
75
+ Because a script cannot rely on the hooks, it should also re-assert the contract
76
+ inline (a comment block naming this file) so the next reader sees the rule.
77
+
78
+ ## Resume safety
79
+
80
+ The Workflow runtime forbids wall-clock and RNG calls inside a script (they
81
+ break runId resume). Timestamps and ids are passed in via `args`. Helper logic
82
+ that needs testing lives in a lib module (e.g.
83
+ `_byan/mcp/byan-mcp-server/lib/native-loop.js`) and is mirrored inline in the
84
+ script, since the sandbox forbids `import` inside a script.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-byan-agent",
3
- "version": "2.19.1",
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 (Copilot CLI, Claude Code, Codex). Merise Agile + TDD + 64 Mantras. ~54% LLM cost savings.",
3
+ "version": "2.20.0",
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 (Copilot CLI, 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",
@@ -0,0 +1,46 @@
1
+ {
2
+ "version": "1.1.0",
3
+ "note": "Per-agent mantra scope map for domain-aware validation. resolveAgentScopes() precedence: explicit frontmatter mantra_scopes > agentScopes[name] > moduleScopes[module] > fallback [universal]. The 'universal' scope is force-unioned at every level so it is never dropped. v1.1 adds 'sdlc-ops' (release/deploy split from sdlc-code) and 'creative' (the CIS family). Edit this file to retune which mantra families a persona is scored against.",
4
+ "scopeNames": ["universal", "sdlc-process", "sdlc-code", "sdlc-ops", "sdlc-modeling", "sdlc-test", "creative"],
5
+ "moduleScopes": {
6
+ "bmm": ["universal", "sdlc-process", "sdlc-code", "sdlc-modeling", "sdlc-test"],
7
+ "cis": ["universal", "creative"],
8
+ "tea": ["universal", "sdlc-test", "sdlc-process"],
9
+ "bmb": ["universal", "sdlc-process", "sdlc-code", "sdlc-modeling", "sdlc-test"],
10
+ "core": ["universal", "sdlc-process"]
11
+ },
12
+ "agentScopes": {
13
+ "analyst": ["universal", "sdlc-process", "sdlc-modeling"],
14
+ "architect": ["universal", "sdlc-modeling", "sdlc-code", "sdlc-process"],
15
+ "dev": ["universal", "sdlc-code", "sdlc-test"],
16
+ "pm": ["universal", "sdlc-process"],
17
+ "sm": ["universal", "sdlc-process"],
18
+ "quinn": ["universal", "sdlc-test"],
19
+ "tech-writer": ["universal", "sdlc-code"],
20
+ "ux-designer": ["universal", "sdlc-process"],
21
+ "quick-flow-solo-dev": ["universal", "sdlc-code", "sdlc-test"],
22
+ "expert-merise-agile": ["universal", "sdlc-modeling", "sdlc-process"],
23
+ "tea": ["universal", "sdlc-test", "sdlc-process"],
24
+ "hermes": ["universal"],
25
+ "bmad-master": ["universal", "sdlc-process"],
26
+ "yanstaller": ["universal", "sdlc-code", "sdlc-ops"],
27
+ "fact-checker": ["universal"],
28
+ "byan": ["universal", "sdlc-process", "sdlc-code", "sdlc-modeling", "sdlc-test"],
29
+ "agent-builder": ["universal", "sdlc-process", "sdlc-code"],
30
+ "module-builder": ["universal", "sdlc-process", "sdlc-code"],
31
+ "workflow-builder": ["universal", "sdlc-process", "sdlc-code"],
32
+ "marc": ["universal", "sdlc-code", "sdlc-ops"],
33
+ "rachid": ["universal", "sdlc-code", "sdlc-ops"],
34
+ "carmack": ["universal", "sdlc-code"],
35
+ "patnote": ["universal", "sdlc-code", "sdlc-ops"],
36
+ "codex": ["universal", "sdlc-code", "sdlc-ops"],
37
+ "claude": ["universal", "sdlc-code", "sdlc-ops"],
38
+ "drawio": ["universal", "sdlc-modeling"],
39
+ "brainstorming-coach": ["universal", "creative"],
40
+ "creative-problem-solver": ["universal", "creative"],
41
+ "design-thinking-coach": ["universal", "creative"],
42
+ "innovation-strategist": ["universal", "creative"],
43
+ "presentation-master": ["universal", "creative"],
44
+ "storyteller": ["universal", "creative"]
45
+ }
46
+ }