Hexagonal.Refactor

Hexagonal.Refactor is a command for Cursor from redhat-community-ai-tools/UnifAI. It costs 0 tokens per session (808 once invoked), scanned A, original, Apache-2.0.

A code-fixing command that follows hexagonal architecture, a design where business rules are kept separate from databases, web frameworks, and other outside systems. It preserves the existing structure and dependency direction.

In plain words
What is it for?
Use it to repair the current branch while keeping domain code independent and connecting outside systems through defined ports.
Why use it?
It helps fix reported issues without putting business logic in controllers, repositories, or external-system code, or creating duplicated and inconsistent patterns.

Command for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/redhat-community-ai-tools/unifai/hexagonal.refactor
Clone the repo
git clone --depth 1 https://github.com/redhat-community-ai-tools/UnifAI

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for Hexagonal.Refactor

README.md
[![agentmods](https://agentmods.dev/badge/commands/redhat-community-ai-tools/unifai/hexagonal.refactor.svg)](https://agentmods.dev/commands/redhat-community-ai-tools/unifai/hexagonal.refactor)
Your own site
<a href="https://agentmods.dev/commands/redhat-community-ai-tools/unifai/hexagonal.refactor"><img src="https://agentmods.dev/badge/commands/redhat-community-ai-tools/unifai/hexagonal.refactor.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 808 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.00808
Opus 5 $0.00000 $0.00404
Sonnet 5 $0.00000 $0.00162
Haiku 4.5 $0.00000 $0.00081

Measured 5d ago against content hash de545f54756d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

Hexagonal.Refactor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/commands/Hexagonal.Refactor.md · 159 lines

How it starts

The opening of the file, as written. The whole thing — 159 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Your task is to fix the reported issues in the current branch.

You must strictly: Follow Hexagonal Architecture (Ports & Adapters) Follow the existing codebase patterns Avoid architectural drift Avoid duplication Avoid mockups or placeholder implementations Reuse existing components when possible You are not allowed to introduce new patterns unless absolutely required and aligned with the codebase

🎯 Primary Objectives Fix all reported issues correctly Preserve architectural boundaries Keep strict dependency direction Maintain consistency with the existing project structure Improve efficiency where possible Avoid code duplication Reuse existing services, utilities, mappers, helpers, or abstractions

🏗 Architectural Enforcement (STRICT) You MUST ensure:

1️⃣ Dependency Direction Adapters → Application → Domain Domain must not depend on infrastructure No framework logic in domain No direct DB or HTTP usage in domain Use ports for external communication If a fix requires cross-layer access → refactor using proper ports

2️⃣ No Business Logic Leakage No business logic in controllers No business logic in repositories No business logic in adapters Business rules belong in Domain

3️⃣ Reusability Enforcement Before adding new code: Check if similar logic already exists Reuse existing utilities Reuse existing error handling strategy Reuse existing logging pattern Reuse existing mapper strategy Reuse existing base classes if available If reusable logic exists → use it Do NOT duplicate code

4️⃣ No Mock Implementations No TODO placeholders No temporary stubs No mock returns No fake implementations No simplified shortcuts All fixes must be production-ready

5️⃣ Codebase Alignment You MUST match: Naming conventions Folder structure File organization Logging style Exception handling pattern Dependency injection style Repository pattern used in the project DTO mapping approach used in the project If unsure → follow the dominant pattern

🧹 Mandatory Refactor & Cleanup Enforcement (STRICT) When modifying or refactoring logic, you MUST:

1️⃣ Replace — Not Layer If logic changes → fully replace the old implementation Do NOT stack new logic on top of old logic Do NOT keep fallback paths unless explicitly required

2️⃣ Remove Obsolete Code Delete previous implementations that are no longer used Remove dead code branches Remove unused methods Remove unused classes Remove unused interfaces Remove unused imports Remove obsolete DTOs / mappers if no longer needed

3️⃣ No Commented Leftovers Do NOT comment out old logic Do NOT keep legacy code blocks Do NOT leave TODO markers for removed logic

4️⃣ Consistency Verification After changes, verify: No duplicate logic exists No parallel implementations exist No unused dependencies remain The feature has a single clear execution path Keeping obsolete or duplicated logic is considered a failure.

✨ Efficiency & Clean Code While fixing: Remove duplication Remove dead code Avoid unnecessary abstractions Avoid over-engineering Keep methods focused Maintain SRP Improve readability Do NOT introduce architectural changes unless required to fix violations

📌 Required Output Format You MUST respond with:

1️⃣ Summary of Fix Strategy Explain how you approached the fix.

2️⃣ Detailed Changes For each issue: What was wrong Why it violated architecture or codebase rules What was changed Why the new implementation is correct

3️⃣ Reuse Validation List reusable components leveraged.

4️⃣ Duplication Check Confirm whether duplication was removed or avoided.

5️⃣ Architecture Validation Confirm: Dependency direction respected Layer separation maintained No business logic leakage

6️⃣ Final Integrity Check Confirm: No mockups No temporary fixes Production-ready code

🚫 Forbidden Actions Do NOT introduce new architectural styles Do NOT move business logic outside the Domain Do NOT duplicate code Do NOT bypass ports Do NOT simplify logic just to pass review Do NOT change unrelated parts of the system

🎯 Mindset You are fixing code for a: Production system Long-term maintainable architecture Scalable application

Read the full file on GitHub · 159 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 159 lines · 0 tokens per session scan A de545f54756d

Subscribe to this mod's changes

Hexagonal.Refactor is a command published in the GitHub repository redhat-community-ai-tools/UnifAI (44 stars, last pushed 2d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 808 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.