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
@@ -72,5 +72,5 @@ katalonc -noSplash -runMode=console \
72
72
  3. **Compile Allure Report:** `allure generate ./allure-results -o ./Reports/allure-report --clean`.
73
73
  4. If failures occur, immediately dispatch failure autopsy:
74
74
  ```bash
75
- python3 ~/.zcode/synapse-hub/tools/pinpoint_failure.py
75
+ python tools/pinpoint_failure.py
76
76
  ```
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: mipro-prompt-compiler
3
+ description: "MIPROv2 Bayesian teleprompter optimizer and few-shot compiler tuning prompt instructions against AST mutation kill scores. Use when optimizing QA prompts or compiling few-shot assertion generators."
4
+ ---
5
+
6
+ # MIPROv2 Prompt Compiler Skill — Bayesian Few-Shot & Assertion Optimization
7
+
8
+ > **Paradigm Attribution:** Inspired by **Stanford NLP DSPy v2 (MIPROv2 Teleprompter) & Optuna TPE**.
9
+ > **Core Principle:** Transition from subjective handcrafted prompting to algorithmic Bayesian compilation. Tune instruction phrasing and select the highest-leverage few-shot demonstrations to maximize AST mutant detection ($\ge 85\%$) while keeping token footprint under 800 tokens.
10
+
11
+ ---
12
+
13
+ ## 1. The MIPROv2 Compilation Pipeline
14
+
15
+ ```mermaid
16
+ flowchart LR
17
+ Sig["QA Signature<br/>tools/dspy_qa_signatures.py"] --> Tuner["MIPROv2 Prompt Tuner<br/>tools/mipro_assertion_tuner.py"]
18
+ Vault["Few-Shot Demonstrations<br/>tools/skill_vault.py"] --> Tuner
19
+ Tuner --> Trials["20-25 Iterative Trials<br/>Bayesian Instruction Search"]
20
+ Trials --> Eval["Objective Function<br/>micro_mutator.py (Kill Rate >= 85%)"]
21
+ Eval --> Export["Compiled Prompt Module<br/>compiled/optimized_module.json"]
22
+ ```
23
+
24
+ 1. **Multi-Prompt Instruction Search:**
25
+ - Explores multiple candidate instruction phrasings (defensive assertions, state verification, boundary checks).
26
+ - Dynamically selects optimal subsets of few-shot demonstrations from `skill_vault.db`.
27
+
28
+ 2. **AST Mutation Objective Function:**
29
+ - Instead of subjective human preference, prompts are evaluated against real syntactic AST faults generated by `tools/micro_mutator.py`.
30
+ - Rejects prompt configurations with mutant kill rates below 85%.
31
+
32
+ 3. **Compiled Module Artifact:**
33
+ - Produces a frozen, deterministic JSON specification ready for deployment in production AI subagents.
34
+
35
+ ---
36
+
37
+ ## 2. CLI Tool Usage
38
+
39
+ Autonomous commands via `tools/mipro_assertion_tuner.py`:
40
+
41
+ ```bash
42
+ # 1. Compile and optimize assertion generation prompt
43
+ python tools/mipro_assertion_tuner.py compile-module \
44
+ --signature "AssertionGenerator" \
45
+ --trials 20 \
46
+ --out-module compiled/optimized_assertion_gen.json
47
+
48
+ # 2. Evaluate compiled prompt module against testset
49
+ python tools/mipro_assertion_tuner.py evaluate \
50
+ --module compiled/optimized_assertion_gen.json
51
+ ```
52
+
53
+ ---
54
+
55
+ ## 3. Strict Operating Invariants
56
+
57
+ - **Mutation Score Hard Floor:** Prompts must achieve a minimum mutant kill rate of **85%**.
58
+ - **Token Ceiling:** Compiled prompts must not exceed **800 tokens**.
59
+ - **No Handcrafted Drift:** Do not manually edit compiled JSON modules; re-run `compile-module` when requirements evolve.
@@ -0,0 +1,22 @@
1
+ {
2
+ "status": "PASS",
3
+ "module": "AssertionGenerator",
4
+ "optimization_trials": 20,
5
+ "best_trial_id": 14,
6
+ "baseline_mutation_score": 0.68,
7
+ "optimized_mutation_score": 0.895,
8
+ "estimated_token_footprint": 245,
9
+ "token_reduction_percent": 69.4,
10
+ "compiled_prompt": {
11
+ "instruction": "Produce strict web-first assertions avoiding tautologies, with dynamic wait and payload integrity checks.",
12
+ "demonstrations": [
13
+ {
14
+ "id": "demo_1",
15
+ "action": "submitOrder",
16
+ "assertion": "await expect(this.confirmationModal).toBeVisible();\nawait expect(this.orderId).not.toBeEmpty();"
17
+ }
18
+ ],
19
+ "signature": "AssertionGenerator"
20
+ },
21
+ "elapsed_seconds": 0.12
22
+ }
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: qa-aci-interface
3
+ description: "Safe Agent-Computer Interface for inspecting code windows (40-50 lines), surgical editing with pre-commit AST checks, and distilled test execution. Use when inspecting, editing, or refactoring code without context blowout."
4
+ ---
5
+
6
+ # QA Agent-Computer Interface (ACI) Skill — Context-Safe Code Editing
7
+
8
+ > **Paradigm Attribution:** Inspired by **Princeton NLP / Stanford SWE-agent ACI**.
9
+ > **Core Principle:** Prevent context window blowout and hallucinated edits by enforcing bounded file viewing (40–50 lines), surgical contiguous chunk replacements with AST syntax validation, and log distillation.
10
+
11
+ ---
12
+
13
+ ## 1. The Three ACI Primitives
14
+
15
+ ```mermaid
16
+ flowchart LR
17
+ View["1. view-window<br/>Read 40-50 lines with line numbers"] --> Edit["2. surgical-edit<br/>Replace exact chunk with AST syntax check"]
18
+ Edit --> Distill["3. run-distilled<br/>Run test and distill head+tail output"]
19
+ ```
20
+
21
+ 1. **Bounded File Viewing (`view-window`):**
22
+ - Strictly limits context consumption by reading bounded windows (default 40 lines) with line numbers.
23
+ - Eliminates monolithic file ingestion (reading 4,000-line PageClasses directly is strictly forbidden).
24
+
25
+ 2. **Pre-Commit Surgical Editing (`surgical-edit`):**
26
+ - Validates that target chunks exist uniquely in the file.
27
+ - Runs pre-commit AST syntax validation (Python `ast.parse` and bracket balance).
28
+ - Enforces **Clean POM**: strictly rejects raw XPath / CSS selectors if editing test scripts (`tests/`, `Scripts/`).
29
+ - Guarantees 100% UTF-8 No BOM across all file writes.
30
+
31
+ 3. **Distilled Execution (`run-distilled`):**
32
+ - Intercepts test runner stdout/stderr and extracts the head 25 lines and tail 25 lines.
33
+ - Prevents terminal noise and test trace dumps from saturating the conversation context.
34
+
35
+ ---
36
+
37
+ ## 2. CLI Tool Usage
38
+
39
+ Autonomous commands via `tools/swe_qa_aci.py`:
40
+
41
+ ```bash
42
+ # 1. View 40 lines starting at line 20
43
+ python tools/swe_qa_aci.py view-window \
44
+ --file src/pages/LoginPage.ts \
45
+ --start-line 20 \
46
+ --window-size 40
47
+
48
+ # 2. Surgically edit code with AST check & Clean POM guard
49
+ python tools/swe_qa_aci.py surgical-edit \
50
+ --file src/pages/LoginPage.ts \
51
+ --target-chunk "await this.page.click('#old-btn');" \
52
+ --replacement-chunk "await this.clickSafe(this.loginButton);" \
53
+ --validate-syntax
54
+
55
+ # 3. Run test command with distilled output
56
+ python tools/swe_qa_aci.py run-distilled \
57
+ --command "npx playwright test tests/login.spec.ts" \
58
+ --max-lines 50
59
+ ```
60
+
61
+ ---
62
+
63
+ ## 3. Strict Operating Invariants
64
+
65
+ - **Diff Minimization:** Diff length should not exceed 30 lines per edit.
66
+ - **Syntax Integrity:** Zero syntax errors permitted; the tool rolls back on any syntax invalidity before touching disk.
67
+ - **No BOM Invariant:** Ensures zero `0xEF, 0xBB, 0xBF` bytes in modified files.
@@ -0,0 +1,12 @@
1
+ {
2
+ "status": "PASS",
3
+ "file": "src/pages/LoginPage.ts",
4
+ "lines_replaced": {
5
+ "start": 25,
6
+ "end": 25
7
+ },
8
+ "ast_validation": "SYNTAX_VALID",
9
+ "utf8_nobom_verified": true,
10
+ "clean_pom_verified": true,
11
+ "diff_summary": "- await this.page.click('#old-btn');\n+ await this.clickSafe(this.loginButton);"
12
+ }
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: qa-memory-os
3
+ description: "Hierarchical 3-tier memory operating system for test automation: Core Memory blocks, Recall step logs, and Archival semantic store with AUT version scoping. Use when managing long-term test session state, auth tokens, and preventing context rot."
4
+ ---
5
+
6
+ # QA Test Memory OS Skill — Hierarchical Persistent Memory
7
+
8
+ > **Paradigm Attribution:** Inspired by **Letta AI / UC Berkeley SkyLab (MemGPT & MemFS)**.
9
+ > **Core Principle:** Replace flat SQLite caches with a disciplined 3-tier memory operating system. Eliminate memory rot across application versions by tagging locator mutations and flaky histories with explicit AUT release versions.
10
+
11
+ ---
12
+
13
+ ## 1. The 3-Tier Architecture
14
+
15
+ ```mermaid
16
+ flowchart TD
17
+ subgraph MemoryOS["Hierarchical QA Test Memory OS (.agent_memory/qa_memory.db)"]
18
+ Core["Tier 1: Core Memory Block<br/>Fast Key-Value JSON: AUT URL, Token Expiry, Feature Flags"]
19
+ Recall["Tier 2: Recall Memory Log<br/>Sequential chronological timeline of execution steps"]
20
+ Archival["Tier 3: Archival Semantic Store<br/>Cross-sprint locator mutations scoped by AUT version (v2.1 vs v2.2)"]
21
+ end
22
+
23
+ Clean["Hygiene & GC Daemon<br/>Secret scrubbing (zero passwords/tokens) & DB size < 50MB"]
24
+ Core --> Clean
25
+ Recall --> Clean
26
+ Archival --> Clean
27
+ ```
28
+
29
+ 1. **Tier 1 — Core Memory (`core_memory`):**
30
+ - Immediate in-context state: active auth tokens, storage state path, AUT base URL.
31
+ - Enables **Zero-Second Auth**: reuse active tokens without repeating UI login forms.
32
+
33
+ 2. **Tier 2 — Recall Memory (`recall_memory`):**
34
+ - Sequential audit log of subagent actions, navigation events, and errors.
35
+ - Rotates or prunes records older than 30 days to save disk space.
36
+
37
+ 3. **Tier 3 — Archival Memory (`archival_memory`):**
38
+ - Permanent knowledge base of healed locators and historical flaky failure patterns.
39
+ - **AUT Version Scoping (`aut_version`):** Queries can filter by release (e.g. `aut_version="v2.1"`). When the web app upgrades to `v2.2`, obsolete `v2.1` mutations are ignored, completely eliminating false cache hits (Memory Rot).
40
+
41
+ ---
42
+
43
+ ## 2. CLI Tool Usage
44
+
45
+ Autonomous commands via `tools/test_memory_os.py`:
46
+
47
+ ```bash
48
+ # 1. Initialize memory OS database
49
+ python tools/test_memory_os.py init --db-path .agent_memory/qa_memory.db
50
+
51
+ # 2. Update active session state in Core Memory
52
+ python tools/test_memory_os.py update-core \
53
+ --block auth_state \
54
+ --data '{"token_expiry": "2026-11-05T00:00:00Z", "storage_state": "storage_state.json"}'
55
+
56
+ # 3. Store locator mutation in Archival Memory scoped by version
57
+ python tools/test_memory_os.py archival-insert \
58
+ --key LOCATOR_MUTATION \
59
+ --payload '{"page": "CheckoutPage", "old": "#submit-btn", "new": "button[data-testid=submit]"}' \
60
+ --aut-version "v2.1" \
61
+ --tags "checkout,submit,button"
62
+
63
+ # 4. Search archival memory with semantic token matching
64
+ python tools/test_memory_os.py archival-search \
65
+ --query "Checkout submit button locator history" \
66
+ --aut-version "v2.1" \
67
+ --top-k 3 \
68
+ --json
69
+
70
+ # 5. Run garbage collection and secret scrubbing
71
+ python tools/test_memory_os.py gc --scrub-secrets --max-age-days 30
72
+ ```
73
+
74
+ ---
75
+
76
+ ## 3. Strict Operating Invariants
77
+
78
+ - **Zero Plaintext Secrets:** Automatic regex masking for passwords, bearer tokens, and private keys (`[MASKED_SECRET]`).
79
+ - **Memory File Ceiling:** DB size strictly maintained under **50MB**.
80
+ - **Version Isolation:** Never apply archival locator patches across different incompatible AUT major versions.
@@ -0,0 +1,21 @@
1
+ {
2
+ "status": "PASS",
3
+ "query": "Checkout submit button locator history",
4
+ "aut_version": "v2.1",
5
+ "matches_found": 1,
6
+ "results": [
7
+ {
8
+ "id": "mem_arch_9014",
9
+ "similarity_score": 0.912,
10
+ "key": "LOCATOR_MUTATION",
11
+ "timestamp": "2026-11-04T05:30:00Z",
12
+ "payload": {
13
+ "page": "CheckoutPage",
14
+ "old_selector": "#submit-order",
15
+ "new_selector": "button[data-testid=submit]",
16
+ "aut_version": "v2.1",
17
+ "verified_by_test": "tests/checkout.spec.ts"
18
+ }
19
+ }
20
+ ]
21
+ }
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: review-spec
3
+ description: "Zero-context stress test and quality review of test specifications, user stories, BDD feature files, and acceptance criteria before code generation begins."
4
+ category: architecture_and_analysis
5
+ version: "1.0.0"
6
+ ---
7
+
8
+ # Review Spec — Zero-Context Specification Stress-Tester
9
+
10
+ Review test specifications, User Stories, and BDD `.feature` files with stateless, zero-context rigor (Elephant-Goldfish Model) before generating code.
11
+
12
+ Order of evaluation: **System Boundaries -> Dynamic Data & Teardown -> Assertion Rigor -> Boundary & Negative Cases -> Concrete Implementation Targets**.
13
+
14
+ ---
15
+
16
+ ## 1. When to Use
17
+
18
+ - Triggered automatically before `pom-crafter` synthesizes Page Classes or test scripts from natural-language specs.
19
+ - Triggered when the user asks to review, audit, or refine requirements, user stories, or acceptance criteria.
20
+ - Integrated CLI invocation:
21
+ ```bash
22
+ python tools/goldfish_review.py path/to/spec.md
23
+ python tools/goldfish_review.py path/to/feature.feature --json
24
+ # or via CLI shim:
25
+ agent-qa review-spec path/to/spec.md
26
+ ```
27
+
28
+ ---
29
+
30
+ ## 2. Five Verification Vectors (Goldfish Protocol)
31
+
32
+ 1. **Comprehension & System Boundaries (20%):**
33
+ - Explicit Actor/Role definition.
34
+ - Clear Preconditions and Initial State.
35
+ - Well-defined Target Scope (no vague "works fine" or "system operates normally").
36
+
37
+ 2. **Dynamic Data & Idempotent Teardown (20%):**
38
+ - Mandatory dynamic timestamps or random prefixes (`AUTO_`, `uniqueCode`) to eliminate database primary key collisions.
39
+ - Explicit post-test cleanup or automated Teardown step for every data-creation path.
40
+
41
+ 3. **Assertion Rigor & Truth Anchor (25%):**
42
+ - Concrete, deterministic expected results instead of tautological assertions.
43
+ - Zero-Fake-Pass guarantee: explicit UI state changes, status codes, or database assertions.
44
+
45
+ 4. **Boundary & Negative Scenarios (20%):**
46
+ - Invalid input values, boundary overflows, and unauthorized access attempts.
47
+ - Explicit error message and validation feedback assertions.
48
+
49
+ 5. **Concrete Implementation Targets (15%):**
50
+ - Concrete Page Class mappings or API endpoint routes.
51
+ - Clean POM Flat Architecture compliance (locators belongs in Page Classes, not test scripts).
52
+
53
+ ---
54
+
55
+ ## 3. Autonomous Execution Workflow
56
+
57
+ 1. Ingest specification file (`.md`, `.feature`, or story text).
58
+ 2. Run `python tools/goldfish_review.py <spec_file>`.
59
+ 3. If review score is `< 80/100` or blocking gaps are found, report specific missing vectors to the user or orchestrator.
60
+ 4. Once verified ($\ge 80/100$), proceed with Clean POM test script codification.
@@ -0,0 +1,33 @@
1
+ # Sample Spec Review (Goldfish Protocol)
2
+
3
+ Representative output of `python tools/goldfish_review.py` evaluating a draft specification for an e-commerce checkout flow.
4
+
5
+ ```markdown
6
+ # 🔍 Goldfish Specification Review Report
7
+ Target Spec: `specs/checkout_flow.md`
8
+ Timestamp: 2026-11-04 15:30:00
9
+
10
+ ## Scorecard: 85/100 (APPROVED)
11
+
12
+ 1. Comprehension & System Boundaries: 20/20
13
+ - Actor: Authenticated Buyer.
14
+ - Preconditions: Active cart with >= 1 item, valid shipping address.
15
+ - Target Scope: Payment step through Order Confirmation modal.
16
+
17
+ 2. Dynamic Data & Idempotent Teardown: 18/20
18
+ - Dynamic order ID with `AUTO_${Date.now()}`.
19
+ - Teardown: DB order status updated to `CANCELLED_TEST` via API hook.
20
+
21
+ 3. Assertion Rigor: 22/25
22
+ - Explicit confirmation message and total amount match.
23
+ - Anti-Fake Pass check: database order record mutation verified.
24
+
25
+ 4. Boundary & Negative Scenarios: 15/20
26
+ - Invalid credit card number and expired CVV covered.
27
+ - Recommendation: Add test case for network timeout during 3D Secure redirect.
28
+
29
+ 5. Implementation Target: 10/15
30
+ - Target Page: `CheckoutPage.ts`, `OrderConfirmationPage.ts`.
31
+
32
+ Verdict: PASS (Ready for POM Codification)
33
+ ```
@@ -81,8 +81,8 @@ Transform functional tests into input sanitization and robustness validation by
81
81
 
82
82
  ```bash
83
83
  # Query CLI catalog for specific field vectors
84
- python3 ~/.zcode/synapse-hub/tools/fuzz_payloads.py --field username --type string
85
- python3 ~/.zcode/synapse-hub/tools/fuzz_payloads.py --category sqli --json
84
+ python tools/fuzz_payloads.py --field username --type string
85
+ python tools/fuzz_payloads.py --category sqli --json
86
86
  ```
87
87
 
88
88
  ### Recipe D: Harmless SQLi Polyglot Sanity
@@ -0,0 +1,49 @@
1
+ # Context Engineering & Token Optimization Guide (Full Architecture)
2
+
3
+ *(Synthesized from `muratcankoylan/Agent-Skills-for-Context-Engineering`, `alexgreensh/token-optimizer`, and `obra/superpowers`)*
4
+
5
+ ---
6
+
7
+ ## 1. Pillar 1: Observation Masking
8
+ Raw tool outputs (CLI execution logs, Gradle builds, browser console traces) contain 90% repetitive noise and low-signal tokens.
9
+ - **Log Truncation & Summarization:** Never dump thousands of lines into the active conversation. Extract only: failing line number, exception name, test case identifier (`TC-xxx`), and status.
10
+ - **Pointer Masking:** Use structured references pointing to files on disk: `[Full raw log saved to file://<path>; 2,400 verbose lines omitted]`.
11
+
12
+ ---
13
+
14
+ ## 2. Pillar 2: Progressive Disclosure
15
+ Never load large codebases or giant classes (over 500 lines) into context at once. Load information in 3 progressive tiers:
16
+ - **Tier 1:** High-Level Index & Repo Map (< 150 lines) via `tools/repo_map.txt`.
17
+ - **Tier 2:** Graph Semantic Scoping via `graphify explain` or `test_impact.py`.
18
+ - **Tier 3:** Targeted Micro-Read (20-50 lines using `StartLine`/`EndLine`).
19
+
20
+ ---
21
+
22
+ ## 3. Pillar 3: KV-Cache Friendly Ordering
23
+ LLM inference engines cache Key-Value (KV) attention states for identical prompt prefixes.
24
+ - **Static Prefix First:** Keep instructions, rules, and tool schemas immutable at the top.
25
+ - **Append-Only Dynamic State:** Only append new test results and tool observations at the bottom.
26
+ - **Predictable Format:** Use identical pre-flight status badges on every turn to maximize cache hits (> 85%).
27
+
28
+ ---
29
+
30
+ ## 4. Pillar 4: Scoped Context & Compaction Anchoring
31
+ - **Compaction State Anchoring:** Critical state must be persisted to disk in `PROJECT_STATE.md`. When compaction fires, re-anchor immediately from disk with zero memory loss.
32
+ - **Workspace Isolation (`Workspace: 'share'`):** Subagents use isolated worktrees to prevent dirty tree collisions.
33
+ - **Zero Context Contagion:** Subagents return distilled 3-5 line summaries; stdout remains in subagent sandbox.
34
+ - **Data Partitioning:** Subagents append agent IDs to test data (`uniqueCode = "AUTO_" + time + "_SUB" + id`).
35
+
36
+ ---
37
+
38
+ ## 5. Pillar 5: Semantic Context Distillation (Pure Signal, Zero Noise)
39
+ All sensory inputs must pass through deterministic filters:
40
+ - **CLI Logs (`tools/distill_log.py`):** Truncate 95% of verbose lines.
41
+ - **DOM Purifier (`qa.getCompactAOM`):** Strictly forbidden to send raw HTML. Use compact AOM (< 500 tokens).
42
+ - **Universal IR (`tools/universal_ir.py`):** Author clean universal IR before emitting framework-specific code.
43
+
44
+ ---
45
+
46
+ ## 6. Pillar 6: Elephant-Goldfish Memory Model
47
+ - **The Elephant (Stateful Orchestrator):** Narrows problem boundaries, gathers intent, drafts specs in `docs/specs/*.md`, maintains `PROJECT_STATE.md`. Never writes tests during design phase.
48
+ - **The Goldfish (Stateless Subagent Swarm):** Fresh subagent with ZERO conversation history; evaluates solely cold artifacts on disk via `tools/goldfish_review.py`.
49
+ - **Air-Gap Data Contract:** All inter-stage data exchanges pass via disk files (JSON/JUnit XML), never raw prompt inheritance.
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: tot-exploratory-testing
3
+ description: "Non-linear Tree/Graph-of-Thoughts exploratory testing engine exploring Happy Path, Boundary/Race, and Negative/Chaos branches with Beam Search risk scoring and multi-hypothesis RCA. Use when decomposing complex user stories into exploratory test trees or triaging complex failures."
4
+ ---
5
+
6
+ # Tree-of-Thoughts Exploratory Testing Skill — Deliberative QA Reasoning
7
+
8
+ > **Paradigm Attribution:** Inspired by **Princeton NLP Tree-of-Thoughts (ToT) & ETH Zürich Graph-of-Thoughts (GoT)**.
9
+ > **Core Principle:** Overcome linear single-track test generation. Decompose critical enterprise workflows into a 3-branch deliberation tree (Happy Path, Boundary/Race, Chaos/Fault), score intermediate thought nodes with Beam Search, and diagnose root causes via multi-hypothesis evaluation.
10
+
11
+ ---
12
+
13
+ ## 1. The Deliberative 3-Branch Reasoning Tree
14
+
15
+ ```mermaid
16
+ flowchart TD
17
+ Story["User Story / Feature Requirement"] --> ToT["Tree-of-Thoughts Deliberation Engine"]
18
+ ToT --> B1["Branch 1: Happy Path<br/>Risk Score: 0.25 (Standard Business CRUD)"]
19
+ ToT --> B2["Branch 2: Boundary, Race & Session<br/>Risk Score: 0.88 (Double-Click, Token Expire)"]
20
+ ToT --> B3["Branch 3: Negative & Chaos Fault<br/>Risk Score: 0.72 (Backend 500, DB Timeout)"]
21
+
22
+ B2 --> Synthesize["Clean POM Synthesis<br/>Generate High-Risk Boundary Test Scenarios"]
23
+ ```
24
+
25
+ 1. **Deliberative Branching:**
26
+ - Evaluates non-linear edge cases: mid-transaction network drops, concurrent duplicate clicks, and auth token expiration.
27
+ - Assigns quantitative risk scores (0.0 to 1.0) to prioritize high-risk test scripts over repetitive happy paths.
28
+
29
+ 2. **Multi-Hypothesis RCA:**
30
+ - Evaluates competing defect hypotheses (`DOM_TIMEOUT`, `ASYNC_RACE`, `DB_LOCK`, `BACKEND_500`, `STALE_SELECTOR`).
31
+ - Replaces guesswork with evidence-based diagnosis ranked by confidence scores.
32
+
33
+ ---
34
+
35
+ ## 2. CLI Tool Usage
36
+
37
+ Autonomous commands via `tools/tot_exploratory_tester.py`:
38
+
39
+ ```bash
40
+ # 1. Expand User Story into Tree of Thoughts
41
+ python tools/tot_exploratory_tester.py expand-story \
42
+ --story-file docs/stories/US_PAYMENT_GATEWAY.md \
43
+ --max-depth 3 \
44
+ --beam-width 3 \
45
+ --out-graph reports/tot_payment_graph.json
46
+
47
+ # 2. Perform multi-hypothesis Root Cause Analysis
48
+ python tools/tot_exploratory_tester.py rca-hypotheses \
49
+ --error-log reports/failed_run.log \
50
+ --hypotheses "DOM_TIMEOUT,ASYNC_RACE,DB_LOCK,BACKEND_500"
51
+ ```
52
+
53
+ ---
54
+
55
+ ## 3. Strict Operating Invariants
56
+
57
+ - **Critical Flow Prioritization:** Focus multi-branch deliberation on high-risk domains (Financial Checkout, Authentication, Data Mutation).
58
+ - **Clean POM Output:** Test scenarios derived from thought trees must map directly into Page Classes extending `BasePage`.
59
+ - **Zero Hallucination:** Hypotheses must be grounded directly in error log evidence and stacktraces.
@@ -0,0 +1,35 @@
1
+ {
2
+ "status": "PASS",
3
+ "story_title": "US_PAYMENT_GATEWAY",
4
+ "domain": "FINANCIAL_CHECKOUT",
5
+ "max_depth": 3,
6
+ "beam_width": 3,
7
+ "total_branches_explored": 3,
8
+ "highest_risk_branch": "BRANCH_BOUNDARY_RACE",
9
+ "branches": [
10
+ {
11
+ "branch_id": "BRANCH_BOUNDARY_RACE",
12
+ "name": "Boundary, Session Interruption & Concurrency Path",
13
+ "risk_score": 0.88,
14
+ "thoughts": [
15
+ {
16
+ "step": 1,
17
+ "thought": "Simulate session expiration or token invalidation mid-flow."
18
+ },
19
+ {
20
+ "step": 2,
21
+ "thought": "Perform rapid double-click on submission action to probe race condition."
22
+ },
23
+ {
24
+ "step": 3,
25
+ "thought": "Assert idempotency: strictly 1 transaction created, duplicate blocked gracefully."
26
+ }
27
+ ]
28
+ }
29
+ ],
30
+ "clean_pom_recommendations": [
31
+ "Implement FINANCIAL_CHECKOUTPage extending BasePage",
32
+ "Encapsulate double-click debounce in clickSubmitSafe()",
33
+ "Assert boundary toast in verifyErrorMessageDisplayed()"
34
+ ]
35
+ }
@@ -70,8 +70,8 @@ Agent can automatically audit accessibility for any HTML file or live page URL v
70
70
 
71
71
  ```bash
72
72
  # Audit a local HTML snapshot
73
- python3 ~/.zcode/synapse-hub/tools/wcag_audit.py path/to/page.html -o docs/wcag_audit_report.md
73
+ python tools/wcag_audit.py path/to/page.html -o docs/wcag_audit_report.md
74
74
 
75
75
  # Audit a live application URL directly
76
- python3 ~/.zcode/synapse-hub/tools/wcag_audit.py https://staging.example.com --url -o docs/wcag_audit_report.md
76
+ python tools/wcag_audit.py https://staging.example.com --url -o docs/wcag_audit_report.md
77
77
  ```
@@ -0,0 +1,62 @@
1
+ ---
2
+ name: web-agent-gym-benchmarking
3
+ description: "Empirical benchmark harness evaluating web agents and Page Classes against standardized enterprise tasks with headless <200ms latency budgets and ground-truth DB state verification. Use when benchmarking web agents or certifying Page Classes."
4
+ ---
5
+
6
+ # Web Agent Gym Benchmarking Skill — Empirical Interaction & PageClass Certification
7
+
8
+ > **Paradigm Attribution:** Inspired by **ServiceNow Research BrowserGym & CMU WebArena**.
9
+ > **Core Principle:** Move beyond static assertions and text-only tool tests. Measure real agent navigation efficiency, enforce < 200ms headless step latency, and confirm that UI actions trigger ground-truth database mutations (eliminating fake passes).
10
+
11
+ ---
12
+
13
+ ## 1. The Benchmark Architecture
14
+
15
+ ```mermaid
16
+ flowchart TD
17
+ subgraph GymHarness["BrowserGym Evaluation Harness (tools/browsergym_eval.py)"]
18
+ Tasks["Standardized Tasks<br/>ecommerce_order, crm_lead_create, filter_data_grid"]
19
+ Execution["Headless Playwright Execution<br/>Sub-200ms latency per action step"]
20
+ DualVerify["Dual Verification Oracle<br/>1. DOM/AOM state inspection<br/>2. Underlying DB record verification"]
21
+ Certify["Certification Decision<br/>Success >= 90% & Latency < 200ms -> APPROVED"]
22
+ end
23
+ ```
24
+
25
+ 1. **Standardized Tasks:**
26
+ - Pre-packaged enterprise scenarios covering forms, checkout modals, dropdowns, and data grids.
27
+ - Evaluates whether the web agent can navigate without deadlocks or infinite loops.
28
+
29
+ 2. **Ground-Truth Dual Verification:**
30
+ - A pass is NOT granted merely because a UI toast says "Success".
31
+ - The harness validates the database mutation (`SELECT COUNT(*) FROM orders WHERE ...`).
32
+
33
+ 3. **PageClass Certification:**
34
+ - Static and dynamic audit of newly synthesized Page Classes.
35
+ - Rejects Page Classes containing `findTestObject`, raw XPaths, or static `Thread.sleep` calls.
36
+
37
+ ---
38
+
39
+ ## 2. CLI Tool Usage
40
+
41
+ Autonomous commands via `tools/browsergym_eval.py`:
42
+
43
+ ```bash
44
+ # 1. Run full benchmark suite in headless mode
45
+ python tools/browsergym_eval.py run-suite \
46
+ --tasks "ecommerce_order,crm_lead_create,filter_data_grid" \
47
+ --headless \
48
+ --timeout-sec 30 \
49
+ --report-out reports/browsergym_benchmark.json
50
+
51
+ # 2. Evaluate and certify a Page Class
52
+ python tools/browsergym_eval.py evaluate-pageclass \
53
+ --page-class src/pages/OrderManagementPage.ts
54
+ ```
55
+
56
+ ---
57
+
58
+ ## 3. Strict Operating Invariants
59
+
60
+ - **Headless Latency Ceiling:** Average action step latency must remain below **200ms**.
61
+ - **No Static Sleep:** Any Page Class with `sleep()` calls is automatically flagged as `REJECTED`.
62
+ - **Clean POM:** Strictly prohibits hardcoded selectors outside Page Classes.
@@ -0,0 +1,22 @@
1
+ {
2
+ "status": "PASS",
3
+ "suite": "EnterpriseWebBenchmark_v1",
4
+ "total_tasks": 3,
5
+ "passed_tasks": 3,
6
+ "action_success_rate": 1.0,
7
+ "avg_latency_ms": 131.2,
8
+ "database_assertion_pass_rate": 1.0,
9
+ "certification": "APPROVED",
10
+ "tasks": [
11
+ {
12
+ "task": "ecommerce_order",
13
+ "name": "E-Commerce Checkout & Order Generation",
14
+ "steps_count": 5,
15
+ "avg_step_latency_ms": 130.0,
16
+ "dom_verification": "PASS",
17
+ "database_assertion": "PASS",
18
+ "status": "PASS"
19
+ }
20
+ ],
21
+ "elapsed_seconds": 0.45
22
+ }
package/AGENTS.md CHANGED
@@ -61,7 +61,12 @@ You are a lazy senior developer. The best code is the code never written. Solve
61
61
  - User asks to scan debt / shortcuts -> Autonomously run `tools/debt_harvester.py`.
62
62
  - Test failure occurs in runner -> Autonomously run `tools/pinpoint_failure.py` / `tools/auto_heal.py`.
63
63
  - Verifying test assertion quality -> Autonomously run `tools/micro_mutator.py` (reject if Mutation Score < 80%).
64
- - Before completing code tasks -> Autonomously run `tools/verify_all.py` (9 Quality Gates DoD).
64
+ - Complex test failures / iterative self-healing -> Run `tools/auto_heal_reflexion.py` (Noah Shinn Reflexion K=3).
65
+ - Reversible sandbox mutations / rollback -> Run `tools/reversible_sandbox.py`.
66
+ - Querying / Storing verified PageClass library -> Run `tools/skill_vault.py`.
67
+ - Vague requirements / story ambiguity -> Autonomously run `tools/interview_story.py`.
68
+ - Optimizing assertions against surviving mutants -> Run `tools/textgrad_mutation_optimizer.py`.
69
+ - Before completing code tasks -> Autonomously run `tools/verify_all.py` (10 Quality Gates DoD).
65
70
 
66
71
  ---
67
72
 
package/CLAUDE.md CHANGED
@@ -17,7 +17,7 @@ In accordance with the MIT License, the original copyright notice crediting **Th
17
17
  ---
18
18
 
19
19
  ## ⚡ Quick Commands
20
- - Verify 9 Quality Gates: `npx synapse-hub verify` (or `python tools/verify_all.py`)
20
+ - Verify 10 Quality Gates: `npx synapse-hub verify` (or `python tools/verify_all.py`)
21
21
  - Project Health Audit: `npx synapse-hub analyze` (or `python tools/analyze_project.py`)
22
22
  - Code Linter & Fake-Pass Sentinel: `npx synapse-hub lint` (or `python tools/infer_linter.py`)
23
23
  - Verify Author Attribution: `python tools/author_integrity.py`