> This page location: Docs > Reference > Models > Optimize a Model
> Full index for agents: https://www.semantius.com/llms.txt

# Optimize a Model

> Reverse-engineer a live Semantius module back into a markdown spec, then audit and refine it.

- **URL**: https://www.semantius.com/docs/models/optimize

---

The `/semantic-model-optimizer` [agent skill](https://www.semantius.com/docs/agent-skills.md) closes the loop in the [model lifecycle](https://www.semantius.com/docs/models.md). It reads a live Semantius module and writes a `*-semantic-model.md` file that is byte-compatible with the format the [Business Analyst](https://www.semantius.com/docs/models/create.md) produces and the [Deployer](https://www.semantius.com/docs/models/deploy.md) consumes. From there you can audit it, refine it, and ship the corrected version back.

## Optimize a Live Module

Point the skill at a module by its slug, or let it list everything that is live and pick:

```text
/semantic-model-optimizer extract the crm module
```

```text
/semantic-model-optimizer snapshot the helpdesk module to a markdown spec
```

```text
/semantic-model-optimizer the live hris has drifted, regenerate the spec and suggest optimizations
```

## Why You Need It

Once a platform is live, people customize it: a teammate adds a field in the Semantius UI, an admin renames a label, an integration introduces a new enum value. The original markdown spec quietly drifts away from reality. The optimizer reads what is actually live and produces a fresh spec that reflects it, so the rest of the toolchain stays in sync.

## How It Works

1. **Pick a module.** Name one directly or browse the list.
2. **Read the live state.** The skill pulls the module's entities, fields, descriptions, label columns, audit-log settings, and enum values via the Semantius CLI.
3. **Pull in related tables.** Any table referenced from the module (other modules, built-ins like `users`) is included so the resulting model is self-contained.
4. **Write the markdown.** The skill produces the file with the right front-matter, a regenerated Mermaid entity-relationship diagram, an enumerations section, and implementation notes that flag external entities for the deployer.

The skill is **read-only against Semantius**: it never writes to the platform.

## Audit and Redeploy

Once the file is saved, you can opt in to an audit pass that flags missing label columns, FK-as-label-column traps, singular `table_name` violations, missing descriptions, and other drift artifacts. Apply the fixes to the markdown, and the [Deployer](https://www.semantius.com/docs/models/deploy.md) can roll the corrected shape back to Semantius, completing the loop. If you want to expand the model further before redeploying, point the [Business Analyst](https://www.semantius.com/docs/models/create.md) at the optimized file in customize or extend mode.

## Get the Skill

Install the Semantius CLI and the [agent skills](https://www.semantius.com/docs/agent-skills.md) bundle to add this skill to your agent.

[Install the Agent Skills →](https://www.semantius.com/docs/agent-skills/installation.md)

---

## Related

- [Deploy](https://www.semantius.com/docs/models/deploy.md)
- [Business Logic](https://www.semantius.com/docs/business-logic.md)
- [Docs home](https://www.semantius.com/docs.md)
- [Full index for agents](https://www.semantius.com/llms.txt)
