01 / 25
T

betterCode() GenAI Summit

Legacy analysis is
not a prompt

Claude Code, MCP Gateway, skills, subagents, dynamic context, and gates.

Bridge from Laura & Sigrid

From modernization frame
to analysis harness

Laura and Sigrid set the modernization frame. We go one layer deeper: the agent workflow.

01

Reverse Engineering

Recover architecture, behavior, risks, and owners.

02

Forward Engineering

Derive target design, tests, and migration seams.

03

What you can copy

Pattern matrix, evidence contract, review gate.

Our focus

No dump and rewrite
evidence pipeline

The model reasons. The harness controls context, tools, artifacts, and gates.

What we avoid
  • Repo dump, tool dump, vague goal.
  • Rewrite proposal without decision artifacts.
  • Confidence without executed checks.
What we build
  • Load context at the decision point.
  • Subagents return referenced evidence.
  • Tests, security checks, owner review.

Context strategy

Do not dump everything
build the right context

Better agents are not fed more material up front. They get the right material at the decision point.

01

Select

Load only the files, tools, skills, and references needed for the current decision.

02

Structure

Turn noisy exploration into contracts, artifacts, and open questions.

03

Review

Make evidence inspectable so engineers can challenge assumptions before rollout.

This is the short version. The routing trade-off comes back in depth.

Audience reality check

Why sessions
get worse

The agent does not forget. It keeps too much.

01

Instructions

System prompt, project rules, safety policy.

02

Tool contracts

Schemas loaded before evidence exists.

03

Exploration

Files, grep results, logs, failed tests.

04

Conversation

Plans, corrections, detours, assumptions.

05

Summaries

Compressed memory with missing nuance.

Context mechanics

The Context Window
keeps growing

History, schemas, file reads, tests, and summaries share one attention budget.

Turn 1
The beginning
systemCLAUDE.md + MCP schemas
useranalyze CatalogService
+
Turn 5
After exploration
systemCLAUDE.md + MCP schemas
useranalyze CatalogService
toolread CatalogService.cs
agentmapped 1,330 nodes, 66 communities
usernow add test strategy

Core trade-off

Load everything?
Or route on demand?

Static
  • Repo, docs, schemas, summaries up front.
  • Simple flow, expensive attention.
  • Noise crowds out migration signals.
Dynamic
  • Discover files, tools, skills, and docs at the decision point.
  • Needs orchestration, output contracts, and merge logic.
  • Keeps the main context focused on evidence and decisions.

Target architecture

Legacy code in
decision artifacts

01 Input

Legacy System

CatalogService, tests, logs, dependency metadata.

02 Orchestrator

Claude Code

Plans the workflow, routes evidence requests, and protects main context.

03 Dynamic context

MCP + Skills + Subagents

MCP-discovered tool contracts
Reusable skill procedures
Fresh context windows for specialists
04 Output

Decision artifacts

Architecture Map, Risk Table, Test-Gap Report, Migration Decision, Review Gates.

Pattern selection

Which pattern
for which job?

If you need
Use
Return
Deterministic capability
MCP Tool / CLI
Graphify dependency slice
Reusable analysis method
Skill
Catalog risk checklist
Noisy repo exploration
Subagent
Referenced evidence contract
Risky action
Hook / Gate
CI result + owner review
Final synthesis
Orchestrator
Strangler/rewrite decision

MCP Gateway

Gateway is governance
not context magic

Wrong expectation

enable many servers
reload whole session context
call it context optimization
hope the model sorts it out

Governance role

central tool catalog
application-level access
user and data policy
auditable tool usage

Gateway config decides which users may access which applications, tools, and evidence sources.

Subagents

Subagents create
fresh Context Windows

Main

Orchestrator

Keeps interaction, task graph, and synthesis together.

->
Specialists

Fresh windows

architecture.extract()
dependency.map()
test_gap.scan()
risk.score()
Return

Evidence contract

Findings, references, confidence, gaps, artifacts.

Subagent trade-offs

Delegation buys focus
but risks summary loss

Benefits
  • Fresh context per specialist.
  • Parallel architecture, risk, and test-gap work.
  • Main thread stays decision-focused.
Downsides
  • Evidence can disappear in summaries.
  • Specialists cannot clarify with users.
  • Repeatable tasks deserve reusable skills.

Transition: when the method repeats, package the method as a skill.

Skills

Skills load knowledge
just in time

Repeatable specialist work becomes reusable method knowledge.

Configured once

Metadata ~50 tokens

Agent knows which reusable methods exist.

Called dynamically

SKILL.md on relevance

Like a command: load the procedure when the task matches.

Own context

Domain knowledge + templates

References and templates stay out of main context until needed.

Many tasks that used to need a specialist subagent can become a reusable skill.

Artifact-first review

Artifacts
beat optimism

Artifacts let different engineers inspect different parts of the migration argument.

01

Old codebase

Referenced source, tests, configuration, and runtime assumptions.

02

Old architecture map

Current boundaries, dependencies, and operational coupling.

03

Target architecture map

Proposed seams, ownership, rollback, and integration contracts.

04

Findings & report

Evidence, assumptions, confidence, and post-migration test gaps.

Quality Hooks

Quality Hooks
turn checks into controls

ctx

Inject / enforce context

Load required project state, architecture rules, or migration policy before risky steps.

skill

Force the right skill

Require validation, architecture, or discovery skills for matching tasks.

read

Guard file reads

Detect secrets and sensitive files before they enter the agent context.

Instructions are not controls. Hooks make the harness enforceable.

Artifact 1

Architecture Map
from evidence

Input

CatalogService

Controllers, services, EF model, DI wiring.

Subagent

architecture.extract()

Finds layer boundaries from evidence.

Output

Layers & seams

Web/MVC, Catalog service, Domain model, EF data access, Composition root.

Review

Owner questions

Which team can operate, deploy and roll it back?

Verification

Trust comes from
verification layers

01

Deterministic checks

Build proven, spec traceability complete, test job still needs follow-up.

02

LLM review

Flags semantic deltas; never replaces tests.

03

Owner decision

Humans accept risk and approve rollout.

Limits and pitfalls

LLMs are always
dynamic

The harness reduces risk. It does not make model output deterministic truth.

01

Polished artifact

Weak evidence can hide behind a clean table.

02

Confident summary

Minority findings disappear when the return contract is vague.

03

Passing syntax

Business invariants can still be broken.

The fix is not more confidence. The fix is stronger evidence and explicit review.

Design principles & learnings

Build the
analysis harness

01

Context is an interface

Purpose, cost, owner, expiry.

02

Tool contracts are budget

Schemas spend attention.

03

Artifacts need contracts

Evidence, confidence, assumptions.

04

Gates are controls

Tests, security, owner review.

05

Humans own risk

Teams approve and operate.

Invest in harness patterns, not bigger prompts.

Demo evidence

Demo run
overview

Start with the run summary: what executed, what passed, and which artifacts exist.

Demo evidence

Pipeline
from discovery to validation

The run is not a single prompt. It is a staged workflow with explicit outputs.

Demo evidence

Specs & target
before code

The target shape is captured as artifacts before implementation claims are trusted.

Demo evidence

Evidence artifacts
not just prose

The result is inspectable: reports, references, checks, and gaps survive the chat.

T

Live demo

Demo
eShop Catalog

One catalog service. Five artifacts. One review gate.

1Assessment
2Architecture Map
3Risk Table
4Test-Gap Report
5Review Gate
Live agent workflow

Closing

Fazit

01

Dynamic context

Load tools, files, and skills when a decision needs them.

02

Contracts & artifacts

Every finding returns references, confidence, assumptions, and gaps.

03

Evidence-based results

Tests, build evidence, security checks, and owner review carry the risk decision.

Context & Harness are Keys to success.