Skip to main content
A use case’s architecture model is what threat modeling and the architecture compliance checks run on. An agent on the Keldyn MCP server can infer it from the repo: technical assets, data assets, trust boundaries, shared runtimes, communication links. Then it saves the model and analyzes it. You stay in the editor.
The generate-architecture prompt models your system from the code and config it can inspect, not from a questionnaire. Run the agent from the repository you want to model so it can read your source.

What you’ll use

Before you start

1

Connect the MCP server

Follow Keldyn MCP server to connect your AI tool and sign in to the team that owns the target use case.
2

Open the repository

Start the agent from the repo (or monorepo) you want to model, so it can list and read your files.
3

Have a use case ready

Know which use case the architecture belongs to. If you don’t pass one, the agent will list your use cases and ask you to choose before saving.

1. Generate the model

Invoke the generate-architecture prompt. It accepts three optional arguments:
Behind the scenes the agent will:
1

Map the system from code

List tracked files (e.g. git ls-files), then read entrypoints, service boundaries, APIs, data stores, auth, queues, external integrations, and infra/config: restricted to your scope if you set one.
2

Use the real schema for enums

Read the keldyn://threagile-schema resource for allowed property names and enum values (rather than guessing), including production-required root fields like business_criticality.
3

Save via the tool

Call update-use-case-architecture with the architectureData object and your useCaseId, and report back the useCaseName and whether success was true.
The model should reflect only assets and links you can justify from the code: the prompt explicitly avoids inventing services that aren’t evidenced. If the agent proposes something you don’t recognize, ask it to cite the file it inferred it from.
Infrastructure-as-code counts as evidence too. If your repository defines infrastructure with Terraform (or similar), tell the agent to read it: files like *.tf, *.tfvars, and modules describe your real deployed topology (VPCs and subnets → trust boundaries, managed databases and buckets → data stores, load balancers/queues/functions → technical assets, security groups → communication links). Point the scope and instructions at them so the model is grounded in what’s actually provisioned:
If saving fails schema validation, the agent re-reads keldyn://threagile-schema, fixes the model, and retries update-use-case-architecture once. Pasting the JSON into chat is not enough: the model only persists when the tool call succeeds.

2. Analyze the architecture

Once a model is saved, run analyze-use-case-architecture to threat-model it and check it against your frameworks in one pass.
It returns a unified, most-severe-first list of issues combining two sources:
  • Security risks (from Threagile): each with severity, CWE, STRIDE category, and the affected asset.
  • Compliance failures (failed RCM architecture checks): each with the frameworkName and rcmId it violates.
Every issue includes a proposedEdit: a natural-language remediation the agent can turn into an architecture change.
Analysis requires a saved architecture: run generate-architecture / update-use-case-architecture first. Issues are capped at 32 per call; when more remain, the result flags truncated with a remainingIssues count so you fix a batch at a time.

3. Remediate and re-verify

Architecture hardening is a loop: fix a batch of issues, save, and re-run to confirm they cleared and fetch the next batch.
1

Turn proposed edits into model changes

For each issue, convert its proposedEdit into a concrete change to the architecture object (e.g. add an encryption protocol on a link, introduce a trust boundary, tag a data asset).
2

Save the updated model

Call update-use-case-architecture with the revised architectureData.
3

Re-run the analysis

Call analyze-use-case-architecture again to verify the fixed issues are gone and pull any remaining ones.
Don’t try to fix hundreds of issues at once. Work the returned batch (up to 32), re-run, and repeat: the tool is designed for this incremental loop.

Keeping the model current

Re-run generate-architecture, or edit with update-use-case-architecture, after you add a service, a data store, or an integration. Stale models produce stale findings. The controls-to-code workflow closes architecture checks against whatever model is saved, so a wrong model closes the wrong gaps.

Next steps

Resolve architecture risks (CWEs)

Give every Threagile risk from this analysis a documented disposition.

From controls to code

Read your controls, analyze code for evidence, and close gaps with tasks.

Keldyn MCP server

Connect your AI tool and see the full catalog of tools and prompts.

Working with a use case

Explore the Architecture Workspace and track control progress in the app.

Frameworks & controls

See how architecture checks feed control coverage and maturity.