@kaddo/mcp 3.97.0 → 3.99.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 +507 -60
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5107,6 +5107,89 @@ actual, y decisi\xF3n de completitud (READY_TO_COMPLETE | NEEDS_WORK | BLOCKED |
5107
5107
  Un reporte de verificaci\xF3n con ACs, gates, excepciones y decisi\xF3n de completitud.
5108
5108
  `
5109
5109
  );
5110
+ var LEGACY_RISK_ASSESSMENT = skill(
5111
+ "legacy-risk-assessment",
5112
+ "Legacy Risk Assessment Skill",
5113
+ "delivery",
5114
+ ["legacy-agent", "implementation-agent", "work-item-agent"],
5115
+ `
5116
+ # Legacy Risk Assessment Skill
5117
+
5118
+ ## Purpose
5119
+
5120
+ Evaluate a planned change against known legacy risks, unknowns and modernization candidates
5121
+ to identify which findings require additional consideration before or after implementation.
5122
+
5123
+ ## When to use
5124
+
5125
+ Before or during implementation of a Work Item in a legacy project \u2014 especially when the
5126
+ Work Item touches areas flagged in \`knowledge/legacy/risks.md\`.
5127
+
5128
+ ## Inputs
5129
+
5130
+ - The Work Item (id, ACs, affected_modules, affected areas).
5131
+ - \`knowledge/legacy/risks.md\` \u2014 known risks with RISK-xxx identifiers.
5132
+ - \`knowledge/legacy/unknowns.md\` \u2014 known unknowns with UNK-xxx identifiers.
5133
+ - \`knowledge/legacy/modernization-candidates.md\` \u2014 MOD-xxx candidates.
5134
+ - System Graph (\`.kaddo/graph.json\`) when available.
5135
+ - Implementation Handoff or Implementation Evidence when available.
5136
+
5137
+ ## Output
5138
+
5139
+ A risk assessment report listing which legacy findings are relevant to the planned change,
5140
+ their intersection with the affected areas, and recommended actions.
5141
+
5142
+ ### Output template
5143
+
5144
+ \`\`\`markdown
5145
+ # Legacy Risk Assessment \u2014 <WI id>
5146
+
5147
+ ## Relevant Risks
5148
+
5149
+ ### RISK-xxx: <title>
5150
+ - **Intersection:** <how this risk relates to the planned change>
5151
+ - **Action:** mitigate before | monitor during | verify after | not applicable
5152
+ - **Notes:** <additional context>
5153
+
5154
+ ## Relevant Unknowns
5155
+
5156
+ ### UNK-xxx: <question>
5157
+ - **Impact on this WI:** <how this unknown affects implementation>
5158
+ - **Recommended:** investigate before | accept as assumption | defer
5159
+
5160
+ ## Relevant Modernization Candidates
5161
+
5162
+ ### MOD-xxx: <title>
5163
+ - **Alignment:** <how this WI relates to the modernization target>
5164
+ - **Recommendation:** advance | defer | not relevant
5165
+
5166
+ ## Summary
5167
+
5168
+ - Risks requiring pre-implementation mitigation: <count>
5169
+ - Unknowns requiring investigation: <count>
5170
+ - Modernization candidates advanced by this WI: <count>
5171
+ - Overall risk posture: low | medium | high
5172
+ \`\`\`
5173
+
5174
+ ## Rules
5175
+
5176
+ - Reference findings by their stable identifiers \u2014 do not copy full content.
5177
+ - Assess intersection based on affected areas (file paths, modules, system entities).
5178
+ - Not every legacy finding is relevant \u2014 filter to those that intersect the change.
5179
+ - Do not block implementation solely because legacy risks exist \u2014 provide context for
5180
+ informed decision-making.
5181
+ - When the System Graph is available, use entity relationships to discover indirect risk
5182
+ intersections.
5183
+
5184
+ ## Quality checklist
5185
+
5186
+ - Every referenced finding uses its stable identifier (RISK-xxx, UNK-xxx, MOD-xxx).
5187
+ - Each relevant finding has an explicit action recommendation.
5188
+ - Findings not relevant to the change are excluded, not listed as "not applicable".
5189
+ - Overall risk posture is stated.
5190
+ - The assessment is proportional \u2014 a small change gets a brief assessment.
5191
+ `
5192
+ );
5110
5193
  var SKILLS = [
5111
5194
  ADR_WRITING,
5112
5195
  WORK_ITEM_REFINEMENT,
@@ -5116,10 +5199,11 @@ var SKILLS = [
5116
5199
  LEARNING_CAPTURE,
5117
5200
  IMPLEMENTATION_PLANNING,
5118
5201
  MODULE_CONTEXT_REFINEMENT,
5119
- EVIDENCE_VERIFICATION
5202
+ EVIDENCE_VERIFICATION,
5203
+ LEGACY_RISK_ASSESSMENT
5120
5204
  ];
5121
5205
  var SKILL_GROUPS = {
5122
- delivery: ["work-item-refinement", "implementation-planning", "learning-capture", "evidence-verification"],
5206
+ delivery: ["work-item-refinement", "implementation-planning", "learning-capture", "evidence-verification", "legacy-risk-assessment"],
5123
5207
  tech: ["adr-writing", "ownership-suggestion", "graph-metadata-review", "module-context-refinement"],
5124
5208
  integration: ["capsule-writing"]
5125
5209
  };
@@ -5868,7 +5952,11 @@ Adapt priorities to the project state from the context pack:
5868
5952
  - **new** \u2014 prioritize foundational capabilities and initial product direction.
5869
5953
  - **pre-ai** \u2014 prioritize organizing existing capabilities and reducing knowledge gaps.
5870
5954
  - **legacy** \u2014 prioritize risk reduction, unknowns and safe modernization before feature
5871
- delivery.
5955
+ delivery. **Explicitly consult** \`knowledge/legacy/risks.md\`, \`knowledge/legacy/unknowns.md\`
5956
+ and \`knowledge/legacy/modernization-candidates.md\` when they exist. Every legacy risk
5957
+ (RISK-xxx) and modernization candidate (MOD-xxx) should be considered as a source signal
5958
+ for roadmap candidates. Reference them by their stable identifiers so downstream Work Items
5959
+ can trace back to the original finding.
5872
5960
 
5873
5961
  ## Grounding rules (VS-077)
5874
5962
 
@@ -5880,7 +5968,7 @@ Every candidate initiative must be **grounded** in the knowledge base \u2014 nev
5880
5968
  - **Related capabilities** \u2014 one or more existing/partial capabilities.
5881
5969
  - **Source signals** \u2014 at least one traceable reason: Capability Gap, Roadmap Candidate Signal, Risk,
5882
5970
  Open Question, Assumption, Deferred Decision, Tech Decision Candidate, ADR, Business Goal,
5883
- Operational Need or Legacy Modernization Signal.
5971
+ Operational Need, Legacy Modernization Signal, Legacy Risk (RISK-xxx) or Legacy Unknown (UNK-xxx).
5884
5972
  - **Expected value**, **Risks**, **Dependencies**, and **Suggested Work Items** (candidates only).
5885
5973
 
5886
5974
  Do **not** emit a candidate with no source signal. Keep initiatives at initiative granularity (small
@@ -5995,10 +6083,13 @@ var LEGACY_AGENT = `# Legacy Agent
5995
6083
  ## Role
5996
6084
 
5997
6085
  You are the Kaddo Legacy Agent. Your job is to analyze a legacy or risky project before
5998
- anyone changes it, using a Kaddo Context Pack.
6086
+ anyone changes it, using a Kaddo Context Pack enriched with scan signals and system
6087
+ topology.
5999
6088
 
6000
6089
  You do not write code. You surface risk, unknowns and safe first steps, marking
6001
- assumptions clearly.
6090
+ assumptions clearly. Your output feeds the downstream Kaddo lifecycle \u2014 roadmap, Work
6091
+ Items, Implementation Handoff, Evidence, Verification and Learning \u2014 so findings must be
6092
+ structured and traceable.
6002
6093
 
6003
6094
  ## When to Use
6004
6095
 
@@ -6009,26 +6100,45 @@ before planning modernization or changes.
6009
6100
 
6010
6101
  Provide \`.kaddo/context-pack.md\` as the primary input.
6011
6102
 
6012
- Optionally provide: incident history, known pain points, dependency manifests.
6103
+ Additionally consult (use whatever is available; mark missing sources as assumptions):
6104
+
6105
+ - \`.kaddo/scan.json\` \u2014 scan signals (auth, payments, webhooks, storage, background_jobs,
6106
+ email, database, migrations, api_routes, tests, security, infrastructure).
6107
+ - System Graph (\`.kaddo/graph.json\` / \`.kaddo/graph.mmd\`) \u2014 entity relationships and
6108
+ topology when available.
6109
+ - \`knowledge/tech/current-state.md\` \u2014 existing architecture baseline.
6110
+ - \`knowledge/product/capabilities.md\` \u2014 capability inventory with statuses and domains.
6111
+ - Incident history, known pain points, dependency manifests (if provided by the user).
6013
6112
 
6014
6113
  ## Expected Output
6015
6114
 
6016
- Markdown artifacts intended to be saved as:
6115
+ Three structured Markdown artifacts intended to be saved as:
6017
6116
 
6018
6117
  - \`knowledge/legacy/risks.md\`
6019
6118
  - \`knowledge/legacy/unknowns.md\`
6020
6119
  - \`knowledge/legacy/modernization-candidates.md\`
6021
6120
 
6022
- ## Instructions
6121
+ Each artifact uses Kaddo template format with front matter and structured entries that
6122
+ downstream agents (roadmap-agent, work-item-agent, implementation-agent) can reference.
6023
6123
 
6024
- Analyze the context pack and identify:
6124
+ ## Instructions
6025
6125
 
6026
- 1. Unknowns.
6027
- 2. Risky areas.
6028
- 3. Dependencies.
6029
- 4. Modernization candidates.
6030
- 5. Safe first steps.
6031
- 6. Areas requiring human validation.
6126
+ 1. **Ingest available signals.** Read scan results, context pack, system graph and any
6127
+ existing knowledge. Do not skip available sources.
6128
+ 2. **Identify risks.** For each risk, provide a stable identifier (RISK-001, RISK-002, ...),
6129
+ the affected area (file paths, modules, or system components), why it is risky, blast
6130
+ radius (local / module / cross-cutting / system-wide), confidence (high / medium / low),
6131
+ related scan signals, and a mitigation suggestion.
6132
+ 3. **Identify unknowns.** For each unknown, provide a stable identifier (UNK-001, UNK-002, ...),
6133
+ the question, why it matters, how to find out, and related risks (RISK-xxx references).
6134
+ 4. **Identify modernization candidates.** For each candidate, provide a stable identifier
6135
+ (MOD-001, MOD-002, ...), current state, target state, value, risk, suggested Knowledge
6136
+ Level (K1\u2013K4), related risks and unknowns, and affected system entities when the Graph
6137
+ is available.
6138
+ 5. **Identify dependencies** \u2014 external and internal dependencies that constrain changes.
6139
+ 6. **Propose safe first steps** \u2014 small, low-risk actions that reduce unknowns or risk.
6140
+ 7. **Flag areas requiring human validation** \u2014 decisions, assumptions or trade-offs that
6141
+ only a human can resolve.
6032
6142
 
6033
6143
  ## Constraints
6034
6144
 
@@ -6036,33 +6146,78 @@ Analyze the context pack and identify:
6036
6146
  - Prefer small, low-risk first steps.
6037
6147
  - Mark assumptions and confidence clearly.
6038
6148
  - Do not write code.
6149
+ - Every risk, unknown and modernization candidate must have a stable identifier (RISK-xxx,
6150
+ UNK-xxx, MOD-xxx) so downstream artifacts can reference them.
6151
+ - When System Graph topology is available, reference affected entities by their graph id.
6152
+ - Do not duplicate capability inventory work \u2014 reference \`capabilities.md\` when it exists.
6039
6153
 
6040
6154
  ## Output Format
6041
6155
 
6156
+ ### knowledge/legacy/risks.md
6157
+
6042
6158
  \`\`\`markdown
6043
- # Legacy Analysis
6159
+ ---
6160
+ type: legacy-risks
6161
+ generated_by: legacy-agent
6162
+ ---
6044
6163
 
6045
- Generated from Kaddo Context Pack.
6164
+ # Legacy Risks
6046
6165
 
6047
- ## Risks
6166
+ ## RISK-001: <Short title>
6048
6167
 
6049
- ### <Risk>
6168
+ - **Area:** <file paths, modules, or components>
6169
+ - **Why risky:** <explanation>
6170
+ - **Blast radius:** local | module | cross-cutting | system-wide
6171
+ - **Confidence:** high | medium | low
6172
+ - **Scan signals:** <related signals from scan.json, or "none detected">
6173
+ - **Graph entities:** <related system graph entities, or "Graph unavailable">
6174
+ - **Mitigation:** <suggested approach>
6050
6175
 
6051
- **Area:**
6176
+ ## RISK-002: ...
6177
+ \`\`\`
6052
6178
 
6053
- **Why it is risky:**
6179
+ ### knowledge/legacy/unknowns.md
6054
6180
 
6055
- **Confidence:**
6181
+ \`\`\`markdown
6182
+ ---
6183
+ type: legacy-unknowns
6184
+ generated_by: legacy-agent
6185
+ ---
6056
6186
 
6057
- ## Unknowns
6187
+ # Legacy Unknowns
6058
6188
 
6059
- ## Dependencies
6189
+ ## UNK-001: <Question>
6190
+
6191
+ - **Why it matters:** <impact if left unresolved>
6192
+ - **How to find out:** <investigation steps>
6193
+ - **Related risks:** RISK-001, RISK-003
6194
+ - **Blocking:** yes | no | unknown
6060
6195
 
6061
- ## Modernization Candidates
6196
+ ## UNK-002: ...
6197
+ \`\`\`
6062
6198
 
6063
- ## Safe First Steps
6199
+ ### knowledge/legacy/modernization-candidates.md
6064
6200
 
6065
- ## Areas Requiring Human Validation
6201
+ \`\`\`markdown
6202
+ ---
6203
+ type: modernization-candidates
6204
+ generated_by: legacy-agent
6205
+ ---
6206
+
6207
+ # Modernization Candidates
6208
+
6209
+ ## MOD-001: <Short title>
6210
+
6211
+ - **Current state:** <what exists today>
6212
+ - **Target state:** <desired outcome>
6213
+ - **Value:** <why this modernization matters>
6214
+ - **Risk:** low | medium | high
6215
+ - **Suggested Knowledge Level:** K1 | K2 | K3 | K4
6216
+ - **Related risks:** RISK-xxx
6217
+ - **Related unknowns:** UNK-xxx
6218
+ - **Affected entities:** <system graph entities, or "Graph unavailable">
6219
+
6220
+ ## MOD-002: ...
6066
6221
  \`\`\`
6067
6222
 
6068
6223
  ## Where to Save the Result
@@ -6073,10 +6228,15 @@ Save risks as \`knowledge/legacy/risks.md\`, unknowns as
6073
6228
 
6074
6229
  ## Quality Checklist
6075
6230
 
6076
- - Risks are backed by evidence.
6231
+ - Every risk has a stable RISK-xxx identifier, blast radius, and confidence level.
6232
+ - Every unknown has a stable UNK-xxx identifier and related risk references.
6233
+ - Every modernization candidate has a stable MOD-xxx identifier and Knowledge Level.
6234
+ - Scan signals are referenced when available \u2014 findings are grounded in detected signals.
6235
+ - System Graph entities are referenced when topology is available.
6077
6236
  - Safe first steps are small and low-risk.
6078
- - Unknowns are explicit.
6237
+ - Assumptions are marked explicitly with confidence.
6079
6238
  - Areas needing human validation are flagged.
6239
+ - Identifiers are unique and sequential within each artifact.
6080
6240
  `;
6081
6241
  var ADR_AGENT = `# ADR Agent
6082
6242
 
@@ -6298,6 +6458,14 @@ the decision is still a candidate in knowledge/tech/decision-candidates.md with
6298
6458
  that it should be materialized first (\`kaddo adr\` + the adr-writing skill) and record
6299
6459
  \`decision_candidates: [<title>]\` \u2014 do not implement work that depends on an unformalized decision
6300
6460
  without surfacing it. -->
6461
+
6462
+ **Related legacy findings:** <!-- for legacy projects (WI-012): when
6463
+ \`knowledge/legacy/risks.md\`, \`knowledge/legacy/unknowns.md\` or
6464
+ \`knowledge/legacy/modernization-candidates.md\` exist, check whether any findings (RISK-xxx,
6465
+ UNK-xxx, MOD-xxx) are relevant to this Work Item's scope. Add \`legacy_risks: [RISK-001, ...]\`
6466
+ and \`legacy_unknowns: [UNK-001, ...]\` to the front matter when applicable. Do NOT copy the full
6467
+ finding content \u2014 reference by identifier. Include relevant findings in the Scope unknowns
6468
+ section when they affect implementation decisions. -->
6301
6469
  \`\`\`
6302
6470
 
6303
6471
  ### Preserve roadmap metadata (VS-077 / VS-078)
@@ -10519,6 +10687,42 @@ var RESOURCES = [
10519
10687
  return [{ uri: "kaddo://project-route", text: JSON.stringify(buildProjectRoute(root), null, 2), mimeType: "application/json" }];
10520
10688
  }
10521
10689
  },
10690
+ {
10691
+ uri: "kaddo://legacy-risks",
10692
+ name: "Kaddo legacy risks",
10693
+ description: "Known legacy risks (RISK-xxx) from `knowledge/legacy/risks.md` \u2014 blast radius, confidence, mitigation (WI-012). Read-only.",
10694
+ mimeType: "text/markdown",
10695
+ read: (root) => fileOrHint(
10696
+ root,
10697
+ "kaddo://legacy-risks",
10698
+ "knowledge/legacy/risks.md",
10699
+ "No legacy risks found. Run the `legacy-agent` in a legacy project to generate `knowledge/legacy/risks.md`."
10700
+ )
10701
+ },
10702
+ {
10703
+ uri: "kaddo://legacy-unknowns",
10704
+ name: "Kaddo legacy unknowns",
10705
+ description: "Known legacy unknowns (UNK-xxx) from `knowledge/legacy/unknowns.md` \u2014 open questions about legacy system behavior (WI-012). Read-only.",
10706
+ mimeType: "text/markdown",
10707
+ read: (root) => fileOrHint(
10708
+ root,
10709
+ "kaddo://legacy-unknowns",
10710
+ "knowledge/legacy/unknowns.md",
10711
+ "No legacy unknowns found. Run the `legacy-agent` in a legacy project to generate `knowledge/legacy/unknowns.md`."
10712
+ )
10713
+ },
10714
+ {
10715
+ uri: "kaddo://modernization-candidates",
10716
+ name: "Kaddo modernization candidates",
10717
+ description: "Modernization candidates (MOD-xxx) from `knowledge/legacy/modernization-candidates.md` \u2014 current state, target state, risk, Knowledge Level (WI-012). Read-only.",
10718
+ mimeType: "text/markdown",
10719
+ read: (root) => fileOrHint(
10720
+ root,
10721
+ "kaddo://modernization-candidates",
10722
+ "knowledge/legacy/modernization-candidates.md",
10723
+ "No modernization candidates found. Run the `legacy-agent` in a legacy project to generate `knowledge/legacy/modernization-candidates.md`."
10724
+ )
10725
+ },
10522
10726
  {
10523
10727
  uri: "kaddo://scan-signals",
10524
10728
  name: "Kaddo scan signals",
@@ -13106,6 +13310,89 @@ actual, y decisi\xF3n de completitud (READY_TO_COMPLETE | NEEDS_WORK | BLOCKED |
13106
13310
  Un reporte de verificaci\xF3n con ACs, gates, excepciones y decisi\xF3n de completitud.
13107
13311
  `
13108
13312
  );
13313
+ var LEGACY_RISK_ASSESSMENT2 = skill2(
13314
+ "legacy-risk-assessment",
13315
+ "Legacy Risk Assessment Skill",
13316
+ "delivery",
13317
+ ["legacy-agent", "implementation-agent", "work-item-agent"],
13318
+ `
13319
+ # Legacy Risk Assessment Skill
13320
+
13321
+ ## Purpose
13322
+
13323
+ Evaluate a planned change against known legacy risks, unknowns and modernization candidates
13324
+ to identify which findings require additional consideration before or after implementation.
13325
+
13326
+ ## When to use
13327
+
13328
+ Before or during implementation of a Work Item in a legacy project \u2014 especially when the
13329
+ Work Item touches areas flagged in \`knowledge/legacy/risks.md\`.
13330
+
13331
+ ## Inputs
13332
+
13333
+ - The Work Item (id, ACs, affected_modules, affected areas).
13334
+ - \`knowledge/legacy/risks.md\` \u2014 known risks with RISK-xxx identifiers.
13335
+ - \`knowledge/legacy/unknowns.md\` \u2014 known unknowns with UNK-xxx identifiers.
13336
+ - \`knowledge/legacy/modernization-candidates.md\` \u2014 MOD-xxx candidates.
13337
+ - System Graph (\`.kaddo/graph.json\`) when available.
13338
+ - Implementation Handoff or Implementation Evidence when available.
13339
+
13340
+ ## Output
13341
+
13342
+ A risk assessment report listing which legacy findings are relevant to the planned change,
13343
+ their intersection with the affected areas, and recommended actions.
13344
+
13345
+ ### Output template
13346
+
13347
+ \`\`\`markdown
13348
+ # Legacy Risk Assessment \u2014 <WI id>
13349
+
13350
+ ## Relevant Risks
13351
+
13352
+ ### RISK-xxx: <title>
13353
+ - **Intersection:** <how this risk relates to the planned change>
13354
+ - **Action:** mitigate before | monitor during | verify after | not applicable
13355
+ - **Notes:** <additional context>
13356
+
13357
+ ## Relevant Unknowns
13358
+
13359
+ ### UNK-xxx: <question>
13360
+ - **Impact on this WI:** <how this unknown affects implementation>
13361
+ - **Recommended:** investigate before | accept as assumption | defer
13362
+
13363
+ ## Relevant Modernization Candidates
13364
+
13365
+ ### MOD-xxx: <title>
13366
+ - **Alignment:** <how this WI relates to the modernization target>
13367
+ - **Recommendation:** advance | defer | not relevant
13368
+
13369
+ ## Summary
13370
+
13371
+ - Risks requiring pre-implementation mitigation: <count>
13372
+ - Unknowns requiring investigation: <count>
13373
+ - Modernization candidates advanced by this WI: <count>
13374
+ - Overall risk posture: low | medium | high
13375
+ \`\`\`
13376
+
13377
+ ## Rules
13378
+
13379
+ - Reference findings by their stable identifiers \u2014 do not copy full content.
13380
+ - Assess intersection based on affected areas (file paths, modules, system entities).
13381
+ - Not every legacy finding is relevant \u2014 filter to those that intersect the change.
13382
+ - Do not block implementation solely because legacy risks exist \u2014 provide context for
13383
+ informed decision-making.
13384
+ - When the System Graph is available, use entity relationships to discover indirect risk
13385
+ intersections.
13386
+
13387
+ ## Quality checklist
13388
+
13389
+ - Every referenced finding uses its stable identifier (RISK-xxx, UNK-xxx, MOD-xxx).
13390
+ - Each relevant finding has an explicit action recommendation.
13391
+ - Findings not relevant to the change are excluded, not listed as "not applicable".
13392
+ - Overall risk posture is stated.
13393
+ - The assessment is proportional \u2014 a small change gets a brief assessment.
13394
+ `
13395
+ );
13109
13396
  var SKILLS2 = [
13110
13397
  ADR_WRITING2,
13111
13398
  WORK_ITEM_REFINEMENT2,
@@ -13115,10 +13402,11 @@ var SKILLS2 = [
13115
13402
  LEARNING_CAPTURE2,
13116
13403
  IMPLEMENTATION_PLANNING2,
13117
13404
  MODULE_CONTEXT_REFINEMENT2,
13118
- EVIDENCE_VERIFICATION2
13405
+ EVIDENCE_VERIFICATION2,
13406
+ LEGACY_RISK_ASSESSMENT2
13119
13407
  ];
13120
13408
  var SKILL_GROUPS2 = {
13121
- delivery: ["work-item-refinement", "implementation-planning", "learning-capture", "evidence-verification"],
13409
+ delivery: ["work-item-refinement", "implementation-planning", "learning-capture", "evidence-verification", "legacy-risk-assessment"],
13122
13410
  tech: ["adr-writing", "ownership-suggestion", "graph-metadata-review", "module-context-refinement"],
13123
13411
  integration: ["capsule-writing"]
13124
13412
  };
@@ -13860,7 +14148,11 @@ Adapt priorities to the project state from the context pack:
13860
14148
  - **new** \u2014 prioritize foundational capabilities and initial product direction.
13861
14149
  - **pre-ai** \u2014 prioritize organizing existing capabilities and reducing knowledge gaps.
13862
14150
  - **legacy** \u2014 prioritize risk reduction, unknowns and safe modernization before feature
13863
- delivery.
14151
+ delivery. **Explicitly consult** \`knowledge/legacy/risks.md\`, \`knowledge/legacy/unknowns.md\`
14152
+ and \`knowledge/legacy/modernization-candidates.md\` when they exist. Every legacy risk
14153
+ (RISK-xxx) and modernization candidate (MOD-xxx) should be considered as a source signal
14154
+ for roadmap candidates. Reference them by their stable identifiers so downstream Work Items
14155
+ can trace back to the original finding.
13864
14156
 
13865
14157
  ## Grounding rules (VS-077)
13866
14158
 
@@ -13872,7 +14164,7 @@ Every candidate initiative must be **grounded** in the knowledge base \u2014 nev
13872
14164
  - **Related capabilities** \u2014 one or more existing/partial capabilities.
13873
14165
  - **Source signals** \u2014 at least one traceable reason: Capability Gap, Roadmap Candidate Signal, Risk,
13874
14166
  Open Question, Assumption, Deferred Decision, Tech Decision Candidate, ADR, Business Goal,
13875
- Operational Need or Legacy Modernization Signal.
14167
+ Operational Need, Legacy Modernization Signal, Legacy Risk (RISK-xxx) or Legacy Unknown (UNK-xxx).
13876
14168
  - **Expected value**, **Risks**, **Dependencies**, and **Suggested Work Items** (candidates only).
13877
14169
 
13878
14170
  Do **not** emit a candidate with no source signal. Keep initiatives at initiative granularity (small
@@ -13987,10 +14279,13 @@ var LEGACY_AGENT2 = `# Legacy Agent
13987
14279
  ## Role
13988
14280
 
13989
14281
  You are the Kaddo Legacy Agent. Your job is to analyze a legacy or risky project before
13990
- anyone changes it, using a Kaddo Context Pack.
14282
+ anyone changes it, using a Kaddo Context Pack enriched with scan signals and system
14283
+ topology.
13991
14284
 
13992
14285
  You do not write code. You surface risk, unknowns and safe first steps, marking
13993
- assumptions clearly.
14286
+ assumptions clearly. Your output feeds the downstream Kaddo lifecycle \u2014 roadmap, Work
14287
+ Items, Implementation Handoff, Evidence, Verification and Learning \u2014 so findings must be
14288
+ structured and traceable.
13994
14289
 
13995
14290
  ## When to Use
13996
14291
 
@@ -14001,26 +14296,45 @@ before planning modernization or changes.
14001
14296
 
14002
14297
  Provide \`.kaddo/context-pack.md\` as the primary input.
14003
14298
 
14004
- Optionally provide: incident history, known pain points, dependency manifests.
14299
+ Additionally consult (use whatever is available; mark missing sources as assumptions):
14300
+
14301
+ - \`.kaddo/scan.json\` \u2014 scan signals (auth, payments, webhooks, storage, background_jobs,
14302
+ email, database, migrations, api_routes, tests, security, infrastructure).
14303
+ - System Graph (\`.kaddo/graph.json\` / \`.kaddo/graph.mmd\`) \u2014 entity relationships and
14304
+ topology when available.
14305
+ - \`knowledge/tech/current-state.md\` \u2014 existing architecture baseline.
14306
+ - \`knowledge/product/capabilities.md\` \u2014 capability inventory with statuses and domains.
14307
+ - Incident history, known pain points, dependency manifests (if provided by the user).
14005
14308
 
14006
14309
  ## Expected Output
14007
14310
 
14008
- Markdown artifacts intended to be saved as:
14311
+ Three structured Markdown artifacts intended to be saved as:
14009
14312
 
14010
14313
  - \`knowledge/legacy/risks.md\`
14011
14314
  - \`knowledge/legacy/unknowns.md\`
14012
14315
  - \`knowledge/legacy/modernization-candidates.md\`
14013
14316
 
14014
- ## Instructions
14317
+ Each artifact uses Kaddo template format with front matter and structured entries that
14318
+ downstream agents (roadmap-agent, work-item-agent, implementation-agent) can reference.
14015
14319
 
14016
- Analyze the context pack and identify:
14320
+ ## Instructions
14017
14321
 
14018
- 1. Unknowns.
14019
- 2. Risky areas.
14020
- 3. Dependencies.
14021
- 4. Modernization candidates.
14022
- 5. Safe first steps.
14023
- 6. Areas requiring human validation.
14322
+ 1. **Ingest available signals.** Read scan results, context pack, system graph and any
14323
+ existing knowledge. Do not skip available sources.
14324
+ 2. **Identify risks.** For each risk, provide a stable identifier (RISK-001, RISK-002, ...),
14325
+ the affected area (file paths, modules, or system components), why it is risky, blast
14326
+ radius (local / module / cross-cutting / system-wide), confidence (high / medium / low),
14327
+ related scan signals, and a mitigation suggestion.
14328
+ 3. **Identify unknowns.** For each unknown, provide a stable identifier (UNK-001, UNK-002, ...),
14329
+ the question, why it matters, how to find out, and related risks (RISK-xxx references).
14330
+ 4. **Identify modernization candidates.** For each candidate, provide a stable identifier
14331
+ (MOD-001, MOD-002, ...), current state, target state, value, risk, suggested Knowledge
14332
+ Level (K1\u2013K4), related risks and unknowns, and affected system entities when the Graph
14333
+ is available.
14334
+ 5. **Identify dependencies** \u2014 external and internal dependencies that constrain changes.
14335
+ 6. **Propose safe first steps** \u2014 small, low-risk actions that reduce unknowns or risk.
14336
+ 7. **Flag areas requiring human validation** \u2014 decisions, assumptions or trade-offs that
14337
+ only a human can resolve.
14024
14338
 
14025
14339
  ## Constraints
14026
14340
 
@@ -14028,33 +14342,78 @@ Analyze the context pack and identify:
14028
14342
  - Prefer small, low-risk first steps.
14029
14343
  - Mark assumptions and confidence clearly.
14030
14344
  - Do not write code.
14345
+ - Every risk, unknown and modernization candidate must have a stable identifier (RISK-xxx,
14346
+ UNK-xxx, MOD-xxx) so downstream artifacts can reference them.
14347
+ - When System Graph topology is available, reference affected entities by their graph id.
14348
+ - Do not duplicate capability inventory work \u2014 reference \`capabilities.md\` when it exists.
14031
14349
 
14032
14350
  ## Output Format
14033
14351
 
14352
+ ### knowledge/legacy/risks.md
14353
+
14034
14354
  \`\`\`markdown
14035
- # Legacy Analysis
14355
+ ---
14356
+ type: legacy-risks
14357
+ generated_by: legacy-agent
14358
+ ---
14036
14359
 
14037
- Generated from Kaddo Context Pack.
14360
+ # Legacy Risks
14038
14361
 
14039
- ## Risks
14362
+ ## RISK-001: <Short title>
14040
14363
 
14041
- ### <Risk>
14364
+ - **Area:** <file paths, modules, or components>
14365
+ - **Why risky:** <explanation>
14366
+ - **Blast radius:** local | module | cross-cutting | system-wide
14367
+ - **Confidence:** high | medium | low
14368
+ - **Scan signals:** <related signals from scan.json, or "none detected">
14369
+ - **Graph entities:** <related system graph entities, or "Graph unavailable">
14370
+ - **Mitigation:** <suggested approach>
14042
14371
 
14043
- **Area:**
14372
+ ## RISK-002: ...
14373
+ \`\`\`
14044
14374
 
14045
- **Why it is risky:**
14375
+ ### knowledge/legacy/unknowns.md
14046
14376
 
14047
- **Confidence:**
14377
+ \`\`\`markdown
14378
+ ---
14379
+ type: legacy-unknowns
14380
+ generated_by: legacy-agent
14381
+ ---
14048
14382
 
14049
- ## Unknowns
14383
+ # Legacy Unknowns
14050
14384
 
14051
- ## Dependencies
14385
+ ## UNK-001: <Question>
14052
14386
 
14053
- ## Modernization Candidates
14387
+ - **Why it matters:** <impact if left unresolved>
14388
+ - **How to find out:** <investigation steps>
14389
+ - **Related risks:** RISK-001, RISK-003
14390
+ - **Blocking:** yes | no | unknown
14054
14391
 
14055
- ## Safe First Steps
14392
+ ## UNK-002: ...
14393
+ \`\`\`
14056
14394
 
14057
- ## Areas Requiring Human Validation
14395
+ ### knowledge/legacy/modernization-candidates.md
14396
+
14397
+ \`\`\`markdown
14398
+ ---
14399
+ type: modernization-candidates
14400
+ generated_by: legacy-agent
14401
+ ---
14402
+
14403
+ # Modernization Candidates
14404
+
14405
+ ## MOD-001: <Short title>
14406
+
14407
+ - **Current state:** <what exists today>
14408
+ - **Target state:** <desired outcome>
14409
+ - **Value:** <why this modernization matters>
14410
+ - **Risk:** low | medium | high
14411
+ - **Suggested Knowledge Level:** K1 | K2 | K3 | K4
14412
+ - **Related risks:** RISK-xxx
14413
+ - **Related unknowns:** UNK-xxx
14414
+ - **Affected entities:** <system graph entities, or "Graph unavailable">
14415
+
14416
+ ## MOD-002: ...
14058
14417
  \`\`\`
14059
14418
 
14060
14419
  ## Where to Save the Result
@@ -14065,10 +14424,15 @@ Save risks as \`knowledge/legacy/risks.md\`, unknowns as
14065
14424
 
14066
14425
  ## Quality Checklist
14067
14426
 
14068
- - Risks are backed by evidence.
14427
+ - Every risk has a stable RISK-xxx identifier, blast radius, and confidence level.
14428
+ - Every unknown has a stable UNK-xxx identifier and related risk references.
14429
+ - Every modernization candidate has a stable MOD-xxx identifier and Knowledge Level.
14430
+ - Scan signals are referenced when available \u2014 findings are grounded in detected signals.
14431
+ - System Graph entities are referenced when topology is available.
14069
14432
  - Safe first steps are small and low-risk.
14070
- - Unknowns are explicit.
14433
+ - Assumptions are marked explicitly with confidence.
14071
14434
  - Areas needing human validation are flagged.
14435
+ - Identifiers are unique and sequential within each artifact.
14072
14436
  `;
14073
14437
  var ADR_AGENT2 = `# ADR Agent
14074
14438
 
@@ -14290,6 +14654,14 @@ the decision is still a candidate in knowledge/tech/decision-candidates.md with
14290
14654
  that it should be materialized first (\`kaddo adr\` + the adr-writing skill) and record
14291
14655
  \`decision_candidates: [<title>]\` \u2014 do not implement work that depends on an unformalized decision
14292
14656
  without surfacing it. -->
14657
+
14658
+ **Related legacy findings:** <!-- for legacy projects (WI-012): when
14659
+ \`knowledge/legacy/risks.md\`, \`knowledge/legacy/unknowns.md\` or
14660
+ \`knowledge/legacy/modernization-candidates.md\` exist, check whether any findings (RISK-xxx,
14661
+ UNK-xxx, MOD-xxx) are relevant to this Work Item's scope. Add \`legacy_risks: [RISK-001, ...]\`
14662
+ and \`legacy_unknowns: [UNK-001, ...]\` to the front matter when applicable. Do NOT copy the full
14663
+ finding content \u2014 reference by identifier. Include relevant findings in the Scope unknowns
14664
+ section when they affect implementation decisions. -->
14293
14665
  \`\`\`
14294
14666
 
14295
14667
  ### Preserve roadmap metadata (VS-077 / VS-078)
@@ -16792,6 +17164,37 @@ function toNode(n, knowledgeByPath, wiModules, groupIds) {
16792
17164
  }
16793
17165
  return node;
16794
17166
  }
17167
+ var RISKS_PATH = "knowledge/legacy/risks.md";
17168
+ var UNKNOWNS_PATH = "knowledge/legacy/unknowns.md";
17169
+ var CANDIDATES_PATH = "knowledge/legacy/modernization-candidates.md";
17170
+ function hasLegacyKnowledge(dir) {
17171
+ return exists2(join3(dir, RISKS_PATH)) || exists2(join3(dir, UNKNOWNS_PATH)) || exists2(join3(dir, CANDIDATES_PATH));
17172
+ }
17173
+ var ID_PATTERN = /^##\s+(RISK-\d+|UNK-\d+|MOD-\d+)/gm;
17174
+ function extractIdentifiers(content, prefix) {
17175
+ const ids = [];
17176
+ for (const m2 of content.matchAll(ID_PATTERN)) {
17177
+ if (m2[1].startsWith(prefix)) ids.push(m2[1]);
17178
+ }
17179
+ return ids;
17180
+ }
17181
+ function readArtifact(dir, rel, prefix) {
17182
+ const abs = join3(dir, rel);
17183
+ if (!exists2(abs)) return { path: rel, exists: false, identifiers: [] };
17184
+ const content = readFile2(abs);
17185
+ return { path: rel, exists: true, identifiers: extractIdentifiers(content, prefix) };
17186
+ }
17187
+ function getLegacyKnowledgeSummary(dir) {
17188
+ const risks = readArtifact(dir, RISKS_PATH, "RISK-");
17189
+ const unknowns = readArtifact(dir, UNKNOWNS_PATH, "UNK-");
17190
+ const candidates = readArtifact(dir, CANDIDATES_PATH, "MOD-");
17191
+ return {
17192
+ available: risks.exists || unknowns.exists || candidates.exists,
17193
+ risks,
17194
+ unknowns,
17195
+ candidates
17196
+ };
17197
+ }
16795
17198
  var RECOMMENDED_AGENT = "work-item-agent";
16796
17199
  var RECOMMENDED_SKILL = "work-item-refinement";
16797
17200
  function buildRefinementHandoff(dir, workItemId) {
@@ -16839,6 +17242,19 @@ function buildRefinementHandoff(dir, workItemId) {
16839
17242
  "repository, Knowledge and mapped modules \u2014 the Graph is enrichment, not a prerequisite."
16840
17243
  );
16841
17244
  }
17245
+ if (hasLegacyKnowledge(dir)) {
17246
+ lines.push(
17247
+ "",
17248
+ "This is a legacy project with existing legacy analysis. When refining, consult:",
17249
+ "- `knowledge/legacy/risks.md` \u2014 known risks (RISK-xxx identifiers).",
17250
+ "- `knowledge/legacy/unknowns.md` \u2014 known unknowns (UNK-xxx identifiers).",
17251
+ "- `knowledge/legacy/modernization-candidates.md` \u2014 modernization candidates (MOD-xxx identifiers).",
17252
+ "",
17253
+ "Reference only the findings relevant to this Work Item's scope \u2014 do not copy all legacy",
17254
+ "knowledge into the Work Item. Add `legacy_risks` and `legacy_unknowns` to the front matter",
17255
+ "when applicable, using the stable identifiers (e.g. `legacy_risks: [RISK-001, RISK-003]`)."
17256
+ );
17257
+ }
16842
17258
  lines.push(
16843
17259
  "",
16844
17260
  `Update the canonical Work Item ${wi.id} with:`,
@@ -16951,6 +17367,37 @@ function buildImplementationHandoff(dir, workItemId) {
16951
17367
  "4. inspect the actual implementation in the repository for each candidate."
16952
17368
  );
16953
17369
  }
17370
+ const legacy = getLegacyKnowledgeSummary(dir);
17371
+ if (legacy.available) {
17372
+ lines.push(
17373
+ "",
17374
+ "--- Legacy Context ---",
17375
+ "",
17376
+ "This project has legacy analysis knowledge. Before implementing, consult the relevant",
17377
+ "legacy findings for the areas this Work Item will modify:"
17378
+ );
17379
+ if (legacy.risks.exists) {
17380
+ lines.push(
17381
+ `- Risks (${legacy.risks.identifiers.length} findings): \`${legacy.risks.path}\``
17382
+ );
17383
+ }
17384
+ if (legacy.unknowns.exists) {
17385
+ lines.push(
17386
+ `- Unknowns (${legacy.unknowns.identifiers.length} findings): \`${legacy.unknowns.path}\``
17387
+ );
17388
+ }
17389
+ if (legacy.candidates.exists) {
17390
+ lines.push(
17391
+ `- Modernization candidates (${legacy.candidates.identifiers.length} findings): \`${legacy.candidates.path}\``
17392
+ );
17393
+ }
17394
+ lines.push(
17395
+ "",
17396
+ "Reference relevant findings by their stable identifiers (RISK-xxx, UNK-xxx, MOD-xxx).",
17397
+ "Highlight risks that intersect with the areas to be modified in the Design Deliberation.",
17398
+ "Do not copy all legacy knowledge \u2014 assemble proportionally to scope."
17399
+ );
17400
+ }
16954
17401
  lines.push(
16955
17402
  "",
16956
17403
  "--- Implementation Plan ---",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaddo/mcp",
3
- "version": "3.97.0",
3
+ "version": "3.99.0",
4
4
  "description": "MCP server for Kaddo project knowledge: read-only resources/tools/prompts plus safe derived generation under .kaddo/.",
5
5
  "license": "MIT",
6
6
  "repository": {