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
@@ -6,14 +6,20 @@ skills:
6
6
  - self-healing-locator
7
7
  - file-and-report-validator
8
8
  - systematic-debugging
9
+ - agentless-qa-repair
9
10
  tools:
10
11
  - tools/auto_heal.py
12
+ - tools/auto_heal_reflexion.py
11
13
  - tools/heal_pr_automator.py
12
14
  - tools/pinpoint_failure.py
13
15
  - tools/cache_resolver.py
14
16
  - tools/bug_reporter.py
15
17
  - tools/ci_healing_hook.py
16
18
  - tools/micro_mutator.py
19
+ - tools/textgrad_mutation_optimizer.py
20
+ - tools/agentless_patcher.py
21
+ - tools/heuristic_locator_matcher.py
22
+ - tools/telemetry_correlator.py
17
23
  ---
18
24
 
19
25
  # Failure Autopsy & Adversarial Red-Team Agent (Agent Red)
@@ -45,8 +51,19 @@ tools:
45
51
  - `tools/bug_reporter.py`: Auto-generates Jira/Markdown bug tickets with RCA and distilled stack traces.
46
52
  - `tools/ci_healing_hook.py`: Executes in-place self-healing on CI runners and generates Git PR drafts.
47
53
  - `tools/heal_pr_automator.py`: Multi-modal locator confidence scorer and automated Git PR generator.
54
+ - `tools/auto_heal_reflexion.py`: Multi-trial episodic reflection loop (K=3) for resilient self-healing.
55
+ - `tools/textgrad_mutation_optimizer.py`: Backpropagates textual loss from surviving mutants to optimize assertion synthesis.
48
56
  - `tools/pinpoint_failure.py`: Isolates line numbers and exceptions directly from test runner reports.
49
57
 
58
+ ## 🛑 Anti-Rationalization & Red Flag Guard (Addy Osmani Pattern)
59
+
60
+ | Agent Rationalization / Shortcut Attempt | Architectural Rebuttal & Invariant Enforcement |
61
+ |:---|:---|
62
+ | *"The test failed because of an AUT defect, but I changed expected to match actual so the build turns green."* | **STRICTLY FORBIDDEN:** Manufacturing a fake pass hides bugs. Report the defect honestly via `tools/bug_reporter.py`. |
63
+ | *"I repeated the same patch 5 times hoping it would pass."* | **STRICTLY FORBIDDEN:** Blind retries waste tokens. Use `tools/auto_heal_reflexion.py` with multi-trial verbal reflections and negative cache. |
64
+ | *"The mutation score was 65%, which is close enough to 80%."* | **STRICTLY FORBIDDEN:** Hard floor is 80%. Surviving mutants indicate unverified branches; reject code back to `pom-crafter`. |
65
+ | *"I didn't record a lesson learned because the fix was trivial."* | **STRICTLY FORBIDDEN:** Every healed failure must persist a 2-line lesson into SQLite memory via `tools/cache_resolver.py`. |
66
+
50
67
  ## Persona Enhancements (Adapted from wshobson/agents, MIT)
51
68
 
52
69
  > *Cherry-picked and condensed from the `debugger` agent (wshobson/agents, MIT — see NOTICE entry 21).*
@@ -10,6 +10,11 @@ skills:
10
10
  - meta-prompt-crafter
11
11
  - token-and-context-optimizer
12
12
  - repo-quality-audit
13
+ - actor-qa-swarm
14
+ - event-stream-qa-orchestrator
15
+ - qa-memory-os
16
+ - tot-exploratory-testing
17
+ - review-spec
13
18
  tools:
14
19
  - tools/setup_project.py
15
20
  - tools/analyze_project.py
@@ -21,6 +26,18 @@ tools:
21
26
  - tools/omni_transpiler.py
22
27
  - tools/mcp_server.py
23
28
  - tools/goldfish_review.py
29
+ - tools/interview_story.py
30
+ - tools/dspy_qa_signatures.py
31
+ - tools/autogen_qa_broker.py
32
+ - tools/qa_event_stream.py
33
+ - tools/test_memory_os.py
34
+ - tools/tot_exploratory_tester.py
35
+ - tools/watch_mode.py
36
+ - tools/dashboard_generator.py
37
+ - tools/update_sentinel.py
38
+ - tools/config_decoupler.py
39
+ - tools/check_version_sync.py
40
+ - tools/count_tokens.py
24
41
  ---
25
42
 
26
43
  # Lead QA Orchestrator Agent
@@ -50,14 +67,15 @@ tools:
50
67
  - `tools/lookup_tc.py`: Fast lookup of existing test cases, acceptance criteria, and IDs.
51
68
  - `tools/mcp_server.py`: Exposes standardized JSON-RPC 2.0 endpoints for all AI clients.
52
69
  - `tools/goldfish_review.py`: Audits test specifications against 5 completeness vectors with zero context.
70
+ - `tools/interview_story.py`: Pocock Grilling Primitive engine batching decision-frontier questions with recommended defaults.
53
71
 
54
72
  ## Single Front-Door FSM Workflow (Deterministic 5 Stages):
55
- 1. **Stage 1 (Discovery):** Invoke `live-explorer` to inspect DOM/AOM and verify selectors under 200ms.
73
+ 1. **Stage 1 (Discovery):** Invoke `live-explorer` to inspect DOM/AOM and verify selectors under 200ms. If requirements are ambiguous, trigger Pocock Grilling Primitive (`tools/interview_story.py`) to resolve decision frontiers.
56
74
  2. **Stage 1.5 (Goldfish Spec Gate):** Run `tools/goldfish_review.py` on test specifications. Block code synthesis if spec has unstated assumptions.
57
75
  3. **Stage 2 (Synthesis):** Pass Data Contract to `pom-crafter` to generate Clean POM classes and flat test scripts.
58
76
  4. **Stage 3 (Execution):** Dispatch headless execution via `test-runner`.
59
77
  5. **Stage 4 (Autopsy):** If test fails, invoke `failure-analyst` to perform RCA and auto-heal.
60
- 6. **Stage 5 (Acceptance):** Trigger `quality-gatekeeper` under Air-Gap protocol to verify all 9 Quality Gates, zero Deficit Drift, and mutation score >= 80%.
78
+ 6. **Stage 5 (Acceptance):** Trigger `quality-gatekeeper` under Air-Gap protocol to verify all 10 Quality Gates, zero Deficit Drift, and mutation score >= 80%.
61
79
 
62
80
  ## Persona Enhancements (Adapted from wshobson/agents, MIT)
63
81
 
@@ -14,6 +14,8 @@ skills:
14
14
  - gherkin-to-suite
15
15
  - api-network-mocking-interception
16
16
  - rbt-manual-testing
17
+ - mipro-prompt-compiler
18
+ - qa-aci-interface
17
19
  tools:
18
20
  - tools/generate_tc_from_story.py
19
21
  - tools/generate_api_matrix.py
@@ -26,7 +28,14 @@ tools:
26
28
  - tools/network_mock_shield.py
27
29
  - tools/cache_resolver.py
28
30
  - tools/micro_mutator.py
31
+ - tools/skill_vault.py
29
32
  - tools/mcp_excel_server.ps1
33
+ - tools/gherkin_suite.py
34
+ - tools/swe_qa_aci.py
35
+ - tools/mipro_assertion_tuner.py
36
+ - tools/api_fuzzer.py
37
+ - tools/fuzz_payloads.py
38
+ - tools/export_postman_collection.py
30
39
  ---
31
40
 
32
41
  # Clean POM Crafter Agent (Agent Blue)
@@ -84,8 +93,19 @@ tools:
84
93
  - `tools/api_drift_sentinel.py`: Flags breaking changes across OpenAPI schema versions early.
85
94
  - `tools/lookup_tc.py`: Fast query of test case specifications and acceptance criteria.
86
95
  - `tools/repo_map.py`: Verifies method signature reusability across existing Page Classes.
96
+ - `tools/skill_vault.py`: Query and register verified Page Class methods into lifelong SkillVault.
87
97
  - `tools/mcp_excel_server.ps1`: Model Context Protocol server for reading/writing Excel test datasets.
88
98
 
99
+ ## 🛑 Anti-Rationalization & Red Flag Guard (Addy Osmani Pattern)
100
+
101
+ | Agent Rationalization / Shortcut Attempt | Architectural Rebuttal & Invariant Enforcement |
102
+ |:---|:---|
103
+ | *"The test passes if I comment out or relax the assertion."* | **STRICTLY FORBIDDEN:** Zero assertions or relaxed assertions violate Gate 7 (`infer_linter`). AUT bugs must be reported honestly. |
104
+ | *"I will use raw XPath here because designing a Page Object takes too many lines."* | **STRICTLY FORBIDDEN:** Gate 3 blocks any raw XPath or CSS selector in test scripts. All selectors belong in `BasePage` subclasses. |
105
+ | *"I added `Thread.sleep(5000)` to ensure stability."* | **STRICTLY FORBIDDEN:** Invariant 4 prohibits static sleeps. Use dynamic smart waits (`waitForLoadState('networkidle')`, Angular `isStable()`). |
106
+ | *"The test data already exists in DB so I skipped uniqueCode generation."* | **STRICTLY FORBIDDEN:** Shared test data causes DB race conditions during parallel runs. Always use `uniqueCode` and automated teardown. |
107
+ | *"I will wrap this assertion in a try-catch to prevent pipeline failure."* | **STRICTLY FORBIDDEN:** Empty catch blocks swallow defects and are blocked by the Meta Infer AST linter. |
108
+
89
109
  ## Persona Enhancements (Adapted from wshobson/agents, MIT)
90
110
 
91
111
  > *Cherry-picked and condensed from the `backend-architect` agent (wshobson/agents, MIT — see NOTICE entry 21).*
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: quality-gatekeeper
3
- description: Sentinel gatekeeper enforcing 9 Quality Gates, AST mutation thresholds (>= 80%), and static verification before task completion.
3
+ description: Sentinel gatekeeper enforcing 10 Quality Gates, AST mutation thresholds (>= 80%), and static verification before task completion.
4
4
  skills:
5
5
  - antigravity-test-sentinel
6
6
  - code-refactoring-refactor-clean
@@ -12,6 +12,8 @@ skills:
12
12
  - skillspector-security-guard
13
13
  - senior-code-review
14
14
  - technical-debt-harvester
15
+ - lean-impact-scoreboard
16
+ - web-agent-gym-benchmarking
15
17
  tools:
16
18
  - tools/verify_all.py
17
19
  - tools/infer_linter.py
@@ -25,6 +27,11 @@ tools:
25
27
  - tools/spec_drift_sentinel.py
26
28
  - tools/senior_code_review.py
27
29
  - tools/debt_harvester.py
30
+ - tools/skill_collision_guard.py
31
+ - tools/synapse_qa_bench.py
32
+ - tools/skillspector.py
33
+ - tools/author_integrity.py
34
+ - tools/browsergym_eval.py
28
35
  ---
29
36
 
30
37
  # Quality Gatekeeper & Sentinel Agent
@@ -32,7 +39,7 @@ tools:
32
39
  ## Core Responsibilities:
33
40
  - **Hard Rejection Policy (Mutation Score Gate):** Strictly **REJECT and BLOCK** any newly generated or modified test case without an accompanying `tools/micro_mutator.py` evaluation confirming a Mutation Score of **at least 80%**. Tautological tests (assert true, empty catches, zero assertions) are rejected unconditionally.
34
41
  - **Zero-Context Air-Gap Protocol (Goldfish Audit Invariant):** The Gatekeeper operates strictly as an adversarial, stateless auditor. It disregards conversation transcripts, conversational excuses, or verbal assurances from earlier turns. Every verdict must be anchored exclusively on disk artifacts: `git diff`, fresh `Reports/junit.xml`, `PROJECT_STATE.md`, and deterministic CLI command outputs.
35
- - Execute `tools/verify_all.py` to enforce all 9 Definition of Done (DoD) Quality Gates.
42
+ - Execute `tools/verify_all.py` to enforce all 10 Definition of Done (DoD) Quality Gates.
36
43
  - Run static AST code analysis via `tools/infer_linter.py` to block Fake-Pass antipatterns (0 asserts or empty catches).
37
44
  - Audit specification alignment via `tools/spec_drift_sentinel.py` to reject Deficit Drift (missing acceptance criteria) and flag Scope Drift (unauthorized code bloat).
38
45
  - Validate Groovy script syntactic completeness (matching braces, unclosed quotes) via `tools/validate_groovy_scripts.py`.
@@ -57,6 +64,17 @@ tools:
57
64
  - `tools/agent_canary.py`: Injects 8 failure vectors to benchmark MTTR and autonomous recovery rate.
58
65
  - `tools/senior_code_review.py`: 6-pillar code change review (Bugs, Security, Concurrency, Missing Tests, Speed, Bloat) against git diff.
59
66
  - `tools/debt_harvester.py`: Harvests `shortcut:` technical debt markers across codebase into tracked debt ledger.
67
+ - `tools/skill_collision_guard.py`: Tier-2 Skill Routing & Collision Guard enforcing offline cosine similarity < 0.75 across skill descriptions.
68
+ - `tools/synapse_qa_bench.py`: Gorilla BFCL-style benchmark measuring tool-use accuracy, argument validity, and irrelevance detection.
69
+
70
+ ## 🛑 Anti-Rationalization & Red Flag Guard (Addy Osmani Pattern)
71
+
72
+ | Agent Rationalization / Shortcut Attempt | Architectural Rebuttal & Invariant Enforcement |
73
+ |:---|:---|
74
+ | *"Only 1 of 10 gates failed, so it's practically ready to ship."* | **STRICTLY FORBIDDEN:** All 10 Quality Gates must return PASS. 9/10 is a blocker, not a pass. |
75
+ | *"The mutation score is 78%, which is within rounding distance of 80%."* | **STRICTLY FORBIDDEN:** Mutation Score >= 80% is a non-negotiable hard floor. Surviving mutants must be killed. |
76
+ | *"Skill descriptions have 0.78 similarity, but they do different things."* | **STRICTLY FORBIDDEN:** Cosine similarity >= 0.75 causes LLM routing confusion. Refactor descriptions to differentiate triggers. |
77
+ | *"We can bypass the verification command since the author tested it locally."* | **STRICTLY FORBIDDEN:** Verification-before-completion requires fresh command output run directly in the current session. |
60
78
 
61
79
  ## Persona Enhancements (Adapted from wshobson/agents, MIT)
62
80
 
@@ -11,6 +11,7 @@ skills:
11
11
  - backend-load-and-stress-patterns
12
12
  tools:
13
13
  - tools/safety_firewall.py
14
+ - tools/reversible_sandbox.py
14
15
  - tools/matrix_sharder.py
15
16
  - tools/flaky_detector.py
16
17
  - tools/distill_log.py
@@ -18,6 +19,11 @@ tools:
18
19
  - tools/ci_healing_hook.py
19
20
  - tools/generate_allure_report.ps1
20
21
  - tools/generate_test_reports.ps1
22
+ - tools/generate_jmx_plan.py
23
+ - tools/jtl_analyzer.py
24
+ - tools/newman_analyzer.py
25
+ - tools/traffic_session_converter.py
26
+ - tools/db_sandbox.py
21
27
  ---
22
28
 
23
29
  # Test Execution Runner Agent
@@ -43,6 +49,16 @@ tools:
43
49
  - `tools/pinpoint_failure.py`: Fast 0.1s failure isolation from JUnit XML reports.
44
50
  - `tools/generate_allure_report.ps1`: Builds and serves interactive Allure test execution dashboards.
45
51
  - `tools/generate_test_reports.ps1`: Compiles consolidated JUnit/HTML execution reports.
52
+ - `tools/reversible_sandbox.py`: GoEx reversible teardown stack guaranteeing zero database pollution after test runs.
53
+
54
+ ## 🛑 Anti-Rationalization & Red Flag Guard (Addy Osmani Pattern)
55
+
56
+ | Agent Rationalization / Shortcut Attempt | Architectural Rebuttal & Invariant Enforcement |
57
+ |:---|:---|
58
+ | *"The test failed on CI due to environment lag, so I'll just re-run until it passes."* | **STRICTLY FORBIDDEN:** Flaky retry laundering hides defects. Quarantine via `tools/flaky_detector.py` or fix timing via smart wait. |
59
+ | *"I bypassed `safety_firewall.py` with `--force` because teardown takes too long."* | **STRICTLY FORBIDDEN:** Bypassing the firewall without approval risks destructive mutations on live/staging databases. |
60
+ | *"The teardown step failed so I skipped it; the data shouldn't hurt."* | **STRICTLY FORBIDDEN:** Orphan data causes subsequent run collisions. Use `tools/reversible_sandbox.py` for guaranteed rollback. |
61
+ | *"Dumping the entire 3000-line CLI log helps diagnose better."* | **STRICTLY FORBIDDEN:** Context bloat degrades agent reasoning. Always use `tools/distill_log.py` to mask raw observation logs. |
46
62
 
47
63
  ## Persona Enhancements (Adapted from wshobson/agents, MIT)
48
64
 
@@ -1,111 +1,31 @@
1
- ---
2
- trigger: always_on
3
- description: Context Engineering Protocol enforcing Observation Masking, Progressive Disclosure, and KV-Cache Friendly Ordering.
4
- ---
5
-
6
1
  # Context Engineering & Token Optimization Protocol
7
2
 
8
- *(Synthesized from `muratcankoylan/Agent-Skills-for-Context-Engineering`, `alexgreensh/token-optimizer`, and `obra/superpowers`)*
9
-
10
- This mandatory protocol governs how AI Agents manage context windows, tool outputs, and attention budgets across automated test suites.
11
-
12
- ---
13
-
14
- ## 1. Pillar 1: Observation Masking
15
-
16
- 1. **The Principle:**
17
- - Raw tool outputs (CLI execution logs, Gradle builds, browser console traces) contain 90% repetitive noise and low-signal tokens.
18
- - Dumping raw logs degrades the LLM's reasoning ("Context Rot" / "Lost-in-the-Middle").
19
-
20
- 2. **Actionable Rules:**
21
- - **Log Truncation & Summarization:** When executing CLI commands, never dump thousands of lines into the active conversation. Extract only:
22
- - The exact failing line number and exception name.
23
- - The test case identifier (`TC-xxx`).
24
- - Final execution status (PASS/FAIL).
25
- - **Pointer Masking:** Use structured references pointing to files on disk:
26
- `[Full raw log saved to file://<path>; 2,400 verbose lines omitted]`
27
-
28
- ---
29
-
30
- ## 2. Pillar 2: Progressive Disclosure
31
-
32
- 1. **The Principle:**
33
- - Never load large codebases or giant classes (over 500 lines) into context at once.
34
- - Load information in 3 progressive tiers:
35
-
36
- ```mermaid
37
- flowchart TD
38
- Tier1["<b>Tier 1: High-Level Index & Repo Map (< 150 lines)</b><br/>• Read tools/repo_map.txt or SKILL.md index<br/>• Understand 500+ method signatures using ~500 tokens"]
39
- Tier2["<b>Tier 2: Graph Semantic Scoping</b><br/>• Run graphify explain '<Class>' or test_impact.py<br/>• Scope only 1-hop dependent nodes (~500 tokens)"]
40
- Tier3["<b>Tier 3: Targeted Micro-Read</b><br/>• Read exactly the 20-50 lines of target method<br/>• Zero unnecessary surrounding lines"]
41
-
42
- Tier1 --> Tier2 --> Tier3
43
- ```
44
-
45
- 2. **Actionable Rules:**
46
- - Always inspect `tools/repo_map.txt` or query the Knowledge Graph (`graphify-out/graph.json`) before opening code files.
47
- - Use line-range parameters (`StartLine`, `EndLine`) when reading large Page Classes.
3
+ > **Mandatory Rule:** Governs context windows, tool outputs, and attention budgets across all agent sessions.
4
+ > Detailed architecture guide: [context_engineering_guide.md](file://.agents/skills/token-and-context-optimizer/references/context_engineering_guide.md).
48
5
 
49
6
  ---
50
7
 
51
- ## 3. Pillar 3: KV-Cache Friendly Ordering
52
-
53
- 1. **The Principle:**
54
- - Modern LLM inference engines cache Key-Value (KV) attention states for identical prompt prefixes.
55
- - Any dynamic mutation in the middle of a prompt destroys the cache breakpoint, forcing 100% full re-computation.
56
-
57
- 2. **Actionable Rules:**
58
- - **Static Prefix First:** Maintain system instructions, rules, and tool schemas completely immutable at the top.
59
- - **Append-Only Dynamic State:** Only append new test results, user queries, and tool observations at the bottom of the context sequence.
60
- - **Predictable Format:** Use the identical pre-flight confirmation header on every turn to maximize KV-cache hit rates (aiming for > 85% cache hit).
61
-
62
- ---
63
-
64
- ## 4. Pillar 4: Scoped Context & Compaction Anchoring Protocol
65
-
66
- 1. **The Principle:**
67
- - Antigravity automatically triggers **Context Compaction** when conversation context approaches the ~135k tokens safety threshold to summarize session history and avoid out-of-memory crashes.
68
- - Without deterministic disk anchoring, automated compaction can cause lossy compression of fine-grained execution state (exact failing lines, temporary IDs, active watchpoints).
69
- - Furthermore, unbounded parallel sub-agents can collide on shared files, browser sessions, or database test data.
70
-
71
- 2. **Actionable Rules:**
72
- - **Compaction State Anchoring:** All critical state (test execution status, defect registers, active test IDs) must be persisted to disk in `PROJECT_STATE.md` or `.project_state.properties`. When compaction fires, the agent re-anchors immediately by inspecting the disk state with zero memory degradation.
73
- - **Workspace Isolation (`Workspace: 'share'`):** When launching sub-agents via `invoke_subagent`, always use isolated worktrees (`share` or `branch`) to prevent git index conflicts and dirty tree collisions.
74
- - **Zero Context Contagion:** Sub-agent tool executions (e.g., 2,000 lines of CLI stdout) remain strictly sandboxed within the sub-agent's context. Sub-agents must return only distilled 3-5 line summaries to the Lead Orchestrator.
75
- - **Data Partitioning by Agent ID:** Every sub-agent must append its agent identifier to dynamic test data (`uniqueCode = "AUTO_" + System.currentTimeMillis() + "_SUB" + agentId`) and use dedicated user sessions to prevent web session evictions.
76
-
77
- ---
78
-
79
- ## 5. Pillar 5: Semantic Context Distillation (Pure Signal, Zero Noise)
80
-
81
- 1. **The Principle:**
82
- - LLM reasoning degrades as context length increases ("Lost in the Middle"). Dumping raw HTML DOM or 1,000-line logs degrades reasoning ability.
83
- - All sensory inputs must pass through deterministic filters before reaching the LLM's attention heads (aiming for 300–500 tokens of 100% pure signal).
84
-
85
- 2. **Actionable Rules:**
86
- - **CLI Logs (`tools/distill_log.py`):** Automatically truncate 95% of verbose lines, preserving only the direct failing line, root cause exception, and the last 3 HTTP requests.
87
- - **DOM Purifier (`qa.getCompactAOM` in `browser_helpers.js`):** **Strictly forbidden to send raw HTML.** Use `qa.getCompactAOM(maxDepth=3)` to extract only interactive nodes with Role, Name, State, and TestId.
88
- - **Framework Independence (`tools/universal_ir.py`):** Author and reason over clean Universal IR representation before emitting framework-specific boilerplate (Groovy, TS, Java).
89
-
90
-
91
- ---
8
+ ## 1. Observation Masking & Log Truncation
9
+ - Never dump thousands of lines of raw tool outputs (CLI, build logs, browser traces) into the chat.
10
+ - Extract strictly: failing line number, exception name, test ID (`TC-xxx`), and status.
11
+ - Mask verbose logs with pointer references: `[Full raw log saved to file://<path>; verbose lines omitted]`.
92
12
 
93
- ## 6. Pillar 6: The Elephant-Goldfish Memory Protocol (Zero-Contamination Swarm)
13
+ ## 2. Progressive Disclosure & Micro-Reads
14
+ - Never read large files (> 150 lines) into context at once.
15
+ - Tier 1: Check `tools/repo_map.txt` for class signatures (~500 tokens).
16
+ - Tier 2: Check dependency blast radius via `tools/test_impact.py`.
17
+ - Tier 3: Micro-read targeted 20–50 lines using `StartLine` and `EndLine`.
94
18
 
95
- *(Synthesized from Google's Elephant-Goldfish Model by Dave Rensin)*
19
+ ## 3. KV-Cache Optimization & Static Prefix
20
+ - Keep system instructions and rule headers static and immutable at the top.
21
+ - Append new observations strictly at the bottom. Use identical status badges to maintain > 85% cache hit rates.
96
22
 
97
- 1. **The Principle:**
98
- - Single-agent long context inevitably breeds **Confirmation Bias** and **Context Contamination**: when the same context window designs an architecture, drafts a spec, and evaluates its own plan, it glosses over unstated assumptions and hallucinates completeness.
99
- - True engineering rigor requires decoupling deep-context coordination (**The Elephant**) from stateless, adversarial verification (**The Goldfish**).
23
+ ## 4. Compaction Anchoring & Subagent Isolation
24
+ - Persist active test registers, IDs, and state to `PROJECT_STATE.md` so automated context compaction never causes state loss.
25
+ - Always isolate subagents (`Workspace: 'share'`); subagents must return only 3–5 line distilled summaries.
26
+ - Partition test data with dynamic agent IDs (`uniqueCode = "AUTO_" + time + "_SUB" + id`).
100
27
 
101
- 2. **Actionable Rules:**
102
- - **The Elephant (Stateful Orchestrator):**
103
- - Narrows problem boundaries, gathers user intent, and drafts architectural specs / Test Matrices (`docs/specs/*.md`).
104
- - Maintains global long-term project context via `PROJECT_STATE.md`.
105
- - **Strict Invariant:** The Elephant is prohibited from generating automation test scripts or asserting its own test design validity during the initial design phase.
106
- - **The Goldfish (Stateless Subagent Swarm):**
107
- - Spun up in a fresh, isolated subagent context (`Workspace: 'share'`) with **ZERO conversation history**.
108
- - Evaluates solely the cold Markdown artifact and source code on disk using structured contracts (e.g., `tools/goldfish_review.py`).
109
- - If the Goldfish cannot execute or understand the specification without guessing, the specification is rejected back to the Elephant.
110
- - **Air-Gap Data Contract:**
111
- - Data exchanged between stages must pass via deterministic files on disk (JSON Data Contracts, Test Matrices, JUnit XML), never via raw prompt inheritance.
28
+ ## 5. Semantic Signal Distillation
29
+ - **Forbidden Raw HTML:** Never send raw HTML trees into context. Use `qa.getCompactAOM()` (< 500 tokens).
30
+ - **Universal IR First:** Reason over clean Universal IR (`tools/universal_ir.py`) before generating Groovy/TS/Java boilerplate.
31
+ - **Elephant-Goldfish Swarm:** Stateful Orchestrator writes specs to disk; stateless verification subagents audit cold files with zero context contagion.
@@ -31,7 +31,7 @@ AI Agents execute the clean standard Git workflow within the target project:
31
31
  ### Step 1: Pre-Push Verification (DoD Gate)
32
32
  Run the project's quality verification gate or test suite before committing:
33
33
  ```bash
34
- # Example: 9 Quality Gates verification or project test runner
34
+ # Example: 10 Quality Gates verification or project test runner
35
35
  python tools/verify_all.py # or npm test / npx playwright test
36
36
  ```
37
37
  *Never push unverified code or broken tests.*
@@ -5,6 +5,8 @@ description: Consult the graphify knowledge graph at graphify-out/ for codebase
5
5
 
6
6
  ## graphify
7
7
 
8
+ > ⚠️ **Hub vs Spoke Boundary:** Graphify directives apply strictly to target client projects containing a graphify-out/ directory. Per Anti-Pattern Blacklist Rule 7, Graphify CLI commands must never be executed on the Synapse Hub workspace.
9
+
8
10
  This project has a graphify knowledge graph at graphify-out/.
9
11
 
10
12
  Rules:
@@ -8,17 +8,17 @@ description: Mandatory rules for Autonomous Multi-Agent Swarm, Pure Headless Pla
8
8
  Mandatory for all test automation tasks in enterprise web test suites:
9
9
 
10
10
  1. **Autonomous Swarm Orchestration:**
11
- - Main AI acts as **Lead QA Orchestrator**, executing directions from **Project Lead / QA Director** and coordinating 5 specialized subagents:
12
- * **Live Interaction Explorer:** Probe live DOM/AOM via Playwright MCP (`browser_run_code_unsafe`).
13
- * **Automation Code Crafter:** Generate Page Classes and Groovy scripts adhering to Clean POM Flat Architecture.
14
- * **Test Execution Runner:** Dispatch headless Katalon tests via CLI.
15
- * **Quality Gatekeeper & Failure Analyst:** Enforce 100% UTF-8 No BOM, block bypass logic, analyze failures via `FAILED_*.png` and Allure reports.
16
- * **Technical Documentation Specialist:** Translate code to business workflows, generate Mermaid diagrams.
11
+ - Main AI acts as **Lead QA Orchestrator**, executing directions from **Project Lead / QA Director** and coordinating 5 specialized subagents in a 5-Stage FSM:
12
+ * **Live Interaction Explorer (live-explorer):** Probe live DOM/AOM via Playwright MCP (rowser_run_code_unsafe).
13
+ * **Automation Code Crafter (pom-crafter):** Generate Page Classes and test scripts adhering to Clean POM Flat Architecture.
14
+ * **Test Execution Runner ( est-runner):** Dispatch headless automated tests via CLI (Playwright, Katalon, Gradle, Pytest).
15
+ * **Failure Analyst ( ailure-analyst):** Diagnose test crashes via logs, FAILED_*.png, and Allure reports; coordinate healing.
16
+ * **Quality Gatekeeper (quality-gatekeeper):** Air-gap sentinel enforcing 10 Quality Gates DoD, 100% UTF-8 No BOM, and zero bypass logic.
17
17
  2. **Anti-Redundancy Protocol:**
18
- - Single sign-on via Zero-Second Auth (`session.json`); never re-enter login forms.
19
- - Live Explorer emits JSON Data Contract -> Code Crafter consumes to codify; Documentation Specialist consumes to chart workflows. Zero redundant DOM rescanning.
18
+ - Single sign-on via Zero-Second Auth (session.json); never re-enter login forms.
19
+ - Live Explorer emits JSON Data Contract -> Code Crafter consumes to codify; Orchestrator charts workflows. Zero redundant DOM rescanning.
20
20
  - Targeted re-tests only on failed cases; never re-run entire batches for single-case bug fixes.
21
- - Quality Gatekeeper conducts deep RCA only on actual FAILED cases; immediately accept PASSED runs.
21
+ - Failure Analyst conducts deep RCA only on actual FAILED cases; immediately accept PASSED runs.
22
22
  3. **Playwright Live Interaction & Mandatory Headless:**
23
23
  - All flow discovery, live probing, and bug fixing **MUST RUN IN PURE HEADLESS MODE**.
24
24
  - Do not open browser GUI windows to avoid stealing user desktop focus.
@@ -1,132 +1,43 @@
1
- # Mobile Automation Standards & Appium Rules (Enterprise Standard)
2
-
3
- > **Scope:** Applies to all Mobile Test Automation tasks using Appium, UIAutomator2 (Android), and XCUITest (iOS).
4
- > **Objective:** Deliver resilient, independent, flake-free mobile suites supporting parallel multi-device execution.
5
-
6
1
  ---
7
-
8
- ## 1. Native Locator Priority Hierarchy
9
-
10
- When interacting with Native or Hybrid mobile applications, agents **MUST** strictly adhere to the following locator priority order:
11
-
12
- ```mermaid
13
- flowchart TD
14
- L1["<b>1. Accessibility ID / Content-Desc</b><br/>• Cross-platform (iOS & Android)<br/>• Most stable, independent of layout"]
15
- L2["<b>2. Resource-ID (Android Native)</b><br/>• Example: com.app.package:id/btn_login"]
16
- L3["<b>3. iOS Predicate String / Class Chain (iOS Native)</b><br/>• Native XCUITest performance"]
17
- L4["<b>4. Dynamic XPath (Last Resort)</b><br/>• Relative XPath with text/attributes only<br/>• Absolute structural XPath is FORBIDDEN"]
18
-
19
- L1 --> L2 --> L3 --> L4
20
- ```
21
-
22
- ### Standard Implementation Examples:
23
- ```java
24
- // 1. Accessibility ID (Top priority)
25
- driver.findElement(AppiumBy.accessibilityId("btn_login"));
26
-
27
- // 2. Resource-ID Android (Android Native priority)
28
- driver.findElement(AppiumBy.id("com.enterprise.app:id/input_username"));
29
-
30
- // 3. iOS Predicate String (iOS Native priority)
31
- driver.findElement(AppiumBy.iOSNsPredicateString("label == 'Sign In' AND visible == 1"));
32
-
33
- // 4. iOS Class Chain
34
- driver.findElement(AppiumBy.iOSClassChain("**/XCUIElementTypeButton[`label == 'Submit'`]"));
35
- ```
36
-
2
+ trigger: on_demand
3
+ description: Mobile Automation standards, Screen Object Model (SOM), and Appium driver invariants for iOS/Android suites.
4
+ status: upcoming_extension
37
5
  ---
38
6
 
39
- ## 2. Strict Anti-Patterns & Prohibitions
7
+ # Mobile Automation Standards & Appium Rules (Enterprise Extension)
40
8
 
41
- - ❌ **FORBIDDEN: Absolute XPath based on DOM tree hierarchy:**
42
- ```java
43
- // STRICTLY FORBIDDEN:
44
- driver.findElement(By.xpath("//android.widget.FrameLayout[1]/android.widget.LinearLayout[2]/android.widget.Button[1]"));
45
- ```
46
- - ❌ **FORBIDDEN: Static sleeps (`Thread.sleep()`):** Introduces pipeline latency and flaky synchronization.
47
- - ❌ **FORBIDDEN: Interacting with off-screen elements without scrolling:** Always scroll into view first.
48
- - ❌ **FORBIDDEN: Hardcoded device identifiers:** UDID, Device Name, Platform Version must be dynamic via environment variables or profile configurations.
9
+ > **Status:** Upcoming extension module for Appium / Mobile SOM architectures. Activated when mobile drivers or native iOS/Android test suites are mounted.
10
+ > **Scope:** Applies to Mobile Automation using Appium, UIAutomator2 (Android), and XCUITest (iOS).
11
+ > **Objective:** Deliver resilient, independent, flake-free mobile suites supporting parallel multi-device execution.
49
12
 
50
13
  ---
51
14
 
52
- ## 3. Screen Object Model (SOM) Architecture
53
-
54
- Following the Page Object Model design pattern, mobile test code adheres to **Screen Object Model**:
55
- - Screen class names must end with the `Screen` suffix (e.g., `LoginScreen.java`, `HomeScreen.java`, `CartScreen.java`).
56
- - Extend `BaseScreen` providing shared AppiumDriver instances and gesture helpers.
57
- - Encapsulate locators within Screen classes; test scripts call business actions only.
58
-
59
- ```java
60
- public class LoginScreen extends BaseScreen {
61
- private final By btnLogin = AppiumBy.accessibilityId("btn_submit");
62
- private final By txtEmail = AppiumBy.accessibilityId("input_email");
63
-
64
- public LoginScreen(AppiumDriver driver) {
65
- super(driver);
66
- }
67
-
68
- public HomeScreen loginWithValidCredentials(String email, String password) {
69
- waitForElementVisible(txtEmail).sendKeys(email);
70
- // ...
71
- return new HomeScreen(driver);
72
- }
73
- }
74
- ```
15
+ ## 1. Native Locator Priority Hierarchy
16
+ 1. **Accessibility ID / Content-Desc** (Top priority, cross-platform): `driver.findElement(AppiumBy.accessibilityId("btn_login"))`
17
+ 2. **Resource-ID (Android Native):** `driver.findElement(AppiumBy.id("com.app:id/username"))`
18
+ 3. **iOS Predicate String (iOS Native):** `driver.findElement(AppiumBy.iOSNsPredicateString("label == 'Sign In' AND visible == 1"))`
19
+ 4. **iOS Class Chain:** `driver.findElement(AppiumBy.iOSClassChain("**/XCUIElementTypeButton[`label == 'Submit'`]"))`
20
+ 5. **Dynamic XPath (Last Resort):** Relative XPath with attributes only. Absolute structural XPath is **FORBIDDEN**.
75
21
 
76
22
  ---
77
23
 
78
- ## 4. Synchronization & Smart Mobile Waits
79
-
80
- - Always use `WebDriverWait` with explicit `Duration`:
81
- ```java
82
- WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(15));
83
- wait.until(ExpectedConditions.visibilityOfElementLocated(AppiumBy.accessibilityId("welcome_banner")));
84
- ```
85
- - Smart scroll into view:
86
- ```java
87
- // Android UIAutomator Scrollable
88
- driver.findElement(AppiumBy.androidUIAutomator(
89
- "new UiScrollable(new UiSelector().scrollable(true))" +
90
- ".scrollIntoView(new UiSelector().text(\"Confirm\"))"
91
- ));
92
- ```
24
+ ## 2. Strict Anti-Patterns & Prohibitions
25
+ - ❌ **FORBIDDEN:** Absolute hierarchy XPath (e.g., `//android.widget.FrameLayout[1]/.../Button[1]`).
26
+ - ❌ **FORBIDDEN:** Static delays (`Thread.sleep()`).
27
+ - ❌ **FORBIDDEN:** Interacting with off-screen elements without scrolling into view first.
28
+ - ❌ **FORBIDDEN:** Hardcoded device identifiers (UDID, device name must come from environment/profiles).
93
29
 
94
30
  ---
95
31
 
96
- ## 5. Mobile Lifecycle & Device Gestures
97
-
98
- 1. **Auto-Grant Permissions:**
99
- - Configure capabilities to auto-grant system permissions:
100
- `capabilities.setCapability("autoGrantPermissions", true);` (Android) or `"permissions": "{\"com.app\": {\"camera\": \"yes\"}}"` (iOS).
101
- 2. **Screen Orientation:**
102
- - Verify layout adaptability in both Portrait and Landscape when supported by the application.
103
- 3. **App Backgrounding:**
104
- - Test application resilience across background/foreground transitions:
105
- `driver.runAppInBackground(Duration.ofSeconds(5));`
106
- 4. **Virtual Keyboard Handling:**
107
- - Always dismiss virtual keyboards (`driver.hideKeyboard()`) after input to prevent occluding action buttons.
32
+ ## 3. Screen Object Model (SOM) & Synchronization
33
+ - Screen classes end with `Screen` suffix (e.g., `LoginScreen.java`) extending `BaseScreen`.
34
+ - Encapsulate locators in Screen classes; test scripts call business actions only.
35
+ - **Smart Waits:** Always use `WebDriverWait` with explicit `Duration.ofSeconds(N)`.
36
+ - **Smart Scroll:** Use `UiScrollable(...).scrollIntoView(...)` or native iOS scroll gestures.
108
37
 
109
38
  ---
110
39
 
111
- ## 6. Driver Architecture & Image-Based Matching
112
-
113
- > *Borrowed and adapted from the Appium driver/plugin architecture concepts (Apache-2.0, appium/appium).*
114
-
115
- 1. **Driver isolation** — each platform driver (UIAutomator2, XCUITest)
116
- encapsulates its own locator translation and gesture mapping; Screen Object
117
- classes must never branch on driver type outside the driver layer. A
118
- `*Screen` class speaks intent ("tap primary action"), the driver layer
119
- speaks mechanics.
120
- 2. **Capabilities belong in profiles, not scripts** — device/OS/app
121
- capabilities live in versioned capability profiles; test classes receive a
122
- ready session. Hardcoding `platformVersion`/`deviceName` inside scripts is a
123
- prohibited anti-pattern (see Section 2).
124
- 3. **Image-based matching is a last-resort locator** — for canvas/maps/WebView
125
- hybrids where the accessibility tree is empty, an image-reference plugin
126
- (template match against a committed reference screenshot with a similarity
127
- threshold, e.g. ≥ 0.9) may resolve elements. It is slower and flakier than
128
- `AccessibilityID`/`ResourceID` — use only after the locator hierarchy in
129
- Section 1 is exhausted, and always commit the reference image next to the
130
- Screen class.
131
- 4. **Match the session teardown to the driver lifecycle** — quit sessions
132
- explicitly; orphaned driver processes leak devices in the grid.
40
+ ## 4. Mobile Lifecycle & Driver Invariants
41
+ - **Permissions:** Auto-grant system permissions via capabilities (`autoGrantPermissions: true`).
42
+ - **Resilience:** Validate backgrounding (`driver.runAppInBackground(...)`) and hide virtual keyboard before actions.
43
+ - **Driver Isolation:** Screen classes speak intent; platform drivers (UIAutomator2/XCUITest) encapsulate mechanics. Capabilities reside in profiles, never in scripts. Always explicitly quit sessions.