# vijayarjun7/ai-qe-agent architecture

> Architecture diagram of the GitHub repository vijayarjun7/ai-qe-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vijayarjun7/ai-qe-agent
- Repository: https://github.com/vijayarjun7/ai-qe-agent

## Overview

1. **What this repository is**
   - This is a TypeScript-based AI quality engineering pipeline, not an application under test.
   - Its main job is to generate, review, run, and heal Playwright test assets using Claude, plus optionally generate a demo app to test against.

2. **Top-level execution boundary**
   - The entry point is the CLI in `src/cli/index.ts`.
   - The CLI dispatches into the orchestration layer in `src/orchestrator/QEPipeline.ts`, which sequences the multi-step QE workflow.
   - Most features are exposed as commands that operate on files and test artifacts rather than serving a runtime API.

3. **AI agent subsystem**
   - `src/agent/` contains the core functional units:
     - `AIDevAgent` generates the demo app.
     - `ManualTestGenerator` produces structured manual test suites from requirements.
     - `QAReviewAgent` reviews manual tests and automation outputs.
     - `AutomationScriptGenerator` creates Playwright UI/API/mobile specs.
     - `AIMobileTester` expands coverage across device profiles and scenarios.
     - `SelfHealingAgent` repairs broken selectors from DOM analysis.
     - `ChangeDetector` watches for file changes and classifies them.
     - `ReviewQueueManager` writes review tickets for requirement changes.
     - `ReportGenerator` summarizes execution into reports.
   - `AITestGenerator`, `APITester`, and `PageAnalyzer` support URL/page-driven generation flows.

4. **AI and browser integration points**
   - `src/utils/ClaudeClient.ts` is the single external AI boundary for Anthropic Claude calls.
   - Playwright is the browser/runtime boundary for page analysis, UI automation, mobile emulation, and report generation.
   - The repo therefore has two major external dependencies: Claude for reasoning/generation and Playwright for execution/inspection.

5. **Primary data flow through the pipeline**
   - Requirements or page state are ingested first.
   - Manual tests are generated into structured JSON/Markdown artifacts.
   - QA review consumes the manual test suite, scores it, and flags or approves cases.
   - Approved test cases are turned into automation scripts.
   - Those scripts are executed by Playwright, then summarized into reports.
   - This is a file-driven pipeline: each stage writes artifacts that become input to the next stage.

6. **Change management and self-healing path**
   - `ChangeDetector` watches the generated demo app and classifies changes as locator, requirement, logic, style, or unknown.
   - Locator changes go to `SelfHealingAgent`, which rewrites affected test files using DOM evidence.
   - Requirement changes go to `ReviewQueueManager`, which creates human-review tickets under `tests/review-queue/`.
   - This creates a clear split between safe auto-repair and changes that require manual approval.

7. **Generated-demo-app boundary**
   - The repository includes a generated target application under `demo-app/`, separated from the QE engine itself.
   - The demo app is a full-stack Task Manager with a React/Vite frontend and an Express/SQLite/JWT backend, running on separate ports.
   - The QE pipeline uses this app as the canonical target for generation, review, automation, and healing demos.

8. **Test artifact layout**
   - `tests/examples/` contains hand-authored reference specs.
   - `tests/generated/` is the output target for AI-generated Playwright scripts.
   - `tests/manual/` stores generated manual test suite JSON/MD artifacts.
   - `tests/reviews/` stores review reports.
   - `samples/` mirrors real pipeline outputs for documentation and validation.
   - These directories define the repo’s artifact contract and make the workflow easy to diagram.

9. **Reporting and observability**
   - Playwright outputs are collected into `reports/` as HTML, JSON, and JUnit XML.
   - `src/utils/Logger.ts` provides structured logging for the pipeline stages.
   - Reporting is a terminal stage, but it is also used as a feedback loop for failures, screenshots, and videos.

10. **Configuration and runtime**
   - The repo runs as a Node.js/TypeScript project with `tsconfig.json` and `package.json` as the main build/runtime descriptors.
   - Environment variables control model selection, base URLs, and output directories, especially `ANTHROPIC_API_KEY`, `BASE_URL`, `API_BASE_URL`, and `GENERATED_TESTS_DIR`.
   - `playwright.config.ts` defines the multi-project execution matrix for desktop, mobile, and API-oriented runs.

11. **Important architectural pattern**
   - The system is strongly decoupled by artifact boundaries: each agent reads and writes files rather than sharing hidden in-memory state.
   - That makes the pipeline reproducible, inspectable, and easy to restart at any stage.
   - It also means the repo’s architecture diagram should emphasize file inputs/outputs between stages more than service-to-service calls.

12. **Legacy/compatibility code**
   - The nested `src/core/src/core/` path suggests an older or compatibility layer that mirrors some core functionality such as `APITester` and `PageAnalyzer`.
   - For an architecture diagram, treat this as supporting code rather than the primary flow unless you need to show legacy/internal reuse paths.

13. **Best way to draw the system**
   - Show the CLI as the entry point.
   - Show Claude and Playwright as two external engines underneath the agent layer.
   - Show a left-to-right pipeline: requirements/demo-app input → manual tests → QA review → automation generation → execution/reporting.
   - Add a side loop for change detection and self-healing, with a separate branch to the review queue for requirement deltas.

Main entry points: [`src/orchestrator/QEPipeline.ts`](https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/orchestrator/QEPipeline.ts) (QE Pipeline), [`src/agent/PageAnalyzer.ts`](https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/PageAnalyzer.ts) (Page Analyzer), [`src/agent/AutomationScriptGenerator.ts`](https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/AutomationScriptGenerator.ts) (Automation), [`src/utils/ClaudeClient.ts`](https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/utils/ClaudeClient.ts) (Claude)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry"]
  node_src_cli_index["CLI<br/>entrypoint<br/>[index.ts]"]
  node_src_orchestrator_qepipeline["QE Pipeline<br/>orchestrator<br/>[QEPipeline.ts]"]
end

subgraph group_agents["Agents"]
  node_aid_ev_agent["Dev Agent<br/>demo-app-generator<br/>[AIDevAgent.ts]"]
  node_manual_test_generator["Manual Tests<br/>test-spec-generator"]
  node_qa_review_agent["QA Review<br/>review-agent<br/>[QAReviewAgent.ts]"]
  node_automation_script_generator["Automation<br/>playwright-generator"]
  node_ai_mobile_tester["Mobile Tests<br/>coverage-expander<br/>[AIMobileTester.ts]"]
  node_api_tester["API Tester<br/>api-flow<br/>[APITester.ts]"]
  node_page_analyzer["Page Analyzer<br/>dom-analyzer<br/>[PageAnalyzer.ts]"]
  node_aitest_generator["Test Generator<br/>test-flow<br/>[AITestGenerator.ts]"]
  node_self_healing_agent["Self Heal<br/>repair-agent"]
  node_change_detector["Change Detector<br/>watcher<br/>[ChangeDetector.ts]"]
  node_review_queue_manager["Review Queue<br/>change-router"]
  node_report_generator["Reports<br/>reporting<br/>[ReportGenerator.ts]"]
end

subgraph group_engines["Engines"]
  node_claude_client(("Claude<br/>llm-boundary<br/>[ClaudeClient.ts]"))
  node_playwright_config(("Playwright<br/>browser-runtime"))
end

subgraph group_artifacts["Artifacts"]
  node_samples_manual["Sample Manual<br/>artifact-sample"]
  node_samples_generated["Sample Auto<br/>artifact-sample"]
  node_samples_reviews["Sample Reviews<br/>artifact-sample"]
end

subgraph group_support["Support"]
  node_logger["Logger<br/>[Logger.ts]"]
  node_file_utils["Files<br/>[FileUtils.ts]"]
  node_core_api_tester["Core API<br/>legacy-support<br/>[APITester.ts]"]
  node_core_page_analyzer["Core Page<br/>legacy-support<br/>[PageAnalyzer.ts]"]
end

node_src_cli_index -->|"dispatches"| node_src_orchestrator_qepipeline
node_src_orchestrator_qepipeline -->|"demo app"| node_aid_ev_agent
node_src_orchestrator_qepipeline -->|"requirements"| node_manual_test_generator
node_manual_test_generator -->|"prompting"| node_claude_client
node_manual_test_generator -->|"writes"| node_samples_manual
node_src_orchestrator_qepipeline -->|"review"| node_qa_review_agent
node_qa_review_agent -->|"scoring"| node_claude_client
node_qa_review_agent -->|"writes"| node_samples_reviews
node_src_orchestrator_qepipeline -->|"automation"| node_automation_script_generator
node_automation_script_generator -->|"generation"| node_claude_client
node_automation_script_generator -->|"targets"| node_playwright_config
node_automation_script_generator -->|"writes"| node_samples_generated
node_src_orchestrator_qepipeline -->|"mobile coverage"| node_ai_mobile_tester
node_ai_mobile_tester -->|"executes"| node_playwright_config
node_src_orchestrator_qepipeline -->|"api flow"| node_api_tester
node_api_tester -->|"executes"| node_playwright_config
node_src_orchestrator_qepipeline -->|"inspect"| node_page_analyzer
node_page_analyzer -->|"inspects"| node_playwright_config
node_src_orchestrator_qepipeline -->|"assist"| node_aitest_generator
node_aitest_generator -->|"generation"| node_claude_client
node_aitest_generator -->|"context"| node_page_analyzer
node_src_orchestrator_qepipeline -->|"watch"| node_change_detector
node_change_detector -->|"locator drift"| node_self_healing_agent
node_self_healing_agent -->|"dom evidence"| node_page_analyzer
node_self_healing_agent -->|"rewrites"| node_file_utils
node_change_detector -->|"requirements drift"| node_review_queue_manager
node_review_queue_manager -->|"writes queue"| node_file_utils
node_src_orchestrator_qepipeline -->|"summarize"| node_report_generator
node_report_generator -->|"records"| node_logger
node_report_generator -->|"writes"| node_file_utils
node_src_orchestrator_qepipeline -->|"logs"| node_logger
node_src_orchestrator_qepipeline -->|"artifacts"| node_file_utils
node_core_api_tester -.->|"legacy copy"| node_api_tester
node_core_page_analyzer -.->|"legacy copy"| node_page_analyzer

click node_src_cli_index "https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/cli/index.ts"
click node_src_orchestrator_qepipeline "https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/orchestrator/QEPipeline.ts"
click node_claude_client "https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/utils/ClaudeClient.ts"
click node_playwright_config "https://github.com/vijayarjun7/ai-qe-agent/blob/main/playwright.config.ts"
click node_logger "https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/utils/Logger.ts"
click node_file_utils "https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/utils/FileUtils.ts"
click node_aid_ev_agent "https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/AIDevAgent.ts"
click node_manual_test_generator "https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/ManualTestGenerator.ts"
click node_qa_review_agent "https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/QAReviewAgent.ts"
click node_automation_script_generator "https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/AutomationScriptGenerator.ts"
click node_ai_mobile_tester "https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/AIMobileTester.ts"
click node_api_tester "https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/APITester.ts"
click node_page_analyzer "https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/PageAnalyzer.ts"
click node_aitest_generator "https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/AITestGenerator.ts"
click node_self_healing_agent "https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/SelfHealingAgent.ts"
click node_change_detector "https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/ChangeDetector.ts"
click node_review_queue_manager "https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/ReviewQueueManager.ts"
click node_report_generator "https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/ReportGenerator.ts"
click node_core_api_tester "https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/core/src/core/APITester.ts"
click node_core_page_analyzer "https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/core/src/core/PageAnalyzer.ts"
click node_samples_manual "https://github.com/vijayarjun7/ai-qe-agent/blob/main/samples/manual-tests/sample-manual-test-suite.json"
click node_samples_generated "https://github.com/vijayarjun7/ai-qe-agent/blob/main/samples/generated-tests/automation-bundle.json"
click node_samples_reviews "https://github.com/vijayarjun7/ai-qe-agent/blob/main/samples/qa-reviews/sample-qa-review-report.json"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_src_cli_index,node_src_orchestrator_qepipeline toneBlue
class node_aid_ev_agent,node_manual_test_generator,node_qa_review_agent,node_automation_script_generator,node_ai_mobile_tester,node_api_tester,node_page_analyzer,node_aitest_generator,node_self_healing_agent,node_change_detector,node_review_queue_manager,node_report_generator toneAmber
class node_claude_client,node_playwright_config toneMint
class node_samples_manual,node_samples_generated,node_samples_reviews toneRose
class node_logger,node_file_utils,node_core_api_tester,node_core_page_analyzer toneIndigo
```

## Components

### Entry

CLI entry and orchestration boundary

- [CLI](https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/cli/index.ts): entrypoint · Command-line entry that dispatches QE workflows · `src/cli/index.ts`
- [QE Pipeline](https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/orchestrator/QEPipeline.ts): orchestrator · Sequences the end-to-end quality engineering workflow · `src/orchestrator/QEPipeline.ts`

### Agents

Core AI and pipeline workers

- [Dev Agent](https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/AIDevAgent.ts): demo-app-generator · Generates the demo target application used by the QE pipeline · `src/agent/AIDevAgent.ts`
- [Manual Tests](https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/ManualTestGenerator.ts): test-spec-generator · Creates structured manual test suites from requirements · `src/agent/ManualTestGenerator.ts`
- [QA Review](https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/QAReviewAgent.ts): review-agent · Scores and approves manual tests and automation outputs · `src/agent/QAReviewAgent.ts`
- [Automation](https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/AutomationScriptGenerator.ts): playwright-generator · Produces Playwright UI, API, and mobile specs · `src/agent/AutomationScriptGenerator.ts`
- [Mobile Tests](https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/AIMobileTester.ts): coverage-expander · Expands coverage across device profiles and scenarios · `src/agent/AIMobileTester.ts`
- [API Tester](https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/APITester.ts): api-flow · URL- and endpoint-driven API test generation flow · `src/agent/APITester.ts`
- [Page Analyzer](https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/PageAnalyzer.ts): dom-analyzer · Inspects page state to support generation and healing · `src/agent/PageAnalyzer.ts`
- [Test Generator](https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/AITestGenerator.ts): test-flow · Support flow for generating tests from page or URL context · `src/agent/AITestGenerator.ts`
- [Self Heal](https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/SelfHealingAgent.ts): repair-agent · Repairs broken selectors from DOM evidence · `src/agent/SelfHealingAgent.ts`
- [Change Detector](https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/ChangeDetector.ts): watcher · Classifies file changes as locator, requirement, logic, style, or unknown · `src/agent/ChangeDetector.ts`
- [Review Queue](https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/ReviewQueueManager.ts): change-router · Routes requirement changes into human-review artifacts · `src/agent/ReviewQueueManager.ts`
- [Reports](https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/agent/ReportGenerator.ts): reporting · Summarizes execution into HTML, JSON, and JUnit outputs · `src/agent/ReportGenerator.ts`

### Engines

External reasoning and browser runtimes

- [Claude](https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/utils/ClaudeClient.ts): llm-boundary · Single Anthropic Claude integration used by generation and review agents · `src/utils/ClaudeClient.ts`
- [Playwright](https://github.com/vijayarjun7/ai-qe-agent/blob/main/playwright.config.ts): browser-runtime · Execution and inspection runtime for UI, mobile, and API-oriented runs · `playwright.config.ts`

### Artifacts

File-driven outputs and samples

- [Sample Manual](https://github.com/vijayarjun7/ai-qe-agent/blob/main/samples/manual-tests/sample-manual-test-suite.json): artifact-sample · Reference manual test suite artifacts · `samples/manual-tests/sample-manual-test-suite.json`
- [Sample Auto](https://github.com/vijayarjun7/ai-qe-agent/blob/main/samples/generated-tests/automation-bundle.json): artifact-sample · Reference generated Playwright artifacts · `samples/generated-tests/automation-bundle.json`
- [Sample Reviews](https://github.com/vijayarjun7/ai-qe-agent/blob/main/samples/qa-reviews/sample-qa-review-report.json): artifact-sample · Reference QA review reports · `samples/qa-reviews/sample-qa-review-report.json`

### Support

Shared utilities and compatibility code

- [Logger](https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/utils/Logger.ts): utility · Structured logging for pipeline stages and failures · `src/utils/Logger.ts`
- [Files](https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/utils/FileUtils.ts): utility · File and artifact IO helpers · `src/utils/FileUtils.ts`
- [Core API](https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/core/src/core/APITester.ts): legacy-support · Compatibility copy of API tester logic · `src/core/src/core/APITester.ts`
- [Core Page](https://github.com/vijayarjun7/ai-qe-agent/blob/main/src/core/src/core/PageAnalyzer.ts): legacy-support · Compatibility copy of page analyzer logic · `src/core/src/core/PageAnalyzer.ts`

## Connections

- CLI → QE Pipeline: dispatches · CLI hands execution to the orchestration layer
- QE Pipeline → Dev Agent: demo app · Can generate the target application used for validation
- QE Pipeline → Manual Tests: requirements · Starts manual test generation from requirements or context
- Manual Tests → Claude: prompting · Uses Claude to synthesize structured test cases
- Manual Tests → Sample Manual: writes · Emits manual test suite artifacts
- QE Pipeline → QA Review: review · Passes generated manual tests into QA review
- QA Review → Claude: scoring · Uses Claude to review and score test quality
- QA Review → Sample Reviews: writes · Produces review reports as artifacts
- QE Pipeline → Automation: automation · Converts approved tests into Playwright specs
- Automation → Claude: generation · Uses Claude to draft automation scripts
- Automation → Playwright: targets · Produces specs aligned to the Playwright execution matrix
- Automation → Sample Auto: writes · Emits generated automation bundles and specs
- QE Pipeline → Mobile Tests: mobile coverage · Expands coverage across mobile scenarios and profiles
- Mobile Tests → Playwright: executes · Relies on Playwright mobile projects and emulation
- QE Pipeline → API Tester: api flow · Supports endpoint-driven API generation and execution
- API Tester → Playwright: executes · Uses Playwright as the test runtime boundary
- QE Pipeline → Page Analyzer: inspect · Analyzes page state for generation and repair
- Page Analyzer → Playwright: inspects · Reads DOM and browser state through Playwright
- QE Pipeline → Test Generator: assist · Helper path for page or URL driven generation
- Test Generator → Claude: generation · Uses Claude for structured test synthesis
- Test Generator → Page Analyzer: context · Combines URL/page analysis with generation
- QE Pipeline → Change Detector: watch · Monitors generated demo app and artifact changes
- Change Detector → Self Heal: locator drift · Routes locator changes to automated repair
- Self Heal → Page Analyzer: dom evidence · Uses page analysis evidence to rewrite selectors
- Self Heal → Files: rewrites · Updates affected test files on disk
- Change Detector → Review Queue: requirements drift · Routes requirement changes to human review
- Review Queue → Files: writes queue · Creates review artifacts for manual approval
- QE Pipeline → Reports: summarize · Collects execution results into terminal reports
- Reports → Logger: records · Uses structured logs as reporting input
- Reports → Files: writes · Persists HTML, JSON, and JUnit outputs
- QE Pipeline → Logger: logs · Pipeline stages emit structured execution logs
- QE Pipeline → Files: artifacts · Coordinates file-based handoffs between stages
- Core API → API Tester: legacy copy · Supports the main API testing flow
- Core Page → Page Analyzer: legacy copy · Supports the main page analysis flow
