agentblueprint 0.7.15 → 0.7.19

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 (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +16 -1
  3. package/dist/__tests__/cli.test.js +2 -0
  4. package/dist/__tests__/cli.test.js.map +1 -1
  5. package/dist/__tests__/generation-client.test.d.ts +1 -0
  6. package/dist/__tests__/generation-client.test.js +96 -0
  7. package/dist/__tests__/generation-client.test.js.map +1 -0
  8. package/dist/__tests__/generation-tools.test.d.ts +1 -0
  9. package/dist/__tests__/generation-tools.test.js +168 -0
  10. package/dist/__tests__/generation-tools.test.js.map +1 -0
  11. package/dist/__tests__/handoff.test.d.ts +1 -0
  12. package/dist/__tests__/handoff.test.js +58 -0
  13. package/dist/__tests__/handoff.test.js.map +1 -0
  14. package/dist/__tests__/renderers.test.js +122 -14
  15. package/dist/__tests__/renderers.test.js.map +1 -1
  16. package/dist/__tests__/tools.test.js +8 -2
  17. package/dist/__tests__/tools.test.js.map +1 -1
  18. package/dist/cli.js +66 -0
  19. package/dist/cli.js.map +1 -1
  20. package/dist/client.d.ts +79 -0
  21. package/dist/client.js +32 -19
  22. package/dist/client.js.map +1 -1
  23. package/dist/errors.d.ts +2 -1
  24. package/dist/errors.js +12 -1
  25. package/dist/errors.js.map +1 -1
  26. package/dist/fetch-blueprint.js +3 -2
  27. package/dist/fetch-blueprint.js.map +1 -1
  28. package/dist/handoff.d.ts +18 -0
  29. package/dist/handoff.js +97 -0
  30. package/dist/handoff.js.map +1 -0
  31. package/dist/renderers.js +422 -14
  32. package/dist/renderers.js.map +1 -1
  33. package/dist/server.js +40 -0
  34. package/dist/server.js.map +1 -1
  35. package/dist/tools/create-business-profile.d.ts +17 -0
  36. package/dist/tools/create-business-profile.js +28 -0
  37. package/dist/tools/create-business-profile.js.map +1 -0
  38. package/dist/tools/generate-blueprint.d.ts +21 -0
  39. package/dist/tools/generate-blueprint.js +25 -0
  40. package/dist/tools/generate-blueprint.js.map +1 -0
  41. package/dist/tools/generate-use-cases.d.ts +21 -0
  42. package/dist/tools/generate-use-cases.js +29 -0
  43. package/dist/tools/generate-use-cases.js.map +1 -0
  44. package/dist/tools/get-generation-status.d.ts +18 -0
  45. package/dist/tools/get-generation-status.js +41 -0
  46. package/dist/tools/get-generation-status.js.map +1 -0
  47. package/dist/tools/trigger-full-pipeline.d.ts +20 -0
  48. package/dist/tools/trigger-full-pipeline.js +24 -0
  49. package/dist/tools/trigger-full-pipeline.js.map +1 -0
  50. package/package.json +4 -3
package/dist/renderers.js CHANGED
@@ -60,6 +60,9 @@ function arr(val) {
60
60
  function rec(val) {
61
61
  return val && typeof val === 'object' && !Array.isArray(val) ? val : {};
62
62
  }
63
+ function jsonTemplate(value) {
64
+ return `${JSON.stringify(value, null, 2)}\n`;
65
+ }
63
66
  /** Returns string representation for numbers, passes through strings, '' otherwise */
64
67
  function numStr(val) {
65
68
  if (typeof val === 'number')
@@ -72,6 +75,24 @@ function numStr(val) {
72
75
  function isPlaceholder(val) {
73
76
  return ['—', '–', '-', 'N/A', 'n/a', 'TBD', 'null', 'undefined', 'none'].includes(val.trim());
74
77
  }
78
+ /** Checks if the business profile has minimal data (fewer than 3 meaningful fields populated) */
79
+ function isProfileSparse(bp) {
80
+ if (!bp)
81
+ return true;
82
+ const meaningfulFields = ['industry', 'size', 'revenue', 'description',
83
+ 'technologyProfile', 'organizationalCapabilities', 'businessOperations', 'constraintsProfile'];
84
+ const populated = meaningfulFields.filter(f => {
85
+ const val = bp[f];
86
+ if (!val)
87
+ return false;
88
+ if (typeof val === 'string' && val.trim() === '')
89
+ return false;
90
+ if (typeof val === 'object' && Object.keys(val).length === 0)
91
+ return false;
92
+ return true;
93
+ });
94
+ return populated.length < 3;
95
+ }
75
96
  /** Strips a trailing unit suffix to prevent double-units (e.g. "3.6 months" + " months") */
76
97
  function stripTrailingUnit(val, unit) {
77
98
  return val.replace(new RegExp(`\\s*${unit}\\s*$`, 'i'), '');
@@ -1553,14 +1574,38 @@ function buildGettingStartedReturnVisit(input) {
1553
1574
  if (input.vendorSkill) {
1554
1575
  lines.push(`The \`.claude/skills/${input.vendorSkill.skillName}/\` skill contains platform-specific`);
1555
1576
  lines.push('deployment guidance. Follow it for all platform-specific work.');
1577
+ lines.push('For new apps or first deployments, re-check its deployment-path decision');
1578
+ lines.push('gate before creating more records. Use direct record or API edits mainly');
1579
+ lines.push('for existing deployments, live tuning, or blocked packaging paths. If you');
1580
+ lines.push('choose a fallback, document the reason in blueprint-local `PROGRESS.md` before proceeding.');
1556
1581
  lines.push('');
1557
1582
  }
1558
- lines.push('For each agent:');
1559
- lines.push('1. Review the agent spec in `references/agent-specifications.md`');
1560
- lines.push('2. Build the agent with its tools and instructions');
1583
+ lines.push('deployment-path decision checkpoint: before creating new app records, prefer the');
1584
+ lines.push('platform\'s source-controlled or native packaging path when one is available.');
1585
+ lines.push('Direct record or API edits are best for existing deployments, live tuning,');
1586
+ lines.push('or blocked packaging paths. Document fallback reasons in blueprint-local `PROGRESS.md`.');
1587
+ lines.push('');
1588
+ lines.push('## Maintain the business profile and artifacts');
1589
+ lines.push('');
1590
+ lines.push('Markdown files are readable snapshots. MCP/CLI writes are the source of truth.');
1591
+ lines.push('When implementation reveals new profile facts or artifact corrections, update');
1592
+ lines.push('Agent Blueprint with a focused patch:');
1593
+ lines.push('');
1594
+ lines.push('1. Read the current markdown context in `references/` and `CURRENT-STATE.md`');
1595
+ lines.push('2. Fill in the matching template in `editable/*.json`');
1596
+ lines.push('3. Call the matching MCP write tool, such as `update_business_profile`,');
1597
+ lines.push(' `update_use_case`, `update_blueprint`, `update_business_case`, or');
1598
+ lines.push(' `update_implementation_plan`');
1599
+ lines.push('4. Re-download this export after staleness changes or recalculations');
1600
+ lines.push('');
1601
+ lines.push('See `references/artifact-editing.md` for the full workflow and tool mapping.');
1602
+ lines.push('');
1603
+ lines.push('For the next pilot slice or agent:');
1604
+ lines.push('1. Review the spec in `SKILL.md` and `references/agent-specifications.md`');
1605
+ lines.push('2. Build the smallest executable slice that proves a useful path');
1561
1606
  lines.push('3. Test and iterate until behavior matches the spec');
1562
- lines.push('4. Update `implementation-state.yaml` with status and platform artifact');
1563
- lines.push('5. Move to the next agent');
1607
+ lines.push('4. Update local `implementation-state.yaml` with status and platform artifact');
1608
+ lines.push('5. Ask before syncing demo/test state back to Agent Blueprint');
1564
1609
  lines.push('');
1565
1610
  // Step 4
1566
1611
  lines.push('## Step 4: Validate and measure');
@@ -1577,7 +1622,9 @@ function buildGettingStartedReturnVisit(input) {
1577
1622
  // Step 5
1578
1623
  lines.push('## Step 5: Sync your progress');
1579
1624
  lines.push('');
1580
- lines.push('After implementing each agent or making significant changes, sync immediately:');
1625
+ lines.push('After implementing each agent or making significant changes, update local');
1626
+ lines.push('`implementation-state.yaml`. In demo/test mode, ask the user before syncing');
1627
+ lines.push('state back to Agent Blueprint.');
1581
1628
  lines.push('');
1582
1629
  lines.push('**MCP tool** (preferred):');
1583
1630
  lines.push('');
@@ -1585,7 +1632,7 @@ function buildGettingStartedReturnVisit(input) {
1585
1632
  lines.push(` blueprintId: "${input.blueprintId}"`);
1586
1633
  lines.push(' stateData: <contents of implementation-state.yaml as JSON>');
1587
1634
  lines.push('');
1588
- lines.push('**CLI**:');
1635
+ lines.push('**CLI** (after user approval in demo/test mode):');
1589
1636
  lines.push('');
1590
1637
  lines.push(` agentblueprint sync --blueprint ${input.blueprintId}`);
1591
1638
  lines.push('');
@@ -1598,6 +1645,7 @@ function buildGettingStartedReturnVisit(input) {
1598
1645
  lines.push(' actualValue: "measured value"');
1599
1646
  lines.push('');
1600
1647
  lines.push('See `AGENTS.md` for trigger points, deviation rules, and full sync guidance.');
1648
+ lines.push('For demo/test implementations, ask before using MCP or CLI sync.');
1601
1649
  lines.push('');
1602
1650
  lines.push('**Claude Code users**: See `hooks/claude-code-sync.json` for a Stop hook that');
1603
1651
  lines.push('reminds you to sync when implementation-state.yaml has unsynced changes.');
@@ -1659,6 +1707,9 @@ function buildGettingStarted(input) {
1659
1707
  lines.push(' One fix, one alternative, then ask. Do not spiral.');
1660
1708
  lines.push('- **Verify before presenting.** Never give the user a URL, path, or command');
1661
1709
  lines.push(' you have not verified against the actual platform instance.');
1710
+ lines.push('- **Ask before high-impact actions.** Get explicit approval before running');
1711
+ lines.push(' background scripts, production writes, credential changes, cleanup/deletion,');
1712
+ lines.push(' or syncing demo/test state back to Agent Blueprint.');
1662
1713
  lines.push('');
1663
1714
  // Staleness warnings
1664
1715
  const staleWarnings = buildStalenessWarnings(input);
@@ -1666,6 +1717,37 @@ function buildGettingStarted(input) {
1666
1717
  lines.push(staleWarnings);
1667
1718
  lines.push('');
1668
1719
  }
1720
+ // Phase 0: Profile interview (only when profile is sparse and base skill is present)
1721
+ if (isProfileSparse(input.businessProfileData) && input.baseSkill) {
1722
+ lines.push('## Phase 0: Build your organization profile');
1723
+ lines.push('');
1724
+ lines.push('Organization context is incomplete. Before deploying agents, build a');
1725
+ lines.push('comprehensive business profile using the interview protocol:');
1726
+ lines.push('');
1727
+ lines.push('1. Read `.claude/skills/agent-blueprint/references/INTERVIEW_PROTOCOL.md`');
1728
+ lines.push('2. Follow the document-first approach: gather existing docs, extract, then interview for gaps');
1729
+ lines.push('3. Output structured JSON for platform sync, or rewrite `references/organization-context.md` locally');
1730
+ lines.push('');
1731
+ lines.push('A richer profile produces better-tailored agent recommendations and more accurate financial projections.');
1732
+ lines.push('');
1733
+ }
1734
+ lines.push('## Maintain the business profile');
1735
+ lines.push('');
1736
+ lines.push('If you learn new facts while implementing, update Agent Blueprint instead of');
1737
+ lines.push('only editing local markdown snapshots.');
1738
+ lines.push('');
1739
+ lines.push('1. Read `references/organization-context.md` and the current implementation context');
1740
+ lines.push('2. Fill in `editable/business-profile.update.json` with only verified changes');
1741
+ lines.push('3. Call the `update_business_profile` MCP tool with the `fields` object');
1742
+ lines.push('4. Re-download this export when staleness changes affect downstream artifacts');
1743
+ lines.push('');
1744
+ lines.push('## Ad-hoc artifact edits');
1745
+ lines.push('');
1746
+ lines.push('Markdown files are readable snapshots. MCP/CLI writes are the source of truth.');
1747
+ lines.push('For piecemeal edits to use cases, blueprints, business cases, or implementation');
1748
+ lines.push('plans, follow `references/artifact-editing.md` and use the templates in');
1749
+ lines.push('`editable/*.json`.');
1750
+ lines.push('');
1669
1751
  // Step 1
1670
1752
  lines.push('## Step 1: Understand the architecture');
1671
1753
  lines.push('');
@@ -1712,12 +1794,24 @@ function buildGettingStarted(input) {
1712
1794
  lines.push('It contains the connection verification steps, deployment sequence, platform');
1713
1795
  lines.push('patterns, and debugging guidance. Follow it for all platform-specific work.');
1714
1796
  lines.push('The deployment sequence adapts to the access level the user provides.');
1797
+ lines.push('');
1798
+ lines.push('Before creating a new app or first deployment, follow the expert skill\'s');
1799
+ lines.push('deployment-path decision gate. Prefer the platform\'s source-controlled or');
1800
+ lines.push('native packaging path when the expert skill recommends one. Use direct record');
1801
+ lines.push('or API edits mainly for existing deployments, live tuning, or blocked packaging');
1802
+ lines.push('paths. If you choose a fallback, document the reason in blueprint-local `PROGRESS.md`.');
1715
1803
  }
1716
1804
  else if (!input.baseSkill) {
1717
1805
  lines.push('If `references/deployment-guide-*.md` files are present, read those for');
1718
1806
  lines.push('platform-specific tooling, deployment sequence, and gotchas.');
1719
1807
  }
1720
1808
  lines.push('');
1809
+ lines.push('deployment-path decision checkpoint: before creating a new app or first deployment,');
1810
+ lines.push('choose the platform\'s source-controlled or native packaging path when one is');
1811
+ lines.push('available. Use direct record or API edits mainly for existing deployments,');
1812
+ lines.push('live tuning, or blocked packaging paths. If you choose a fallback, document');
1813
+ lines.push('the reason in blueprint-local `PROGRESS.md`.');
1814
+ lines.push('');
1721
1815
  lines.push('**B. User wants to build from scratch** (custom code, open-source frameworks):');
1722
1816
  lines.push('Help them choose a framework based on the blueprint architecture. Search the web');
1723
1817
  lines.push('for current agentic AI frameworks and their capabilities -- this space moves fast');
@@ -1735,8 +1829,9 @@ function buildGettingStarted(input) {
1735
1829
  // Step 3
1736
1830
  lines.push('## Step 3: Build and validate the pilot');
1737
1831
  lines.push('');
1738
- lines.push('Check the Phase 1 section in `SKILL.md` for pilot scope.');
1739
- lines.push('Build the lead agent first. **Do not expand to remaining agents until the');
1832
+ lines.push('Check the Phase 1/Pilot sections in `SKILL.md` and');
1833
+ lines.push('`references/agent-specifications.md` for pilot scope.');
1834
+ lines.push('Build the smallest executable pilot slice first. **Do not expand to remaining agents until the');
1740
1835
  lines.push('pilot is fully working with real data.** This is a gate, not a suggestion.');
1741
1836
  lines.push('');
1742
1837
  if (input.vendorSkill) {
@@ -1753,7 +1848,9 @@ function buildGettingStarted(input) {
1753
1848
  lines.push('**Phase A: Scaffold and validate orchestration.**');
1754
1849
  lines.push('1. Create an application container for the pilot (project, workspace, or whatever');
1755
1850
  lines.push(' your platform uses to group related agents). State your intent to the user.');
1756
- lines.push('2. Build the first worker agent with its tools and instructions.');
1851
+ lines.push('2. Build the smallest executable pilot slice: the minimum native workflow or');
1852
+ lines.push(' orchestrator plus the worker agent(s), tools, and instructions needed to');
1853
+ lines.push(' prove the first useful path.');
1757
1854
  lines.push('3. Use simulation scripts to validate the LLM orchestration (tool chaining,');
1758
1855
  lines.push(' parameter passing, sequencing). This proves the agent can chain tools correctly.');
1759
1856
  lines.push('4. **Test before proceeding.** Invoke the agent programmatically, read the execution');
@@ -1808,7 +1905,7 @@ function buildGettingStarted(input) {
1808
1905
  // Step 5
1809
1906
  lines.push('## Step 5: Track progress and close the loop');
1810
1907
  lines.push('');
1811
- lines.push('As you implement each agent, update `implementation-state.yaml`:');
1908
+ lines.push('As you implement each agent, update local `implementation-state.yaml`:');
1812
1909
  lines.push('');
1813
1910
  lines.push('1. Set the agent\'s `status` to `in_progress` when you start, `implemented` when done.');
1814
1911
  lines.push('2. Record the `platform_artifact` (sys_id, function name, service URL, etc.).');
@@ -1817,9 +1914,10 @@ function buildGettingStarted(input) {
1817
1914
  lines.push('5. Update `overall_status` as you progress.');
1818
1915
  lines.push('6. Fill in the `platform` section with the actual platform, version, and environment.');
1819
1916
  lines.push('');
1820
- lines.push('### Sync trigger points');
1917
+ lines.push('### Local update trigger points');
1821
1918
  lines.push('');
1822
- lines.push('Sync after each of these events (do not wait until the end):');
1919
+ lines.push('Update local `implementation-state.yaml` after each of these events');
1920
+ lines.push('(do not wait until the end):');
1823
1921
  lines.push('- After implementing an agent');
1824
1922
  lines.push('- After connecting an integration');
1825
1923
  lines.push('- After modifying an agent\'s behavior');
@@ -1827,13 +1925,16 @@ function buildGettingStarted(input) {
1827
1925
  lines.push('');
1828
1926
  lines.push('### How to sync');
1829
1927
  lines.push('');
1928
+ lines.push('In demo/test mode, ask the user before syncing local state back to Agent');
1929
+ lines.push('Blueprint. Sync only after approval.');
1930
+ lines.push('');
1830
1931
  lines.push('**MCP tool** (preferred when Agent Blueprint MCP server is connected):');
1831
1932
  lines.push('');
1832
1933
  lines.push(' Use the sync_implementation_state tool with:');
1833
1934
  lines.push(` blueprintId: "${input.blueprintId}"`);
1834
1935
  lines.push(' stateData: <contents of implementation-state.yaml as JSON>');
1835
1936
  lines.push('');
1836
- lines.push('**CLI**:');
1937
+ lines.push('**CLI** (after approval in demo/test mode):');
1837
1938
  lines.push('');
1838
1939
  lines.push(` agentblueprint sync --blueprint ${input.blueprintId}`);
1839
1940
  lines.push('');
@@ -2043,6 +2144,281 @@ function buildPlatformConnectivity() {
2043
2144
  return lines.join('\n');
2044
2145
  }
2045
2146
  // =============================================================================
2147
+ // ARTIFACT EDITING REFERENCE + JSON TEMPLATES
2148
+ // =============================================================================
2149
+ function buildArtifactEditingReference(input) {
2150
+ const lines = [
2151
+ '# Artifact Editing Reference',
2152
+ '',
2153
+ '> Markdown files in this export are readable snapshots. Agent Blueprint MCP/CLI',
2154
+ '> writes are the source of truth for saved changes.',
2155
+ '',
2156
+ `Blueprint ID: \`${input.blueprintId}\``,
2157
+ '',
2158
+ '## Workflow',
2159
+ '',
2160
+ '1. Read the current markdown context in `references/` and `SKILL.md`.',
2161
+ '2. Prepare a focused JSON patch using the matching file in `editable/`.',
2162
+ '3. Call the matching MCP write tool with only the fields or sections that changed.',
2163
+ '4. If the tool reports downstream staleness, refresh the affected artifact before relying on it.',
2164
+ '5. Re-download this blueprint export after important changes so local markdown snapshots match Agent Blueprint.',
2165
+ '',
2166
+ 'Do not edit markdown snapshots as the canonical record. Local markdown edits are notes only unless they are written back through MCP or CLI.',
2167
+ '',
2168
+ '## Tool Mapping',
2169
+ '',
2170
+ '| Change area | Template | Write tool |',
2171
+ '|-------------|----------|------------|',
2172
+ '| Profile facts, systems, capabilities, operations, constraints | `editable/business-profile.update.json` | `update_business_profile` |',
2173
+ '| Use case, pain points, outcomes, success metrics | `editable/use-case.update.json` | `update_use_case` |',
2174
+ '| Agent team, architecture, phases, success criteria | `editable/blueprint.update.json` | `update_blueprint` |',
2175
+ '| ROI narrative, benefits, risks, recommendation | `editable/business-case.update.json` | `update_business_case`, then `recalculate_financials` when numbers need refresh |',
2176
+ '| Implementation sequencing, epics, resources, agent specs | `editable/implementation-plan.update.json` | `update_implementation_plan` |',
2177
+ '',
2178
+ '## Patch Rules',
2179
+ '',
2180
+ '- Keep patches small. Include only the top-level fields or sections you intend to change.',
2181
+ '- Delete placeholder keys before submitting if you are not changing them.',
2182
+ '- Preserve IDs, agent names, phase names, and metric names unless the user explicitly asks to rename them.',
2183
+ '- For financial narrative edits, call `update_business_case` first. Call `recalculate_financials` only when numeric assumptions or ROI inputs changed.',
2184
+ '- Unknown keys may be ignored or preserved depending on the endpoint. Prefer the keys shown in the templates.',
2185
+ '',
2186
+ '## MCP Examples',
2187
+ '',
2188
+ 'Business profile:',
2189
+ '',
2190
+ '```json',
2191
+ '{',
2192
+ ' "fields": {',
2193
+ ' "companyName": "Replace with verified company name",',
2194
+ ' "technology": { "systems": [] }',
2195
+ ' }',
2196
+ '}',
2197
+ '```',
2198
+ '',
2199
+ 'Blueprint section:',
2200
+ '',
2201
+ '```json',
2202
+ '{',
2203
+ ` "blueprintId": "${input.blueprintId}",`,
2204
+ ' "sections": {',
2205
+ ' "executiveSummary": "Replace with the revised summary"',
2206
+ ' }',
2207
+ '}',
2208
+ '```',
2209
+ '',
2210
+ 'After a successful write, inspect the response for `downstreamStale` or staleness warnings. Refresh or recalculate those artifacts before treating the export as current.',
2211
+ ];
2212
+ return lines.join('\n');
2213
+ }
2214
+ function buildBusinessProfileUpdateTemplate() {
2215
+ return jsonTemplate({
2216
+ _instructions: 'Replace placeholders, delete unused keys, then call update_business_profile with the fields object. Use only verified facts.',
2217
+ fields: {
2218
+ companyName: '<replace with verified company name>',
2219
+ industry: '<replace with industry>',
2220
+ size: '<replace with employee or company size>',
2221
+ revenue: '<replace with revenue range if known>',
2222
+ currency: 'USD',
2223
+ description: '<replace with concise business description>',
2224
+ companyWebsite: '<replace with company website>',
2225
+ technology: {
2226
+ systems: [
2227
+ {
2228
+ name: '<replace with system name>',
2229
+ category: '<replace with system category>',
2230
+ criticality: '<replace with criticality>',
2231
+ },
2232
+ ],
2233
+ },
2234
+ capabilities: {
2235
+ technicalTeam: {
2236
+ developmentCapacity: '<replace with capacity if known>',
2237
+ aiMlExperience: '<replace with AI/ML experience level>',
2238
+ },
2239
+ },
2240
+ operations: {
2241
+ keyProcesses: [
2242
+ {
2243
+ name: '<replace with process name>',
2244
+ volume: '<replace with process volume if known>',
2245
+ },
2246
+ ],
2247
+ painPoints: ['<replace with operational pain point>'],
2248
+ },
2249
+ constraints: {
2250
+ budget: {
2251
+ totalAiBudget: '<replace with budget if known>',
2252
+ },
2253
+ timeline: {
2254
+ preferredTimeline: '<replace with timeline if known>',
2255
+ },
2256
+ },
2257
+ strategicInitiatives: [
2258
+ {
2259
+ title: '<replace with initiative title>',
2260
+ description: '<replace with initiative description>',
2261
+ },
2262
+ ],
2263
+ },
2264
+ });
2265
+ }
2266
+ function buildUseCaseUpdateTemplate(input) {
2267
+ return jsonTemplate({
2268
+ _instructions: 'Replace placeholders, delete unused sections, then call update_use_case with blueprintId and sections.',
2269
+ blueprintId: input.blueprintId,
2270
+ sections: {
2271
+ title: '<replace with use case title>',
2272
+ description: '<replace with concise use case description>',
2273
+ businessChallenge: '<replace with updated business challenge>',
2274
+ description5Ws: {
2275
+ who: '<replace with impacted people or teams>',
2276
+ what: '<replace with work being changed>',
2277
+ where: '<replace with business area or systems>',
2278
+ when: '<replace with timing or trigger>',
2279
+ why: '<replace with reason this matters>',
2280
+ },
2281
+ currentPainPoints: ['<replace with pain point>'],
2282
+ desiredBusinessOutcomes: ['<replace with desired outcome>'],
2283
+ processDocumentation: {
2284
+ steps: [
2285
+ {
2286
+ stepNumber: 1,
2287
+ description: '<replace with current process step>',
2288
+ performer: '<replace with performer>',
2289
+ },
2290
+ ],
2291
+ },
2292
+ transformationStory: {
2293
+ situation: '<replace with current situation>',
2294
+ complication: '<replace with complication>',
2295
+ resolution: '<replace with desired resolution>',
2296
+ },
2297
+ typedSuccessMetrics: [
2298
+ {
2299
+ metric: '<replace with metric name>',
2300
+ target: '<replace with target>',
2301
+ },
2302
+ ],
2303
+ organizationalConstraints: ['<replace with constraint>'],
2304
+ affectedDepartments: ['<replace with department>'],
2305
+ },
2306
+ });
2307
+ }
2308
+ function buildBlueprintUpdateTemplate(input) {
2309
+ return jsonTemplate({
2310
+ _instructions: 'Replace placeholders, delete unused sections, then call update_blueprint with blueprintId and sections. Top-level sections are shallow-merged.',
2311
+ blueprintId: input.blueprintId,
2312
+ sections: {
2313
+ executiveSummary: '<replace with revised executive summary>',
2314
+ agenticPattern: '<replace with agentic pattern if changed>',
2315
+ enhancedDigitalTeam: [
2316
+ {
2317
+ name: '<replace with agent name>',
2318
+ role: '<replace with agent role>',
2319
+ agentRole: '<replace with orchestration role>',
2320
+ responsibilities: ['<replace with responsibility>'],
2321
+ },
2322
+ ],
2323
+ phases: [
2324
+ {
2325
+ name: '<replace with phase name>',
2326
+ phaseGoal: '<replace with phase goal>',
2327
+ durationWeeks: '<replace with duration in weeks>',
2328
+ },
2329
+ ],
2330
+ architectureRationale: {
2331
+ whyAgentic: ['<replace with rationale>'],
2332
+ },
2333
+ successCriteria: {
2334
+ kpis: [
2335
+ {
2336
+ name: '<replace with KPI name>',
2337
+ target: '<replace with target>',
2338
+ },
2339
+ ],
2340
+ },
2341
+ },
2342
+ });
2343
+ }
2344
+ function buildBusinessCaseUpdateTemplate(input) {
2345
+ return jsonTemplate({
2346
+ _instructions: 'Replace placeholders, delete unused sections, then call update_business_case with blueprintId and sections. If numeric assumptions or ROI inputs changed, call recalculate_financials next.',
2347
+ blueprintId: input.blueprintId,
2348
+ sections: {
2349
+ executiveSummary: {
2350
+ purpose: '<replace with revised purpose>',
2351
+ valueProposition: '<replace with revised value proposition>',
2352
+ },
2353
+ businessContext: {
2354
+ problemStatement: '<replace with updated problem statement>',
2355
+ },
2356
+ objectives: {
2357
+ successMetrics: [
2358
+ {
2359
+ metric: '<replace with metric name>',
2360
+ targetValue: '<replace with target value>',
2361
+ },
2362
+ ],
2363
+ },
2364
+ proposedSolution: {
2365
+ summary: '<replace with solution summary>',
2366
+ },
2367
+ benefits: {
2368
+ tangibleBenefits: {
2369
+ processEfficiency: '<replace with benefit>',
2370
+ },
2371
+ },
2372
+ risks: {
2373
+ implementationRisks: [
2374
+ {
2375
+ title: '<replace with risk title>',
2376
+ severity: '<replace with severity>',
2377
+ impact: '<replace with impact>',
2378
+ },
2379
+ ],
2380
+ },
2381
+ recommendation: {
2382
+ summary: '<replace with recommendation>',
2383
+ },
2384
+ },
2385
+ });
2386
+ }
2387
+ function buildImplementationPlanUpdateTemplate(input) {
2388
+ return jsonTemplate({
2389
+ _instructions: 'Replace placeholders, delete unused sections, then call update_implementation_plan with blueprintId and sections.',
2390
+ blueprintId: input.blueprintId,
2391
+ sections: {
2392
+ projectOverview: {
2393
+ summary: '<replace with updated implementation summary>',
2394
+ },
2395
+ epics: [
2396
+ {
2397
+ name: '<replace with epic name>',
2398
+ description: '<replace with epic description>',
2399
+ phase: '<replace with phase>',
2400
+ },
2401
+ ],
2402
+ dependencies: ['<replace with dependency>'],
2403
+ resources: {
2404
+ team: ['<replace with required role or team>'],
2405
+ },
2406
+ risks: [
2407
+ {
2408
+ title: '<replace with implementation risk>',
2409
+ mitigation: '<replace with mitigation>',
2410
+ },
2411
+ ],
2412
+ agentSpecifications: [
2413
+ {
2414
+ name: '<replace with agent name>',
2415
+ implementationNotes: '<replace with implementation notes>',
2416
+ },
2417
+ ],
2418
+ },
2419
+ });
2420
+ }
2421
+ // =============================================================================
2046
2422
  // IMPLEMENTATION STATE TEMPLATE
2047
2423
  // =============================================================================
2048
2424
  function buildImplementationState(input) {
@@ -2337,6 +2713,31 @@ function buildAgentsMd(input) {
2337
2713
  lines.push('');
2338
2714
  lines.push(` ${bpId}`);
2339
2715
  lines.push('');
2716
+ lines.push('## Source of truth for edits');
2717
+ lines.push('');
2718
+ lines.push('Markdown files in this export are readable snapshots. Agent Blueprint MCP/CLI');
2719
+ lines.push('writes are the source of truth for saved profile and artifact changes.');
2720
+ lines.push('Use `references/artifact-editing.md` and `editable/*.json` to prepare focused');
2721
+ lines.push('patches, then write them back with MCP tools.');
2722
+ lines.push('');
2723
+ lines.push('## Maintain the business profile');
2724
+ lines.push('');
2725
+ lines.push('When you discover new profile facts, systems, capabilities, operations,');
2726
+ lines.push('constraints, or strategic initiatives:');
2727
+ lines.push('1. Read `references/organization-context.md`');
2728
+ lines.push('2. Fill in `editable/business-profile.update.json`');
2729
+ lines.push('3. Call `update_business_profile` with the `fields` object');
2730
+ lines.push('4. Re-download or refresh stale artifacts before continuing');
2731
+ lines.push('');
2732
+ lines.push('## Ad-hoc artifact edits');
2733
+ lines.push('');
2734
+ lines.push('For piecemeal corrections, use the matching template and MCP write tool:');
2735
+ lines.push('- Use case changes: `editable/use-case.update.json` -> `update_use_case`');
2736
+ lines.push('- Blueprint changes: `editable/blueprint.update.json` -> `update_blueprint`');
2737
+ lines.push('- Business case changes: `editable/business-case.update.json` -> `update_business_case`');
2738
+ lines.push('- Financial number changes: `update_business_case`, then `recalculate_financials`');
2739
+ lines.push('- Implementation plan changes: `editable/implementation-plan.update.json` -> `update_implementation_plan`');
2740
+ lines.push('');
2340
2741
  lines.push('## When to sync implementation state');
2341
2742
  lines.push('');
2342
2743
  lines.push('Sync after each of these events:');
@@ -2625,6 +3026,13 @@ export function renderSkillDirectory(input) {
2625
3026
  files.set('references/guardrails-and-governance.md', buildGuardrailsAndGovernance(input));
2626
3027
  files.set('references/evaluation-criteria.md', buildEvaluationCriteria(input));
2627
3028
  files.set('references/platform-connectivity.md', buildPlatformConnectivity());
3029
+ files.set('references/artifact-editing.md', buildArtifactEditingReference(input));
3030
+ // Editable JSON helper templates (not canonical state)
3031
+ files.set('editable/business-profile.update.json', buildBusinessProfileUpdateTemplate());
3032
+ files.set('editable/use-case.update.json', buildUseCaseUpdateTemplate(input));
3033
+ files.set('editable/blueprint.update.json', buildBlueprintUpdateTemplate(input));
3034
+ files.set('editable/business-case.update.json', buildBusinessCaseUpdateTemplate(input));
3035
+ files.set('editable/implementation-plan.update.json', buildImplementationPlanUpdateTemplate(input));
2628
3036
  // Getting Started guide
2629
3037
  files.set('GETTING-STARTED.md', buildGettingStarted(input));
2630
3038
  // Sync rules (universal -- all coding agents via AGENTS.md standard)