@ryuenn3123/agentic-senior-core 6.16.2 → 6.16.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/.agents/plugins/agentic-senior-core/.codex-plugin/plugin.json +1 -1
  2. package/.agents/plugins/agentic-senior-core/commands/asc-pentest.md +2 -0
  3. package/.agents/plugins/agentic-senior-core/commands/asc-pentest.toml +3 -0
  4. package/.agents/plugins/agentic-senior-core/hooks/dedup-gate.js +137 -128
  5. package/.agents/plugins/agentic-senior-core/hooks/hooks.json +97 -0
  6. package/.agents/plugins/agentic-senior-core/hooks/ladder-pulse.js +53 -36
  7. package/.agents/plugins/agentic-senior-core/hooks/lib/known-ui-slop-patterns.json +20 -0
  8. package/.agents/plugins/agentic-senior-core/hooks/path-util.cjs +118 -4
  9. package/.agents/plugins/agentic-senior-core/hooks/post-edit-enforce.js +98 -81
  10. package/.agents/plugins/agentic-senior-core/hooks/pre-tool-dependency-gate.js +168 -191
  11. package/.agents/plugins/agentic-senior-core/hooks/session-pulse.js +48 -35
  12. package/.agents/plugins/agentic-senior-core/hooks/session-start.js +62 -11
  13. package/.agents/plugins/agentic-senior-core/hooks.json +4 -94
  14. package/.agents/plugins/agentic-senior-core/plugin.json +5 -13
  15. package/.agents/plugins/agentic-senior-core/rules/agentic-senior-core.md +6 -1
  16. package/.agents/plugins/agentic-senior-core/skills/asc/SKILL.md +5 -2
  17. package/.agents/plugins/agentic-senior-core/skills/asc-develop/SKILL.md +3 -3
  18. package/.agents/plugins/agentic-senior-core/skills/asc-pentest/SKILL.md +97 -0
  19. package/.agents/plugins/agentic-senior-core/skills/asc-pentest/references/api-security-idor.md +105 -0
  20. package/.agents/plugins/agentic-senior-core/skills/asc-pentest/references/dast-baseline.md +78 -0
  21. package/.agents/plugins/agentic-senior-core/skills/asc-pentest/references/fuzzing-dsl.md +66 -0
  22. package/.agents/plugins/agentic-senior-core/skills/asc-pentest/references/pentest-task-tree.md +70 -0
  23. package/.agents/plugins/agentic-senior-core/skills/asc-review/SKILL.md +2 -2
  24. package/.agents/plugins/agentic-senior-core/skills/asc-test/SKILL.md +8 -1
  25. package/.agents/plugins/agentic-senior-core/skills/asc-test/references/mutation-testing.md +55 -0
  26. package/.agents/plugins/agentic-senior-core/skills/asc-test/references/performance-budgets.md +67 -0
  27. package/.agents/plugins/agentic-senior-core/skills/asc-test/references/property-testing.md +72 -0
  28. package/.agents/plugins/agentic-senior-core/skills/asc-ui/SKILL.md +17 -14
  29. package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/copy-i18n.md +56 -8
  30. package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/craft/color-surfaces.md +25 -0
  31. package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/craft/themes-catalog.md +198 -0
  32. package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/divergence.md +34 -2
  33. package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/modes/genre-calibration.md +89 -0
  34. package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/modes/operate.md +26 -0
  35. package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/modes/persuade.md +10 -9
  36. package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/redesign-audit.md +4 -9
  37. package/bin/agentic-senior-core.js +19 -4
  38. package/gemini-extension.json +2 -2
  39. package/lib/cli/ascx/runtime.mjs +5 -27
  40. package/lib/cli/ascx/windows-spawn.mjs +348 -0
  41. package/lib/cli/commands/bootstrap.mjs +56 -0
  42. package/lib/cli/commands/dedup.mjs +500 -0
  43. package/lib/cli/commands/git-hook-generator.mjs +3 -2
  44. package/lib/cli/commands/global.mjs +109 -53
  45. package/lib/cli/commands/preview.mjs +18 -9
  46. package/package.json +1 -1
  47. package/plugin.yaml +3 -1
@@ -0,0 +1,70 @@
1
+ # The Pentesting Task Tree (PTT) Protocol
2
+
3
+ Derived from the USENIX Security architecture of **PentestGPT**. Prevents conversational context drift and maintains rigorous state tracking across multi-turn security engagements.
4
+
5
+ ---
6
+
7
+ ## 1. Task Taxonomies
8
+
9
+ Every security evaluation action must map to one of six explicit task kinds:
10
+
11
+ | Task Kind | Intent & Scope | Entry Criteria | Exit Criteria |
12
+ |---|---|---|---|
13
+ | **`DISCOVER`** | Network and surface mapping. Extract routes, ports, endpoints, and authentication schemes from source or running app. | Target URL / source repository provided. | Exhaustive inventory of accessible routes and protocols documented in session ledger. |
14
+ | **`ENUMERATE`** | Parameter and contract analysis. Identify parameter types, required fields, and boundary expectations per route. | Route inventory established. | Input vectors mapped (query parameters, body schema, headers, cookies). |
15
+ | **`TEST`** | Dynamic vulnerability probing. Execute targeted fuzzing, payload injection, or authorization checks. | Target parameters identified. | Target behavior analyzed; anomalies (5xx errors, reflection, unauthorized data) logged. |
16
+ | **`EXPLOIT`** | Proof-of-exploit verification. Formulate a minimal, non-destructive reproduction proving the vulnerability is real. | Anomaly confirmed under `TEST`. | Deterministic `curl` script or test assertion proving the vulnerability exists. |
17
+ | **`VERIFY`** | Patch verification. Re-run the reproduction script after developer code remediation. | Code patch applied. | Reproduction script fails (vulnerability successfully mitigated). |
18
+ | **`RECOVER`** | Environment restoration. Purge canary entities, tokens, or temporary records injected during testing. | Engagement complete or failed. | Database and filesystem confirmed clean of canary records. |
19
+
20
+ ---
21
+
22
+ ## 2. Task State Transitions
23
+
24
+ Tasks progress through a deterministic state machine:
25
+
26
+ ```
27
+ ┌─────────┐ Dependencies Met ┌─────────┐ Execution Start ┌──────────┐
28
+ │ BLOCKED │ ─────────────────────────► │ READY │ ────────────────────────► │ ACTIVE │
29
+ └─────────┘ └─────────┘ └────┬─────┘
30
+ │
31
+ ┌─────────────────────────────────────┴──────────┐
32
+ ▼ ▼
33
+ ┌─────────┐ ┌──────────┐
34
+ │ DONE │ │ FAILED │
35
+ └─────────┘ └──────────┘
36
+ ```
37
+
38
+ - **`BLOCKED`**: Prerequisites (e.g. valid auth token, route discovery) not yet satisfied.
39
+ - **`READY`**: All `depends_on` tasks have reached `DONE`.
40
+ - **`ACTIVE`**: Currently executing under a single task lease.
41
+ - **`DONE`**: Target objective fulfilled; basis artifacts recorded.
42
+ - **`FAILED`**: Execution failed or payload rejected; requires recovery or strategy adaptation.
43
+
44
+ ---
45
+
46
+ ## 3. Session Ledger Format (`scratch/pentest-session.md`)
47
+
48
+ When executing an engagement spanning more than 2 steps, initialize a session ledger in the scratch directory:
49
+
50
+ ```markdown
51
+ # Pentest Session Ledger: [Target Name]
52
+ Target URL: http://localhost:8000
53
+ Session Started: YYYY-MM-DD HH:MM:SS
54
+
55
+ ## Active Task Tree
56
+ - [x] T01 [DISCOVER]: Route inventory from src/routes/ (DONE)
57
+ - [x] T02 [ENUMERATE]: Parameter mapping on /api/v1/invoices/:id (DONE)
58
+ - [x] T03 [TEST]: BOLA check with secondary tenant token (DONE)
59
+ - [ ] T04 [EXPLOIT]: Minimal curl proof demonstrating horizontal data leakage (ACTIVE)
60
+ - [ ] T05 [VERIFY]: Re-check after authorization policy middleware applied (BLOCKED on T04)
61
+ - [ ] T06 [RECOVER]: Purge canary tenant records from test database (BLOCKED on T05)
62
+
63
+ ## Findings Ledger
64
+ ### F01: BOLA on GET /api/v1/invoices/:id
65
+ - Severity: CRITICAL
66
+ - Location: routes/invoices.js:45
67
+ - Finding: Route queries DB by `id` directly without filtering by `tenant_id` from auth context.
68
+ - Evidence: Peer B token successfully retrieved Invoice #1042 owned by Tenant A.
69
+ ```
70
+
@@ -32,12 +32,12 @@ Use when reviewing PRs, diffs, commits, or newly written feature code.
32
32
  ### Review Procedure
33
33
  1. **Scope Inspection**: Run `git diff --stat` (or `git status`) to inspect modified files and line deltas.
34
34
  2. **Test-Change Correlation**: For every modified application logic file, verify that a corresponding test was updated. If logic changed without tests, flag as missing test coverage.
35
- 3. **Deterministic Verification**: Run project linter and test suite (`ascx test` / `npm test`). Confirm exit code 0 fresh.
35
+ 3. **Deterministic Verification**: Run project linter and test suite (`ascx npm test`). Confirm exit code 0 fresh.
36
36
  4. **Severity Priority Order**:
37
37
  - **Severity 1 (Critical)**: Correctness, data corruption, auth/permission bypass, security sinks, PII leakage.
38
38
  - **Severity 2 (High)**: Action feedback failures (hanging spinners, unhandled mutations, missing error boundaries), unhandled async rejections, missing remote timeouts.
39
39
  - **Severity 3 (Medium)**: Public contract drift, missing failure-path tests, architectural boundary violations.
40
- - **Severity 4 (Low)**: Maintainability debt, performance micro-optimizations, code comment noise.
40
+ - **Severity 4 (Low)**: Maintainability debt, performance micro-optimizations, narrative code comment noise, AI prose cadence or buzzwords in user-facing copy or documentation.
41
41
 
42
42
  ---
43
43
 
@@ -33,6 +33,9 @@ Before writing tests, running suites, or claiming verification:
33
33
  1. **Mandatory Ingestion (BLOCKING GATE):** Call `read_file` on the tier reference matching your testing requirement BEFORE taking action:
34
34
  - Writing unit tests / TDD cycle ➔ `references/tdd-cycle.md`
35
35
  - Behavior testing, boundary isolation, mocks/fakes ➔ `references/test-design.md`
36
+ - Generative property invariants & fuzzing ➔ `references/property-testing.md`
37
+ - Mutation testing & assertion integrity ➔ `references/mutation-testing.md`
38
+ - Concurrency latency & performance budgets ➔ `references/performance-budgets.md`
36
39
  - Playwright browser tests, locators, page objects ➔ `references/e2e-playwright.md`
37
40
  - Acceptance criteria, UAT checklists, edge case quads ➔ `references/uat.md`
38
41
  - Bug reproduction, root-cause verification, regression proof ➔ `references/regression-proof.md`
@@ -104,6 +107,9 @@ Select the lowest testing tier that validates the requirement:
104
107
  |---|---|
105
108
  | Red-Green-Refactor mechanics & whole-suite checks | `references/tdd-cycle.md` |
106
109
  | Behavior testing, boundary isolation & mocking | `references/test-design.md` |
110
+ | Generative property invariants & boundary fuzzing | `references/property-testing.md` |
111
+ | Mutation integrity score (>= 80%) & mutant triage | `references/mutation-testing.md` |
112
+ | Latency budgets (p95 <= 150ms) & concurrency benchmarking | `references/performance-budgets.md` |
107
113
  | Playwright E2E, reconnaissance & locator hierarchy | `references/e2e-playwright.md` |
108
114
  | Given/When/Then acceptance criteria & edge case quad | `references/uat.md` |
109
115
  | 3-step bugfix verification & regression proof | `references/regression-proof.md` |
@@ -118,5 +124,6 @@ Before declaring any coding or testing task complete:
118
124
  2. **Regression Proof:** For bugfixes, confirm the test failed without the fix and passes with it.
119
125
  3. **Whole-Suite Run:** Execute the full test suite (`ascx npm test` or project test runner); confirm exit code 0.
120
126
  4. **No Assertions Weakened:** Verify no existing test assertions were deleted or commented out to simulate success.
121
- 5. **Hermetic State:** Ensure tests clean up temporary files, database records, and environment variables.
127
+ 5. **Mutation Sanity:** For critical authorization or business logic, verify tests catch condition inversion.
128
+ 6. **Hermetic State:** Ensure tests clean up temporary files, database records, and environment variables.
122
129
 
@@ -0,0 +1,55 @@
1
+ # Mutation Testing & Test Suite Integrity
2
+
3
+ Staff-grade guidelines for mutation testing and eradicating false-positive test suites. Grounded in the principles of **Stryker Mutator**.
4
+
5
+ ---
6
+
7
+ ## 1. The Fallacy of Code Coverage
8
+
9
+ Code coverage (line, branch, or statement coverage) measures only what code was executed; it does **not** measure whether assertions were made:
10
+ ```javascript
11
+ // A test with 100% line coverage and ZERO verification value:
12
+ it('calculates invoice total', () => {
13
+ const result = calculateTotal(mockCart);
14
+ // No assertions! Or weak assertion: assert.ok(result);
15
+ });
16
+ ```
17
+ Such tests give false confidence: business logic can break completely while 100% of tests continue to pass.
18
+
19
+ **Mutation testing** tests the test suite: it introduces small synthetic defects (**mutants**) into the production code. If your tests fail, the mutant is **killed** (good). If your tests pass despite the corrupted logic, the mutant **survives** (flawed test coverage).
20
+
21
+ ---
22
+
23
+ ## 2. Standard Mutant Operators
24
+
25
+ | Mutant Class | Original Code | Mutated Code | Verification Test Expectation |
26
+ |---|---|---|---|
27
+ | **Equality Operator** | `if (user.role === 'admin')` | `if (user.role !== 'admin')` | Test asserting admin access must fail immediately. |
28
+ | **Relational Boundary** | `if (balance >= price)` | `if (balance > price)` | Boundary test where `balance === price` must fail. |
29
+ | **Logical Connector** | `if (hasToken && isValid)` | `if (hasToken \|\| isValid)` | Test with valid token and invalid state must fail. |
30
+ | **Return Constant** | `return totalAmount;` | `return 0;` or `return null;` | Result consumer assertion must fail. |
31
+ | **Statement Deletion** | `await auditLog.record(event);` | `/* deleted */` | Audit persistence assertion must fail. |
32
+
33
+ ---
34
+
35
+ ## 3. The Mutation Integrity Score
36
+
37
+ $$\text{Mutation Score} = \left( \frac{\text{Killed Mutants}}{\text{Total Mutants}} \right) \times 100\%$$
38
+
39
+ - **Target Threshold**: Core business logic, pricing, authorization checks, and security boundaries must achieve a Mutation Score of $\ge 80\%$.
40
+ - **Survived Mutant Triage**:
41
+ - Every survived mutant indicates an untested boundary or missing assertion.
42
+ - Fix: Do not modify production code; write a specific failure assertion that kills the surviving mutant.
43
+
44
+ ---
45
+
46
+ ## 4. The Agentic Mutant Sanity Check
47
+
48
+ When introducing or refactoring a critical function (e.g. auth check, payment math, permissions):
49
+ 1. **Identify the core decision branch** (e.g. `if (isAuthorized) return allow();`).
50
+ 2. **Inject a manual mutant**: temporarily invert the condition (`if (!isAuthorized)`).
51
+ 3. **Run the test runner**:
52
+ - If tests still pass $\to$ **FLAG AS CRITICAL TEST DEFECT**. Your tests are not testing the logic.
53
+ - Add the missing negative test case until the mutant is killed.
54
+ 4. **Revert the mutant** and confirm the full test suite turns green.
55
+
@@ -0,0 +1,67 @@
1
+ # Performance Budgets & Concurrency Benchmarking
2
+
3
+ Staff-grade guidelines for performance testing, latency budgets, and concurrency verification. Grounded in the principles of **Grafana k6**.
4
+
5
+ ---
6
+
7
+ ## 1. Latency Budgets & Percentiles
8
+
9
+ Averages mask performance degradation. A service with an average response time of $50\text{ms}$ can still have $10\%$ of users waiting over $1,500\text{ms}$. Performance must be budgeted and measured using **percentiles**:
10
+
11
+ | Metric | Target Standard | Operational Context |
12
+ |---|---|---|
13
+ | **Unit Logic Runtime** | $\le 5\text{ms}$ | Pure algorithms, mathematical transforms, string parsers. |
14
+ | **$p_{50}$ (Median Latency)** | $\le 50\text{ms}$ | Standard read operations with warm database index. |
15
+ | **$p_{95}$ (95th Percentile)** | $\le 150\text{ms}$ | 95 out of 100 requests must complete under this budget. |
16
+ | **$p_{99}$ (Worst-case Tail)** | $\le 300\text{ms}$ | Tail latency under concurrency and database lock contention. |
17
+ | **Error Rate Threshold** | Strictly $0.00\%$ | Zero 5xx errors or dropped socket connections under target load. |
18
+
19
+ ---
20
+
21
+ ## 2. Micro-Benchmark Concurrency Harness
22
+
23
+ For critical endpoints, verify concurrency resilience using a native script before handoff:
24
+
25
+ ```javascript
26
+ import assert from 'node:assert/strict';
27
+
28
+ async function benchmarkEndpoint(url, concurrentRequests = 10, totalRequests = 50) {
29
+ const durations = [];
30
+ const runBatch = async () => {
31
+ const start = performance.now();
32
+ const res = await fetch(url);
33
+ const duration = performance.now() - start;
34
+ assert.equal(res.status, 200, `Expected 200, got ${res.status}`);
35
+ durations.push(duration);
36
+ };
37
+
38
+ // Run in chunks of `concurrentRequests`
39
+ for (let i = 0; i < totalRequests; i += concurrentRequests) {
40
+ await Promise.all(Array.from({ length: concurrentRequests }, runBatch));
41
+ }
42
+
43
+ durations.sort((a, b) => a - b);
44
+ const p50 = durations[Math.floor(durations.length * 0.50)];
45
+ const p95 = durations[Math.floor(durations.length * 0.95)];
46
+
47
+ console.log(`Benchmark: N=${totalRequests} | p50=${p50.toFixed(1)}ms | p95=${p95.toFixed(1)}ms`);
48
+ assert.ok(p95 <= 150, `p95 exceeded budget: ${p95.toFixed(1)}ms > 150ms`);
49
+ }
50
+ ```
51
+
52
+ ---
53
+
54
+ ## 3. Memory Leak & Garbage Collection Invariants
55
+
56
+ Under sustained request loops, memory footprint must reach a steady plateau rather than growing monotonically:
57
+
58
+ 1. **Heap Growth Check**:
59
+ - Record `process.memoryUsage().heapUsed` before iteration loop.
60
+ - Run $1,000$ iterations of the business operation.
61
+ - Trigger garbage collection (or sample at $N=1000$).
62
+ - Assert heap growth is bounded ($\le 10\%$ increase from baseline).
63
+ 2. **Common Culprits**:
64
+ - Global event listeners (`emitter.on()`) attached inside request handlers without removal.
65
+ - Unbounded in-memory caches or map accumulators without LRU eviction.
66
+ - Retained references inside closures of unresolved promises.
67
+
@@ -0,0 +1,72 @@
1
+ # Generative Property-Based Testing & Invariant Fuzzing
2
+
3
+ Staff-grade guidelines for property-based testing and generative fuzzing. Grounded in the principles of **Hypothesis** and **fast-check**.
4
+
5
+ ---
6
+
7
+ ## 1. Example-Based vs. Property-Based Testing
8
+
9
+ Standard unit tests validate specific, hand-picked examples:
10
+ ```javascript
11
+ // Example-based: tests 1 trivial scenario
12
+ assert.equal(parsePrice("$19.99"), 1999);
13
+ ```
14
+ Example-based tests suffer from confirmation bias: developers only test inputs they already anticipate.
15
+
16
+ **Property-based testing** flips the testing paradigm: you define universal system **invariants** (truths that must hold for ALL possible inputs), and the engine executes hundreds or thousands of randomized boundary inputs to prove or disprove the property:
17
+ ```javascript
18
+ import fc from 'fast-check';
19
+
20
+ // Property-based: tests 100+ generated inputs across extreme boundaries
21
+ fc.assert(
22
+ fc.property(fc.integer({ min: 0, max: 1000000 }), (cents) => {
23
+ const formatted = formatCurrency(cents);
24
+ return parseCurrency(formatted) === cents; // Invariant: round-trip fidelity
25
+ })
26
+ );
27
+ ```
28
+
29
+ ---
30
+
31
+ ## 2. Core Invariant Archetypes
32
+
33
+ Every complex business module should be tested against at least one of these four invariant patterns:
34
+
35
+ | Invariant Pattern | Definition | Canonical Example |
36
+ |---|---|---|
37
+ | **Round-Trip (Serialization)** | Transforming $A \to B \to A$ preserves exact identity. | `deserialize(serialize(record)) === record`<br>`base64Decode(base64Encode(data)) === data` |
38
+ | **Idempotence** | Applying an operation multiple times yields the same result as applying it once. | `format(format(input)) === format(input)`<br>`cleanHtml(cleanHtml(dirty)) === cleanHtml(dirty)` |
39
+ | **Crash Invariance (No 5xx)** | No valid or invalid input shall trigger an unhandled exception or server crash. | For any generated string $s$, `parseAddress(s)` returns a parsed object OR a safe `ValidationFailure` without throwing uncaught errors. |
40
+ | **Monotonicity & Invariance** | Mathematical or business logic ordering invariants. | Adding an item to a cart never decreases the cart subtotal (`subtotal(cart + item) >= subtotal(cart)`). |
41
+
42
+ ---
43
+
44
+ ## 3. Boundary Input Generators
45
+
46
+ When testing pure functions or data transformations, generators must evaluate pathological boundary inputs:
47
+
48
+ 1. **Numeric Boundaries**:
49
+ - `0`, `-0`, `1`, `-1`
50
+ - `Number.MIN_SAFE_INTEGER`, `Number.MAX_SAFE_INTEGER`
51
+ - `Infinity`, `-Infinity`, `NaN`
52
+ - Floating-point precision traps (`0.1 + 0.2`)
53
+ 2. **String Boundaries**:
54
+ - Empty string `""`
55
+ - Strings with null bytes (`"canary\0danger"`)
56
+ - Unicode RTL override characters (`\u202E`) and emojis
57
+ - Extremely large strings ($10^5$ characters)
58
+ - Unpaired surrogate halves (`\uD800`)
59
+ 3. **Collection & Tree Boundaries**:
60
+ - Empty arrays `[]`, single-element `[x]`, arrays with duplicates `[x, x]`.
61
+ - Deeply nested objects (depth $> 30$).
62
+ - Objects with prototype poisoning keys (`__proto__`, `constructor`).
63
+
64
+ ---
65
+
66
+ ## 4. Failure Shrinking
67
+
68
+ When a property test fails on a massive random input (e.g. an array of 500 items containing a string of 4,000 characters), the property testing runner automatically **shrinks** the failure down to the minimal counterexample that still reproduces the bug (e.g. `['\0']`).
69
+
70
+ **Operational Rule**:
71
+ When documenting a property test failure, always report the **minimal shrunk counterexample** rather than the full randomized run seed.
72
+
@@ -30,6 +30,9 @@ Every UI edit must satisfy these 15 rules without exception:
30
30
  14. **Single-language purity:** Never mix languages on one surface; ban hybrid neologisms (`di-submit`, `meng-generate`).
31
31
  15. **Icon semantics:** Never use raw unicode or emojis as icons. Use dedicated SVG icons; mark decorative icons `aria-hidden="true"`.
32
32
  16. **Substance over restraint:** Stripping slop is only half the job. Replace removed ornaments with real substance: strong typographic scale contrast, full-field color anchors, and authentic interface fragments. Never leave an empty, sterile wireframe void.
33
+ 17. **Product over skill (No geek cosplay):** The real-world domain dictates aesthetics. Never inject terminal windows, ASCII art, or pseudo-telemetry consoles into civic, educational, or commercial products (`references/modes/genre-calibration.md`).
34
+ 18. **The Purpose-Gate:** Every component, widget, or scorecard must enable an actual user task. Never invent unearned widgets, sliders, or simulated feeds without real business data.
35
+ 19. **Anti-card-soup invariant:** Never wrap structural layout sections (header, nav, rails, tables) into floating rounded card islands. Use a Unified Spatial Canvas with hairline dividers (`divide-y`, `border-r`). Cards are strictly for discrete, interchangeable items (`references/divergence.md`).
33
36
 
34
37
  ---
35
38
 
@@ -42,13 +45,10 @@ Before declaring markup, drafting redesign plans, or inspecting user code:
42
45
  `<skill_directory>/references/<category>/<file>.md`
43
46
  Identify the path of this `SKILL.md` file (provided by host/tooling) and resolve all reference paths relative to it.
44
47
 
45
- 2. **Step 1 — Surface Mode Ingestion (MANDATORY GATE):**
46
- Classify the surface and execute `read_file` on the corresponding mode reference BEFORE inspecting files or writing code:
47
- - Dashboards, settings, data tables, developer tools ➔ `references/modes/operate.md`
48
- - Landing pages, pricing tiers, conversion flows ➔ `references/modes/persuade.md`
49
- - Documentation, changelogs, knowledge bases ➔ `references/modes/read.md`
50
- - Showcases, portfolios, interactive galleries ➔ `references/modes/experience.md`
51
- *Do NOT proceed until you have read the mode reference into context.*
48
+ 2. **Step 1 — Two-Phase Enforcement Gate (MANDATORY GATE):**
49
+ - **Phase A (Structure & Hierarchy First):** Lock project domain genre (Civic, Enterprise, SaaS, DevTools) and read `references/modes/genre-calibration.md` + target mode reference (`references/modes/<mode>.md`). Lock the primary focal anchor and spatial posture before writing code.
50
+ - **Phase B (Visual System & Themes):** Read `references/craft/themes-catalog.md` and lock one of the 16 curated themes across 8 real-world domains (e.g., Sovereign Slate, Almanac Index, Editorial Ledger, Pharmacy Calm, Ink & Signal, Graphite Instrument) to prevent probabilistic palette slop.
51
+ *Do NOT proceed until you have read the genre, mode, and theme references into context.*
52
52
 
53
53
  3. **Step 2 — Secondary Craft Ingestion:**
54
54
  Execute `read_file` on at least one relevant craft reference for your task from Section 5 (e.g. `references/craft/typography.md`, `references/craft/color-surfaces.md`, or `references/divergence.md`).
@@ -79,7 +79,7 @@ Visual posture is governed by the surface type, not product branding. Every surf
79
79
  Never split the difference into cosmetic polish on a discarded look:
80
80
  - **Polish / Refinement:** Preserves layout structure, DOM hierarchy, and design tokens. Resolves contrast, missing state quad, microcopy, and lint issues.
81
81
  - **Restyle:** Preserves layout geometry. Replaces color tokens, typographic scales, corner radiuses, and elevation shadows.
82
- - **Full Redesign:** Replaces entire spatial geometry and posture. Mandatory decoupled protocol: extract data/contracts first, discard old DOM, author standalone preview (`asc preview <path>`), build fresh geometry, re-bind dynamic data.
82
+ - **Full Redesign:** Replaces entire spatial geometry and posture. Mandatory decoupled protocol: extract data/contracts first, discard old DOM, establish clear spatial posture and theme tokens, and compile directly to production files with complete layout coherence.
83
83
 
84
84
  ---
85
85
 
@@ -90,6 +90,8 @@ Never split the difference into cosmetic polish on a discarded look:
90
90
 
91
91
  | Target Domain / Task Requirement | Mandatory Reference Path |
92
92
  |---|---|
93
+ | Domain & genre calibration (Anti-geek cosplay) | `references/modes/genre-calibration.md` |
94
+ | Curated material themes & locked art direction | `references/craft/themes-catalog.md` |
93
95
  | Waivable defaults & waiver syntax | `references/reflexes.md` |
94
96
  | Typography, line-height & tabular numbers | `references/craft/typography.md` |
95
97
  | Color tokens, 60-30-10 & elevation | `references/craft/color-surfaces.md` |
@@ -99,7 +101,7 @@ Never split the difference into cosmetic polish on a discarded look:
99
101
  | Responsive reflow, dvh & touch targets | `references/mobile-responsive.md` |
100
102
  | WCAG 2.2 AA contrast & keyboard operability | `references/accessibility.md` |
101
103
  | The Data State Quad & mutation feedback | `references/states-feedback.md` |
102
- | Anti-convergence, 3 Waves of Tells & Mirror Test | `references/divergence.md` |
104
+ | Anti-convergence, 4 Waves of Tells & Mirror Test | `references/divergence.md` |
103
105
  | Structured UI audit matrix | `references/redesign-audit.md` |
104
106
 
105
107
  ---
@@ -107,8 +109,9 @@ Never split the difference into cosmetic polish on a discarded look:
107
109
  ## 6. Verification & Handoff Sweep
108
110
 
109
111
  Before completing any UI task, run this mechanical check:
110
- 1. **Reference Compliance:** Confirm constraints from the loaded `references/modes/<mode>.md` and craft references were strictly applied.
111
- 2. **State Quad:** Loading skeleton, empty state, error with retry, and populated data are all handled.
112
- 3. **Pending Feedback:** Buttons disable and display feedback during ongoing mutations.
113
- 4. **Contrast & Focus:** Verify keyboard tab flow and high-contrast `:focus-visible` styling.
114
- 5. **Lint Check:** Verify changes against `hooks/lib/known-ui-slop-patterns.json`.
112
+ 1. **Reference Compliance:** Confirm constraints from `references/modes/genre-calibration.md`, `references/craft/themes-catalog.md`, and target mode were strictly applied.
113
+ 2. **Finish Gate Sweep:** Verify zero text clipping (+30% expansion buffer), zero awkward text wraps, and 4px/8px spacing grid consistency.
114
+ 3. **State Quad:** Loading skeleton, empty state, error with retry, and populated data are all handled.
115
+ 4. **Pending Feedback:** Buttons disable and display feedback during ongoing mutations.
116
+ 5. **Contrast & Focus:** Verify keyboard tab flow and high-contrast `:focus-visible` styling.
117
+ 6. **Lint Check:** Verify changes against `hooks/lib/known-ui-slop-patterns.json`.
@@ -29,11 +29,44 @@ Exception: Standard multi-step navigation controls in fixed wizards (`Back`, `Ne
29
29
 
30
30
  ---
31
31
 
32
- ## 3. Marketing Buzzword Blacklist
32
+ ## 3. Arithmetic Copy Budgets & The Argument-First Protocol
33
+
34
+ ### 3.1 Arithmetic Budgets
35
+ Constraint is arithmetic; enforce before falling in love with a sentence:
36
+ - **Hero Headline Budget:** Must fit in **two lines or fewer** across all viewports.
37
+ - Mobile (390px): $\le 32$ characters ($\sim 4$–$5$ words).
38
+ - Desktop (1280px): $\le 42$ characters ($\sim 5$–$6$ words).
39
+ - Use `text-wrap: balance` and intentional `<br>` tags to avoid single-word orphans.
40
+ - **Supporting Line Budget:** Exactly **1 sentence**, at most **22 words**.
41
+ - Directly states concrete function and audience.
42
+ - Never repeats or paraphrases headline words.
43
+ - **First-Viewport Word Budget:** Maximum **80 words** total across the first screen.
44
+
45
+ ### 3.2 The Argument-First Protocol
46
+ Before writing any HTML/JSX markup, outline the page as a sequence of claims with verifiable proofs:
47
+ ```text
48
+ 1. Claim: Three-legged oak stool, made to order. → Proof: High-res macro photography of stool.
49
+ 2. Claim: Each seat cut from single solid board. → Proof: 3 close-ups of continuous wood grain.
50
+ 3. Claim: Shipped in 6 weeks with tracking. → Proof: Verifiable production stages schedule.
51
+ 4. Claim: Costs $240, delivered by the maker. → Proof: Exact price figure + Order button.
52
+ ```
53
+ *Rule:* Any section that lacks a factual claim or verifiable proof is filler—delete it immediately.
33
54
 
34
- The following words are banned in operational interfaces:
55
+ ---
56
+
57
+ ## 4. AI Cadences & Marketing Buzzword Blacklist
58
+
59
+ ### 4.1 Banned AI Cadence Formulas
60
+ Language models fall into statistical average patterns; recognize and refuse them:
61
+ 1. **The Mad-Lib:** *"The [AI-powered/next-gen] platform for modern teams."*
62
+ 2. **The Tricolon:** *"Fast. Simple. Secure."* or *"Plan. Build. Ship."*
63
+ 3. **The Rebuttal:** *"It’s not just a tool, it’s a workflow."* / *"More than a framework."*
64
+ 4. **The Preamble Throat-Clearing:** *"In today’s fast-paced digital world..."* / *"Built for modern teams..."*
65
+ 5. **The Em-Dash Habit:** Using multiple em-dashes (`—`) in a single paragraph. Use a full stop.
35
66
 
36
- `seamless`, `seamlessly`, `empower`, `empowering`, `robust`, `effortless`, `effortlessly`, `cutting-edge`, `game-changing`, `elevate`, `unlock`, `dive in`, `delightful`, `next-generation`, `supercharge`, `blazing-fast`.
67
+ ### 4.2 Banned Marketing Buzzwords
68
+ The following adjectives and verbs are banned across all surfaces:
69
+ `seamless`, `seamlessly`, `empower`, `empowering`, `robust`, `effortless`, `effortlessly`, `cutting-edge`, `game-changing`, `elevate`, `unlock`, `unleash`, `dive in`, `delightful`, `next-generation`, `supercharge`, `blazing-fast`.
37
70
 
38
71
  When tempted to write an adjective, state the measurable property instead:
39
72
  - Instead of: *"A robust, blazing-fast pipeline."*
@@ -41,16 +74,31 @@ When tempted to write an adjective, state the measurable property instead:
41
74
 
42
75
  ---
43
76
 
44
- ## 4. Single-Language Purity & Anti-Gado-Gado
77
+ ## 5. Actionable Error Messages & Recovery
78
+
79
+ An operational error message must never produce a dead end or display raw internal stack traces. Every error must answer three questions:
80
+ 1. **What failed:** Direct statement of the blocked action.
81
+ 2. **Why:** Factual cause (if actionable and known).
82
+ 3. **How to recover:** Concrete button or path to unblock the user.
83
+
84
+ | Raw / Unhelpful Error | Actionable Engineering Copy | Recovery Path |
85
+ |---|---|---|
86
+ | "Error 413: Payload too large." | "File exceeds the 25MB limit." | "Choose a smaller file" CTA |
87
+ | "Failed to connect to server." | "Unable to reach database. Changes saved locally." | "Retry connection" button |
88
+ | "Invalid credentials." | "Incorrect password for user@example.com." | "Reset password →" link |
89
+
90
+ ---
91
+
92
+ ## 6. Single-Language Purity & Anti-Gado-Gado
45
93
 
46
94
  Interfaces must maintain strict language purity. Mixing two languages within the same surface causes cognitive friction and feels unpolished.
47
95
 
48
- ### 4.1 Strict Monolingual Surface
96
+ ### 6.1 Strict Monolingual Surface
49
97
  Choose one language for the entire surface and enforce it across headings, labels, errors, and tooltips:
50
98
  - **English UI:** All copy, actions, and timestamps in English.
51
99
  - **Indonesian UI:** All copy, actions, and timestamps in standard Indonesian (KBBI/PUEBI).
52
100
 
53
- ### 4.2 Ban Hybrid Neologisms (Indonesian Context)
101
+ ### 6.2 Ban Hybrid Neologisms (Indonesian Context)
54
102
  Never prefix Indonesian grammatical affixes (`di-`, `meng-`, `ter-`, `pe-`) onto raw English stems:
55
103
 
56
104
  | Hybrid Neologism (Banned) | Standard Indonesian | Pure English Alternative |
@@ -66,14 +114,14 @@ Never prefix Indonesian grammatical affixes (`di-`, `meng-`, `ter-`, `pe-`) onto
66
114
 
67
115
  ---
68
116
 
69
- ## 5. Dynamic Text Expansion & Internationalization Layout
117
+ ## 7. Dynamic Text Expansion & Internationalization Layout
70
118
 
71
119
  Text length varies drastically between languages:
72
120
  - German and Dutch expand +20% to +35% compared to English.
73
121
  - Indonesian expands +15% to +30% for verb-rich phrases.
74
122
  - Japanese and Chinese are visually dense and vertically taller.
75
123
 
76
- ### 5.1 Layout Rules for Expanding Strings
124
+ ### 7.1 Layout Rules for Expanding Strings
77
125
  1. **Never set fixed widths on action buttons:**
78
126
  ```html
79
127
  <!-- BANNED: clips or overflows in German/Indonesian -->
@@ -47,3 +47,28 @@ Grounded in: Apple HIG, Google Material Design 3, and Refactoring UI Color Strat
47
47
  - When placing secondary text on a colored or dark surface, tint the text using the parent background hue or foreground token (`text-primary-foreground/70`).
48
48
  - **Never use neutral gray text (`text-slate-400`) on a saturated or colored background.** It produces a muddy, dirty optical illusion.
49
49
 
50
+ ---
51
+
52
+ ## 4. Integrated Scorecards & Metric Blocks (Anti-Sticker Invariant)
53
+
54
+ - **Ban The Sticker Box:** Never place an isolated white box with a thin border floating inside an already white or light header canvas. This creates an optical "detached sticker" artifact.
55
+ - **Anchor Into Layout Chrome:**
56
+ - Integrate scorecards directly into the identity header rail or stage banner using a unified divider (`border-l border-border/80 pl-6`) or structural inset well (`bg-muted/40`).
57
+ - **Semantic Tinting for Evaluation Scores:**
58
+ - When communicating aggregate grades (e.g. `84,20 / 100`, Predikat B):
59
+ - Background: subtle semantic tint (`bg-emerald-500/10` or `bg-slate-500/10`).
60
+ - Border: matching tinted hairline (`border border-emerald-500/20`).
61
+ - Typography: tabular numbers (`font-mono tabular-nums`) with clear contrast ($Display \ge 3.5\times Body$).
62
+ - Always position the grading scale key (e.g. `A > 85, B 71-85`) in immediate secondary proximity as muted metadata.
63
+
64
+ ---
65
+
66
+ ## 5. Contextual Inline Alerts & Callouts (The Callout Invariant)
67
+
68
+ - **Never Float Warning Text Adrift:** Warning notes, disclaimers, or temporary state alerts must NEVER be dumped as raw floating text between layout sections.
69
+ - **The Callout Invariant:** Every alert must reside in a structured callout container:
70
+ - Container: 1px hairline border with matching light background tint (e.g. `border border-amber-500/30 bg-amber-500/10 rounded-md p-3`).
71
+ - Icon Anchor: Dedicated semantic SVG icon (alert circle, triangle) aligned with first line of text.
72
+ - Placement: Positioned immediately above or inside the data table/form it modifies, establishing unmistakable contextual binding.
73
+
74
+