replicube-deoptimization-rule

replicube-deoptimization-rule is a cursor rule for Cursor from Kartones/replicube-game-solutions. It costs 0 tokens per session (1,515 once invoked), scanned A, original, Unlicense.

A rule for turning shortened or optimized Replicube Lua code back into clearer, more readable code.

In plain words
What is it for?
Use it when asked to deoptimize or make Replicube Lua readable, including expanding conditional returns and naming repeated calculations.
Why use it?
Optimized code can be harder to understand because conditions and repeated calculations are compressed into fewer expressions.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/. Also seen: mentions Cursor.

Good fit Use it when asked to deoptimize or make Replicube Lua readable, including…

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/kartones/replicube-game-solutions/replicube-deoptimization-rule
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.

Clone the repo
git clone --depth 1 https://github.com/Kartones/replicube-game-solutions

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 replicube-deoptimization-rule

README.md
[![agentmods](https://agentmods.dev/badge/rules/kartones/replicube-game-solutions/replicube-deoptimization-rule.svg)](https://agentmods.dev/rules/kartones/replicube-game-solutions/replicube-deoptimization-rule)
Your own site
<a href="https://agentmods.dev/rules/kartones/replicube-game-solutions/replicube-deoptimization-rule"><img src="https://agentmods.dev/badge/rules/kartones/replicube-game-solutions/replicube-deoptimization-rule.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,515 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.01515
Opus 5 $0.00000 $0.00758
Sonnet 5 $0.00000 $0.00303
Haiku 4.5 $0.00000 $0.00152

Measured 7d ago against content hash 115c9de69c22, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

replicube-deoptimization-rule 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 7d 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/rules/replicube-deoptimization-rule.mdc · 238 lines

How it starts

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

Replicube Code Deoptimization Rule

Purpose

Convert optimized Replicube LUA code into human-readable format by reversing the optimization techniques described in coding.md.

Cursor Rule

When asked to "deoptimize" or "make readable" Replicube LUA code, apply these transformations:

Convert Ternary-like Returns to If-Else Statements

From: return condition and value or 0 To:

if condition then
  return value
end
return 0

From: return condition and value (implicit or 0) To:

if condition then
  return value
end
return 0

Convert Complex Boolean Returns to If-Else

From: return x == y and y == z and 11 or 0 To:

if x == y and y == z then
  return 11
end
return 0

Extract Repeated Calculations to Variables

From: Multiple occurrences of x*x. There must be AT MINIMUM 2 occurrences of each case to extract it, else do NOT extract to a variable. Example:

if x*x > 2 and y*y > 4 then
  -- some code
end
if x*x > 3 and y*y < 6 then
  -- some other code
end

To:

local x_squared = x * x
local y_squared = y * y

if x_squared > 2 and y_squared > 4 then
  -- some code
end
if x_squared > 3 and y_squared < 6 then
  -- some other code
end

Example (of non-conversion due to only a single occurrence): From:

if x*x > 2 and y*y > 4 then
  -- some code
end

To:

-- code is unchanged
if x*x > 2 and y*y > 4 then
  -- some code
end

Add Local Scope for Readability

From: Variables without local scope To: Add local keyword for better readability (even if it increases instruction count)

Prefer abs(x) instead of x*x

From: x*x == squared_value_of_x (optimized absolute value comparison) To: abs(x) == value_of_x or explicit absolute value logic

From: x*x + z*z < value (squared distance calculations) To: Consider if this represents abs(x) + abs(z) < threshold (Manhattan distance) or keep as Euclidean distance.

Note: When x*x appears to be used for absolute value comparisons (especially in small integer ranges), convert back to abs(x) for clarity, taking into account to also update the value compared with. This includes local variables (feel free to rename them accordingly). Example: From:

local x_squared = x*x
local y_squared = y*y

if x_squared < 4 and y_squared < 4 then
  return PEACH
end

to:

local x_abs = abs(x)
local y_abs = abs(y)

if x_abs < 2 and y_abs < 2 then
  return PEACH
end

Another example: From:

if y * y > x * x then
  return YELLOW
end

To:

if abs(y) > abs(x) then
  return YELLOW
end

Read the full file on GitHub · 238 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. 7d ago First seen · 238 lines · 0 tokens per session scan A 115c9de69c22

Subscribe to this mod's changes

replicube-deoptimization-rule is a cursor rule published in the GitHub repository Kartones/replicube-game-solutions (14 stars, last pushed 1y ago), licensed Unlicense. It costs nothing until one of its globs matches a file; then it loads 1,515 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.