been quiet on twitter lately, been working on the future.
you been doing some vibecoding? but a few days into your project, you're not encapsulated, you're regressing, getting ghosts and drifting?
so you make your prompts like this (see right below), which take a lot of time, then you have to deep audit after, before next microchunk. (What IF YOU could automate 90% of vibecoding into AAA studio automated output with self auditing, risk scoring, and patch implementation? Working on something..
CAPTURE KINGDOM — ENGINE EXECUTION PROMPT
CHUNK 2C — COMMAND ROUTER AUTHORITY SUCCESS SEMANTICS LOCK
(AAA LOCKSTEP CONTINUATION)
BOOTSTRAP ACKNOWLEDGEMENT REQUIRED:
Constitution loaded ✔
Additive-only edits ✔
Determinism unchanged ✔
Output integrity active ✔
(NO truncation. NO summaries. NO ellipses.)
================================================================
ENGINE LAW — DO NOT INTERPRET
================================================================
This task hardens the command routing architecture.
Goal:
- Establish canonical router handler shape for all future commands.
- Remove ambiguity: “Ok” is reserved for “authoritative mutation applied.”
- Preserve determinism and sealed engine layers.
Rules:
- AdvanceTick remains the sole authoritative boundary.
- TickIndex advances every tick regardless of command validity.
- Step advances only when handler returns Ok AND Kind != Noop (already implemented).
- Tick owns hash cleanliness. Handlers MUST NEVER call RecomputeAndStoreHash.
- No gameplay commands in 2C.
If repository reality conflicts with this prompt:
STOP and REPORT. DO NOT ADAPT.
================================================================
SCOPE LOCK (HARD)
================================================================
ONLY THESE FILES MAY CHANGE:
1) Assets/Scripts/Sim/Core/SimState.cs
2) Tests/CaptureKingdom.Sim.Tests/SimDeterminismTests.cs
Command.cs MUST NOT change in 2C.
If Command.cs changes: STOP immediately.
If ANY other file changes: STOP immediately.
================================================================
GLOBAL HARD RULES
================================================================
• Hash algorithm/inputs/order MUST NOT change.
• No Unity references added to Sim.
• No refactors.
• No formatting outside touched hunks.
• No new public APIs.
• No strings/exceptions for normal invalid input.
• No direct SimGrid mutation in handlers.
• Do not modify AdvanceTick in 2C (unless required for compilation due to private handler signature mismatch).
Violation → STOP.
================================================================
PHASE 0 — CLEAN REPO GATE
================================================================
cd "C:\Users\evanh\Downloads\Capture_Kingdom"
git status --porcelain
git diff --name-only
If output NOT empty: STOP.
================================================================
PHASE 1 — ZIP TRUTH ANCHORS (NO EDITS)
================================================================
cd "C:\Users\evanh\Downloads\Capture_Kingdom"
$sim="Assets/Scripts/Sim/Core/SimState.cs"
$h1=(Select-String -Path
$sim -SimpleMatch "public SimCommandResult AdvanceTick(SimCommand cmd, Rng rng)")
"AdvanceTick_SIG_COUNT=" $h1.Count
$h1 | ForEach-Object { " LINE $($_.LineNumber): $($_.Line.Trim())" }
$h2=(Select-String -Path
$sim -SimpleMatch "private SimCommandResult ApplyCommandInternal(SimCommand cmd, Rng rng)")
"ApplyInternal_SIG_COUNT=" $h2.Count
$h2 | ForEach-Object { " LINE $($_.LineNumber): $($_.Line.Trim())" }
$h3=(Select-String -Path
$sim -SimpleMatch "switch (cmd.Kind)")
"SWITCH_COUNT=" $h3.Count
$h3 | ForEach-Object { " LINE $($_.LineNumber): $($_.Line.Trim())" }
Requirement: all three counts == 1.
If any count != 1: STOP and report.
================================================================
PHASE 2 — DUPLICATION GUARDS (NO EDITS YET)
================================================================
We will add exactly these private names in SimState.cs:
- HandleNoop
- HandleInvalid
- HandleUnknownKind
- ENGINE LAW — COMMAND HANDLER CONTRACT
Counts must be 0 before insertion:
cd "C:\Users\evanh\Downloads\Capture_Kingdom"
(Select-String -Path
$sim -SimpleMatch "HandleNoop").Count
(Select-String -Path
$sim -SimpleMatch "HandleInvalid").Count
(Select-String -Path
$sim -SimpleMatch "HandleUnknownKind").Count
(Select-String -Path
$sim -SimpleMatch "ENGINE LAW — COMMAND HANDLER CONTRACT").Count
If any non-zero: STOP and print matching lines.
================================================================
PHASE 3 — IMPLEMENT ROUTER HANDLER SHAPE (SimState.cs)
================================================================
NO-TOUCH REGIONS:
- Do not edit ComputeHash64Snapshot or any hashing code.
- Do not edit SimGrid/structures/units logic.
- Do not edit legality seams.
- Do not edit AdvanceTick logic other than strictly necessary compilation fixes.
Insertion site rule:
- Insert the new comment private handlers immediately ABOVE ApplyCommandInternal
(the line you proved in Phase 1).
3A) Insert EXACT comment block:
// ENGINE LAW — COMMAND HANDLER CONTRACT
// - ApplyCommandInternal is the sole routing point for commands.
// - Each handler MUST be deterministic and allocation-free.
// - Handlers MUST NOT call RecomputeAndStoreHash (tick owns cleanliness).
// - Handlers MUST NOT call StateHash64.
// - Ok MUST mean: authoritative mutation applied.
// - Invalid means malformed/unknown command.
// - Illegal means well-formed but fails legality checks (reserved for future commands).
3B) Insert EXACT private handler methods:
private SimCommandResult HandleNoop()
{
return new SimCommandResult(SimCommandStatus.Ok);
}
private SimCommandResult HandleInvalid()
{
return new SimCommandResult(SimCommandStatus.Invalid);
}
private SimCommandResult HandleUnknownKind(SimCommandKind kind)
{
return new SimCommandResult(SimCommandStatus.Invalid);
}
3C) Modify ONLY the body of ApplyCommandInternal to be a pure router:
private SimCommandResult ApplyCommandInternal(SimCommand cmd, Rng rng)
{
if (cmd == null)
return HandleInvalid();
switch (cmd.Kind)
{
case SimCommandKind.Noop:
return HandleNoop();
case SimCommandKind.Invalid:
return HandleInvalid();
default:
return HandleUnknownKind(cmd.Kind);
}
}
Strict:
- Do NOT change signature lines.
- Do NOT add gameplay logic.
- Do NOT call RecomputeAndStoreHash in router or handlers.
================================================================
PHASE 4 — TEST LOCK (SimDeterminismTests.cs)
================================================================
Append-only rule:
- Only one append hunk at end of file.
Add exactly one test and one test-only command (at end of file):
[Test]
public void AdvanceTick_UnknownKind_TickIndexIncrements_StepUnchanged_ResultNotOk()
{
var state = new SimState(1, 1);
int tickBefore = state.TickIndex;
int stepBefore = state.Step;
SimCommandResult result = state.AdvanceTick(UnknownKindTestCommand.Instance, new Rng(0));
Assert.That(state.TickIndex, Is.EqualTo(tickBefore 1));
Assert.That(state.Step, Is.EqualTo(stepBefore));
Assert.That(result.IsOk, Is.False);
}
file sealed class UnknownKindTestCommand : SimCommand
{
public static readonly UnknownKindTestCommand Instance = new UnknownKindTestCommand();
private UnknownKindTestCommand() {}
public override SimCommandKind Kind => (SimCommandKind)123;
}
Do NOT use null commands in tests.
================================================================
PHASE 5 — DIFF COUNT GATES
================================================================
cd "C:\Users\evanh\Downloads\Capture_Kingdom"
git diff --name-only
Hard requirement: EXACTLY these two files and nothing else:
- Assets/Scripts/Sim/Core/SimState.cs
- Tests/CaptureKingdom.Sim.Tests/SimDeterminismTests.cs
If Command.cs appears: STOP.
If any other file appears: STOP.
Count gate in SimState.cs (must be exactly 1 each):
cd "C:\Users\evanh\Downloads\Capture_Kingdom"
(Select-String -Path
$sim -SimpleMatch "HandleNoop").Count
(Select-String -Path
$sim -SimpleMatch "HandleInvalid").Count
(Select-String -SimpleMatch "HandleUnknownKind").Count
(Select-String -Path -SimpleMatch "ENGINE LAW — COMMAND HANDLER CONTRACT").Count
Any count != 1: STOP.
Append-only gate in tests:
git diff --numstat "Tests/CaptureKingdom.Sim.Tests/SimDeterminismTests.cs"
Must show only additions (no deletions). If deletions occur: STOP.
================================================================
PHASE 6 — TEST GATE
================================================================
cd "C:\Users\evanh\Downloads\Capture_Kingdom\Tests\CaptureKingdom.Sim.Tests"
dotnet test --no-restore -v minimal 2>&1 > "..\..\Artifacts\Logs\test_chunk2c.txt"
echo "EXIT:$LASTEXITCODE"
Get-Content "..\..\Artifacts\Logs\test_chunk2c.txt"
Must be green.
================================================================
PHASE 7 — COMMIT PUSH
================================================================
cd "C:\Users\evanh\Downloads\Capture_Kingdom"
git add "Assets/Scripts/Sim/Core/SimState.cs" "Tests/CaptureKingdom.Sim.Tests/SimDeterminismTests.cs"
git commit --trailer "Made-with: Cursor" -m "Chunk2C: harden command router authority lock Ok semantics"
git push origin --all
git push origin --tags
================================================================
HOSTILE SELF-AUDIT (MANDATORY OUTPUT)
================================================================
Confirm:
✓ Only 2 scoped files changed
✓ Command.cs untouched
✓ ApplyCommandInternal is pure router calling handlers
✓ Handlers do not call RecomputeAndStoreHash
✓ Unknown kind returns Invalid (result.IsOk == false)
✓ TickIndex increments and Step unchanged for unknown kind
✓ No hash algorithm/input/order changes
✓ Tests pass