@kaddo/cli 3.7.1 → 3.8.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 (2) hide show
  1. package/dist/index.js +323 -24
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
+ import { createRequire } from "module";
4
5
  import { Command } from "commander";
5
6
 
6
7
  // src/commands/init.ts
@@ -1374,6 +1375,220 @@ var guardAdvancedModule = {
1374
1375
  ]
1375
1376
  };
1376
1377
 
1378
+ // src/agents/responsibility.ts
1379
+ var RESPONSIBILITY_MATRIX = {
1380
+ "business-agent": {
1381
+ agent: "business-agent",
1382
+ responsibleFor: ["Problem", "Users", "Rules", "Constraints"],
1383
+ produces: ["knowledge/business/business.md"],
1384
+ canSuggest: ["product-agent"],
1385
+ cannotSuggest: ["Git", "branches", "commits", "code"],
1386
+ next: ["product-agent"]
1387
+ },
1388
+ "product-agent": {
1389
+ agent: "product-agent",
1390
+ responsibleFor: ["Product", "Capabilities", "Scope"],
1391
+ produces: ["knowledge/product/product.md", "knowledge/product/capabilities.md"],
1392
+ canSuggest: ["roadmap-agent"],
1393
+ cannotSuggest: ["Git", "implementation", "branches", "code"],
1394
+ next: ["roadmap-agent"]
1395
+ },
1396
+ "capability-agent": {
1397
+ agent: "capability-agent",
1398
+ responsibleFor: ["Capabilities"],
1399
+ produces: ["knowledge/product/capabilities.md"],
1400
+ canSuggest: ["roadmap-agent"],
1401
+ cannotSuggest: ["Git", "implementation", "branches", "code"],
1402
+ next: ["roadmap-agent"]
1403
+ },
1404
+ "bootstrap-agent": {
1405
+ agent: "bootstrap-agent",
1406
+ responsibleFor: ["Initial direction", "Capabilities", "Quality attributes", "Roadmap seed"],
1407
+ produces: [
1408
+ "knowledge/bootstrap-summary.md",
1409
+ "knowledge/product/capabilities.md",
1410
+ "knowledge/delivery/roadmap.md"
1411
+ ],
1412
+ canSuggest: ["capability-agent", "architecture-agent", "roadmap-agent"],
1413
+ cannotSuggest: ["Git", "branches", "commits", "code"],
1414
+ next: ["capability-agent", "architecture-agent"]
1415
+ },
1416
+ "codebase-agent": {
1417
+ agent: "codebase-agent",
1418
+ responsibleFor: ["Stack", "Structure", "Standards"],
1419
+ produces: ["knowledge/tech/codebase.md"],
1420
+ canSuggest: ["architecture-agent", "decision-agent"],
1421
+ cannotSuggest: ["Git", "branches", "commits", "production code"],
1422
+ next: ["architecture-agent"]
1423
+ },
1424
+ "stack-agent": {
1425
+ agent: "stack-agent",
1426
+ responsibleFor: ["Technologies", "Stack classification"],
1427
+ produces: ["knowledge/tech/stack.md"],
1428
+ canSuggest: ["architecture-agent", "standards-agent"],
1429
+ cannotSuggest: ["Git", "branches", "code"],
1430
+ next: ["architecture-agent"]
1431
+ },
1432
+ "standards-agent": {
1433
+ agent: "standards-agent",
1434
+ responsibleFor: ["Coding/doc/testing standards"],
1435
+ produces: ["knowledge/tech/standards.md"],
1436
+ canSuggest: ["architecture-agent"],
1437
+ cannotSuggest: ["Git", "branches", "code"],
1438
+ next: ["architecture-agent"]
1439
+ },
1440
+ "security-agent": {
1441
+ agent: "security-agent",
1442
+ responsibleFor: ["Security considerations"],
1443
+ produces: ["knowledge/tech/security.md"],
1444
+ canSuggest: ["architecture-agent", "decision-agent"],
1445
+ cannotSuggest: ["Git", "branches", "code", "vulnerability scanning"],
1446
+ next: ["architecture-agent"]
1447
+ },
1448
+ "module-design-agent": {
1449
+ agent: "module-design-agent",
1450
+ responsibleFor: ["Module design", "Boundaries"],
1451
+ produces: ["knowledge/tech/modules/<module>/module-design.md"],
1452
+ canSuggest: ["architecture-agent", "decision-agent"],
1453
+ cannotSuggest: ["Git", "branches", "code"],
1454
+ next: ["architecture-agent"]
1455
+ },
1456
+ "architecture-agent": {
1457
+ agent: "architecture-agent",
1458
+ responsibleFor: ["Architecture", "Technical state", "Risks"],
1459
+ produces: ["knowledge/tech/current-state.md"],
1460
+ canSuggest: ["decision-agent", "roadmap-agent"],
1461
+ cannotSuggest: ["Git", "branches", "commits", "code"],
1462
+ next: ["decision-agent", "roadmap-agent"]
1463
+ },
1464
+ "decision-agent": {
1465
+ agent: "decision-agent",
1466
+ responsibleFor: ["ADRs"],
1467
+ produces: ["knowledge/tech/decisions/"],
1468
+ canSuggest: ["implementation-agent"],
1469
+ cannotSuggest: ["Git", "branches", "commits", "code"],
1470
+ next: ["implementation-agent"]
1471
+ },
1472
+ // The shipped prompt file is `adr-agent.md`; it plays the decision-agent role.
1473
+ "adr-agent": {
1474
+ agent: "adr-agent",
1475
+ responsibleFor: ["ADRs", "Decision candidates"],
1476
+ produces: ["knowledge/tech/decision-candidates.md", "knowledge/tech/decisions/"],
1477
+ canSuggest: ["implementation-agent"],
1478
+ cannotSuggest: ["Git", "branches", "commits", "code"],
1479
+ next: ["implementation-agent"]
1480
+ },
1481
+ "roadmap-agent": {
1482
+ agent: "roadmap-agent",
1483
+ responsibleFor: ["Roadmap", "Initiatives", "Work Item candidates"],
1484
+ produces: ["knowledge/delivery/roadmap.md"],
1485
+ canSuggest: ["kaddo create --from roadmap", "work-item-agent"],
1486
+ cannotSuggest: ["branches", "commits", "pull requests", "code"],
1487
+ next: ["kaddo create --from roadmap", "work-item-agent"]
1488
+ },
1489
+ "work-item-agent": {
1490
+ agent: "work-item-agent",
1491
+ responsibleFor: ["Work Item refinement"],
1492
+ produces: ["knowledge/delivery/work-items/"],
1493
+ canSuggest: ["implementation-agent"],
1494
+ cannotSuggest: ["branches", "commits", "pull requests", "code"],
1495
+ next: ["implementation-agent"]
1496
+ },
1497
+ "implementation-agent": {
1498
+ agent: "implementation-agent",
1499
+ responsibleFor: ["Implementation"],
1500
+ produces: ["Code", "Tests", "Migrations"],
1501
+ // The ONLY agent allowed to suggest branches — and only respecting the Git strategy.
1502
+ canSuggest: [
1503
+ "a branch (per knowledge/tech/git-strategy.md / .kaddo/git.yml)",
1504
+ "kaddo scan",
1505
+ "kaddo owners suggest",
1506
+ "kaddo guard"
1507
+ ],
1508
+ cannotSuggest: [
1509
+ "running git itself",
1510
+ "committing without human confirmation",
1511
+ "pushing or merging"
1512
+ ],
1513
+ next: ["kaddo scan", "kaddo owners suggest", "kaddo guard", "kaddo explain"]
1514
+ },
1515
+ "guard-agent": {
1516
+ agent: "guard-agent",
1517
+ responsibleFor: ["Knowledge drift"],
1518
+ produces: ["Findings", "Warnings"],
1519
+ canSuggest: ["update knowledge", "update ownership"],
1520
+ cannotSuggest: ["branches", "commits", "code"],
1521
+ next: ["update knowledge", "kaddo owners suggest"]
1522
+ },
1523
+ "git-strategy-agent": {
1524
+ agent: "git-strategy-agent",
1525
+ responsibleFor: ["Branch/commit/tag/release strategy (documentation)"],
1526
+ produces: ["knowledge/tech/git-strategy.md"],
1527
+ canSuggest: ["implementation-agent"],
1528
+ // It documents a strategy; it never creates branches/commits itself.
1529
+ cannotSuggest: ["creating branches", "creating commits", "creating tags"],
1530
+ next: ["implementation-agent"]
1531
+ },
1532
+ "legacy-agent": {
1533
+ agent: "legacy-agent",
1534
+ responsibleFor: ["Risks", "Unknowns", "Safe first steps"],
1535
+ produces: ["knowledge/legacy/risks.md", "knowledge/legacy/unknowns.md"],
1536
+ canSuggest: ["architecture-agent", "capability-agent"],
1537
+ cannotSuggest: ["Git", "branches", "code", "large rewrites"],
1538
+ next: ["architecture-agent"]
1539
+ }
1540
+ };
1541
+ function list(items) {
1542
+ return items.length > 0 ? items.join(", ") : "\u2014";
1543
+ }
1544
+ function renderAgentBoundaries(agent) {
1545
+ const r = RESPONSIBILITY_MATRIX[agent];
1546
+ if (!r) return "";
1547
+ return [
1548
+ "## Responsibility & Boundaries",
1549
+ "",
1550
+ `**Responsible for:** ${list(r.responsibleFor)}`,
1551
+ `**Produces:** ${list(r.produces)}`,
1552
+ `**May suggest:** ${list(r.canSuggest)}`,
1553
+ `**Must NOT suggest:** ${list(r.cannotSuggest)}`,
1554
+ "",
1555
+ "This agent produces **knowledge only**. It never runs Git, never runs code and never runs commands. It may only suggest actions inside its own responsibility.",
1556
+ ""
1557
+ ].join("\n");
1558
+ }
1559
+ function renderAgentTrace(agent) {
1560
+ const r = RESPONSIBILITY_MATRIX[agent];
1561
+ if (!r) return "";
1562
+ const produced = r.produces.length > 0 ? r.produces.join("\n") : "(none)";
1563
+ const next = r.next.length > 0 ? r.next.join("\n") : "(end of flow)";
1564
+ return [
1565
+ "## Agent Trace",
1566
+ "",
1567
+ "End **every** response with this trace block so the flow stays auditable:",
1568
+ "",
1569
+ "```text",
1570
+ "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",
1571
+ `Agent: ${r.agent}`,
1572
+ "",
1573
+ "Produced:",
1574
+ produced,
1575
+ "",
1576
+ "Next:",
1577
+ next,
1578
+ "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",
1579
+ "```",
1580
+ ""
1581
+ ].join("\n");
1582
+ }
1583
+ function withResponsibilityTrace(fileName, content) {
1584
+ const agent = fileName.replace(/\.md$/, "");
1585
+ if (!RESPONSIBILITY_MATRIX[agent]) return content;
1586
+ return `${content.trimEnd()}
1587
+
1588
+ ${renderAgentBoundaries(agent)}
1589
+ ${renderAgentTrace(agent)}`;
1590
+ }
1591
+
1377
1592
  // src/agents/prompts.ts
1378
1593
  var CAPABILITY_AGENT = `# Capability Agent
1379
1594
 
@@ -1633,6 +1848,9 @@ Adapt priorities to the project state from the context pack:
1633
1848
 
1634
1849
  - Do not invent business priorities or business facts \u2014 mark them as assumptions when inferred.
1635
1850
  - Do not write code or implementation details.
1851
+ - **Do not suggest branches, commits or pull requests.** Git and implementation belong to the
1852
+ implementation-agent, and only after Work Items are materialized. Your handoff is
1853
+ \`kaddo create --from roadmap\` \u2192 work-item-agent.
1636
1854
  - Do not create the work items themselves; only propose candidates.
1637
1855
  - Make clear that initiatives and work items are **candidates**, not final decisions.
1638
1856
  - Mark any uncertain information as an assumption or open question.
@@ -1959,23 +2177,12 @@ Save new output as a draft under \`knowledge/delivery/work-items/draft/\` unless
1959
2177
  explicitly asks for another lifecycle state. Treat only \`draft\`, \`ready\`, \`in-progress\`
1960
2178
  and \`blocked\` as active work; \`completed\` and \`archived\` are historical knowledge.
1961
2179
 
1962
- ## Delivery workflow
2180
+ ## Handoff
1963
2181
 
1964
- When this Work Item is **implemented** (by you or the coding agent), follow the project's
1965
- delivery protocol. **Never run git mutating commands without the human's confirmation.**
1966
-
1967
- 1. **Branch first.** Before changing any code, create a branch following the project's Git
1968
- strategy (\`.kaddo/git.yml\` \u2192 \`branchNaming.pattern\`, default
1969
- \`feature/<work-item-id>-<slug>\`; also \`bugfix/\`, \`hotfix/\`, \`spike/\`). This keeps work
1970
- off the default branch so nothing lands on \`main\` by accident.
1971
- 2. Implement the change.
1972
- 3. Run \`kaddo scan\` after adding modules, migrations, contracts or significant structure.
1973
- 4. Run \`kaddo owners suggest\` and confirm the \`code:\` globs.
1974
- 5. Run \`kaddo guard\` before committing to detect possible knowledge drift.
1975
- 6. Update the affected knowledge (ADR / capabilities.md / current-state.md).
1976
- 7. **Commit only with explicit human confirmation.** Never commit, push or merge on your
1977
- own \u2014 suggest a Conventional Commit message and wait for the human. The Kaddo CLI itself
1978
- never touches git.
2182
+ When the Work Item is refined and ready to build, **hand off to the implementation-agent**.
2183
+ You do **not** suggest branches, commits or pull requests \u2014 implementation (including any Git
2184
+ branch suggestion) is the implementation-agent's responsibility, and only by respecting the
2185
+ project Git strategy. Your job ends at a clear, traceable Work Item.
1979
2186
 
1980
2187
  ## Quality Checklist
1981
2188
 
@@ -1983,8 +2190,9 @@ delivery protocol. **Never run git mutating commands without the human's confirm
1983
2190
  - Large candidates are split.
1984
2191
  - Knowledge Level is justified.
1985
2192
  - Acceptance criteria are testable.
2193
+ - Out of scope and Validation are stated.
1986
2194
  - Open questions are explicit.
1987
- - Delivery: branch first, commit only with human confirmation.
2195
+ - Handoff: next step is the implementation-agent (never a branch or commit).
1988
2196
  `;
1989
2197
  var GIT_STRATEGY_AGENT = `# Git Strategy Agent
1990
2198
 
@@ -2497,6 +2705,82 @@ Save as \`knowledge/tech/codebase.md\`.
2497
2705
  - Minimum criteria to start development are explicit.
2498
2706
  - Assumptions and open questions are listed.
2499
2707
  `;
2708
+ var IMPLEMENTATION_AGENT = `# Implementation Agent
2709
+
2710
+ ## Role
2711
+
2712
+ You are the Kaddo Implementation Agent. Your job is to implement a refined Work Item \u2014 code,
2713
+ tests and migrations \u2014 and keep the project knowledge in sync. You are the **only** agent that
2714
+ may suggest a Git branch, and only by respecting the project's Git strategy.
2715
+
2716
+ You never run Git yourself. The Kaddo CLI never runs Git either. Every git action is the
2717
+ human's, and commits/pushes/merges happen only with explicit human confirmation.
2718
+
2719
+ ## When to Use
2720
+
2721
+ Use this agent after the work-item-agent has produced a clear, traceable Work Item under
2722
+ \`knowledge/delivery/work-items/\` (typically in \`ready/\`).
2723
+
2724
+ ## Input Required
2725
+
2726
+ Provide \`.kaddo/context-pack.md\`, the Work Item to implement, and the Git strategy
2727
+ (\`knowledge/tech/git-strategy.md\` / \`.kaddo/git.yml\`) if it exists.
2728
+
2729
+ ## Expected Output
2730
+
2731
+ Working code, tests and migrations, plus updated knowledge (ADR / capabilities / current-state)
2732
+ when the change affects them. You also produce a suggested branch name and a suggested
2733
+ Conventional Commit message \u2014 as suggestions, never executed.
2734
+
2735
+ ## Instructions
2736
+
2737
+ 1. **Suggest a branch first** (do not run it). Follow the Git strategy
2738
+ (\`.kaddo/git.yml\` \u2192 \`branchNaming.pattern\`, default \`feature/<work-item-id>-<slug>\`;
2739
+ also \`bugfix/\`, \`hotfix/\`, \`spike/\`). If no strategy exists, suggest the default and say so.
2740
+ 2. Implement the change with tests.
2741
+ 3. Suggest running \`kaddo scan\` after adding modules, migrations, contracts or significant
2742
+ structure.
2743
+ 4. Suggest running \`kaddo owners suggest\` and confirm the \`code:\` globs.
2744
+ 5. Suggest running \`kaddo guard\` before committing to detect knowledge drift.
2745
+ 6. Update affected knowledge (ADR / capabilities.md / current-state.md).
2746
+ 7. Suggest a Conventional Commit message and **wait for explicit human confirmation**. Never
2747
+ commit, push or merge on your own.
2748
+
2749
+ ## Constraints
2750
+
2751
+ - Never run Git. Never commit, push or merge \u2014 suggest and wait for the human.
2752
+ - Respect \`knowledge/tech/git-strategy.md\` when it exists.
2753
+ - Keep knowledge in sync with the code you change.
2754
+ - Do not invent business facts.
2755
+
2756
+ ## Output Format
2757
+
2758
+ \`\`\`markdown
2759
+ # Implementation Plan \u2014 <Work Item id>
2760
+
2761
+ ## Suggested branch
2762
+
2763
+ ## Changes
2764
+
2765
+ ## Tests
2766
+
2767
+ ## Knowledge to update
2768
+
2769
+ ## Suggested commit (await human confirmation)
2770
+ \`\`\`
2771
+
2772
+ ## Where to Save the Result
2773
+
2774
+ Code, tests and migrations live in the repository. Knowledge updates go under \`knowledge/\`.
2775
+
2776
+ ## Quality Checklist
2777
+
2778
+ - A branch is suggested per the Git strategy (never executed).
2779
+ - Tests accompany the change.
2780
+ - \`kaddo scan\` / \`owners suggest\` / \`guard\` are suggested at the right moments.
2781
+ - Affected knowledge is updated.
2782
+ - Commit is suggested and awaits human confirmation \u2014 never run automatically.
2783
+ `;
2500
2784
  var AGENT_PROMPTS = [
2501
2785
  { fileName: "capability-agent.md", content: CAPABILITY_AGENT },
2502
2786
  { fileName: "architecture-agent.md", content: ARCHITECTURE_AGENT },
@@ -2512,8 +2796,11 @@ var AGENT_PROMPTS = [
2512
2796
  // Bootstrap agents (new projects)
2513
2797
  { fileName: "business-agent.md", content: BUSINESS_AGENT },
2514
2798
  { fileName: "bootstrap-agent.md", content: BOOTSTRAP_AGENT },
2515
- { fileName: "codebase-agent.md", content: CODEBASE_FOUNDATION_AGENT }
2516
- ];
2799
+ { fileName: "codebase-agent.md", content: CODEBASE_FOUNDATION_AGENT },
2800
+ // Implementation (the only agent that may suggest a branch — VS-044)
2801
+ { fileName: "implementation-agent.md", content: IMPLEMENTATION_AGENT }
2802
+ // Every official prompt ends with its responsibility boundaries + Agent Trace footer.
2803
+ ].map((p2) => ({ fileName: p2.fileName, content: withResponsibilityTrace(p2.fileName, p2.content) }));
2517
2804
 
2518
2805
  // src/agents/groups.ts
2519
2806
  var AGENT_GROUPS = {
@@ -2528,7 +2815,12 @@ var AGENT_GROUPS = {
2528
2815
  "module-design-agent.md",
2529
2816
  "adr-agent.md"
2530
2817
  ],
2531
- delivery: ["roadmap-agent.md", "work-item-agent.md", "git-strategy-agent.md"],
2818
+ delivery: [
2819
+ "roadmap-agent.md",
2820
+ "work-item-agent.md",
2821
+ "implementation-agent.md",
2822
+ "git-strategy-agent.md"
2823
+ ],
2532
2824
  utilities: ["legacy-agent.md"]
2533
2825
  };
2534
2826
  var AGENT_GROUP_NAMES = Object.keys(AGENT_GROUPS);
@@ -2550,20 +2842,23 @@ var RECOMMENDED_BY_STATE = {
2550
2842
  "codebase-agent.md",
2551
2843
  "roadmap-agent.md",
2552
2844
  "work-item-agent.md",
2845
+ "implementation-agent.md",
2553
2846
  "adr-agent.md"
2554
2847
  ],
2555
2848
  "pre-ai": [
2556
2849
  "capability-agent.md",
2557
2850
  "architecture-agent.md",
2558
2851
  "roadmap-agent.md",
2559
- "work-item-agent.md"
2852
+ "work-item-agent.md",
2853
+ "implementation-agent.md"
2560
2854
  ],
2561
2855
  legacy: [
2562
2856
  "legacy-agent.md",
2563
2857
  "architecture-agent.md",
2564
2858
  "capability-agent.md",
2565
2859
  "roadmap-agent.md",
2566
- "work-item-agent.md"
2860
+ "work-item-agent.md",
2861
+ "implementation-agent.md"
2567
2862
  ]
2568
2863
  };
2569
2864
  function recommendedAgents(state) {
@@ -5695,7 +5990,9 @@ function runUnderstand() {
5695
5990
  ],
5696
5991
  delivery: [
5697
5992
  "Use roadmap-agent \u2192 knowledge/delivery/roadmap.md",
5698
- "Run `kaddo create --from roadmap`, then `kaddo owners suggest`"
5993
+ "Run `kaddo create --from roadmap` (candidates \u2192 Work Items)",
5994
+ "Use work-item-agent \u2192 refine into knowledge/delivery/work-items/",
5995
+ "Use implementation-agent \u2192 implement, then `kaddo scan`, `kaddo owners suggest`, `kaddo guard`"
5699
5996
  ],
5700
5997
  utilities: ["Use legacy-agent to surface risks and unknowns"]
5701
5998
  };
@@ -8435,8 +8732,10 @@ async function runBootstrap(dir = cwd()) {
8435
8732
  }
8436
8733
 
8437
8734
  // src/index.ts
8735
+ var require2 = createRequire(import.meta.url);
8736
+ var { version } = require2("../package.json");
8438
8737
  var program = new Command();
8439
- program.name("kaddo").description("Knowledge Driven Development toolkit").version("3.6.0");
8738
+ program.name("kaddo").description("Knowledge Driven Development toolkit").version(version);
8440
8739
  program.command("init").description("Initialize Kaddo in the current project").action(async () => {
8441
8740
  await runInit();
8442
8741
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaddo/cli",
3
- "version": "3.7.1",
3
+ "version": "3.8.0",
4
4
  "description": "Knowledge Driven Development toolkit",
5
5
  "license": "MIT",
6
6
  "repository": {