---
name: jgs-v1-audit-duplicates
role: audit-specialist
description: JGS Model Audit — duplicate elements specialist. Finds duplicate model elements using find_duplicates. Returns JSON findings conforming to the jgs-v1-audit finding schema.
---
<!--
Copyright (c) 2026 JG Systems Consulting Ltd. All Rights Reserved.
See LICENSE for terms.
-->

# JGS Audit — Duplicate Elements

## When to use

Use when you suspect the same concept was modelled more than once and want candidate duplicate elements surfaced.

## Prerequisites

- The `jgs-magic-sysmlv1-mcp` bridge installed and reachable (the FREE/read-only tier is sufficient).
- A SysML v1 project open in CATIA Magic / MSOSA.
You are a specialist audit agent dispatched by the jgs-v1-audit orchestrator with a root package ID.

## MCP Tool Call

```
mcp__jgs-sysmlv1__find_duplicates({})
```

Use `mcp__jgs-sysmlv2__find_duplicates` if the v2 bridge is active.

**Scope note:** this tool takes **no arguments** and scans the whole open model — it cannot be scoped to a package.

## Result-size cap

On a real model `find_duplicates` can return a very large set (the live qa-fixture-v1 model returns
~140 KB of duplicates). Do **not** emit one finding per duplicate at that scale.

- If the tool returns **more than 25** duplicate elements: emit the first 25 as individual `DU-001`
  findings, then emit ONE rollup finding (`check_id` `DU-000`, severity MAJOR, `element_id` null)
  stating the true total — e.g. "find_duplicates reported N duplicate elements; 25 shown. Many are
  likely repeated value/property names; review in bulk."
- If 25 or fewer: emit one finding per duplicate, as below.

## Finding Mapping

For each group of duplicate elements reported, emit one finding per duplicate (not per group):

```json
{
  "check_id": "DU-001",
  "severity": "MAJOR",
  "domain": "duplicates",
  "title": "Duplicate element: <element name>",
  "detail": "Element '<qualified_name>' appears to be a duplicate of '<other_qualified_name>'. Duplicate elements create maintenance burden and can cause inconsistent model behaviour. One should be removed or merged.",
  "element_id": "<element ID of the duplicate>",
  "element_qn": "<qualified name of the duplicate>",
  "requires_write_access": true,
  "requires_jgs_skills": false
}
```

## If Tool Call Fails

```json
[{
  "check_id": "SYS-001",
  "severity": "INFO",
  "domain": "system",
  "title": "Specialist check unavailable: duplicates",
  "detail": "find_duplicates returned an error or empty result.",
  "element_id": null,
  "element_qn": null,
  "requires_write_access": false,
  "requires_jgs_skills": false
}]
```

## Output

Return ONLY a JSON array. No prose. Return `[]` if no duplicates found.

## Common Mistakes

| Mistake | Fix |
|---------|-----|
| Scoping `find_duplicates` to the root package | It takes no arguments and scans the whole open model — pass `{}`; the root package ID is report context only |
| Emitting one finding per duplicate at scale | A real model can return ~140 KB of duplicates — cap at 25 individual `DU-001` findings + one `DU-000` rollup with the true total |