# K-ArtSell Aegis AI Coding Constitution v16.0 ## ๐Ÿ”’ GOVERNANCE LOCK **AGENTS.md IS THE ONLY AUTHORITATIVE SOURCE FOR ENGINEERING GUIDELINES.** **Rules (Non-negotiable):** 1. **All engineering procedures, harnesses, and decision frameworks go in AGENTS.md only.** 2. **CLAUDE.md, GEMINI.md, and all other .md files follow AGENTS.md. They do NOT define rules.** 3. **If any document conflicts with AGENTS.md, AGENTS.md wins. Other text is void.** 4. **Never add guidelines to CLAUDE.md, GEMINI.md, or side documents.** 5. **Supplementary files reference AGENTS.md with explicit links only.** **Scope:** - **AGENTS.md owns:** Coding rules, development setup, procedures, harnesses, decision frameworks, anti-patterns, workflows - **Other files provide:** Project status, architecture context, navigation, references (links to AGENTS.md) **Enforcement:** - Claude Code will not accept conflicting guidance from multiple sources - When in doubt, check AGENTS.md section headers - If you see conflicting guidance elsewhere, update that document to reference AGENTS.md instead ## Default execution procedure All work in this repository MUST follow `docs/CURRENT/WBS_EXECUTION_PROCEDURES.md` as the default operating procedure, together with this constitution. Before editing, select exactly one WBS item from `docs/CURRENT/CATALOGS/WBS_MASTER.csv`, verify dependencies, Gate, Requirement/API/DB/Job/UI/Test IDs, Acceptance_Evidence, and Artifact. Record Source / Assumption / Unknown / Decision Required, then execute, collect actual evidence, update `WBS_PROGRESS_TRACKER.csv`, and commit with the WBS_ID. Do not mark a WBS item COMPLETED or claim a test/build/migration result without preserved execution evidence. 1. ์ž๋™์ฃผ๋ฌธ๊ณผ KIS ์ œ์ถœ Capability๋Š” OFF๋‹ค. ๋ณ„๋„ ์Šน์ธ Release ์ „ ๊ตฌํ˜„ยทํ™œ์„ฑํ™”ยท์šฐํšŒํ•˜์ง€ ์•Š๋Š”๋‹ค. 2. ์ฑ„ํŒ…๊ณผ ์ƒ์„ฑ ์ฝ”๋“œ๋Š” Source of Truth๊ฐ€ ์•„๋‹ˆ๋‹ค. ๋ชจ๋“  ๋ณ€๊ฒฝ์€ Source / Assumption / Unknown / Decision Required๋ฅผ ํ‘œ์‹œํ•œ๋‹ค. 3. ํ•œ PR์€ ํ•œ Vertical Slice ๋˜๋Š” ํ•œ ๋™์ž‘๋ณด์กด ๋ฆฌํŒฉํ„ฐ๋ง ๋ชฉ์ ๋งŒ ๊ฐ€์ง„๋‹ค. 4. Endpointโ†’Applicationโ†’Pure Policyโ†’Dapper SQLโ†’Outboxโ†’Tests ๊ฒฝ๊ณ„๋ฅผ ์ง€ํ‚จ๋‹ค. 5. Domain Policy๋Š” ์‹œ๊ฐ„ยท๋žœ๋คยท๋„คํŠธ์›ŒํฌยทDBยทDI Container๋ฅผ ์ง์ ‘ ์ฝ์ง€ ์•Š๋Š”๋‹ค. 6. Generic Repository, God Service, Service Locator, Job ๋‚ด ๋น„์ฆˆ๋‹ˆ์Šค ์ •์ฑ…, ์กฐ๊ธฐ Microservice ๋ถ„๋ฆฌ๋ฅผ ๊ธˆ์ง€ํ•œ๋‹ค. 7. ๋ชจ๋“ˆ์€ ๋‹ค๋ฅธ ๋ชจ๋“ˆ Source Table์„ ์ง์ ‘ ์กฐํšŒํ•˜์ง€ ์•Š๋Š”๋‹ค. ์Šน์ธ๋œ Contract/Read Model๋งŒ ์‚ฌ์šฉํ•œ๋‹ค. 8. `DateTime.Now/UtcNow`๋ฅผ ์ง์ ‘ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ  IClock๊ณผ MarketCalendar๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค. 9. ๊ธˆ์œต๊ฐ’์€ decimal, ๋ช…์‹œ์  rounding, ๋‹จ์œ„ ๊ณ„์•ฝ์„ ์‚ฌ์šฉํ•œ๋‹ค. ๋ชจ๋ธ ๋‚ด๋ถ€ double์€ ๊ฒฝ๊ณ„์—์„œ ๋ณ€ํ™˜ํ•œ๋‹ค. 10. `SellRatioOfLot`, `SellQuantity`, `TargetPortfolioWeightAfter`, `StrategicCoreFloorWeight`๋ฅผ ํ˜ผ์šฉํ•˜์ง€ ์•Š๋Š”๋‹ค. 11. EvidenceSnapshotยทDatasetIdยทModel/Config/Code SHA ์—†์ด Decision/Recommendation์„ ์ €์žฅํ•˜์ง€ ์•Š๋Š”๋‹ค. 12. Command/Job๋Š” IdempotencyKey/JobRunId/Watermark๋ฅผ ๊ฐ–๊ณ  replay๋ฅผ ๊ฒฌ๋”˜๋‹ค. 13. Evidence/Decision/Audit๋Š” update/deleteํ•˜์ง€ ์•Š๊ณ  append/correction event๋กœ ๋ณด์กดํ•œ๋‹ค. 14. Write Model์€ ์ •๊ทœํ™”ยทappendยทrevision, ํ™”๋ฉด์€ version/watermark/rebuild๊ฐ€ ์žˆ๋Š” Read Model์ด๋‹ค. 15. ์„œ๋ฒ„ ์ƒํƒœ๋Š” TanStack Query๊ฐ€ ์†Œ์œ ํ•œ๋‹ค. Pinia์— API ์‘๋‹ต์„ ๋ณต์ œํ•˜์ง€ ์•Š๋Š”๋‹ค. 16. FE request/response๋Š” Zod๋กœ runtime validationํ•˜๊ณ  ๊ฐ™์€ retry์— ๊ฐ™์€ Idempotency-Key๋ฅผ ์žฌ์‚ฌ์šฉํ•œ๋‹ค. 17. `/internal/*` Endpoint๋Š” Roles ๋˜๋Š” Policies๋ฅผ ์„ ์–ธํ•˜๋ฉฐ ์ต๋ช… ์ ‘๊ทผ์„ ํ—ˆ์šฉํ•˜์ง€ ์•Š๋Š”๋‹ค. 18. ์•Œ๊ณ ๋ฆฌ์ฆ˜ ๋ณ€๊ฒฝ์€ Policy ID, Golden, Frozen OOS, costร—2, false-exit/reentry/ES, ModelCard๋ฅผ ๋™๋ฐ˜ํ•œ๋‹ค. 19. ์ƒˆ library/pattern/table/threshold๋Š” ADR/Issue ์Šน์ธ ์—†์ด ๋„์ž…ํ•˜์ง€ ์•Š๋Š”๋‹ค. 20. ์‹คํ–‰ํ•˜์ง€ ๋ชปํ•œ build/test/migration์„ ํ†ต๊ณผํ–ˆ๋‹ค๊ณ  ๊ธฐ๋กํ•˜์ง€ ์•Š๋Š”๋‹ค. 21. AI ์ƒ์„ฑ Migration์€ fresh/upgrade/re-run/failure rehearsal ๋ฐ DBA ์Šน์ธ ์—†์ด๋Š” ๋ณ‘ํ•ฉํ•˜์ง€ ์•Š๋Š”๋‹ค. 22. ์‹ค๊ณ ๊ฐ ๋ฐ์ดํ„ฐยท์‹ค๊ณ„์ขŒยท์‹ค์ฃผ๋ฌธ ํ‚คยทsecret๋ฅผ prompt/fixture/log/trace์— ๋„ฃ์ง€ ์•Š๋Š”๋‹ค. 23. MetricยทAlertยทRunbookยทRollbackยทOwner/Secondary๊ฐ€ ์—†์œผ๋ฉด Done์ด ์•„๋‹ˆ๋‹ค. ## v12.1 execution-readiness delta - Every change must cite Requirement/Slice/Policy/Data/API/DB/Job/UI/Test IDs. - Production commands load Evidence/Model/Config from approved server-side PIT context; never trust client-supplied evidence. - Write models are normalized and append/correction based. Denormalization is allowed only in versioned, rebuildable read models. - Outbox/Inbox/JobRun/Projection operations require scope, idempotency, watermark, hashes, and replay evidence. - No generic repository, God service, reflection plugin framework, premature microservice, or unapproved threshold. - Refactoring and policy changes must be separate PRs with characterization or Golden tests first. - Never claim a build, migration, test, Shadow period, PBO, or DSR result that was not executed and preserved as evidence. ## v12.2 strategic data-semantics delta - `CurrentSecurityPortfolioWeight`, `CurrentLotPortfolioWeight`, `SellRatioOfLot`, and `StrategicCoreFloorWeight` are distinct units. Never reintroduce the ambiguous `CurrentPortfolioWeight` into active decision code. - A lot-relative sell changes security weight by `CurrentLotPortfolioWeight * SellRatioOfLot`. - Persist the ordered policy trace with Applied/Blocked/NotApplicable dispositions; do not expose raw internal scores directly to customers. - Prior migrations are immutable. v12.2 changes belong in migration `0014` or later. - The six current-session attachments and their SHA-256 values are part of the release evidence. - Use the reviewed templates under `templates/`; do not bulk-generate unapproved modules or placeholder implementations. ## v12.3 execution and semantic-version delta - `weight_semantics_version=1` contexts are legacy ambiguous data and must never enter active decisions; rebuild them as version 2 from explicit security and lot weights. - A positive opportunity edge with a zero or missing requested sell ratio is BLOCKED. Never clamp missing intent to a minimum sell. - Policy IDs, priorities and thresholds must match `contracts/policies/sell-policy-contract.v1.json`; drift blocks G2. - Decision/API/Event/DB evidence must preserve `decision_contract_version` and `policy_trace_schema_version`. - Outcome metrics must name a definition version, population, numerator, denominator, window and aggregation. Do not equate 63-session research output with an annual target without approval. - `scripts/scaffold_slice.py` is dry-run by default, refuses overwrite and produces SCAFFOLD_ONLY code. Generated files are not approved implementation. - The seven cumulative attachments and their SHA-256 values are part of v12.3 release evidence. ## v12.4 Model Operations Constitution - Scheduler automation is limited to EVALUATION_ONLY, PROPOSAL_ONLY and DRILL_ONLY. - Never generate or merge automatic model promotion, rollback, threshold mutation, code change, automatic order or KIS submission paths. - Every evaluation request freezes Dataset/Model/Config/Code/Contract VersionSet from an approved server-side context. - Metric changes require a versioned numerator, denominator, window, aggregation, PIT/revision rule and Golden/OOS impact. - Improvement proposals are documents and records only; they do not edit model, policy, configuration or source files. - Drift thresholds, false-exit definition and retention policy are DECISION_REQUIRED until approved. ## v14.0 UI / Model Feedback non-negotiables - Feature code MUST NOT import PrimeVue or AG Grid directly. Use shared UI ports and screen types. - UI provider changes require contract, accessibility, visual, state-matrix and performance evidence. - Model operation automation stops at evaluation/proposal. Model activation is human change approval only. - J39 and every new schedule remain disabled until their source, calendar, ownership and alert contracts are approved. - Never claim .NET, pnpm, PostgreSQL, Playwright or Shadow evidence passed unless the actual artifact is attached. - **[CRITICAL IRON RULE] Viewport-Fit Zero-Scroll Layout**: Except for analytical dashboards, ALL workstation screens MUST fit 100% within the initial viewport upon loading WITHOUT page-level window scrolling. All primary grids, forms, and control panels must automatically calculate `height: calc(100vh - header/tabs)` and handle internal scrolling inside containers. - **[CRITICAL IRON RULE] Standardized Button Layout Strategy**: 1. **Page Action Toolbar (Top-Right `.ks-page__actions`)**: Dedicated exclusively to **Primary Processing Actions** (e.g., `โ–ถ ๋ฐฐ์น˜ ์‹คํ–‰`, `โšก ๋ฆฌ๋ฐธ๋Ÿฐ์‹ฑ ์‹คํ–‰`, `๐Ÿ“ค ๋ฐ์ดํ„ฐ ์ˆ˜์ง‘`) and **Global Page Operations** (e.g., `โž• ์‹ ๊ทœ ๋“ฑ๋ก`). Secondary actions are styled as outline/ghost. 2. **Grid Row & Item Context Actions (Table Row Actions)**: Dedicated to **Single-Row CRUD & Processing** (e.g., `โœ๏ธ ์ˆ˜์ •`, `๐Ÿ—‘๏ธ ์‚ญ์ œ`, `๐Ÿ” ์ƒ์„ธ๋ณด๊ธฐ`, `โ–ถ ์žฌ์ฒ˜๋ฆฌ`). Placed in a pinned right column or explicit context menu; never placed in page top toolbar. 3. **Multi-Selection Batch Toolbar (Grid Top/Bottom Selection Bar)**: Activated conditionally upon multi-row selection for **Bulk Actions** (e.g., `์„ ํƒ ์ผ๊ด„ ์Šน์ธ(3)`, `์„ ํƒ ์ผ๊ด„ ์‚ญ์ œ`). - **[CRITICAL IRON RULE] Standardized Loading Skeleton Rule**: ALL screen-level and section-level data loading MUST render animated `SkeletonLoader` (shimmer mode) matching the expected layout (e.g. `skeletonType="table"` for grids, `skeletonType="card"` for forms/summaries) through `QueryStateBoundary`/`StandardScreenBoundary`. Static text ("๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘...") or empty screen placeholders during loading states are STRICTLY PROHIBITED. - **[CRITICAL IRON RULE] Standardized Empty Data State Rule**: When zero records or empty dataset states occur, ALL grids, lists, and summary cards MUST render standard `EmptyStatePlaceholder` component (`๐Ÿ“ญ` icon, clear title, descriptive helper text, and optional recovery action button). Blank white spaces or plain `

๋ฐ์ดํ„ฐ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค

` text tags are STRICTLY PROHIBITED. - **[CRITICAL IRON RULE] Standardized Form & Filter Control Width Rule**: ALL form & filter controls MUST adhere to central default width tokens (`tokens.css` / `base.css`). Controls MUST NOT stretch to 100% full width inside filter bars unless explicitly grouped in full-width grid layouts: 1. **Select / Dropdown (`select`, `.p-select`, `.ks-select`)**: Default width `--ks-control-width-select` (`160px`). 2. **Search Input (`.search-input`)**: Default width `--ks-control-width-search` (`220px`). 3. **Date Picker (`input[type="date"]`)**: Default width `--ks-control-width-date` (`140px`). - **[CRITICAL IRON RULE] Standardized Grid Row Numbering Rule**: Unless explicitly disabled (`showRowNumber: false`), ALL data grids MUST automatically prepend a pinned left `No.` column rendering 1-indexed sequential row numbers (`node.rowIndex + 1`) centered with `54px` fixed width. - **[CRITICAL IRON RULE] Standardized Grid Theme, Zebra Stripes & Color Palette Rule**: ALL data grids MUST inherit central Theme Color Tokens (`tokens.css`) without ad-hoc inline overrides. Grids MUST enforce: 1. **Header Background**: Premium Header Gray `#f1f5f9` (Dark Mode: `#1e293b`), font-weight: `700`. 2. **Zebra Stripes (Odd Rows)**: Even rows `#ffffff`, Odd rows (`.ag-row-odd`) `#f8fafc` (Dark Mode: `#0f172a`). 3. **Hover Color**: Sky Light Blue `#e0f2fe` (Dark Mode: `#334155`). 4. **Active Selection Color**: Active Selected Row Sky Blue `#dbeafe` with bold text `#1e3a8a` (Dark Mode: `#1e3a8a`). ## v16.0 Gitea API & CI/CD Automation ### Environment Setup **Gitea API Token:** ```bash # Set GITEA_TOKEN_TAXBAIK environment variable # This token enables: # - Pull request automation (labels, milestones, comments) # - Issue management (create, update, close) # - Release management (tags, release notes) # - CI/CD pipeline integration # On Windows (PowerShell): $env:GITEA_TOKEN_TAXBAIK = "your-token-here" # On macOS/Linux (bash): export GITEA_TOKEN_TAXBAIK="your-token-here" # Verify: echo $GITEA_TOKEN_TAXBAIK ``` ### Gitea API Patterns **Common endpoints (https://gitea.taxbaik.com/api/v1):** ```bash # Create a PR comment curl -X POST \ -H "Authorization: token $GITEA_TOKEN_TAXBAIK" \ -H "Content-Type: application/json" \ -d '{"body":"Verification complete: 41/41 tests passed"}' \ https://gitea.taxbaik.com/api/v1/repos/kjh2064/KArtSell.Aegis/issues/{issue_id}/comments # Add labels to PR curl -X POST \ -H "Authorization: token $GITEA_TOKEN_TAXBAIK" \ -d '["architecture","verified"]' \ https://gitea.taxbaik.com/api/v1/repos/kjh2064/KArtSell.Aegis/issues/{pr_number}/labels # Create release with notes curl -X POST \ -H "Authorization: token $GITEA_TOKEN_TAXBAIK" \ -H "Content-Type: application/json" \ -d '{"tag_name":"v16.0.1","body":"Release notes..."}' \ https://gitea.taxbaik.com/api/v1/repos/kjh2064/KArtSell.Aegis/releases # Query PR/Issue curl -H "Authorization: token $GITEA_TOKEN_TAXBAIK" \ https://gitea.taxbaik.com/api/v1/repos/kjh2064/KArtSell.Aegis/pulls?state=open ``` ### CI/CD Integration (Gitea Actions) **Leverage in `.gitea/workflows/ci.yml`:** ```yaml - name: Comment on PR with test results if: github.event_name == 'pull_request' run: | curl -X POST \ -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ -H "Content-Type: application/json" \ -d "{\"body\":\"Build: โœ… Tests: 41/41 PASS\"}" \ https://gitea.taxbaik.com/api/v1/repos/kjh2064/KArtSell.Aegis/issues/${{ github.event.pull_request.number }}/comments ``` ### Automation Best Practices (from v16.0) - **PR Labels:** Auto-label based on affected module (e.g., `ModelOperations`, `SignalEngine`) - **Milestones:** Link PRs to quarterly sprints for burndown tracking - **Comments:** Post verification results (build, test, security scan) directly on PR ## v16.0 Development Environment Configuration ### Database & Backend Setup **DO NOT make up or ask for database credentials.** Read `src/KArtSell.Host/appsettings.Development.json` directly. Current values: ```json { "ConnectionStrings": { "Postgres": "Host=127.0.0.1;Port=5432;Database=kartselldb;Username=kartsell;Password=kartsell4321@!" }, "Authentication": { "Mode": "DevelopmentHeader" } } ``` **Connection Parameters:** - Host: `127.0.0.1` (localhost) - Port: `5432` - Database: `kartselldb` (NOT `kartsell`) - Username: `kartsell` - Password: `kartsell4321@!` **SSH Tunnel (Required before starting backend):** ```powershell ssh -L 5432:127.0.0.1:5432 kjh2064@178.104.200.7 ``` **Start Backend (use config file, no env var injection):** ```powershell cd D:\JobRoomz\KArtSell.Aegis dotnet run --project src/KArtSell.Host --configuration Debug --no-build ``` ### Frontend Development Server **Port:** 5174 (fallback: 5173 if available) **Start Frontend (from project root):** ```bash cd frontend pnpm install --frozen-lockfile pnpm dev ``` **URL:** http://localhost:5174 ### Authentication for Testing Development mode uses `DevelopmentHeaderAuthenticationHandler`. Test requests with: ```powershell $headers = @{ "X-KArtSell-User" = "kjh2064" "X-KArtSell-Role" = "Admin" "Content-Type" = "application/json" } Invoke-WebRequest -Uri "http://127.0.0.1:5002/api/shadow-runs" ` -Method POST ` -Headers $headers ` -Body $body ``` ### Rules for Development Configuration 1. **Never invent credentials.** Read config files first. 2. **Never ask the user for settings.** Read `appsettings.Development.json` directly. 3. **Database name is `kartselldb`.** Not `kartsell`. 4. **SSH tunnel is mandatory.** PostgreSQL is not accessible without it. 5. **Authentication mode is `DevelopmentHeader`.** Use headers, not OIDC tokens. - **Releases:** Tag with semver + architecture contract version (e.g., `v16.0.1-contract-v3.0`) - **Issue Linking:** Reference debt IDs, ADRs, decision logs in commits (e.g., `TECH-001: Fix CA1822`) --- ## v16.0 Strategic Architecture & Engineering Excellence ### Decision Criteria for All Work Every task โ€” code change, refactor, new feature, tooling, infrastructure โ€” must be evaluated against these dimensions before implementation: #### 1. SOLID ์›์น™ - **S**ingle Responsibility: One class, one reason to change. Vertical Slice boundaries are trust boundaries. - **O**pen/Closed: Open for extension (new Policies, new decision gates); closed for modification (immutable Evidence, append-only migrations). - **L**iskov Substitution: Handlers, Policies, Adapters are swappable; never break contract. - **I**nterface Segregation: IClock โ‰  IDateTime; IOutboxWriter โ‰  IEventBus. Ports are narrow. - **D**ependency Inversion: Depend on abstractions (IClock, ILogger, IOutboxWriter); inject concretions at composition root only. - **์ ์šฉ:** ๋ชจ๋“ˆ ๊ฒฝ๊ณ„ ์„ค๊ณ„, ์ธํ„ฐํŽ˜์ด์Šค ๋ถ„๋ฆฌ, ์Šคํƒœํ‹ฑ ๋ฉ”์„œ๋“œ vs ์ธ์Šคํ„ด์Šค ๋ฉ”์„œ๋“œ ํŒ๋‹จ. #### 2. ์ฝ”๋“œ ๋ฆฌํŒฉํ† ๋ง (Code Mass & Complexity) - Cyclomatic Complexity โ‰ค 10 per method (Policy๋Š” ์˜ˆ์™ธ: decision trees๋Š” ๋ณต์žกํ•ด์งˆ ์ˆ˜ ์žˆ์Œ). - Characterize โ†’ Isolate โ†’ Transform โ†’ Verify โ†’ Simplify โ†’ Observe โ†’ Close Debt (์ •๊ณต๋ฒ•). - Dead code, unused flags, unreachable branches๋Š” ์ฆ‰์‹œ ์‚ญ์ œ. "ํ˜น์‹œ ํ•„์š”ํ• ๊นŒ๋ด"๋Š” ๊ธˆ์ง€. - Performance refactor์™€ ๊ธฐ๋Šฅ ๋ณ€๊ฒฝ์€ ๋ถ„๋ฆฌ๋œ PR. ๋™์‹œ ๋ณ€๊ฒฝ์€ ํšŒ๊ท€ ํƒ์ง€ ๋ถˆ๊ฐ€. #### 3. ๋ฐ์ดํ„ฐ ์ •ํ•ฉ์„ฑ (Data Integrity & Audit) - **PIT (Point-in-Time):** `WHERE published_at <= cutoff AND revision = latest` ํ•„์ˆ˜. ์‹œ๊ฐ„ ์—ฌํ–‰ ์ฟผ๋ฆฌ๋Š” audit ๋ชฉ์ ๋งŒ. - **Revision Tracking:** update/delete ๊ธˆ์ง€. ์ƒˆ ๋ฒ„์ „์„ append๋กœ ์ €์žฅ. ์ˆ˜์ •์€ correction event๋กœ ๋ณด์กด. - **Audit Trail:** EvidenceSnapshot, DatasetId, Model/Config/Code SHA๋Š” Decision๊ณผ ํ•จ๊ป˜ ์ €์žฅ. Trace ๋ถˆ๊ฐ€๋Šฅํ•˜๋ฉด ๋ฏธ์™„์„ฑ. - **์ ์šฉ:** ๋ชจ๋“  ์“ฐ๊ธฐ๋Š” append/correction ํŒจํ„ด. ์ฝ๊ธฐ๋Š” PIT ์กฐ๊ฑด. ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜์€ ํšŒ์›๊ฐ€์ž… ์—†์Œ. #### 4. ๊ณผ์œ ๋ถˆ๊ธ‰ (Necessity-Driven, No Gold-Plating) - "ํ˜น์‹œ ๋‚˜์ค‘์— ํ•„์š”ํ•˜๋ฉด"์œผ๋กœ ์ฝ”๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜์ง€ ์•Š๋Š”๋‹ค. ๊ทผ๊ฑฐ ์—†๋Š” ์ถ”์ƒํ™” ๊ธˆ์ง€. - ํ•œ ๊ณณ์—์„œ๋งŒ ์“ฐ๋ฉด ๋ถ„๋ฆฌํ•˜์ง€ ์•Š๋Š”๋‹ค. ์„ธ ๊ณณ์—์„œ ๋ฐ˜๋ณต๋˜๋ฉด ๊ทธ๋•Œ abstract. - Feature flag, backward-compat shim, deprecation layer๋Š” ๊ทผ๊ฑฐ ์žˆ์„ ๋•Œ๋งŒ. ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” ์ฝ”๋“œ๋Š” ์‚ญ์ œ. - **์ ์šฉ:** ์ƒˆ service/interface/config ๋„์ž… ์ „์— "์ด๊ฒƒ์ด ์ •๋ง ํ•„์š”ํ•œ๊ฐ€?" ์ž๋ฌธ. #### 5. ์ •๊ทœํ™” & ์—ญ์ •๊ทœํ™” (Normalization Strategy) - **Write Models:** 3NF + append + revision. ์ค‘๋ณต ์—†์Œ, ๊ด€๊ณ„ ๋ช…ํ™•, ์ด์ƒ ๋ถˆ๊ฐ€. - **Read Models:** Denormalized projections. 1NF ์œ„๋ฐ˜ ํ—ˆ์šฉ (์„ฑ๋Šฅ, ์ ‘๊ทผ์„ฑ). ๋ชจ๋“  Read๋Š” versioned, rebuildable. - **๊ฒฝ๊ณ„:** Write๋Š” Dapper๋กœ ์Šคํ‚ค๋งˆ-๊ทœ์ •. Read๋Š” ์ฟผ๋ฆฌ ์ตœ์ ํ™”. ์–‘์ชฝ ์Šคํ‚ค๋งˆ ๊ฐ์‹œ. - **์ ์šฉ:** ์ƒˆ column ์ถ”๊ฐ€ ์ „์— "์ด๊ฒƒ์€ 3NF ์œ„๋ฐ˜์ธ๊ฐ€? ๊ทธ๋ ‡๋‹ค๋ฉด projection์œผ๋กœ." #### 6. ํ”„๋กœ์„ธ์Šค ๋‹จ์ˆœํ™” (Simplicity & Clarity) - ํ•œ ๋ฒˆ์— ํ•œ ๊ฐ€์ง€๋งŒ ํ•œ๋‹ค. ๋‹ค์ค‘ ์ฑ…์ž„ = ๋‹ค์ค‘ ์ดํ•ด ์‹คํŒจ = ๋ฒ„๊ทธ. - "์™œ ์ด ์ˆœ์„œ์ธ๊ฐ€?" ๋ฌป์ง€ ์•Š์•„๋„ ๋ช…ํ™•ํ•œ ์ฝ”๋“œ. ์ˆจ๊ฒจ์ง„ ์ „์ œ ๊ธˆ์ง€. - Circular dependency, magic numbers, implicit state ์ œ๊ฑฐ. - **์ ์šฉ:** ์ฝ”๋“œ ํ๋ฆ„์ด ์œ„โ†’์•„๋ž˜๋กœ ์ฝํ˜€์•ผ ํ•จ. ๋’ค๋กœ ๋Œ์•„๊ฐ€๋ฉฐ ์ฝ์–ด์•ผ ํ•˜๋ฉด ๋ฆฌํŒฉํ„ฐ. #### 7. ํŒจํ„ดํ™”, ํ‘œ์ค€ํ™”, ๊ตฌ์กฐํ™” (Patterns & Standards) - Vertical Slice๋Š” ๋‹จ์ผ ํŒจํ„ด. Endpoint โ†’ Handler โ†’ Policy โ†’ Dapper โ†’ Outbox. - Job์€ ๋‹จ์ผ ์ฑ…์ž„. ๋น„์ฆˆ๋‹ˆ์Šค ์ •์ฑ…์€ ๋“ค์–ด๊ฐ€์ง€ ์•Š์Œ. ์Šน์ธ๋œ Command๋งŒ ์‹คํ–‰. - Event schema๋Š” contract-first. ๊ตฌ๋…์ž๊ฐ€ ์—†์œผ๋ฉด ์ด๋ฒคํŠธ๋„ ์—†์Œ. - **ํ‘œ์ค€ ์ปดํฌ๋„ŒํŠธ:** QueryStateBoundary, CrudForm, PermissionGuard ๋“ฑ์€ ๋ชจ๋“  ํ™”๋ฉด์—์„œ ์žฌ์‚ฌ์šฉ. ์ง์ ‘ import ๊ธˆ์ง€. - **์ ์šฉ:** ์ƒˆ pattern/component ๋„์ž… ์ „ ํŒ€ ๊ฒ€ํ† . ์ฝ”๋“œ ์‚ฌ๋ณธ 3๊ฐœ = abstract ์‹ ํ˜ธ. #### 8. ๋ฐ”์ด๋ธŒ์ฝ”๋”ฉ & ํ™€๋ฃจ์‹œ๋„ค์ด์…˜ ํ†ต์ œ (AI Guardrails) - AI ์ƒ์„ฑ ์ฝ”๋“œ๋Š” ๊ทผ๊ฑฐ ์—†์Œ. Source/Assumption/Decision ๋ฐ˜๋“œ์‹œ ๊ธฐ๋ก. - **๊ธˆ์ง€:** ๊ทผ๊ฑฐ ์—†๋Š” Policy ID, threshold, DB column, API endpoint. - SQL์€ schema owner, PIT ์กฐ๊ฑด, index, execution plan ๊ฒ€ํ†  ํ•„์ˆ˜. - ์•Œ๊ณ ๋ฆฌ์ฆ˜ ๋ณ€๊ฒฝ์€ Golden/Frozen OOS diff ์—†์ด ๋ณ‘ํ•ฉ ๊ธˆ์ง€. - **์ ์šฉ:** "์ด ๊ฐ’์€ ์–ด๋””์„œ ๋‚˜์™”๋‚˜?" ๋ฌป๋Š” ์Šต๊ด€. ๋‹ต ์—†์œผ๋ฉด DECISION_REQUIRED ํ‘œ์‹œ. #### 9. ํ˜„์žฅ๊ฐ, ์žฌํ˜„์„ฑ, ์ด๋ ฅ์„ฑ (Traceability & Reproducibility) - **ํ˜„์žฅ๊ฐ:** Build/test/migration artifact๋Š” ๋ณด์กด. "ํ†ต๊ณผํ–ˆ๋‹ค๊ณ  ์ฃผ์žฅ"ํ•˜๋˜ ์ฆ๊ฑฐ ์—†์œผ๋ฉด ๊ฑฐ์ง“. - **์žฌํ˜„์„ฑ:** ๋™์ผ input โ†’ ๋™์ผ output. Random, network, system time ์˜์กด์€ ๊ฒฉ๋ฆฌ. Mock ๊ธˆ์ง€, integration test๋กœ. - **์ด๋ ฅ์„ฑ:** Commit message๋Š” "์™œ"๋ฅผ ๊ธฐ๋ก. "๋ฒ„๊ทธ ์ˆ˜์ •"์€ ๋ถˆ์ถฉ๋ถ„. "X ๊ธฐ๋Šฅ์—์„œ Y ์กฐ๊ฑด์—์„œ Z ๋ฒ„๊ทธ โ†’ ์›์ธ: ๋กœ์ง ์˜ค๋ฅ˜" ๊ธฐ๋ก. - **์ ์šฉ:** CI/CD ๊ฒฐ๊ณผ๋ฌผ ์ €์žฅ, ํšŒ๊ท€ ํ…Œ์ŠคํŠธ ์ž ๊ธˆ, ADR์— ์˜์‚ฌ๊ฒฐ์ • ๊ธฐ๋ก. #### 10. ์•ˆ์ •์„ฑ (Reliability & Safety) - Idempotency: ๊ฐ™์€ ์š”์ฒญ โ†’ ๊ฐ™์€ ๊ฒฐ๊ณผ. ๋‘ ๋ฒˆ ์‹คํ–‰ํ•ด๋„ ์•ˆ์ „. - Rollback ๋ถˆ๊ฐ€๋Šฅํ•œ ๋ณ€๊ฒฝ ๊ธˆ์ง€. Migration๋„ down script ํ•„์ˆ˜. - Failure mode: ๊ฐ Job/Endpoint์€ ์‹คํŒจํ–ˆ์„ ๋•Œ ์ƒํƒœ๋ฅผ ๋ช…ํ™•ํžˆ. "์‹คํŒจํ–ˆ๋Š”๋ฐ ๋ถ€๋ถ„ ์„ฑ๊ณต?" ๊ธˆ์ง€. - **์ ์šฉ:** Command/Job๋Š” IdempotencyKey, Watermark ํ•„์ˆ˜. DB constraint, NOT NULL ๊ฒ€์ฆ. #### 11. ๊ณ ๋„ํ™” & ์ปดํฌ๋„ŒํŠธํ™” (Componentization & Maturity) - ํ•œ ๋ฒˆ ์ œ๋Œ€๋กœ. ์ž„์‹œ๋ฐฉํŽธ ๊ธˆ์ง€. ๊ธฐ์ˆ ๋ถ€์ฑ„๋Š” Debt register์— ๊ธฐ๋ก. - ๊ตฌํ˜„ ์ „ contract/schema/test ๋จผ์ €. "ํ•˜๋ฉด์„œ ๋ฐฐ์šด๋‹ค"๋Š” ์„ค๊ณ„ ๋ถ€์‹ค์˜ ์‹ ํ˜ธ. - ๋ฒ„์ „ ๊ด€๋ฆฌ: ๊ธฐ๋Šฅ์ด ์•„๋‹Œ contract ๋ฒ„์ „. API/Event/DB schema ๋ฒ„์ „ ๋ถ„๋ฆฌ. - **์ ์šฉ:** Release note์—๋Š” contract version, breaking change, migration step ๋ช…์‹œ. #### 12. ์ •๊ณต๋ฒ• (Right Way, Not Shortcuts) - ์•ˆ ๋˜๋Š” ๊ธธ์— ์‹œ๊ฐ„ ๋‚ญ๋น„ํ•˜์ง€ ๋ง๋˜, ํŽธํ•œ ๊ธธ๋„ ํ”ผํ•œ๋‹ค (--no-verify, force push). - ๋ฌธ์ œ ๊ทผ๋ณธ ํ•ด๊ฒฐ. Symptom ์น˜๋ฃŒ๋Š” debt ์ฆ๊ฐ€. - ๋ฆฌ๋ทฐ์–ด๊ฐ€ "์ด๊ฒŒ ์ตœ์„ ์ธ๊ฐ€?" ๋ฌป๋Š” ์ฝ”๋“œ๋Š” ์žฌ์ž‘์„ฑ. "์ถฉ๋ถ„ํžˆ ์ข‹๋‹ค" โ‰  "์ตœ์„ ". - **์ ์šฉ:** Build ์‹คํŒจ โ†’ --no-verify X, ์›์ธ ํŒŒ์•…. Merge conflict โ†’ cherry-pick X, rebase ์ œ๋Œ€๋กœ. #### 13. ๊ธฐ์ˆ ๋ถ€์ฑ„ ๊ด€๋ฆฌ (Tech Debt Registry) - ๋ถ€์ฑ„๋Š” ๊ธฐ๋กํ•˜๋Š” ์ˆœ๊ฐ„๋ถ€ํ„ฐ ์ด์ž ๋ฐœ์ƒ. ๋ฏธ๋ฃจ์ง€ ๋ง ๊ฒƒ. - **Debt ID:** TECH-001 ๋“ฑ์œผ๋กœ ์ถ”์ . PR/commit์—์„œ ์ฐธ์กฐ. - **์šฐ์„ ์ˆœ์œ„:** Impact (์–ผ๋งˆ๋‚˜ ํฐ๊ฐ€) ร— Effort (๊ณ ์น˜๋Š” ๋ฐ ๋“œ๋Š” ๋น„์šฉ). ๊ณ ์˜ํ–ฅ ์ €๋น„์šฉ ์šฐ์„ . - **Paydown:** ๋ถ„๊ธฐ๋งˆ๋‹ค debt 20% ๊ฐ์ถ• ๋ชฉํ‘œ. ์‹ ๊ทœ debt > paydown์ด๋ฉด ์งˆ์‹. - **์ ์šฉ:** README.md์˜ TECH_DEBT_REGISTER ๋งค์›” ๊ฒ€ํ† . 3๊ฐœ์›” ๋ฏธํ•ด๊ฒฐ = ๋ฆฌํŒฉํ„ฐ ์Šคํ”„๋ฆฐํŠธ ํ•„์š”. ### Work Decision Checklist ๋ชจ๋“  task์— ๋Œ€ํ•ด ๋‹ค์Œ์„ ์ž๋ฌธ: - [ ] **SOLID:** ์ด ๋ณ€๊ฒฝ์ด ๋‹จ์ผ ์ฑ…์ž„์ธ๊ฐ€? Dependency inversion์„ ์ง€ํ‚ฌ ๊ฒƒ์ธ๊ฐ€? - [ ] **Complexity:** ํ•จ์ˆ˜/๋ฉ”์„œ๋“œ ๋ณต์žก๋„๋Š” 10 ์ดํ•˜์ธ๊ฐ€? (Policy ์˜ˆ์™ธ) - [ ] **Audit:** Evidence/Revision ์ถ”์  ๊ฐ€๋Šฅํ•œ๊ฐ€? PIT ์ฟผ๋ฆฌ ์žˆ๋Š”๊ฐ€? - [ ] **Necessity:** ๊ทผ๊ฑฐ ์žˆ๋Š” ๋ณ€๊ฒฝ์ธ๊ฐ€? "ํ˜น์‹œ ํ•„์š”ํ•˜๋ฉด" ์•„๋‹Œ๊ฐ€? - [ ] **Normalization:** ์“ฐ๊ธฐ๋Š” 3NF, ์ฝ๊ธฐ๋Š” projection์ธ๊ฐ€? - [ ] **Simplicity:** ์œ„โ†’์•„๋ž˜๋กœ ์ฝํ˜€์•ผ ํ•˜๋Š”๊ฐ€? ์ˆจ๊ฒจ์ง„ ์ „์ œ ์—†๋Š”๊ฐ€? - [ ] **Pattern:** ํ‘œ์ค€ Slice/Job/Component ๋”ฐ๋ฅด๋Š”๊ฐ€? ์ƒˆ ํŒจํ„ด ๋„์ž…์€ ๊ฒ€์ฆ๋๋Š”๊ฐ€? - [ ] **Guardrails:** ๊ทผ๊ฑฐ ์žˆ๋Š”๊ฐ€? "์™œ"๋ฅผ ๊ธฐ๋กํ–ˆ๋Š”๊ฐ€? - [ ] **Traceability:** Artifact ๋ณด์กด๋˜๋Š”๊ฐ€? Reproduction ๊ฐ€๋Šฅํ•œ๊ฐ€? ADR/Issue ๋งํฌ ์žˆ๋Š”๊ฐ€? - [ ] **Safety:** Idempotent์ธ๊ฐ€? Rollback ๊ฐ€๋Šฅํ•œ๊ฐ€? ๋ถ€๋ถ„ ์‹คํŒจ ์ผ€์ด์Šค ์ฒ˜๋ฆฌํ–ˆ๋Š”๊ฐ€? - [ ] **Maturity:** ์ž„์‹œ๋ฐฉํŽธ ์•„๋‹Œ๊ฐ€? Contract/schema/test ๋จผ์ € ํ–ˆ๋Š”๊ฐ€? - [ ] **Right Way:** Shortcut (--no-verify, force) ์•ˆ ์ผ๋Š”๊ฐ€? ๊ทผ๋ณธ ํ•ด๊ฒฐํ–ˆ๋Š”๊ฐ€? - [ ] **Debt:** ์ƒˆ๋กœ์šด debt ๋งŒ๋“ค์ง€ ์•Š๋Š”๊ฐ€? ๊ธฐ์กด debt ๊ฐ์ถ•ํ•˜๋Š”๊ฐ€? - [ ] **Viewport Fit (UI):** ๋Œ€์‹œ๋ณด๋“œ๋ฅผ ์ œ์™ธํ•œ ๋ชจ๋“  ์—…๋ฌด ํ™”๋ฉด์ด ํŽ˜์ด์ง€ ์Šคํฌ๋กค ์—†์ด ์ดˆ๊ธฐ ๋กœ๋”ฉ ์‹œ 100% ํ•œ๋ˆˆ์— ๋“ค์–ด์˜ค๋Š”๊ฐ€? - [ ] **Button Standard (UI):** ์ƒ๋‹จ ํˆด๋ฐ”(๋ฐฐ์น˜/๋“ฑ๋ก), ํ–‰๋ณ„ ์ž‘์—…(์ˆ˜์ •/์ƒ์„ธ), ๋‹ค์ค‘์„ ํƒ(์ผ๊ด„), ํผ ํ‘ธํ„ฐ(์ทจ์†Œ/์ €์žฅ) ๋ฒ„ํŠผ ๋ฐฐ์น˜๊ฐ€ ๊ทœ์น™ ๋งคํŠธ๋ฆญ์Šค๋ฅผ ๋”ฐ๋ฅด๋Š”๊ฐ€? - [ ] **Skeleton Loading (UI):** ๋กœ๋”ฉ ์ƒํƒœ ์‹œ ํ…์ŠคํŠธ ๋Œ€์‹  ๋ ˆ์ด์•„์›ƒ์— ๋ฐ˜์‘ํ•˜๋Š” shimmer ์Šค์ผˆ๋ ˆํ†ค(SkeletonLoader)์ด ์ œ๋Œ€๋กœ ๋…ธ์ถœ๋˜๋Š”๊ฐ€? - [ ] **Empty State (UI):** ๋ฐ์ดํ„ฐ 0๊ฑด ๋˜๋Š” ์กฐํšŒ ๊ฒฐ๊ณผ๊ฐ€ ์—†์„ ์‹œ ํ‘œ์ค€ EmptyStatePlaceholder(์•„์ด์ฝ˜+์„ค๋ช…+์กฐ์น˜๋ฒ„ํŠผ)๊ฐ€ ๋…ธ์ถœ๋˜๋Š”๊ฐ€? - [ ] **Component Scale (UI):** ์ž…๋ ฅํผ, ๊ทธ๋ฆฌ๋“œ, ๋ฒ„ํŠผ, ์„ ํƒ์ƒ์ž ๋†’์ด/ํฐํŠธ๊ฐ€ ์ค‘์•™ ํ† ํฐ(`tokens.css`) ๊ทœ๊ฒฉ(ํ—ค๋” 30px, ํ–‰ 28px, ์ปจํŠธ๋กค 28px, ํฐํŠธ 12px)์„ ๋”ฐ๋ฅด๋Š”๊ฐ€? ### Anti-Patterns (๊ธˆ์ง€) - โŒ "์ผ๋‹จ ๋งŒ๋“ค๊ณ  ๋‚˜์ค‘์— ๋ฆฌํŒฉํ„ฐ" โ†’ Feature ์ดˆ๊ธฐ๋ถ€ํ„ฐ ์ •๊ณต๋ฒ• - โŒ "ํŽ˜์ด์ง€์— ์ฐฝ ์Šคํฌ๋กค๋ฐ”๊ฐ€ ์ƒ๊ธฐ๊ฒŒ ๋ฐฉ์น˜" โ†’ ๋Œ€์‹œ๋ณด๋“œ ์ œ์™ธ ๋ชจ๋“  ์—…๋ฌด ํ™”๋ฉด์€ Viewport-Fit Zero-Scroll ํ•„์ˆ˜ - โŒ "๋ฒ„ํŠผ ์œ„์น˜ ๋‚œ์žก ๋ฐฐ์น˜" โ†’ ์ƒ๋‹จ ์šฐ์ธก(ํŽ˜์ด์ง€/๋ฐฐ์น˜), ํ–‰ ๋‚ด๋ถ€(๊ฐœ๋ณ„ CRUD), ์„ ํƒ๋ฐ”(์ผ๊ด„), ํผ ํ‘ธํ„ฐ(์ €์žฅ/์ทจ์†Œ) ํ‘œ์ค€ ๋ฌด์‹œ ๊ธˆ์ง€ - โŒ "๋กœ๋”ฉ ์‹œ '๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘...' ํ…์ŠคํŠธ ๋ฐฉ์น˜" โ†’ ๋ฐ˜๋“œ์‹œ ๋ ˆ์ด์•„์›ƒ ๋งž์ถคํ˜• ์• ๋‹ˆ๋ฉ”์ด์…˜ ์Šค์ผˆ๋ ˆํ†ค(SkeletonLoader) ์ ์šฉ ํ•„์ˆ˜ - โŒ "๋ฐ์ดํ„ฐ 0๊ฑด ์‹œ ๋นˆ ํฐ์ƒ‰ ๊ณต๊ฐ„ ๋ฐฉ์น˜" โ†’ ๋ฐ˜๋“œ์‹œ ํ‘œ์ค€ EmptyStatePlaceholder ์ปดํฌ๋„ŒํŠธ ๋ Œ๋”๋ง ํ•„์ˆ˜ - โŒ "๊ฐœ๋ณ„ ์ธ๋ผ์ธ height/font style ๋‚œ๋ฆฝ" โ†’ ๋ฐ˜๋“œ์‹œ ์ค‘์•™ tokens.css / base.css ๋””์ž์ธ ํ† ํฐ ์ƒ์† ํ•„์ˆ˜ - โŒ "ํ˜น์‹œ ํ•„์š”ํ• ๊นŒ๋ด ์ถ”์ƒํ™”" โ†’ Necessity-driven๋งŒ - โŒ SELECT * / Generic Repository โ†’ Explicit columns, explicit logic - โŒ "์ด๊ฑด ์ž‘์€ ๋ณ€๊ฒฝ์ด๋ผ ํ…Œ์ŠคํŠธ ์Šคํ‚ต" โ†’ ๋ชจ๋“  ๊ฒฝ๋กœ characterize - โŒ Timestamp๋ฅผ ์ง์ ‘ DateTime.Now โ†’ IClock ์ฃผ์ž… - โŒ Policy ๋กœ์ง์ด Job/Handler์— โ†’ Domain Policy๋งŒ - โŒ "๋‚˜์ค‘์— monitoring ์ถ”๊ฐ€" โ†’ ๋ฐฐํฌ ์ „ Metric/Alert/Runbook ํ•„์ˆ˜ - โŒ Magic number โ†’ ๊ทผ๊ฑฐ ์žˆ๋Š” ์ƒ์ˆ˜, Policy ID๋กœ ์ถ”์  - โŒ "๋‹ค๋ฅธ ๋ชจ๋“ˆ ํ…Œ์ด๋ธ” ์กฐํšŒ" โ†’ Contract/Read Model๋งŒ - โŒ ์Šคํ‚ต๋œ ํ…Œ์ŠคํŠธ ๊ธฐ๋ก ์•ˆ ํ•จ โ†’ Debt register์— DECISION_REQUIRED ## Execution Protocol Addendum ### Before Any Change - Read the current Source of Truth first: user-provided configuration, current schema, active contracts, and existing tests. - Record `Source / Assumption / Unknown / Decision Required` in the Slice note before editing. - Preserve user-fixed development and production configuration values. Never replace them with compose defaults, environment fallbacks, or guessed credentials. - Classify the change as exactly one Vertical Slice or one behavior-preserving refactoring. Do not mix policy, schema, configuration, and unrelated cleanup. ### Database Test Routing - Unit tests do not connect to a database. - Integration and migration tests use the configured test database from the test project's Development settings. - Production database access is read-only diagnostics only unless an explicitly approved production release step says otherwise. - Before any destructive test-database operation, parse and verify the database name is the approved test database. Refuse all other names. - Do not infer schema from a legacy migration file. Compare active runtime SQL, tests, and the current database schema first. ### Time and Timezone - Persist instants in UTC with timezone-aware database types where the contract permits. - Convert to KST only at display, reporting, scheduling, or MarketCalendar boundaries. - Keep `IClock.UtcNow` as the application clock contract. A KST conversion requires an explicit contract and characterization test. - Never change a timezone or reinterpret existing timestamps without a documented data-meaning decision and rehearsal evidence. ### Blockers Must Be Actionable - Do not repeatedly report that work is blocked without a concrete resolution proposal. - For each blocker, state: exact cause, safe options, recommended option, required command or approval, and the evidence that will be produced. - If the user has provided the required authority or test resource, proceed within that scope instead of asking for the same approval again. - If an external prerequisite is missing, perform all safe read-only checks first, then give one precise request to unblock the next Slice. ### Evidence and Completion - Never claim completion from an intended command. Record the actual command result and artifact path. - For migrations, preserve fresh-install, upgrade, re-run, and failure-rehearsal evidence before calling the Slice complete. - When a change fails validation, revert or isolate the failed draft before starting the next Slice; do not leave an unapplied journal or partial scaffold as if it were approved.