synapse-hub 2.5.0 → 2.7.0

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 (92) hide show
  1. package/.agents/agents/failure-analyst.md +17 -0
  2. package/.agents/agents/orchestrator.md +20 -2
  3. package/.agents/agents/pom-crafter.md +20 -0
  4. package/.agents/agents/quality-gatekeeper.md +20 -2
  5. package/.agents/agents/test-runner.md +16 -0
  6. package/.agents/rules/context-engineering.md +22 -102
  7. package/.agents/rules/git-push-protocol.md +1 -1
  8. package/.agents/rules/graphify.md +2 -0
  9. package/.agents/rules/mandatory-playwright-live.md +9 -9
  10. package/.agents/rules/mobile_appium_rules.md +27 -116
  11. package/.agents/rules/performance_testing_rules.md +18 -62
  12. package/.agents/rules/skill-precedence.md +22 -42
  13. package/.agents/rules/systematic-debugging.md +10 -29
  14. package/.agents/skills/actor-qa-swarm/SKILL.md +77 -0
  15. package/.agents/skills/actor-qa-swarm/examples/broker_sharding_sample.json +12 -0
  16. package/.agents/skills/agentless-qa-repair/SKILL.md +69 -0
  17. package/.agents/skills/agentless-qa-repair/examples/healing_report_sample.json +17 -0
  18. package/.agents/skills/api-spec-to-e2e-matrix/SKILL.md +1 -1
  19. package/.agents/skills/clean-pom-crafter/SKILL.md +2 -2
  20. package/.agents/skills/db-state-verifier-and-seeder/SKILL.md +4 -4
  21. package/.agents/skills/event-stream-qa-orchestrator/SKILL.md +79 -0
  22. package/.agents/skills/event-stream-qa-orchestrator/examples/timeline_sample.jsonl +2 -0
  23. package/.agents/skills/failure-autopsy-and-healing/SKILL.md +2 -2
  24. package/.agents/skills/failure-autopsy-and-healing/scripts/triage_failures.sh +6 -21
  25. package/.agents/skills/katalon-cli-runner/SKILL.md +1 -1
  26. package/.agents/skills/mipro-prompt-compiler/SKILL.md +59 -0
  27. package/.agents/skills/mipro-prompt-compiler/examples/compiled_module_sample.json +22 -0
  28. package/.agents/skills/qa-aci-interface/SKILL.md +67 -0
  29. package/.agents/skills/qa-aci-interface/examples/surgical_edit_sample.json +12 -0
  30. package/.agents/skills/qa-memory-os/SKILL.md +80 -0
  31. package/.agents/skills/qa-memory-os/examples/archival_memory_sample.json +21 -0
  32. package/.agents/skills/review-spec/SKILL.md +60 -0
  33. package/.agents/skills/review-spec/examples/sample_spec_review.md +33 -0
  34. package/.agents/skills/synthetic-test-data-generator/SKILL.md +2 -2
  35. package/.agents/skills/token-and-context-optimizer/references/context_engineering_guide.md +49 -0
  36. package/.agents/skills/tot-exploratory-testing/SKILL.md +59 -0
  37. package/.agents/skills/tot-exploratory-testing/examples/tot_graph_sample.json +35 -0
  38. package/.agents/skills/wcag-audit-patterns/SKILL.md +2 -2
  39. package/.agents/skills/web-agent-gym-benchmarking/SKILL.md +62 -0
  40. package/.agents/skills/web-agent-gym-benchmarking/examples/benchmark_report_sample.json +22 -0
  41. package/AGENTS.md +6 -1
  42. package/CLAUDE.md +1 -1
  43. package/NOTICE +40 -4
  44. package/README.en.md +27 -11
  45. package/README.md +28 -12
  46. package/docs/ARCHITECTURE.md +39 -11
  47. package/docs/adopted-ecosystem-tools.md +9 -0
  48. package/docs/research/EXTERNAL_AGENT_SKILLS_SURVEY.md +1062 -0
  49. package/docs/research/agent_skill_training_analysis.md +1357 -0
  50. package/package.json +1 -1
  51. package/skills_manifest.json +88 -7
  52. package/synapse.config.json +3 -2
  53. package/templates/ai_bridges/CLAUDE.md +1 -1
  54. package/templates/welcome.html.tmpl +34 -25
  55. package/tools/TOOLS_RUNBOOK.md +130 -1
  56. package/tools/__init__.py +1 -1
  57. package/tools/_openapi_parser.py +158 -0
  58. package/tools/agentless_patcher.py +417 -0
  59. package/tools/analyze_project.py +9 -6
  60. package/tools/auto_heal.py +29 -0
  61. package/tools/auto_heal_reflexion.py +172 -0
  62. package/tools/autogen_qa_broker.py +318 -0
  63. package/tools/browser_helpers.js +57 -2
  64. package/tools/browsergym_eval.py +237 -0
  65. package/tools/ci_healing_hook.py +1 -1
  66. package/tools/cli.py +3 -3
  67. package/tools/dashboard_generator.py +29 -13
  68. package/tools/db_sandbox.py +4 -0
  69. package/tools/dspy_qa_signatures.py +357 -0
  70. package/tools/heal_pr_automator.py +25 -0
  71. package/tools/interview_story.py +117 -0
  72. package/tools/lint_ai_docs.py +1 -1
  73. package/tools/mcp_excel_server.py +1 -1
  74. package/tools/mcp_server.py +1 -1
  75. package/tools/mipro_assertion_tuner.py +207 -0
  76. package/tools/pinpoint_failure.py +12 -0
  77. package/tools/project_state.py +4 -0
  78. package/tools/qa_event_stream.py +336 -0
  79. package/tools/reversible_sandbox.py +161 -0
  80. package/tools/safety_firewall.py +28 -0
  81. package/tools/skill_collision_guard.py +231 -0
  82. package/tools/skill_vault.py +343 -0
  83. package/tools/swe_qa_aci.py +369 -0
  84. package/tools/synapse_qa_bench.py +190 -0
  85. package/tools/sync_agent_rules.py +1 -1
  86. package/tools/test_memory_os.py +409 -0
  87. package/tools/textgrad_mutation_optimizer.py +234 -0
  88. package/tools/tot_exploratory_tester.py +240 -0
  89. package/tools/update_sentinel.py +3 -3
  90. package/tools/verify_all.py +35 -4
  91. package/tools/watch_mode.py +1 -1
  92. package/tools/welcome_page.py +2 -2
@@ -1,74 +1,30 @@
1
1
  # Performance & Load Testing Invariants (k6 · JMeter · Locust)
2
2
 
3
3
  > **Scope:** Applies whenever designing, executing, or analyzing performance, load, stress, spike, or soak test workloads.
4
- > These invariants complement `AGENTS.md` and enforce enterprise safety, workload realism, and zero-hallucination analysis.
4
+ > Complement to `AGENTS.md` enforcing enterprise safety, workload realism, and zero-hallucination analysis.
5
5
 
6
6
  ---
7
7
 
8
- ## 1. Safety Gate & Approval Invariants (Mandatory Pre-Flight)
9
-
10
- 1. **Explicit Authorization:**
11
- - Execute load tests **only** against pre-approved, dedicated environments (performance test environment or isolated sandbox).
12
- - **Strictly forbidden:** Running load tests against production, shared staging, public demo sites, or third-party APIs without formal written sign-off.
13
- 2. **Pre-Run Declaration:**
14
- - Prior to any execution above Smoke test, the agent must declare the run profile and wait for explicit confirmation:
15
- - Target host and environment owner
16
- - Test archetype (Smoke, Average Load, Stress, Spike, Soak)
17
- - Load profile (max VUs, target iterations/sec or requests/sec, duration, ramp-up/down phases)
18
- - Data volume created and teardown strategy
19
- - Kill-switch threshold (`abortOnFail`)
20
- 3. **Progressive Stepped Escalation:**
21
- - Always adhere to progressive ramp-up: **Smoke (1–5 VUs) → Baseline Average Load → Stress / Spike / Soak**.
22
- - Never initiate Stress, Spike, Soak, or Breakpoint runs autonomously.
23
- 4. **Hard Caps & Kill-Switch:**
24
- - Every script must enforce hard upper bounds on rate and VUs, finite duration, and an automatic abort condition (`abortOnFail` when error rate breaches acceptable thresholds, e.g., > 10%).
25
- - Unbounded loops or infinite duration scripts are strictly prohibited.
26
- 5. **Third-Party Isolation:**
27
- - Mock or stub third-party external dependencies (Payment Gateways, SMS providers, email senders, CAPTCHA, web analytics). Never send synthetic load to unisolated external partners.
28
- 6. **Data Safety & Idempotent Cleanup:**
29
- - Write traffic must use isolated, synthetic test data with recognizable prefixes (e.g., `PERF_AUTO_`, `PERF-`). Real customer credentials or PII must never be used.
30
- - Every creation run must be paired with an automated teardown or ephemeral DB rollback.
8
+ ## 1. Safety Gate & Pre-Flight Invariants
9
+ 1. **Dedicated Environments Only:** Never run load tests against production, shared staging, or third-party APIs without written approval.
10
+ 2. **Pre-Run Declaration:** Declare target host, archetype (Smoke, Average Load, Stress, Spike, Soak), VU/arrival profile, duration, and kill-switch threshold (`abortOnFail`).
11
+ 3. **Progressive Escalation:** Smoke (1–5 VUs) -> Baseline Average Load -> Stress / Spike / Soak. Never start high-VU runs autonomously.
12
+ 4. **Hard Caps & Kill-Switch:** Scripts must enforce finite durations, rate caps, and automated abort (`abortOnFail` when error rate > 10%). Unbounded loops are strictly forbidden.
13
+ 5. **Isolation & Cleanup:** Mock third-party providers (Payment, SMS, Captcha). Use synthetic test data (`PERF_AUTO_`); teardown after runs.
31
14
 
32
15
  ---
33
16
 
34
- ## 2. Workload Modeling Invariants
35
-
36
- 1. **Open vs. Closed Model:**
37
- - **Open Model (Arrival Rate):** Use arrival-rate executors for public web traffic or SLA requirements stated in rate (e.g., `N req/sec`). Real users arrive independently of system slowdown.
38
- - **Closed Model (Virtual Users):** Use VU-based executors only when modeling fixed concurrent sessions (e.g., internal enterprise portals).
39
- 2. **Realistic Think Time:**
40
- - Model user think time between journey steps using realistic distributions (e.g., Gaussian or uniform 1s–5s). Zero-think-time "hammer" testing is forbidden unless specifically requested for denial-of-service resilience audits.
41
- 3. **Data Realism & Cache Skew Prevention:**
42
- - Parameterize query parameters, identifiers, and payloads across realistic key spaces. Repeatedly querying identical records measures database cache hit rates rather than true backend capability.
43
- 4. **Phase-Based Evaluation:**
44
- - Structure tests into `Ramp-Up`, `Steady State`, and `Ramp-Down` phases.
45
- - Compute SLA thresholds and verdicts **strictly against the Steady State**, never against warm-up or cool-down transients.
17
+ ## 2. Workload Modeling & k6 Script Standards
18
+ 1. **Arrival Rate vs VU:** Use open arrival-rate executors for public traffic; use closed VU-based executors only for fixed employee portals.
19
+ 2. **Realistic Think Time & Cache Skew:** Parameterize queries across realistic key spaces. Model user think time (1s–5s); zero think time is forbidden.
20
+ 3. **Steady-State Evaluation:** Evaluate SLA thresholds strictly against Steady State, excluding warm-up/cool-down transients.
21
+ 4. **k6 Script Structure:** `options` -> `setup()` -> default VU function (`check()`) -> `teardown()`.
22
+ - Valid threshold syntax: `'http_req_duration{expected_response:true}': ['p(95)<500']`.
23
+ - Always pair `check()` with `'checks': ['rate>0.99']`.
24
+ - Set `discardResponseBodies: true` when responses are unparsed. Pass secrets via `__ENV`.
46
25
 
47
26
  ---
48
27
 
49
- ## 3. k6 Script Engineering Standards
50
-
51
- 1. **Script Structure:**
52
- - `options` (profile, stages, thresholds) → `setup()` (one-time auth and shared state) → default function (user journey with `check()` calls) → `teardown()` (cleanup).
53
- 2. **Valid Threshold Syntax:**
54
- - Use standard k6 threshold syntax: `metric{tag:value}: ['p(95)<500']`. Braces contain tag filters only.
55
- - Latency thresholds must evaluate successful responses: `'http_req_duration{expected_response:true}': ['p(95)<500', 'p(99)<1000']`.
56
- - Always pair `check()` with a `checks` threshold (e.g., `'checks': ['rate>0.99']`), as unasserted check failures do not alter k6 exit codes.
57
- 3. **Generator Efficiency:**
58
- - Set `discardResponseBodies: true` when response bodies are not required for subsequent extractions, minimizing memory overhead on the load generator.
59
- 4. **Strict Credential Hygiene:**
60
- - Pass tokens, usernames, and base URLs via environment variables (`__ENV.BASE_URL`). Never hardcode secrets in test plans or committed repository scripts.
61
-
62
- ---
63
-
64
- ## 4. Truth Anchor & Performance Autopsy Protocol
65
-
66
- 1. **No Lowering Thresholds (Truth Anchor):**
67
- - If an SLA threshold is breached, report the failure with root causes. **Never loosen thresholds, truncate steady states, or drop samples to manufacture a false pass.**
68
- 2. **Structured Analysis Sequence:**
69
- - Analyze results in strict sequence:
70
- 1. **Run Validity:** Confirm `dropped_iterations == 0` and generator CPU remained < 80%. If the generator was saturated, mark the run INVALID.
71
- 2. **Error Rate:** Categorize HTTP 4xx, 5xx, timeouts, connection resets.
72
- 3. **Latency Percentiles:** Report P50, P90, P95, P99, and Max. Never headline average latency.
73
- 4. **Throughput:** Compare target requests/sec vs. achieved requests/sec.
74
- 5. **Correlation:** Correlate breaches with backend APM traces (database slow queries, GC pauses, connection pool exhaustion) before attributing root causes.
28
+ ## 3. Truth Anchor & Autopsy Sequence
29
+ 1. **Truth Anchor:** If an SLA is breached, report root cause honestly. Never loosen thresholds or drop samples to manufacture a fake pass.
30
+ 2. **Analysis Sequence:** 1. Run Validity (`dropped_iterations == 0`, generator CPU < 80%) -> 2. Error Rate (4xx, 5xx, timeouts) -> 3. Latency Percentiles (P50, P90, P95, P99; never headline average) -> 4. Throughput -> 5. APM Correlation (DB slow queries, connection pool exhaustion).
@@ -5,58 +5,38 @@ description: Skill Resolution Precedence, Inter-Skill Coordination, and Anti-Col
5
5
 
6
6
  # Skill Resolution Precedence & Anti-Collision Protocol
7
7
 
8
- > **Purpose:** Resolve overlapping trigger scopes between Project-Local Skills and External Plugins, as well as distinct operational boundaries among internal skills — eliminating context contagion, token bloat, and conflicting instructions.
8
+ > **Purpose:** Resolve overlapping trigger scopes between Project-Local Skills and External Plugins, eliminating context contagion, token bloat, and conflicting instructions.
9
9
 
10
10
  ---
11
11
 
12
- ## 1. Non-Negotiable Precedence Order
13
-
14
- When executing tasks within automated testing repositories, all AI Agents must strictly apply the following 3-tier hierarchy:
15
-
16
- ```text
17
- [Tier 1: Project-Local Skills] (.agents/skills/*)
18
- v (Highest priority — Specialized, Context-Aware & Clean POM Enforced)
19
- [Tier 2: Core Project Rules] (.agents/rules/*)
20
- v (Mandatory operating invariants & behavioral guardrails)
21
- [Tier 3: External Plugin Skills] (antigravity-testing-kit, chrome-devtools-plugin, generic plugins)
22
- v (Suppressed whenever a Tier 1 skill exists)
23
- ```
12
+ ## 1. Non-Negotiable 3-Tier Precedence Order
13
+ `[Tier 1: Project-Local Skills] (.agents/skills/*)` > `[Tier 2: Core Rules] (.agents/rules/*)` > `[Tier 3: External Plugins] (generic plugins)`.
14
+ Whenever a Tier 1 local skill exists, the external plugin skill is **strictly suppressed**.
24
15
 
25
16
  ---
26
17
 
27
- ## 2. External Plugin Suppression Matrix (Tier 1 vs Tier 3)
28
-
29
- When an external plugin offers a capability that overlaps with a specialized Synapse Hub skill, the external skill is **strictly suppressed**:
30
-
31
- | Task Domain | REQUIRED Skill (Tier 1) | SUPPRESSED Skill (Tier 3) | Architectural Reason |
32
- |---|---|---|---|
33
- | **POM & Test Authoring** | `clean-pom-crafter`<br/>`lam-script-generator` | `QA Automation Engineer`, `Test Generator` | Generic plugins generate raw XPaths and Selenium boilerplate; Hub strictly enforces Flat Architecture and zero raw locators in scripts. |
34
- | **Code Change Review** | `senior-code-review` | `Generic PR Reviewer`, `Code Reviewer` | Evaluates 6 pillars (Bugs, Security, Concurrency, Missing Tests, Speed, Bloat) specifically against Git Diff. |
35
- | **Locator Healing & Diffing** | `self-healing-locator`<br/>`failure-autopsy-and-healing` | `Locator Healer Agent` | Uses token-efficient semantic AOM diffing (Role > Label > TestId) instead of dumping thousands of raw HTML lines. |
36
- | **Flaky Test Triage & RCA** | `failure-autopsy-and-healing`<br/>`flaky-test-sentinel-and-quarantine` | `Flaky Test Analyzer` | Triage occurs via 0-token JUnit XML parsing, screenshot autopsy, and SQLite episodic memory cache (`global_cache.db`). |
37
- | **Live Probing & Inspection** | `playwright-live-interaction` | `Smart Locator Agent` | Direct CDP network idle 0, dynamic overlay detachment, and in-browser helper integration under 200ms. |
38
- | **Accessibility (WCAG)** | `wcag-audit-patterns` *(Guideline)* | `a11y-debugging` *(Tooling Only)* | `wcag-audit-patterns` enforces WCAG 2.2 A/AA criteria; Chrome DevTools MCP is used strictly for low-level node inspection. |
18
+ ## 2. External Plugin Suppression Rules (Tier 1 overrides Tier 3)
19
+ - **POM & Test Authoring:** Use `clean-pom-crafter` / `lam-script-generator`. Suppress generic QA/test plugins. Flat Clean POM only; no raw XPaths in test scripts.
20
+ - **Code Review:** Use `senior-code-review` (6 pillars against git diff). Suppress generic PR reviewers.
21
+ - **Locator Healing:** Use `self-healing-locator` / `failure-autopsy-and-healing` (AOM diffing). Suppress generic locator healers.
22
+ - **Flaky Test Triage:** Use `flaky-test-sentinel-and-quarantine` (episodic SQLite memory + JUnit parsing).
23
+ - **Live Probing:** Use `playwright-live-interaction` (CDP idle 0 under 200ms). Suppress generic smart locators.
24
+ - **Accessibility:** Use `wcag-audit-patterns` for WCAG 2.2 A/AA criteria; use Chrome DevTools MCP strictly for low-level node inspection.
39
25
 
40
26
  ---
41
27
 
42
- ## 3. Internal Inter-Skill Coordination & Boundary Separation
43
-
44
- To prevent decision paralysis among internal skills in `.agents/skills/`, agents must strictly adhere to the following boundary matrix:
45
-
46
- | Functional Area | Primary Skill | Sibling Skill | Distinct Responsibility & Hand-Off |
47
- |---|---|---|---|
48
- | **Code Creation** | `lean-code-ladder` | `surgical-coding-principles` | • `lean-code-ladder` governs **what to build** (descends 7-rung ladder, selects smallest working solution).<br/>• `surgical-coding-principles` governs **where to touch** (keeps git diff surgical, no unrelated file edits). |
49
- | **Technical Debt** | `technical-debt-harvester` | `code-refactoring-refactor-clean` | • `technical-debt-harvester` is the **accountant** (scans and tracks `shortcut:` comments in Markdown ledgers).<br/>• `code-refactoring-refactor-clean` is the **surgeon** (executes SOLID refactoring and code smell remediation). |
50
- | **Quality Review** | `senior-code-review` | `review-spec` (`goldfish_review`) | • `senior-code-review` audits **Source Code Diffs** (uncommitted / staged git changes).<br/>• `review-spec` audits **Requirements & User Stories** in a 0-context stress-test (Elephant-Goldfish model). |
51
- | **System Audit** | `repo-quality-audit` | `analyze_project` (`tools/`) | • `analyze_project.py` produces **deterministic facts** (AST map, env check, data flow, 9 gates DoD).<br/>• `repo-quality-audit` applies **senior engineering judgment** (evaluates real load, ranks *"Fix #1 first"*). |
52
- | **API Testing** | `api-spec-to-e2e-matrix` | `api-network-mocking-interception` | • `api-spec-to-e2e-matrix` compiles **test matrices** from OpenAPI specs.<br/>• `api-network-mocking-interception` stubs routes and injects **chaos network faults** during UI/API test runs. |
53
- | **Failure Analysis** | `self-healing-locator` | `failure-autopsy-and-healing` | • `self-healing-locator` fixes **individual broken Page Class selectors**.<br/>• `failure-autopsy-and-healing` triages **suite-wide run crashes**, JUnit XML reports, and logs. |
54
- | **DoD Verification** | `verification-before-completion` | `antigravity-test-sentinel` | • `verification-before-completion` enforces the **evidence protocol** (fresh command output required in session).<br/>• `antigravity-test-sentinel` is the **hard gatekeeper** (blocks task completion until all 9 Quality Gates pass). |
28
+ ## 3. Internal Inter-Skill Coordination & Boundaries
29
+ - **Code Authoring:** `lean-code-ladder` decides *what* to build (7-rung ladder); `surgical-coding-principles` restricts *where* to touch (surgical git diff).
30
+ - **Technical Debt:** `technical-debt-harvester` tracks `shortcut:` markers; `code-refactoring-refactor-clean` executes refactoring.
31
+ - **Quality Review:** `senior-code-review` audits source diffs; `review-spec` audits requirements/stories (0-context stress test).
32
+ - **System Audit:** `tools/analyze_project.py` gathers facts (AST, env, gates); `repo-quality-audit` prioritizes "Fix #1 first".
33
+ - **API Testing:** `api-spec-to-e2e-matrix` compiles test matrices; `api-network-mocking-interception` stubs routes and chaos faults.
34
+ - **Failure Analysis:** `self-healing-locator` heals individual locators; `failure-autopsy-and-healing` triages suite-wide crashes.
35
+ - **DoD Gatekeeper:** `verification-before-completion` checks fresh command evidence; `antigravity-test-sentinel` enforces all 10 gates.
55
36
 
56
37
  ---
57
38
 
58
39
  ## 4. Strict Prohibitions
59
-
60
- 1. **Zero Generic Test Boilerplate:** Never generate legacy Selenium, Cucumber, or Object Repository (`findTestObject`) code from external plugins.
61
- 2. **Zero Raw HTML Dumps:** Never dump full HTML trees into context for locator healing; always extract compact AOM subtrees (< 500 tokens).
62
- 3. **Zero Unverified Assertions:** Never complete a code or test task without executing fresh verification via `tools/verify_all.py`.
40
+ 1. **Zero Generic Boilerplate:** Never generate legacy Selenium, Cucumber, or `findTestObject` code.
41
+ 2. **Zero Raw HTML Dumps:** Extract compact AOM subtrees (< 500 tokens); never dump raw HTML trees.
42
+ 3. **Zero Unverified Assertions:** Never complete tasks without running fresh verification via `tools/verify_all.py`.
@@ -31,7 +31,7 @@ This rule governs all AI Agents operating on the repository. It mandates strict
31
31
  ```bash
32
32
  python3 tools/verify_all.py
33
33
  ```
34
- - All 9 Gates must return `PASS`. If any gate fails, the task is NOT complete.
34
+ - All 10 Gates must return `PASS`. If any gate fails, the task is NOT complete.
35
35
  2. **Targeted Re-Test:**
36
36
  - After modifying Page Classes, check impacted Test Cases with:
37
37
  ```bash
@@ -46,34 +46,15 @@ This rule governs all AI Agents operating on the repository. It mandates strict
46
46
 
47
47
  ## 3. Situational Tool Dispatch Matrix & Zero-Command Autonomy
48
48
 
49
- > 🚀 **Zero-Command Autonomous Invariant (Zero Manual Commands):**
50
- > The user **NEVER** needs to remember syntax or manually type tool commands (`agent-qa setup`, `agent-qa analyze`, `verify_all.py`...).
51
- > The AI Agent **MUST AUTONOMOUSLY recognize context and trigger** the corresponding tools below on-demand whenever the situation arises.
52
- >
53
- > 🎯 **On-Demand Activation Principle (Situation-Specific — Never Run Blindly):**
54
- > Tools assigned to AI and Subagents are **situational weapons**, **NEVER executed all at once**. Agents draw the specific tool from the arsenal if and only if a concrete need arises (e.g.: failing test triggers `auto_heal`, new project triggers `setup_project`, API breaking change triggers `api_drift_sentinel`).
55
-
56
- | Context / Trigger | Mandatory Tool | Specific Objective |
57
- | :--- | :--- | :--- |
58
- | **New project / Missing `PROJECT_AI_GUIDE.md` / Fresh clone** | `python3 tools/setup_project.py [target]` | 100% Autonomous: Detects framework (Playwright/Katalon/Pytest), generates `PROJECT_AI_GUIDE.md`, installs `pre-push` hook, extracts `repo_map.txt`, runs initial audit. |
59
- | **User requests: "analyze project" / "re-analyze" / "project audit"** | `python3 tools/analyze_project.py [target]` | Execute comprehensive 5-in-1 health audit, sync repo_map, infer_linter, data_flow, verify_all & generate PROJECT_HEALTH_REPORT.md.<br/>**Post-Action:** Stage, commit & push updated project files (`PROJECT_HEALTH_REPORT.md`, `repo_map.txt`) to git. |
60
- | **User requests: "review code" / "review diff" / "senior review"** | `python3 tools/senior_code_review.py` | 6-pillar code change review (Bugs, Security, Concurrency, Missing Tests, Speed, Bloat). |
61
- | **User requests: "scan debt" / "list shortcuts" / "harvest debt"** | `python3 tools/debt_harvester.py` | Harvest `shortcut:` technical debt markers across repo into tracked markdown ledger. |
62
- | **Starting task / Querying Page Class methods** | `tools/repo_map.txt`<br/>*(run `python3 tools/repo_map.py` if classes changed)* | Read compressed 500-token map for signatures; avoid reading 4,000-line files. |
63
- | **Dispatching Browser Actions (Live/CDP)** | `python3 tools/safety_firewall.py --dry-run` | Mandatory Pre-execution Hook: Block irreversible/destructive operations before browser dispatch. |
64
- | **Creating or updating Test Scripts** | `python3 tools/infer_linter.py` | Run AST scan for Fake-Pass (0 asserts) and empty catch blocks. |
65
- | **New/Modified Test Case Quality** | `python3 tools/micro_mutator.py --min-score 80` | AST Mutation Testing: Reject test suites with mutation score < 80%. |
66
- | **Before Git Commit or Completing Task** | `python3 tools/verify_all.py` | Validate all 9 Quality Gates DoD. |
67
- | **After modifying Page Classes** | `python3 tools/test_impact.py --git-diff` | Scope impacted test cases; avoid re-running entire test suites. |
68
- | **When Test FAILS in CLI/KRE** | `python3 tools/pinpoint_failure.py` | Parse JUnit XML to identify exact failing line and exception in 0.1s. |
69
- | **When CLI / Gradle logs are verbose** | `python3 tools/distill_log.py <log>` | Filter 95% noise; preserve only actionable stacktraces and pointers. |
70
- | **Handling UI exceptions (Overlay, Stale)** | `python3 tools/cache_resolver.py query "<error>"` | Lookup 0-token solution from local SQLite memory cache before improvising. |
71
- | **Pre-Push / Suite Acceptance** | `python3 tools/trace_data_flow.py` | Run Taint Analysis to verify no orphan database junk remains uncleaned. |
72
- | **Canary Self-Healing Audit** | `python3 tools/agent_canary.py --run` | Inject 8 failure vectors to benchmark MTTR and autonomous recovery rate. |
73
- | **Testing GIS Canvas / Chart without DOM** | `python3 tools/visual_diff_canvas.py` | Compare pixel / SSIM to detect visual rendering regression. |
74
- | **Pulling code / New clone** | `python3 tools/cache_resolver.py init` | Automatically sync Central Agent Memory (`~/.agent_memory/global_cache.db`). |
75
- | **Before authoring test for Page/Flow** | `python3 tools/cache_resolver.py get-lessons --context "<page>"` | Query top 2 episodic lessons learned to avoid repeating past failure patterns. |
76
- | **After healing a bug / failure** | `python3 tools/cache_resolver.py record-lesson` | Record a concise 2-line lesson into SQLite memory for cross-session reflexion. |
49
+ > 🚀 **Zero-Command Autonomous Invariant:** The user **NEVER** needs to manually type tool commands. The AI Agent **MUST AUTONOMOUSLY recognize context and trigger** the corresponding tools on-demand. Never run tools blindly; invoke only when the concrete situation arises.
50
+
51
+ - **Setup & Audit:** New project -> `tools/setup_project.py`; Project audit -> `tools/analyze_project.py`; Code review -> `tools/senior_code_review.py`; Debt scan -> `tools/debt_harvester.py`.
52
+ - **Quality Gates & DoD:** Pre-commit/Handoff -> `tools/verify_all.py` (10 Gates DoD); Script lint -> `tools/infer_linter.py`; Mutation testing -> `tools/micro_mutator.py --min-score 80`.
53
+ - **Failure Autopsy & Healing:** Test failure -> `tools/pinpoint_failure.py` (parse JUnit XML in 0.1s); Iterative repair -> `tools/auto_heal_reflexion.py`; Reversible rollback -> `tools/reversible_sandbox.py`.
54
+ - **Context & Safety:** Verbose logs -> `tools/distill_log.py`; Destructive browser actions -> `tools/safety_firewall.py`; Method signatures -> `tools/repo_map.txt`.
55
+ - **Memory & Reflexion:** UI exceptions -> `tools/cache_resolver.py query "<error>"`; Query/Save proven patterns -> `tools/skill_vault.py`.
56
+
57
+ *(For the complete CLI parameters and full tools catalog, refer to [tools/TOOLS_RUNBOOK.md](file://tools/TOOLS_RUNBOOK.md)).*
77
58
 
78
59
  ---
79
60
 
@@ -0,0 +1,77 @@
1
+ ---
2
+ name: actor-qa-swarm
3
+ description: "Asynchronous Actor Model message broker and matrix sharding coordinator for multi-agent test execution. Use when distributing parallel test workloads or wiring decoupled subagent event pub/sub."
4
+ ---
5
+
6
+ # Actor QA Swarm Skill — Asynchronous Actor Messaging & Matrix Sharding
7
+
8
+ > **Paradigm Attribution:** Inspired by **Microsoft AutoGen v0.4+ (AG2 Actor Framework)**.
9
+ > **Core Principle:** Transition from synchronous lock-step file coordination to an asynchronous Actor Model. Subagents exchange messages via non-blocking mailboxes and subscribe to test failure events in real time.
10
+
11
+ ---
12
+
13
+ ## 1. The Actor Swarm Architecture
14
+
15
+ ```mermaid
16
+ flowchart TD
17
+ Orchestrator["Orchestrator Actor"] -->|dispatch-shards| Broker["Actor QA Message Broker (tools/autogen_qa_broker.py)"]
18
+ Broker -->|ASSIGN_SHARD| W1["test-runner:worker_1 (Playwright Shard 1)"]
19
+ Broker -->|ASSIGN_SHARD| W2["test-runner:worker_2 (Playwright Shard 2)"]
20
+ Broker -->|ASSIGN_SHARD| W3["test-runner:worker_3 (Playwright Shard 3)"]
21
+
22
+ W1 -.->|publish(TEST_FAILED)| Broker
23
+ Broker -.->|notify| Analyst["failure-analyst Actor (Triage in Parallel)"]
24
+ ```
25
+
26
+ 1. **Decoupled Actor Mailboxes (`send-message` / `fetch-messages`):**
27
+ - Each QA subagent operates as an autonomous Actor with its own private mailbox.
28
+ - Eliminates monolithic conversational logs and prevents context contamination across subagents.
29
+
30
+ 2. **Parallel Matrix Sharding (`dispatch-shards`):**
31
+ - Automatically splits regression test suites into $N$ balanced shards.
32
+ - Dispatches shards to headless Playwright worker actors running in parallel.
33
+
34
+ 3. **Event-Driven Triage (`subscribe` / `publish`):**
35
+ - When a test runner encounters a failure, it immediately publishes `TEST_FAILED`.
36
+ - `failure-analyst` diagnoses the failure concurrently while other test runners continue uninterrupted.
37
+
38
+ ---
39
+
40
+ ## 2. CLI Tool Usage
41
+
42
+ Autonomous commands via `tools/autogen_qa_broker.py`:
43
+
44
+ ```bash
45
+ # 1. Dispatch regression suite across 4 parallel shards
46
+ python tools/autogen_qa_broker.py dispatch-shards \
47
+ --suite-manifest tests/regression_manifest.json \
48
+ --shard-count 4 \
49
+ --worker-role "test-runner"
50
+
51
+ # 2. Subscribe failure-analyst to test failure events
52
+ python tools/autogen_qa_broker.py subscribe \
53
+ --actor "failure-analyst" \
54
+ --event "TEST_FAILED"
55
+
56
+ # 3. Send direct message between subagents
57
+ python tools/autogen_qa_broker.py send-message \
58
+ --from-actor "test-runner:worker_1" \
59
+ --to-actor "failure-analyst" \
60
+ --topic "TEST_FAILED" \
61
+ --payload '{"test_case": "TC-102", "error": "TimeoutError"}'
62
+
63
+ # 4. Fetch messages from actor mailbox
64
+ python tools/autogen_qa_broker.py fetch-messages \
65
+ --actor "failure-analyst"
66
+
67
+ # 5. Check broker health and verify zero deadlocks
68
+ python tools/autogen_qa_broker.py check-health
69
+ ```
70
+
71
+ ---
72
+
73
+ ## 3. Strict Operating Invariants
74
+
75
+ - **Deadlock Prevention:** Enforce 300s timeout ceilings on actor response waits.
76
+ - **Asynchronous Execution:** No subagent shall block the main thread waiting for another subagent's response.
77
+ - **Zero Raw Selectors:** Messages instructing code synthesis must strictly enforce Clean POM standards.
@@ -0,0 +1,12 @@
1
+ {
2
+ "status": "PASS",
3
+ "total_tests": 12,
4
+ "shard_count": 4,
5
+ "shards": {
6
+ "worker_1": 3,
7
+ "worker_2": 3,
8
+ "worker_3": 3,
9
+ "worker_4": 3
10
+ },
11
+ "dispatched_to_role": "test-runner"
12
+ }
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: agentless-qa-repair
3
+ description: "Repair broken test scripts and Page Classes using an Agentless 3-phase flow: localization, candidate synthesis, and minimal diff validation. Use when repairing test failures without multi-agent chat bloat."
4
+ ---
5
+
6
+ # Agentless QA Repair Skill — Ultra-Low-Token 3-Phase Failure Healing
7
+
8
+ > **Paradigm Attribution:** Inspired by **UIUC OpenAutoCoder Agentless**.
9
+ > **Core Principle:** The best fix is the smallest working diff without round-trip chat loops. Solve 80% of daily test automation defects with a single-pass 3-stage pipeline under 2,500 tokens.
10
+
11
+ ---
12
+
13
+ ## 1. The 3-Phase Deterministic Pipeline
14
+
15
+ Rather than spawning multi-turn swarm conversations that cost 40,000–80,000 tokens per failure, `agentless-qa-repair` executes in three deterministic stages:
16
+
17
+ ```mermaid
18
+ flowchart LR
19
+ Fail["Test Failure (Stacktrace)"] --> P1["Phase 1: Localization<br/>Pinpoint file & line span"]
20
+ P1 --> P2["Phase 2: Candidate Gen<br/>Synthesize 3 minimal patches"]
21
+ P2 --> P3["Phase 3: Validation & Gate<br/>Syntax + Clean POM + Diff"]
22
+ P3 --> Winner["Apply Shortest Winning Diff (<10s)"]
23
+ ```
24
+
25
+ 1. **Phase 1 (Localization):**
26
+ - Parses the stacktrace (Playwright, Jest, JUnit XML, or Python Traceback).
27
+ - Cross-references `tools/repo_map.txt` or repository structure.
28
+ - Restricts focus strictly to the enclosing method and 5–10 line span.
29
+
30
+ 2. **Phase 2 (Parallel Candidate Synthesis):**
31
+ - Candidate 1: Semantic ARIA role locator (`getByRole('button', { name: '...' })`).
32
+ - Candidate 2: Resilient test identifier (`getByTestId('...')`).
33
+ - Candidate 3: Smart wait / network idle synchronization wrapper (`waitForLoadState('networkidle')`).
34
+
35
+ 3. **Phase 3 (Validation & Selection):**
36
+ - Checks AST syntax validity (Python `ast.parse` or JS/TS/Groovy bracket balance).
37
+ - Enforces **Clean POM**: strictly rejects raw XPath / CSS injected into test script files.
38
+ - Selects the shortest valid diff that clears all checks.
39
+
40
+ ---
41
+
42
+ ## 2. CLI Tool Usage
43
+
44
+ Autonomous trigger via `tools/agentless_patcher.py`:
45
+
46
+ ```bash
47
+ # End-to-end 3-stage healing
48
+ python tools/agentless_patcher.py heal-failure \
49
+ --error-log reports/failed_run.log \
50
+ --repo-map tools/repo_map.txt \
51
+ --max-candidates 3
52
+
53
+ # Localize failing line only
54
+ python tools/agentless_patcher.py localize-error \
55
+ --error-log reports/failed_run.log
56
+
57
+ # Generate patch candidates for a specific line
58
+ python tools/agentless_patcher.py generate-candidates \
59
+ --file src/pages/CustomerDirectoryPage.ts \
60
+ --line 48
61
+ ```
62
+
63
+ ---
64
+
65
+ ## 3. Strict Operating Invariants
66
+
67
+ - **Token Budget Ceiling:** Must stay under **2,500 tokens** per repair cycle.
68
+ - **Zero Raw Selectors in Test Scripts:** If the failing file is located in `tests/`, `Scripts/`, or matches `*.spec.ts`, the fix must redirect selector adjustments into the corresponding Page Class extending `BasePage`.
69
+ - **Minimal Working Diff:** Always choose the patch with the fewest altered lines that passes verification.
@@ -0,0 +1,17 @@
1
+ {
2
+ "status": "PASS",
3
+ "localization": {
4
+ "file": "src/pages/CustomerDirectoryPage.ts",
5
+ "method": "selectCustomerRow",
6
+ "line_span": [48, 52]
7
+ },
8
+ "candidates_evaluated": 3,
9
+ "validation_results": {
10
+ "candidate_1": "FAIL (Syntax error: unbalanced bracket)",
11
+ "candidate_2": "PASS (All DoD Gates cleared, diff: 2 lines)",
12
+ "candidate_3": "PASS (All DoD Gates cleared, diff: 6 lines)"
13
+ },
14
+ "selected_winner": "candidate_2",
15
+ "tokens_consumed": 1780,
16
+ "elapsed_seconds": 7.8
17
+ }
@@ -65,7 +65,7 @@ Agent can automatically invoke `tools/generate_api_matrix.py` and `tools/export_
65
65
  python3 tools/generate_api_matrix.py --spec path/to/openapi.json --format md -o docs/api_matrix.md
66
66
 
67
67
  # 2. Generate JSON matrix for programmatic ingestion
68
- python3 tools/generate_api_matrix.py --spec path/to/openapi.json --format json -o tools/api_matrix.json
68
+ python3 tools/generate_api_matrix.py --spec path/to/openapi.json --format json -o reports/api_matrix.json
69
69
 
70
70
  # 3. Export directly to Postman Collection v2.1.0 with AJV JSON Schema & DDT
71
71
  synapse export-postman --spec path/to/openapi.json -o postman_collection.json --env-output postman_env.json --ddt-output test_data.csv
@@ -22,7 +22,7 @@ Specialized skill for creating, refactoring, and standardizing test automation s
22
22
  - All `.groovy`, `.java`, `.ts`, `.tc` files must NEVER contain UTF-8 BOM bytes (`0xEF, 0xBB, 0xBF`).
23
23
  5. **Context Window Protection (Zero-Token Economy):**
24
24
  - 🚫 **NEVER read entire monolithic Page Class files (> 100KB) into LLM context.**
25
- - Always use `python3 ~/.zcode/synapse-hub/tools/lookup_xpath.py <keyword>` or line-range targeted reads (`read_file` with `StartLine`/`EndLine`) to find selectors and methods on demand.
25
+ - Always use `python tools/lookup_xpath.py <keyword>` or line-range targeted reads (`read_file` with `StartLine`/`EndLine`) to find selectors and methods on demand.
26
26
 
27
27
  ---
28
28
 
@@ -68,7 +68,7 @@ All Page Classes **MUST** follow this strict locator hierarchy:
68
68
 
69
69
  - [**Standard Clean POM Methods (`pom_patterns.groovy`)**](references/pom_patterns.groovy): Full implementation of `searchRecord`, `editRecord`, `deleteRecord`, `setCalendarDate`, `selectMultiOptions`, `verifyRecordExists`, `verifyRecordNotExists`, `jsSetInput`.
70
70
  - [**Standard Test Script Template (`standard_test_case.groovy`)**](examples/standard_test_case.groovy): 7-step complete script template from Login -> Create -> Search -> Edit -> Delete.
71
- - [**Zero-Token XPath Lookup (`~/.zcode/synapse-hub/tools/lookup_xpath.py`)**](~/.zcode/synapse-hub/tools/lookup_xpath.py): Command `python3 ~/.zcode/synapse-hub/tools/lookup_xpath.py <PageClass>` returns exact locators in <200 tokens without parsing full files.
71
+ - [**Zero-Token XPath Lookup (`tools/lookup_xpath.py`)**](tools/lookup_xpath.py): Command `python tools/lookup_xpath.py <PageClass>` returns exact locators in <200 tokens without parsing full files.
72
72
  - [**Browser Runtime Helper (`tools/browser_helpers.js`)**](tools/browser_helpers.js): In-browser validation engine for form audits, safe clicks, and batch verification.
73
73
 
74
74
  ---
@@ -102,22 +102,22 @@ To eliminate cascading flakiness and orphan test junk in parallel CI runs, agent
102
102
  ### 1. Transaction Savepoint Rollback Context
103
103
  Wrap E2E test data creation inside transactional savepoints:
104
104
  ```bash
105
- python3 ~/.zcode/synapse-hub/tools/db_sandbox.py rollback-test --db-path "path/to/db.sqlite"
105
+ python tools/db_sandbox.py rollback-test --db-path "path/to/db.sqlite"
106
106
  ```
107
107
  *Guarantees zero leftover records: state is automatically rolled back to pristine baseline upon test completion.*
108
108
 
109
109
  ### 2. Ephemeral Snapshot & Instant Restore (< 0.5s)
110
110
  ```bash
111
111
  # Before test suite runs: capture pristine database baseline
112
- python3 ~/.zcode/synapse-hub/tools/db_sandbox.py snapshot --id pristine_baseline
112
+ python tools/db_sandbox.py snapshot --id pristine_baseline
113
113
 
114
114
  # After suite execution: instantly restore clean database
115
- python3 ~/.zcode/synapse-hub/tools/db_sandbox.py restore --id pristine_baseline
115
+ python tools/db_sandbox.py restore --id pristine_baseline
116
116
  ```
117
117
 
118
118
  ### 3. Taint Pollution Audit & Cascading Purge
119
119
  Scan all tables for orphan records carrying test prefixes (`AUTO_`, `TEST_`) and purge them cleanly:
120
120
  ```bash
121
- python3 ~/.zcode/synapse-hub/tools/db_sandbox.py audit
121
+ python tools/db_sandbox.py audit
122
122
  ```
123
123
 
@@ -0,0 +1,79 @@
1
+ ---
2
+ name: event-stream-qa-orchestrator
3
+ description: "Immutable EventStream orchestrator recording deterministic action/observation timelines with SHA-256 hash chains and reversible checkpoint rollbacks. Use when tracing test executions and managing replayable state."
4
+ ---
5
+
6
+ # QA Event Stream Orchestrator Skill — Immutable Audit & Replay Timeline
7
+
8
+ > **Paradigm Attribution:** Inspired by **All-Hands-AI OpenHands (EventStream & CodeAct Runtime)**.
9
+ > **Core Principle:** Treat automated testing sessions as an append-only, immutable stream of events. Prevent state corruption and lost context by chaining each event with cryptographic SHA-256 hashes and enabling deterministic check-pointed rollbacks.
10
+
11
+ ---
12
+
13
+ ## 1. The EventStream Pipeline
14
+
15
+ ```mermaid
16
+ flowchart LR
17
+ Init["init-stream<br/>Genesis Hash (000...0)"] --> Act["record-event<br/>ACTION_NAVIGATE / ACTION_CLICK"]
18
+ Act --> Obs["record-event<br/>OBSERVATION_DOM / ASSERTION"]
19
+ Obs --> Check["Checkpoint Anchor<br/>CHECKPOINT_PRE_SUBMIT"]
20
+ Check --> Verify["verify-stream<br/>Cryptographic Audit"]
21
+ Verify --> Rollback["rollback<br/>Rewind to Checkpoint"]
22
+ ```
23
+
24
+ 1. **Immutable Event Logging (`record-event`):**
25
+ - Each event records: `index`, `session_id`, `event_type`, `actor`, `payload`, `timestamp`, `prev_hash`, and `event_hash`.
26
+ - Continuous SHA-256 hash chaining prevents unobserved event injection or tampering.
27
+
28
+ 2. **Reversible Checkpointing (`rollback`):**
29
+ - In conjunction with GoEx LIFO undo stack (`tools/reversible_sandbox.py`), enables restoring the browser or data state when an unexpected crash occurs.
30
+ - Appends a `ROLLBACK_EXECUTED` event to the stream without destroying the audit trail.
31
+
32
+ 3. **Cryptographic Verification (`verify-stream`):**
33
+ - Verifies hash continuity from genesis to latest event.
34
+ - Ensures zero missing or out-of-order events before certifying run results.
35
+
36
+ ---
37
+
38
+ ## 2. CLI Tool Usage
39
+
40
+ Autonomous commands via `tools/qa_event_stream.py`:
41
+
42
+ ```bash
43
+ # 1. Initialize stream
44
+ python tools/qa_event_stream.py init-stream \
45
+ --session-id "CHECKOUT_E2E_001" \
46
+ --out-file .agent_memory/timeline.jsonl
47
+
48
+ # 2. Record an action event
49
+ python tools/qa_event_stream.py record-event \
50
+ --stream .agent_memory/timeline.jsonl \
51
+ --event-type ACTION_CLICK \
52
+ --actor live-explorer \
53
+ --payload '{"page":"CartPage","element":"checkout_button"}'
54
+
55
+ # 3. Create a state checkpoint
56
+ python tools/qa_event_stream.py record-event \
57
+ --stream .agent_memory/timeline.jsonl \
58
+ --event-type CHECKPOINT \
59
+ --actor test-runner \
60
+ --payload '{"cart_total": 99.99}' \
61
+ --checkpoint-id "PRE_CHECKOUT_FORM"
62
+
63
+ # 4. Verify stream integrity
64
+ python tools/qa_event_stream.py verify-stream \
65
+ --stream .agent_memory/timeline.jsonl
66
+
67
+ # 5. Rollback to checkpoint on test failure
68
+ python tools/qa_event_stream.py rollback \
69
+ --stream .agent_memory/timeline.jsonl \
70
+ --to-checkpoint "PRE_CHECKOUT_FORM"
71
+ ```
72
+
73
+ ---
74
+
75
+ ## 3. Strict Operating Invariants
76
+
77
+ - **Hash Chain Integrity:** All events must compute `SHA-256(prev_hash | session_id | event_type | actor | payload | timestamp)`.
78
+ - **Zero Log Tampering:** Never edit `timeline.jsonl` lines manually; always append via the CLI tool.
79
+ - **UTF-8 No BOM:** Timeline files must remain clean UTF-8 without byte-order marks.
@@ -0,0 +1,2 @@
1
+ {"index": 0, "session_id": "SESSION_DEMO_001", "event_type": "STREAM_INIT", "actor": "system", "payload": {"initialized_at": "2026-11-04T12:00:00Z"}, "timestamp": "2026-11-04T12:00:00Z", "prev_hash": "0000000000000000000000000000000000000000000000000000000000000000", "event_hash": "1a2b3c4d5e6f"}
2
+ {"index": 1, "session_id": "SESSION_DEMO_001", "event_type": "ACTION_NAVIGATE", "actor": "live-explorer", "payload": {"url": "https://app.local/login"}, "timestamp": "2026-11-04T12:00:01Z", "prev_hash": "1a2b3c4d5e6f", "event_hash": "2b3c4d5e6f7a"}
@@ -21,7 +21,7 @@ flowchart LR
21
21
 
22
22
  1. **Zero-Token Triage:** Pinpoint failed line and cause instantly (<50 tokens):
23
23
  ```bash
24
- python3 ~/.zcode/synapse-hub/tools/pinpoint_failure.py
24
+ python tools/pinpoint_failure.py
25
25
  # or bash .agents/skills/failure-autopsy-and-healing/scripts/triage_failures.sh
26
26
  ```
27
27
  2. **Visual Autopsy:** Inspect the latest error screenshot to immediately detect: disabled buttons, missing required fields, UI overlaps, or obscuring modal backdrops.
@@ -49,7 +49,7 @@ flowchart LR
49
49
 
50
50
  - [**Diagnostic & Healing Matrix (`healing_matrix.md`)**](references/healing_matrix.md): Concrete code prescriptions for disabled buttons, boundary overlaps, `ElementClickInterceptedException`, `StaleElementReferenceException`, and 4 flaky test root causes.
51
51
  - [**Fast-Fix Triad & Runtime Helper (`tools/browser_helpers.js`)**](tools/browser_helpers.js): In-browser diagnosis engine via `window.__qa` (`audit`, `heal`, `clickSafe`, `hud`).
52
- - **Automated Triage Script:** `python3 ~/.zcode/synapse-hub/tools/pinpoint_failure.py` and `scripts/triage_failures.sh`.
52
+ - **Automated Triage Script:** `python tools/pinpoint_failure.py` and `scripts/triage_failures.sh`.
53
53
 
54
54
  ---
55
55
 
@@ -64,28 +64,13 @@ list_recent_screenshots() {
64
64
  list_recent_screenshots | while read -r epoch date time filepath; do
65
65
  filename=$(basename "$filepath")
66
66
 
67
- # Ánh xạ Page Class gợi ý dựa trên mã Test Case (Dynamic Pattern Matching)
67
+ # Dynamic Page Class mapping via repo_map lookup or fallback to BasePage
68
68
  suggested_page="BasePage.groovy"
69
- if [[ "$filename" =~ TC-([0-9]+) ]]; then
70
- tc_num="${BASH_REMATCH[1]}"
71
- if [ "$tc_num" -ge 1 ] && [ "$tc_num" -le 7 ]; then
72
- suggested_page="TargetPlanPage.groovy"
73
- elif [ "$tc_num" -ge 8 ] && [ "$tc_num" -le 12 ]; then
74
- suggested_page="LoginPage.groovy"
75
- elif [ "$tc_num" -ge 13 ] && [ "$tc_num" -le 16 ]; then
76
- suggested_page="UserAdminPage.groovy"
77
- elif [ "$tc_num" -ge 17 ] && [ "$tc_num" -le 28 ]; then
78
- suggested_page="CommonCategoryPage.groovy"
79
- elif [ "$tc_num" -ge 29 ] && [ "$tc_num" -le 92 ]; then
80
- suggested_page="IndustryCategoryPage.groovy"
81
- elif [ "$tc_num" -ge 93 ] && [ "$tc_num" -le 122 ]; then
82
- suggested_page="PlanningPage.groovy"
83
- elif [ "$tc_num" -ge 123 ] && [ "$tc_num" -le 247 ]; then
84
- suggested_page="DataMiningPage.groovy"
85
- elif [ "$tc_num" -ge 248 ] && [ "$tc_num" -le 249 ]; then
86
- suggested_page="ReportPage.groovy"
87
- elif [ "$tc_num" -ge 250 ] && [ "$tc_num" -le 259 ]; then
88
- suggested_page="TokenMgmtPage.groovy"
69
+ if [ -f "tools/repo_map.txt" ] && [[ "$filename" =~ TC-([0-9]+) ]]; then
70
+ tc_pattern="TC-${BASH_REMATCH[1]}"
71
+ found_page=$(grep -m 1 -i "$tc_pattern" tools/repo_map.txt | awk '{print $1}' 2>/dev/null)
72
+ if [ -n "$found_page" ]; then
73
+ suggested_page="$found_page"
89
74
  fi
90
75
  fi
91
76