| name | rootimagine |
| description | Pre-deploy simulation mode. Use when a fix is written but not yet verified โ to step-trace the code through normal/edge/failure scenarios, expose what was missed, and require explicit case coverage before commit. Pairs with rootfix. |
| triggers | ["์๋ฎฌ๋ ์ด์
","์๋ฎฌ๋ ์ด์
๋๋ ค","์๋ฎฌ","๋ฃจํธ์ด๋งค์ง","rootimagine","root-imagine","imagine","ํ์คํ ํด๊ฒฐํ๊ฑฐ์ง","์ง์ง ํด๊ฒฐ๋๋์ง","๊ฒ์ฆํด์ค","๊ฒ์ฆํด๋ด","์๋๋ฆฌ์ค ๊ฒ์ฆ","์ฝ๋ ์๋ฎฌ","๋
ผ๋ฆฌ์ ์ผ๋ก ํ์ธ","dry-run","๋จธ๋ฆฟ์์ผ๋ก ๋๋ ค๋ด"] |
rootimagine โ Simulation Verification Mode
Writing the fix isn't the end. Mentally (or on paper) run the fix through normal/edge/failure scenarios before commit to expose what you missed. "Compiles OK" absolutely does NOT mean "works."
Activation
Explicit: /rootimagine
Auto-triggers:
- "์๋ฎฌ๋ ์ด์
๋๋ ค"
- "ํ์คํ ํด๊ฒฐํ๊ฑฐ์ง"
- "์ง์ง ํด๊ฒฐ๋๋์ง"
- "์ฝ๋ ํ์ธํด๋ด"
- "๋
ผ๋ฆฌ์ ์ผ๋ก ํ์ธ"
- "dry-run"
- "๋จธ๋ฆฟ์์ผ๋ก ๋๋ ค๋ด"
Relationship with rootfix
| rootfix | rootimagine |
|---|
| Tracks cause (WHYร5) | Tracks effect (time-step trace) |
| Suggests fix options | Verifies the applied fix |
| Patterns (Drift/Race/...) | Cases (A/B/C/D normal/edge/failure) |
| Pre-commit step | Pre-commit final gate |
Common pair: rootfix to draft โ rootimagine to verify โ commit.
6-Step Simulation
1. Build State/Variable Table
List every variable, state, and external resource (cache/DB/event/queue/...) the fix touches:
| Name | Initial | Updated At | Updated By |
|---|
_share_card_sent | False | after yield | SSE generator |
_pg.share_card_ready | unset | finally of side task | _gen_share_card_early |
_bg_queue | empty | each chunk | _bg_generate |
This table is the mental state model. Miss it and the sim is wrong.
2. Time-Step Trace (T = time)
For each time point of interest (T=0, T=5, T=10, ...), trace what runs and how variables change.
How to pick trace points โ any of these is a checkpoint
await / asyncio.wait_for / condition.wait_for โ any yieldable point
timeout expiry โ wait_for timeout value
- loop iterations โ
while True / for ... boundaries
event.set() / event.is_set() โ completion points of external tasks
- external calls (Bedrock/DB/HTTP) โ response arrival (typically ms to tens of seconds)
- user actions โ click/leave/refresh/page change
- component mount/unmount (frontend)
- branches (
if/else) โ trace both arms
At each time point, record
- Code line + one-line description ("line 3040: chunk = await _bg_queue.get() blocked")
- Every cell of the variable table (especially the deciding branch variables)
- What yielded/returned/dispatched (effect on user view)
- What other tasks are doing simultaneously (critical in async)
Forced self-check at every branch / await
- During this await, can another task mutate Z so that the next branch chooses differently?
- Did I trace the other arm of this branch?
- After this timeout, in what state is the next line invoked?
- While this yield reaches the client, what is the backend doing? (and vice versa)
Example trace:
T=0 : line 2944 _gen_share_card_early task started (Bedrock call started)
T=0 : line 2964 _bg_generate task started
T=0.1 : SSE generator entered, line 3027 stat_cards yielded โ client view
T=0.1~5 : line 3031 share_card_ready.wait() blocked
| meanwhile: _gen_share_card_early awaiting Bedrock response
T=5 : line 3031 wait_for TimeoutError โ share_card emission skipped โ chunks loop
T=5+ฮต : line 3041 _bg_queue.get() blocked (no chunk yet)
| meanwhile: _gen_share_card_early awaiting Bedrock response
T=10 : _gen_share_card_early got Bedrock response โ _pg.share_card filled โ share_card_ready.set()
| line 3041 still blocked
T=120 : first chunk arrives โ line 3041 unblocks โ yield chunk โ polling โ share_card yielded
| user: doesn't see share_card until T=120 โ MISSED CASE!
If during a trace you find a "wait this is missed" โ fix immediately. That is the entire point of the sim.
3. Case Enumeration โ Pull more than you think
Principle: A/B/C/D are the starting line, not the finish. For each variable/timing/external resource the code depends on, pull out dimensions of variation, then multiply cases by sampling extremes/middles along each dimension. "I only ran the happy path" = immediate fail.
Dimension checklist (commonly missed axes)
- Timing: fast / right at timeout / slow / never arrives
- Order: A first / B first / simultaneous
- Resource state: cache hit / miss / stale / reset (after deploy)
- Network / IO: normal / slow / disconnect / partial response
- Concurrency: single / same user twice / different users simultaneously
- Input: normal / empty / malformed / very large
- Auth: valid / expired / forged / anonymous
- Lifecycle: normal exit / user leaves / refresh / page change
- External: external API success / failure / timeout / partial
- State reset: initial / leftover from prior call / cross-instance influence
Minimum cases (starting line)
A. Normal (fast path): all dependencies satisfied within timeout. Happy path.
B. Slow path: async dependency is late but eventually completes. โ Most fixes miss here.
C. Failure: dependency errors out. Verify fallback behavior.
D. Extreme: dependency never completes / external abort / cancel / process kill.
Don't stop here. From the dimension checklist above, pick relevant ones and add cases:
- E. Concurrent invocations (race)
- F. Partial failure (some chunks arrive + cancel)
- G. External resource reset (cache cleared right after deploy)
- H. User input variability (empty form / unicode / emoji / very large)
- ...
Question to ask yourself: "Did I write down every way this fix could break in someone's hands?" โ if you have fewer than 5, push harder.
4. State the User-Visible Effect
For each case, what does the user actually see?
- "share_card appears around T=3"
- "1-2 minutes of blank screen, then share_card around T=11"
- "user never sees share_card (fallback kicks in, content batched at the end)"
If you can't write the user-visible effect in plain words, you haven't really traced it.
5. Latent Defect Self-Check
6. Confidence Declaration
- HIGH: all 4+ cases traced end-to-end, no latent defects
- MEDIUM: only some cases simulated, operational verification still required
- LOW: simulation is hard, or external factors dominate โ real validation environment needed
No fake confidence. If "HIGH" but you skipped cases, it's actually MEDIUM.
7. Concerns
Surface things that "won't break right now but need attention." Not just bugs โ anything that could become a problem. The purpose is to expose risks before they become incidents.
Scope (full coverage)
| Category | Examples |
|---|
| Code Quality | Tech debt accumulation, scalability limits, maintenance difficulty, test coverage gaps, naming |
| Operational | Missing monitoring, incident recovery difficulty, missing alerts, SLA impact, insufficient logging |
| Business Impact | User experience degradation, revenue impact, compliance issues, data integrity risk |
How to write concerns
- Each concern: what + why it's concerning + when it could break
- Severity tag:
๐ด HIGH / ๐ก MEDIUM / ๐ข LOW
- If you feel "this might be a problem someday..." โ write it down. Don't ignore your instinct.
- Overlap with latent defects is OK โ here you take a wider lens.
Example:
๐ก MEDIUM: No backoff in retry logic โ could exceed rate limits under external API failure (breaks at 10x traffic)
๐ด HIGH: Errors silently swallowed in this function โ impossible to trace root cause during incidents (no monitoring alerts either)
๐ข LOW: Magic numbers in 3 places โ not broken now but invites mistakes on next change
8. Next Actions
After simulation, state clearly "so what now?" If the agent doesn't know what to do next, the simulation was just self-satisfaction.
3-tier classification
| Tier | Criteria | Examples |
|---|
| ๐จ NOW (Immediate) | Defects found in simulation. Must fix before commit | "Fix Case B miss", "Add error handling" |
| ๐ NEXT (Follow-up) | Not this PR, but the very next PR | "Add monitoring dashboard", "Write perf test" |
| ๐ก LATER (Optional) | Nice to have, not urgent. Backlog material | "Refactor", "Docs", "Expand test coverage" |
How to write actions
- Each action is one executable sentence (vague "needs improvement" forbidden)
- Link to which mode (rootfix/rootclean/rootbuild) when possible
- If any NOW items exist โ commit forbidden, apply fix first then re-simulate
- NOW items must be zero before commit is allowed
Example:
๐จ NOW (Immediate):
1. Case B: share_card missed when first chunk delayed โ add polling outside chunks loop [rootfix]
2. Resource not released in finally after timeout โ memory leak possible [rootfix]
๐ NEXT (Follow-up):
1. Add share_card generation latency monitoring alert [rootbuild]
2. Write E2E test for Case D (process kill) scenario [rootbuild]
๐ก LATER (Optional):
1. Extract _bg_generate function โ currently 87 lines, readability improvement [rootclean]
2. Move magic number timeout 5s to config [rootclean]
Output Format
[Simulation โ <fix one-liner>]
State table:
| Name | Initial | Updated At | Updated By |
|---|---|---|---|
| ... |
Case A (Normal): T=0 โ T=N trace
Case B (Slow): T=0 โ T=N trace
Case C (Failure): T=0 โ T=N trace
Case D (Extreme): T=0 โ T=N trace
User-visible effect per case:
- A: ...
- B: ...
- C: ...
- D: ...
Latent defects:
- (list if any)
Confidence: HIGH | MEDIUM | LOW
Reason: ...
Concerns:
- ๐ด/๐ก/๐ข <what> โ <why concerning> (<when it breaks>)
- ...
Next Actions:
๐จ NOW (Immediate):
1. <executable instruction> [linked mode]
๐ NEXT (Follow-up):
1. <executable instruction> [linked mode]
๐ก LATER (Optional):
1. <executable instruction> [linked mode]
Termination Conditions
Simulation ends โ commit/deploy allowed only when ALL of:
Any unchecked item โ simulation incomplete. Commit forbidden. No self-deception.
Anti-Patterns (forbidden in this mode)
- "It compiles, so OK" โ skipping simulation and declaring success
- Happy-path-only trace โ skipping B/C/D cases
- Self-inflated confidence โ calling it "HIGH" without operational verification
- Implicit assumptions โ "chunks will probably arrive early" without stating it
- Missing user-visible effect โ wrote what code does, but not what the user sees
- Ignoring races โ only one ordering of two tasks considered
Notes
- Derived from real-world async debugging sessions where fixes were repeatedly applied yet all of them missed the actual operating environment โ e.g. adding polling inside a chunks loop while the first chunk takes 1-2 minutes to arrive in production (so the polling never runs).
- Pairs with rootfix: fix โ simulate โ discover missing case โ fix again โ simulate again โ confidence.
- Works in any project. Global skill.