@capagents/forgeqe 1.2.1 → 1.3.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 (65) hide show
  1. package/HOW_TO_USE.md +39 -2
  2. package/README.md +1 -1
  3. package/docs/COST_ARCHITECTURE.md +280 -0
  4. package/docs/feature-test-prompts.md +95 -0
  5. package/docs/user-guide.html +53 -6
  6. package/forgeqe.example.yaml +15 -0
  7. package/package.json +1 -1
  8. package/prompts/brain.md +35 -4
  9. package/prompts/browser-checks.md +2 -0
  10. package/py/forgeqe_engine/checks.py +8 -2
  11. package/py/forgeqe_engine/llm.py +33 -5
  12. package/py/forgeqe_engine/memory.py +59 -2
  13. package/py/forgeqe_engine/observe.py +123 -0
  14. package/py/forgeqe_engine/replay.py +55 -2
  15. package/py/forgeqe_engine/service.py +155 -3
  16. package/src/capabilities/registry.ts +19 -5
  17. package/src/cases/ado.ts +1 -1
  18. package/src/cases/journey.ts +61 -0
  19. package/src/cases/readiness.ts +35 -6
  20. package/src/cases/save.ts +241 -48
  21. package/src/cases/types.ts +11 -0
  22. package/src/cli/help.ts +8 -0
  23. package/src/cli/index.ts +64 -1
  24. package/src/code/coverage.ts +22 -3
  25. package/src/code/decisions.ts +73 -0
  26. package/src/code/find.ts +3 -1
  27. package/src/code/graph/graph.ts +33 -2
  28. package/src/code/loop.ts +17 -1
  29. package/src/code/notes.ts +48 -1
  30. package/src/code/prompt.ts +31 -9
  31. package/src/code/protect.ts +103 -0
  32. package/src/code/review.ts +2 -0
  33. package/src/code/runtime.ts +35 -3
  34. package/src/code/shortlist.ts +309 -0
  35. package/src/code/testrun.ts +3 -1
  36. package/src/code/traceability.ts +2 -0
  37. package/src/commands.ts +6 -1
  38. package/src/config.ts +46 -0
  39. package/src/engine/bridge.ts +47 -5
  40. package/src/mcp/casetools.ts +107 -11
  41. package/src/mcp/commands.ts +74 -20
  42. package/src/mcp/packtools.ts +187 -0
  43. package/src/mcp/tools.ts +238 -29
  44. package/src/pack/collect.ts +251 -0
  45. package/src/pack/index.ts +134 -0
  46. package/src/pack/init.ts +45 -0
  47. package/src/pack/pack.ts +327 -0
  48. package/src/pack/pipeline.ts +373 -0
  49. package/src/pack/run.ts +155 -0
  50. package/src/registry/db.ts +249 -0
  51. package/src/registry/index.ts +72 -0
  52. package/src/registry/resolve.ts +57 -0
  53. package/src/registry/tier0.ts +81 -0
  54. package/src/report/data.ts +7 -0
  55. package/src/report/html.ts +14 -0
  56. package/src/report/template.html +52 -48
  57. package/src/report/usage.ts +113 -0
  58. package/src/run.ts +22 -2
  59. package/src/suite/run.ts +12 -5
  60. package/src/summary.ts +1 -0
  61. package/src/tokenomics/budget.ts +172 -0
  62. package/src/tokenomics/ledger.ts +287 -0
  63. package/src/tui/App.tsx +89 -2
  64. package/src/tui/inspector.tsx +40 -35
  65. package/src/types.ts +9 -2
package/HOW_TO_USE.md CHANGED
@@ -50,13 +50,14 @@ Everything ForgeQE can do, by area. ForgeQE's agent answers "can you…?" questi
50
50
  | Browser | **Run any goal in a real browser**: Carries out a plain-language goal in a real browser one step at a time and verifies the outcome, with screenshots, a report, and the steps it took. The browser comes from forgeqe.yaml: local Chrome or Chromium by default, or BrowserStack or TestMu AI/LambdaTest when configured. Page memory replays steps that already worked on a site, so repeat runs are faster and cheaper. | `browser_run`, `run_details`, `page_memory`, `browser_devices` | [docs](#4-without-the-shell) |
51
51
  | Browser | **Saved logins for the application under test**: Signs the browser agent in with saved credentials (including TOTP) and reuses the session; a user can also sign in by hand once in a browser. | `logins` | [docs](#signing-in) |
52
52
  | Test cases | **Run manual test cases in browsers**: Reads test cases from Azure DevOps, Jira, Xray, TestRail, Zephyr Scale, qTest, a file, or pasted text, runs each in a real browser with a verdict per step, writes report.html and junit.xml, posts results back, and files or updates bugs for failures. | `find_test_cases`, `run_test_cases` | [docs](#7-test-cases-and-suites) |
53
- | Test cases | **Check and improve test cases**: Checks test cases before they run (vague or missing expected results, missing test data, placeholders, duplicates) against the story, feature, and epic they test, then rewrites Azure DevOps cases once the user agrees. | `check_test_cases`, `update_test_case` | [docs](#checking-test-cases-before-they-run) |
54
- | Test cases | **Write test cases from a story**: Writes test cases from a story's acceptance criteria and saves them in Azure DevOps or Jira, linked to the story. | `save_test_cases` | [docs](#where-cases-come-from) |
53
+ | Test cases | **Check and improve test cases**: Checks test cases before they run (vague or missing expected results, missing test data, placeholders, duplicates) against the story, feature, and epic they test, then rewrites Azure DevOps or Jira cases in place once the user agrees. | `check_test_cases`, `update_test_case` | [docs](#checking-test-cases-before-they-run) |
54
+ | Test cases | **Write test cases from a story**: Writes test cases from a story's acceptance criteria and saves them in Azure DevOps or Jira, linked to the story. Reads the cases already linked first, so asking again adds only what is missing and updates cases in place instead of duplicating them; plans end-to-end journeys from the existing cases. | `story_test_cases`, `save_test_cases`, `e2e_journey` | [docs](#where-cases-come-from) |
55
55
  | Test cases | **Domain and regulatory test design**: Every agent works as an expert in the product's industry would, automatically: the risks the industry is known for and the obligations of its regulations and standards (for example DORA, PSD2, GDPR, ISO 27001), declared in forgeqe.yaml or worked out from the story and the application. It applies to analysing requirements, writing and checking test cases, exploration, writing, reviewing, and healing test code, API tests, finding tests, and pull request reviews, labelled so coverage can be traced and citing only the control ids in the team's compliance file. forgeqe eval domain measures how well the agent does it. | | [docs](#16-domain-and-regulations) |
56
56
  | Test cases | **Exploratory testing of a story**: Explores a story in real browsers beyond its scripted cases (edge cases, invalid input, boundaries, roles, state), confirms each defect by reproducing it, proposes test cases, and files bugs once the user agrees. | `explore_story` | [docs](#exploratory-testing-from-a-story) |
57
57
  | Automated tests | **Turn a passed run into an automated test**: Scribe, the coding agent, writes a test for a passed browser run in the repository's own framework, page objects, and helpers; ForgeQE runs it until it passes and a reviewer approves it. | `write_test`, `run_test` | [docs](#6-tests) |
58
58
  | Automated tests | **Heal failing tests**: Runs a repository's tests and updates the ones the application has outgrown against the live app, or reports a real application bug instead. | `heal_tests` | [docs](#fixing-broken-tests) |
59
59
  | Automated tests | **Find and run existing tests**: Finds the automated tests that match a feature, tags, ids, a folder, or a sprint, confirms the selection, and runs it once the user agrees, with a verdict per test. | `find_tests`, `run_tests`, `list_sprints` | [docs](#finding-and-running-existing-tests) |
60
+ | Automated tests | **Regression packs for a release**: Builds a regression pack from what goes into a release (an Azure DevOps sprint or work items, a commit range, pull requests, or changes read from any connected tool): the tests those changes can break, each with why, plus risk-area and smoke tests, and the changes no test covers. Runs it locally, on TestMu AI, or in a pipeline, and compares each run with the last. | `build_regression_pack`, `run_regression_pack`, `list_regression_packs` | [docs](#regression-packs-for-a-release) |
60
61
  | Automated tests | **Flaky test detection and quarantine**: Finds tests that flip between passing and failing in the repository's run history, with their likely cause, and quarantines them once the user agrees. | `flaky_tests`, `quarantine_tests` | [docs](#flaky-tests) |
61
62
  | Pull requests | **Review pull requests**: Reviews an Azure DevOps or GitHub pull request from the local clone for bugs, security, requirements, and tests, and posts the review once the user agrees. | `review_pull_request`, `post_pr_review` | [docs](#reviewing-pull-requests) |
62
63
  | Pull requests | **Pull request impact and test selection**: Works out which product areas, pages, requirements, and tests a pull request touches, picks the tests it can break, runs them, and posts the impact or results on the pull request once the user agrees. | `analyze_pr_impact`, `select_pr_tests`, `post_pr_test_results`, `comment_on_pr` | [docs](#what-a-pull-request-impacts-in-the-product) |
@@ -859,6 +860,42 @@ Review my open pull requests
859
860
 
860
861
  Through `forgeqe mcp`, `post_pr_review` posts only when called again with `confirmed: true`; the MCP client should ask you first.
861
862
 
863
+ ### Regression packs for a release
864
+
865
+ A regression pack is the set of your repository's tests that a release's changes can break, saved under a name so you can run it again (here, on TestMu AI, or in a pipeline) and compare runs. Ask in your own words:
866
+
867
+ ```text
868
+ Build a regression pack for sprint 12 and run it on TestMu
869
+ Which tests should we run for the PRs merged this week?
870
+ Build a pack for Jira fix version 2.4 and the commits since release/2.3 in ../shop-app
871
+ ```
872
+
873
+ **Where the changes come from.** Any mix of:
874
+
875
+ - an Azure DevOps sprint, area, epic or feature, or work item ids: their stories and bugs, the test cases each is tested by, and the files their linked pull requests changed;
876
+ - the commits between two refs of a repository (`from` and `to`): the product's repository, or the test repository's own; work items the commit messages name (`AB#123`, `#123`, `PAY-12`) are read too;
877
+ - pull requests by number or URL, or the ones merged in the last N days (Azure DevOps or GitHub);
878
+ - anything ForgeQE's agent can read through its connected tools (a Jira release, GitHub issues, a Confluence release note): it reads the items and passes them in with their text and links.
879
+
880
+ **Why each test is in.** A test can be in for more than one reason, and the card and `<name>.md` say each one:
881
+
882
+ | Reason | Meaning |
883
+ |---|---|
884
+ | linked | it automates a test case that tests a changed work item (`.forgeqe/test-cases.json`, or a case id in the test's attributes) |
885
+ | test code changed | the change is in the test repository, in code the test uses |
886
+ | matches a change | the work item's or pull request's words name what the test does: the elements it uses, its page, its name |
887
+ | risk area | the release touches an area with defects or failures before, and the test works there |
888
+ | smoke | the test is tagged smoke, so it is in every pack |
889
+
890
+ **Gaps.** Changes no test is in for are listed as *not covered*, each with the closest existing test and what it lacks, so you can extend that test rather than write a new one.
891
+
892
+ **Running it.** ForgeQE asks before it runs anything.
893
+
894
+ - *This machine*: ForgeQE builds one command for exactly the pack's tests, the way the repository already runs a test (for .NET, a `--filter` with each test, the settings an earlier job used, TRX results), runs it, and reads each result. A failed test runs once more; one that then passes is flaky.
895
+ - *TestMu AI*: the same command, with the variable `FORGEQE_PW_WS_ENDPOINT` set to TestMu AI's Playwright endpoint for the browser and platform in `testmu.yaml` (the access key goes in the variable, never in the command, and is removed from the output). The tests must connect to it when it is set: for NUnit, override `ConnectOptionsAsync` in the test base class; for Playwright Test, set `connectOptions` from it in `playwright.config`. ForgeQE refuses a TestMu run when the tests do not read the variable, so a run never looks remote while it ran locally.
896
+
897
+ Each run is kept with the pack: the card says which tests fail now that passed in the last run, and which were fixed. Packs are saved in `.forgeqe/packs/<name>.json` and `<name>.md`; run output and results in `.forgeqe/reports/packs/<name>/<time>/`.
898
+
862
899
  ### Flaky tests
863
900
 
864
901
  Every `run_tests` and `pr-tests` run keeps each test's result in `.forgeqe/test-history.json` in the repository (commit it to share the history, or keep it between CI runs as a cache). A test that fails runs once more in the same run, with the framework's own option (Playwright `--last-failed`, pytest `--lf`, Jest `--onlyFailures`; otherwise the whole command again when the selection is small): when it then passes it is **flaky**, not failed, and the run does not fail because of it.
package/README.md CHANGED
@@ -236,7 +236,7 @@ sources:
236
236
 
237
237
  ### Reports
238
238
 
239
- Every suite writes `report.html`, `junit.xml`, and `suite.json` to `.forgeqe/reports/suites/<time>/`, with each case's run folder beside them; every single run writes its own `report.html` too. The report is one HTML file with the screenshots embedded, so you can open it straight from disk, attach it to a build, or mail it; no server is needed. It has an overview (verdict, totals, step checks, tokens, cost, page memory savings, browser errors, accessibility issues, bugs filed, what changed since the last run, results over earlier runs, the cases that need attention, results by source and tag, the slowest cases, and what was posted where), a test results page (each case's step table with expected and actual results, why it failed, its last passing screenshot beside this run's, browser errors per step, page memory with healed locators, the browser agent's steps with a screenshot each and the clicked element outlined, a timing waterfall, accessibility issues, and the trace and workflow to read in place), a failures page, since last run, trends and flaky tests from the earlier suite runs in the same `.forgeqe/reports/suites/` folder, time and cost (model vs browser time, a parallel worker timeline, cost per case from the model's `price` in `llms.json`), coverage by requirement and group from the test system, accessibility checks for every page visited, and the environment (model, browser, ForgeQE version, CI build, branch, commit). It exports Markdown and JSON and prints cleanly. See `samples/reports/nightly/20260929-020005/report.html` for an example. `report.screenshots: failures` keeps screenshots for failed runs only, `off` drops them; `report.accessibility: false` skips the page checks. On GitHub Actions the suite also writes a job summary.
239
+ Every suite writes `report.html`, `junit.xml`, and `suite.json` to `.forgeqe/reports/suites/<time>/`, with each case's run folder beside them; every single run writes its own `report.html` too. The report is one HTML file with the screenshots embedded, so you can open it straight from disk, attach it to a build, or mail it; no server is needed. It has an overview (verdict, totals, step checks, tokens, cost, page memory savings, browser errors, accessibility issues, bugs filed, what changed since the last run, results over earlier runs, the cases that need attention, results by source and tag, the slowest cases, and what was posted where), a test results page (each case's step table with expected and actual results, why it failed, its last passing screenshot beside this run's, browser errors per step, page memory with healed locators, the browser agent's steps with a screenshot each and the clicked element outlined, a timing waterfall, accessibility issues, and the trace and workflow to read in place), a failures page, since last run, trends and flaky tests from the earlier suite runs in the same `.forgeqe/reports/suites/` folder, time and cost (model vs browser time, a parallel worker timeline, cost per case from the model's `price` in `llms.json`), coverage by requirement and group from the test system, accessibility checks for every page visited, the environment (model, browser, ForgeQE version, CI build, branch, commit), and Tokenomics: every model call by every agent from the usage ledger in `~/.forgeqe/usage` (tokens, cache, cost, time, by agent, job, task, purpose, model, user and machine, never prompt text), the models compared, spend per day with a month forecast, the `budget:` limits from `forgeqe.yaml` (warnings at 80%, 90% and 100%, nothing stopped), and a calculator for what runs would cost at another size, cache rate or model. It exports Markdown and JSON and prints cleanly. See `samples/reports/nightly/20260929-020005/report.html` for an example. `report.screenshots: failures` keeps screenshots for failed runs only, `off` drops them; `report.accessibility: false` skips the page checks. On GitHub Actions the suite also writes a job summary.
240
240
 
241
241
  ### Static BI
242
242
 
@@ -0,0 +1,280 @@
1
+ # Cost-aware execution: registry, tiers, and escalation
2
+
3
+ Status: proposal · 2026-10-15
4
+
5
+ ForgeQE pays the model for work it has already done. This document sets out how ForgeQE decides when the
6
+ model is needed at all, and how much of it. The approach is built from published, measured techniques.
7
+ The goal for known work: **a rerun of an existing test costs 0–5% of its first run**, and the model is
8
+ paid only for what is new or broken.
9
+
10
+ ## 1. What a request costs today (measured)
11
+
12
+ From the session logs in a live project (`.forgeqe/logs`, Azure OpenAI gpt-5.4):
13
+
14
+ | Request | Agent calls | Input tokens | Output tokens | Cached |
15
+ |---|---|---|---|---|
16
+ | "Are we ready to release?" (one release-readiness tool call) | 12 | 577K | 2.6K | 518K |
17
+ | Test-authoring session | many | 1.9M | 8.9K | 1.65M |
18
+
19
+ These numbers show three things:
20
+
21
+ 1. **Fixed overhead per call.** Every chat-agent call resends about 45K tokens of system prompt, tool
22
+ definitions and history. Output is under 0.5% of tokens, so the cost is the context, not the work.
23
+ 2. **Calls multiply.** The deterministic release check took 12 calls, because the agent asked
24
+ questions, searched for files, read config and summarised.
25
+ 3. **Known work is not recognised:**
26
+ - Every request goes through the chat agent, including the **rerun** link.
27
+ - Page memory finds a saved flow only by the exact goal text plus the URL (`memory.py: goal_key`), so a
28
+ reworded goal misses it.
29
+ - `replay: verify` replays every step, then starts the browser agent to check the result.
30
+
31
+ Prompt caching already works (about 90% of input is cached). It lowers the price per token, but not the
32
+ number of tokens or calls, so on its own it cannot reach the target.
33
+
34
+ ## 2. The approaches this design uses
35
+
36
+ | Technique | Evidence | Where it applies here |
37
+ |---|---|---|
38
+ | **Workflows before agents.** Use fixed code paths for predictable tasks; keep agents for open-ended ones. | Anthropic, [*Building effective agents*](https://www.anthropic.com/research/building-effective-agents) (2024) | Tier 0: rerun, run case, run suite, release check |
39
+ | **Plan caching.** Extract a plan template from a finished run, match new requests by key, and adapt the template with a small model. | Zhang et al., [*Agentic Plan Caching*](https://arxiv.org/abs/2506.14852), NeurIPS 2025: 50.3% lower cost and 27.3% lower latency on average, performance maintained | Tier 1: known flow, new wording or new data |
40
+ | **Workflow memory.** Turn successful trajectories into reusable routines. | Wang et al., [*Agent Workflow Memory*](https://arxiv.org/abs/2409.07429), ICML 2025: +51.1% relative success on WebArena, fewer steps | Flows saved from passing runs, shared across cases |
41
+ | **Model cascade and routing.** Try the cheapest model or step that can answer, and escalate only when a check fails. | Chen et al., [*FrugalGPT*](https://arxiv.org/abs/2305.05176) (up to 98% savings, task-dependent); Ong et al., [*RouteLLM*](https://arxiv.org/abs/2406.18665), ICLR 2025 (over 2x savings at about 95% quality) | The router; result checks on the reviewer model |
42
+ | **Content-addressed memoization.** Key cached work by a fingerprint of its inputs; any change to the inputs invalidates it. | Standard in build systems (Bazel, Gradle remote cache) and in test impact analysis | Registry fingerprints, the tool-result cache |
43
+ | **Record–replay with self-healing locators.** | Already in ForgeQE (`replay.py`, ranked locators) | Tier 0 and Tier 2 execution |
44
+
45
+ The published figures come from the authors' own benchmarks. ForgeQE has to measure its own (section 7).
46
+
47
+ ## 3. The execution ladder
48
+
49
+ Every request is resolved to the **lowest tier that can do it**. A tier escalates only on a concrete
50
+ failure signal, never on a guess.
51
+
52
+ | Tier | When | Model use | Target cost vs. first run |
53
+ |---|---|---|---|
54
+ | **0: Deterministic** | The request resolves to a known entity, and replay and end-state checks pass | None. The reply is filled in from the result. | 0% |
55
+ | **1: Adapt** | A known flow, but with new wording, new test data, or an end-state check that is unsure | One call to the small (reviewer) model with a short prompt (about 2K tokens) | ≤5% |
56
+ | **2: Heal** | Replay stopped at step *k*, or a check failed | The agent starts at step *k* with the steps so far as context, not from the beginning | Proportional to what broke |
57
+ | **3: Explore** | No match in the registry: a new goal or new kind of task | Full agent, as today | 100% |
58
+
59
+ ```
60
+ request ──► Resolver (no model) ──hit──► Tier 0 run ──checks pass──► reply from template
61
+ │ │ checks fail / replay stops
62
+ │ ambiguous ▼
63
+ ▼ Tier 2 heal (agent from step k)
64
+ Router (small model, ~2K) ──known──► Tier 1 adapt
65
+ │ novel
66
+ ▼
67
+ Tier 3 full agent ──passes──► registry learns the flow, plan and checks
68
+ ```
69
+
70
+ **Resolver (no model).** Matches IDs (`TC-123`, `SHOP-12`, plan/suite numbers, run folders,
71
+ `last`), file and test names, and aliases from the registry. The **rerun** link and `/rerun` call it
72
+ directly. Plain requests try it before any model is called.
73
+
74
+ **Router (small model).** Runs only when the resolver is unsure. It sees the request and the top
75
+ registry candidates (ranked by alias and keyword match), not the full tool catalogue. It returns
76
+ `{entity, tier}` or `novel`.
77
+
78
+ **Safety rules (non-negotiable):**
79
+ - A Tier 0 pass needs evidence: replay complete **and** every recorded end-state check passing. Anything
80
+ else escalates.
81
+ - **Freshness.** A flow is marked *stale* when the app changes: a new deploy or build id (when
82
+ configured), a changed page fingerprint seen during replay, or the age limit
83
+ (`registry.maxAgeDays`). A stale flow runs at Tier 1 once to re-confirm it.
84
+ - **Canary.** Every *N*th Tier 0 run of an entity (default 10) runs at Tier 1, so a check that silently
85
+ passes is caught.
86
+ - The user can always force a tier: `/rerun --verify`, `/rerun --fresh`.
87
+
88
+ ## 4. The registry: one indexed catalogue
89
+
90
+ The registry is one SQLite file per project: `.forgeqe/registry/registry.db`.
91
+ - Bun ships `bun:sqlite` and Python ships `sqlite3`, so there are no new dependencies.
92
+ - It is local, and git-ignored by default (its folder carries its own `.gitignore`).
93
+ - Existing JSON stores (page memory, code graph, quality history) stay where they are. The registry
94
+ **indexes and links** them, it does not replace them.
95
+
96
+ ### 4.1 Taxonomy
97
+
98
+ Every row has a `kind`, and every kind has a single source of truth:
99
+
100
+ | Kind | Source of truth | Example |
101
+ |---|---|---|
102
+ | `test_case` | ADO / Jira / Xray / TestRail / cases file | `ado:QI-Claims:TC-4812` |
103
+ | `code_test` | Repo test code (code graph) | `PlaywrightPom.Web.Tests.LoginTests.ValidLogin` |
104
+ | `flow` | Page memory `flows/` | recorded steps for a goal |
105
+ | `page`, `element` | Page memory `pages/` | `/login`, `#username` |
106
+ | `suite`, `plan` | ADO / cases file | `plan 12 / suite 34` |
107
+ | `work_item` | ADO / Jira | story, bug, feature |
108
+ | `pipeline`, `environment`, `login` | Config, ADO, saved sessions | `QI-Claims nightly`, `staging`, `saucedemo-standard` |
109
+ | `run`, `report` | `.forgeqe/reports` | run folders |
110
+
111
+ ### 4.2 Tables
112
+
113
+ ```sql
114
+ -- Everything ForgeQE knows about, categorised. fingerprint = hash of the inputs that define it.
115
+ entities(id TEXT PK, kind TEXT, source TEXT, external_id TEXT, title TEXT,
116
+ path TEXT, fingerprint TEXT, version TEXT, updated_at TEXT)
117
+ -- Every name a person might use for an entity: ids, titles, file and method names, normalised.
118
+ aliases(alias TEXT, entity_id TEXT, weight REAL, PRIMARY KEY(alias, entity_id))
119
+ -- Links between entities: case↔code_test, case↔flow, flow↔page, test↔page_object, story↔case.
120
+ links(from_id TEXT, rel TEXT, to_id TEXT, PRIMARY KEY(from_id, rel, to_id))
121
+ -- Reusable plans (the plan cache): what to call, with which arguments, how to judge the result.
122
+ plans(id TEXT PK, entity_id TEXT, intent TEXT, tool TEXT, args_template TEXT,
123
+ checks TEXT, input_fingerprint TEXT, successes INT, failures INT,
124
+ last_success TEXT, stale INT DEFAULT 0)
125
+ -- End-state checks recorded from a passing run: url, visible text, element, API status.
126
+ checks(plan_id TEXT, kind TEXT, target TEXT, expected TEXT)
127
+ -- The cost ledger: every request, its tier, and what it cost.
128
+ runs(id TEXT PK, entity_id TEXT, plan_id TEXT, tier INT, outcome TEXT,
129
+ escalated_from INT, tokens_in INT, tokens_out INT, tokens_cached INT,
130
+ cost REAL, currency TEXT, ms INT, started_at TEXT)
131
+ -- Memoised reads from external systems (ADO, Jira, GitHub), keyed by arguments and source version.
132
+ tool_cache(tool TEXT, args_hash TEXT, source_version TEXT, result_path TEXT,
133
+ fetched_at TEXT, ttl_s INT, PRIMARY KEY(tool, args_hash, source_version))
134
+ -- Pre-built context briefs per entity, rebuilt only when the fingerprint changes.
135
+ context_packs(entity_id TEXT PK, fingerprint TEXT, brief TEXT, tokens INT, built_at TEXT)
136
+ ```
137
+
138
+ ### 4.3 Fingerprints and invalidation
139
+
140
+ A cached item is valid only while its fingerprint matches its source:
141
+
142
+ - **test_case:** hash of the normalised steps plus expected results, together with the ADO `rev`.
143
+ This replaces matching on goal text, so rewording a request no longer misses the flow.
144
+ - **code_test:** git blob sha of the test file and of the page objects it reaches (from the code graph).
145
+ - **flow:** hash of its steps, together with the page fingerprints seen on its last pass.
146
+ - **tool_cache:** the source's own version (work item `rev`, sprint id, ETag) where one exists;
147
+ otherwise a short TTL. Writes always bypass it.
148
+
149
+ ## 5. Building context (for Tiers 1–3)
150
+
151
+ The agent's fixed 45K-token context is the main cost driver. Context is built from the registry instead
152
+ of being discovered by the agent:
153
+
154
+ - **Context packs.** For each entity, a brief of a few hundred tokens: what it is, its linked case, code
155
+ test, flow, pages and last results. The agent gets the brief rather than spending calls on
156
+ `read`, `grep` and `code_outline`.
157
+ - **Tool listing by tier:**
158
+ - Tier 1 gets one tool.
159
+ - Tier 2 gets the tools of the capability that broke.
160
+ - Tier 3 gets today's progressive listing (`routing.ts`).
161
+ - **Stable prefix first, variable last**, so prompt caching keeps hitting.
162
+ - **History compaction.** After a request finishes, only its outcome and ids are carried forward, not
163
+ its tool results.
164
+
165
+ ## 6. Learning: how the registry fills itself
166
+
167
+ - **Indexing.**
168
+ - On `forgeqe init`, and incrementally on file change, the code graph and cases sources are indexed
169
+ into `entities`, `aliases` and `links`.
170
+ - ADO and Jira items are indexed when they are first fetched.
171
+ - **Promotion.** A Tier 2 or Tier 3 run that passes, and passes the judge when it is on, writes or updates
172
+ its `plan` and `checks`. A plan needs two passes, or one pass plus user confirmation, before it is
173
+ allowed to run at Tier 0.
174
+ - **Demotion.** Failures increment `failures`. Two failures in a row mark the plan *stale*, and the next
175
+ run goes to Tier 1 or 2.
176
+
177
+ ## 7. Measurement and acceptance
178
+
179
+ The ledger (`runs`) makes cost measurable per tier and per entity. `forgeqe cost` reports the following
180
+ metrics. Each must meet its target before a phase counts as done.
181
+
182
+ | Metric | Target |
183
+ |---|---|
184
+ | Cost of a rerun of a known passing test, vs. its first run | ≤5% (Tier 0: 0 tokens) |
185
+ | Share of reruns served at Tier 0 or Tier 1 | ≥90% |
186
+ | Tier escalation rate on unchanged apps | ≤5% |
187
+ | **False pass rate** (Tier 0 pass that a Tier 1 canary then fails) | 0 known; every one investigated |
188
+ | Release check ("are we ready", scope known) | 0–1 agent calls |
189
+
190
+ The evaluation is an offline replay suite under `src/evals`. It holds recorded requests (rerun, reworded
191
+ rerun, changed app, new goal), each with an expected tier and outcome. It runs on every change to the
192
+ resolver, router or registry, and live against the real model before release.
193
+
194
+ ## 8. Compatibility and rollout safety
195
+
196
+ Nothing here may change what ForgeQE does today until it has been shown to give the same results.
197
+
198
+ **Built alongside, never in place of**
199
+ - `registry.mode: off | shadow | on` in `forgeqe.yaml`. It defaulted to `off` through phases 1 and 2,
200
+ and to `on` from 2026-10-15, after the live results in sections 9–10. With `off`, every request takes the
201
+ agent's path, unchanged.
202
+ - The new code lives in `src/registry/`. Existing modules gain only small hooks at their entry points:
203
+ the chat request handler, the command parser and config. The chat agent, page memory, replay modes and
204
+ tools keep their behaviour.
205
+ - Any registry error (missing, locked or corrupt database, an exception in the resolver) falls back to
206
+ today's path. The registry is a cache: deleting it loses savings, never behaviour.
207
+ - Existing stores (page memory, code graph, quality history, run folders) keep their formats. The registry
208
+ reads and indexes them and never writes to them.
209
+ - Tier 0 runs through the same `browser_run` tool the agent calls. Existing-test reuse, page memory
210
+ replay, the configured replay mode, reports and quality checks all apply as they do today.
211
+
212
+ **Proven before it is switched on**
213
+ - **Tests that lock in today's behaviour.** Written before the hooks, they pin down today's results:
214
+ a request with the registry `off` goes to the agent, and the **rerun** link goes to the agent.
215
+ They have to pass unchanged afterwards.
216
+ - **Shadow mode.** The resolver decides and records what it would do (`runs` with `mode = shadow`), while
217
+ the request still takes today's path. The decisions are compared with real outcomes before `on`.
218
+ - **False pass check.** During rollout, every Tier 0 pass is re-checked at Tier 1. Any disagreement blocks
219
+ the next phase.
220
+ - **The full suite.** Every existing test passes unchanged in every phase, with no existing test edited
221
+ to make it pass.
222
+
223
+ **Switched on gradually**
224
+ - One phase per release. Each one can be turned off on its own.
225
+ - A live check against the real model, Azure DevOps and Teams before each phase is called done.
226
+ - Every reply says which tier answered it. `/rerun` is an explicit command, and the agent remains one
227
+ sentence away: anything the resolver is unsure of goes to it.
228
+
229
+ ## 9. Phase 1 live result (2026-10-15)
230
+
231
+ Live run against Azure OpenAI gpt-5.4 and a real headless Chrome: a `/rerun` of a 27-step practice-form run
232
+ whose first run used 242K tokens.
233
+
234
+ | | Result |
235
+ |---|---|
236
+ | Resolver | Matched the run; no chat-agent calls |
237
+ | Page memory | Replayed 26 of 27 steps without the model |
238
+ | Step 27 | A read-only `evaluate` (reading the fields to check them) is not replayable, so the browser agent took over for 14 model steps |
239
+ | Cost | **178K tokens: 74% of the first run.** The target is not met |
240
+
241
+ The remaining cost is the browser agent's check after replay. Phase 2 is the step that reaches the target.
242
+ Read-only steps (`evaluate`, extract) and the final check must be answered from recorded end-state checks
243
+ (`run.json` already records `checks` with expected values). The agent comes in only when a check fails.
244
+
245
+ ## 10. Phase 2 live result (2026-10-15)
246
+
247
+ What phase 2 adds, with `registry.mode: on` only:
248
+ - `evaluate` steps whose script only reads the page are left out of a replay. The test is on the script's
249
+ source and conservative: any assignment, any page-changing call, any request or deferred code counts
250
+ as writing. Checked against every `evaluate` in a live project's flows: no write was classed as read-only.
251
+ - A passing run's `record_check` results are kept in its flow, each with the step it was recorded after.
252
+ - A replay finds each check on the page again after that step, with no model. If every check holds, the
253
+ run passes with no model. The first check that does not hold stops the replay there, and the agent
254
+ takes over on that page (today's path).
255
+ - The agent still judges the run when: a check is dynamic, the flow has not passed for 30 days, or it is
256
+ every 10th replay of the flow (the canary).
257
+
258
+ Live, Azure OpenAI gpt-5.4 and headless Chrome:
259
+
260
+ | Flow | Run | Tokens | vs. first run |
261
+ |---|---|---|---|
262
+ | Wikipedia search (3 steps, 1 check) | first run | 50.3K | 100% |
263
+ | | rerun: the search suggestion did not show in time, so the agent took 2 steps | 25.1K | 50% |
264
+ | | rerun: replay complete, the check held | **0** | **0%** (6 s) |
265
+ | | rerun with the saved check changed to text the page does not show | 25.1K | the replay refused to pass it, and the agent judged the real page |
266
+ | Practice-form playground (27+ steps) | reruns | 122K, 135K, 82K | 50%, 56%, 34% |
267
+
268
+ The practice page is built to resist replay: double-click targets, clipboard paste and per-key typing that
269
+ replay's direct input does not reproduce. Its checks correctly never passed a replay that ended in a
270
+ different state. Flows like that stay with the agent until replay can repeat those inputs (a later phase).
271
+
272
+ ## 11. Rollout
273
+
274
+ | Phase | Scope | Done when |
275
+ |---|---|---|
276
+ | **1** | Registry (entities, aliases, plans, runs). Resolver plus Tier 0 for `/rerun`, the rerun link, and case and run ids. Fingerprint matching for test cases. Reply filled in from the result. | A rerun of a known passing case logs 0 tokens; a reworded request still finds its flow |
277
+ | **2** | Recorded end-state checks replace the post-replay agent check. Canary and freshness rules. | `verify` default costs one small-model call or none; the false pass suite stays green |
278
+ | **3** | Router (small model) plus Tier 1 adapt. Repo code tests run directly (`dotnet test` / `npx playwright test` with filters, results files parsed). | Reworded and new-data reruns at ≤5% |
279
+ | **4** | Tool-result cache, context packs, history compaction. Release check as a fixed workflow. | The release check takes 0–1 agent calls; the agent's average context per call is down by half |
280
+ | **5** | `forgeqe cost` report and the evaluation suite in CI | Metrics in section 7 reported per release |
@@ -0,0 +1,95 @@
1
+ # ForgeQE feature test prompts
2
+
3
+ One prompt for each ForgeQE feature, to check the agent end to end. Type each prompt in the ForgeQE terminal (`forgeqe start`), started in the test project's folder (for example `playwright-csharp-pom-framework`).
4
+
5
+ ## Before you start
6
+
7
+ - Replace the `<…>` placeholders with your own ids (a story, a pull request).
8
+ - ⚠ marks prompts that change something outside ForgeQE: Azure DevOps, Teams, git, or the repository. Run those on test data only.
9
+ - Some prompts need an earlier run. #2, #17, #27, and #28 depend on #1 or #9, so run them after it.
10
+ - Don't use test case 2287 for the API + UI check. As written, its step 2 gets a 403 (`POST /add_to_cart` is not how that site adds to the cart), and it signs in to a personal account. Use #26 instead.
11
+
12
+
13
+
14
+ ## Browser and test cases
15
+
16
+
17
+ | # | Feature | Prompt | What to check |
18
+ | --- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
19
+ | 1 | Browser goals | `Go to https://www.playwrightautomation.com, open the Practice tab, fill the Text Inputs with realistic values and check they are accepted` | Steps appear live; the run ends with a pass verdict and a report link |
20
+ | 2 | Page memory | Run #1 again, then: `What does ForgeQE know about the Practice page?` | The rerun replays from memory, faster and with fewer tokens; the answer lists locators |
21
+ | 3 | Saved logins | `Sign in to https://www.automationexercise.com/login with the test account and keep the session` | The login is saved; the password never appears in the chat or the logs |
22
+ | 4 | Run test cases | `Run test case 2287 from QI-Claims and don't post results` | Each step has a verdict; report.html and junit.xml are written; nothing is posted to Azure DevOps |
23
+ | 5 | Test case quality | `Is test case 2287 in QI-Claims good enough to run? Check it against PBI 2286` | The card says "to review", not "not runnable"; the missing expected results are listed |
24
+ | 6 | ⚠ Write test cases | `Write test cases for PBI 2286 in QI-Claims and show them before saving` | Each case has expected results and links to PBI 2286; ForgeQE asks before saving |
25
+ | 7 | Domain and regulatory design | `Write test cases for PBI 2286 covering PCI DSS obligations for card payments` | Cases cover card data and masking, and name the regulation |
26
+ | 8 | Exploratory testing | `Explore PBI 2286 on automationexercise.com and find bugs beyond the test cases` | A charter, findings with evidence, and suggested bugs |
27
+
28
+
29
+
30
+
31
+ ## Automated tests (Scribe)
32
+
33
+
34
+ | # | Feature | Prompt | What to check |
35
+ | --- | ------------------------ | --------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
36
+ | 9 | ⚠ Turn a run into a test | `Write a Playwright test for the last passed run` | A handoff; a C# test that uses the repository's page objects; ForgeQE runs the test; the reviewer gives a verdict |
37
+ | 10 | ⚠ Heal failing tests | `Heal the failing tests in tests/PlaywrightPom.Web.Tests` | Each failure is healed or reported as an application bug; no test is deleted or skipped |
38
+ | 11 | Find and run tests | `Run the Wikipedia tests in this repo` | The right `dotnet test --filter` command; a pass or fail for each test |
39
+ | 12 | Flaky tests | `Which tests in this repo are flaky?` | Tests ranked, each with evidence (retries, mixed results) |
40
+
41
+
42
+
43
+
44
+ ## Pull requests
45
+
46
+
47
+ | # | Feature | Prompt | What to check |
48
+ | --- | ------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------- |
49
+ | 13 | Pull request review | `Review PR <n> in QI-Claims and focus on test coverage` | Findings with file and line, and a verdict |
50
+ | 14 | Impact and test selection | `What does PR <n> impact, and run only the tests it can break` | The test list comes from the code graph; only those tests run |
51
+
52
+
53
+
54
+
55
+ ## API and quality
56
+
57
+
58
+ | # | Feature | Prompt | What to check |
59
+ | --- | ----------------------------- | ----------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
60
+ | 15 | API and contract tests | `Turn the last run's API calls into contract tests and run them` | Contracts are saved and run without a browser; a JUnit file is written |
61
+ | 16 | Accessibility and performance | `Is the automationexercise.com checkout page accessible, and how fast is it?` | WCAG findings by severity; LCP, CLS, and INP figures |
62
+ | 17 | Visual comparison | Run #1 twice, then: `What changed visually since the last run?` | Each page is marked same or changed, with diff images |
63
+
64
+
65
+
66
+
67
+ ## Release, operations, and systems
68
+
69
+
70
+ | # | Feature | Prompt | What to check |
71
+ | --- | ---------------------- | ------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
72
+ | 18 | Defect intelligence | `Which defects in QI-Claims keep coming back?` | Recurring defects, with counts and areas |
73
+ | 19 | Release readiness | `Are we ready to release QI-Claims? Give requirement coverage` | A coverage table and a GO, GO WITH RISKS, or NO-GO verdict |
74
+ | 20 | ⚠ Scheduled monitoring | `Check the automationexercise.com login every 15 minutes and alert Teams if it fails` | The monitor is scheduled and `/monitor` lists it; the alert text is clear |
75
+ | 21 | ⚠ Notifications | `Post the last suite's results to the Teams QA channel` | A message arrives in Teams, with a link to the report |
76
+ | 22 | Reports | `Write up the open defects in QI-Claims as a report I can share` | report.html and report.md, linked from the card |
77
+ | 23 | ⚠ CI pipelines | `Add an Azure Pipelines workflow that runs tests/cases.yaml on every PR, and make it green` | A pipeline file, the secrets it needs stored, a pushed branch (never main) |
78
+ | 24 | Azure DevOps | `List the last 3 pipeline runs in QI-Claims and QI-Payments and which failed` | The agent's plan shows; calls appear in Activity; failure causes are given |
79
+ | 25 | Setup help | `What can you do here, and what is still not set up?` | The features, each with what it still needs |
80
+
81
+
82
+
83
+
84
+ ## Recent additions
85
+
86
+
87
+ | # | Feature | Prompt | What to check |
88
+ | --- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
89
+ | 26 | API and UI steps in one case | Run a case with these steps: `1. Open https://automationexercise.com/products 2. Call POST https://automationexercise.com/api/searchProduct with form body search_product=top, expect 200 3. Search "top" in the UI, expect "Searched Products"` | `api_request` is used and the server answers 200; workflow.yaml has an `api` step; the card says "API … saved as a reusable API scenario"; the replay passes |
90
+ | 27 | Reuse or extend existing tests | Run #9's flow again with one extra check added | ForgeQE offers reuse, extend, or new, with coverage evidence; no duplicate test file appears |
91
+ | 28 | Reviewer exchange | Any Scribe job that needs two or more attempts (for example #9 on a new flow) | "Reviewer asked for changes" lists each issue with its fix; "Scribe tries again" shows the real error; then the verdict |
92
+ | 29 | Activities panel | During #24, press **ctrl+o** | Activity takes half the width: the plan with spinners, Now and Next, each call shown as it starts; each request has a header row and a result row |
93
+ | 30 | Refine | Type `run 2287 and write automation`, then press **ctrl+r** | The panel scrolls with ↑↓ and PgUp/PgDn; open questions come first; Use, Edit, and Keep stay visible |
94
+
95
+
@@ -378,7 +378,7 @@ forgeqe docs --copy ./docs # copy the guide, the architecture page, and the re
378
378
  <h3 class="band-title">Every feature</h3>
379
379
  <div class="area"><a class="area-name" href="#area-browser"><span class="mono">Browser</span></a><ul class="tiles"><li><a class="tile" href="#cap-browser-goals"><b>Run any goal in a real browser</b><span>Go to booking.com and search hotels in Mumbai for next weekend</span></a></li><li><a class="tile" href="#cap-logins"><b>Saved logins for the application under test</b><span>Sign in to the admin site and keep the session</span></a></li></ul></div>
380
380
  <div class="area"><a class="area-name" href="#area-test-cases"><span class="mono">Test cases</span></a><ul class="tiles"><li><a class="tile" href="#cap-run-test-cases"><b>Run manual test cases in browsers</b><span>Run SHOP-12 and SHOP-14 from Jira, two browsers at once</span></a></li><li><a class="tile" href="#cap-test-case-quality"><b>Check and improve test cases</b><span>Are the cases in test plan 12 good enough to run?</span></a></li><li><a class="tile" href="#cap-write-test-cases"><b>Write test cases from a story</b><span>Write test cases for story 1234 and save them</span></a></li><li><a class="tile" href="#cap-domain-compliance"><b>Domain and regulatory test design</b><span>Write test cases for story 1234, covering our DORA and PSD2 obligations</span></a></li><li><a class="tile" href="#cap-exploratory-testing"><b>Exploratory testing of a story</b><span>Explore story 1234 and find bugs</span></a></li></ul></div>
381
- <div class="area"><a class="area-name" href="#area-automated-tests"><span class="mono">Automated tests</span></a><ul class="tiles"><li><a class="tile" href="#cap-write-tests"><b>Turn a passed run into an automated test</b><span>Write a Playwright test for that run in ../app</span></a></li><li><a class="tile" href="#cap-heal-tests"><b>Heal failing tests</b><span>Heal the failing tests in ../app</span></a></li><li><a class="tile" href="#cap-find-run-tests"><b>Find and run existing tests</b><span>Run the checkout tests</span></a></li><li><a class="tile" href="#cap-flaky-tests"><b>Flaky test detection and quarantine</b><span>Which tests are flaky?</span></a></li></ul></div>
381
+ <div class="area"><a class="area-name" href="#area-automated-tests"><span class="mono">Automated tests</span></a><ul class="tiles"><li><a class="tile" href="#cap-write-tests"><b>Turn a passed run into an automated test</b><span>Write a Playwright test for that run in ../app</span></a></li><li><a class="tile" href="#cap-heal-tests"><b>Heal failing tests</b><span>Heal the failing tests in ../app</span></a></li><li><a class="tile" href="#cap-find-run-tests"><b>Find and run existing tests</b><span>Run the checkout tests</span></a></li><li><a class="tile" href="#cap-regression-packs"><b>Regression packs for a release</b><span>Build a regression pack for sprint 12 and run it on TestMu</span></a></li><li><a class="tile" href="#cap-flaky-tests"><b>Flaky test detection and quarantine</b><span>Which tests are flaky?</span></a></li></ul></div>
382
382
  <div class="area"><a class="area-name" href="#area-pull-requests"><span class="mono">Pull requests</span></a><ul class="tiles"><li><a class="tile" href="#cap-pr-review"><b>Review pull requests</b><span>Review PR 42 and focus on error handling</span></a></li><li><a class="tile" href="#cap-pr-impact"><b>Pull request impact and test selection</b><span>What does PR 42 impact?</span></a></li></ul></div>
383
383
  <div class="area"><a class="area-name" href="#area-api"><span class="mono">API</span></a><ul class="tiles"><li><a class="tile" href="#cap-api-testing"><b>API and contract testing</b><span>Turn the last run's API calls into tests</span></a></li></ul></div>
384
384
  <div class="area"><a class="area-name" href="#area-quality"><span class="mono">Quality</span></a><ul class="tiles"><li><a class="tile" href="#cap-accessibility-performance"><b>Accessibility and page performance</b><span>Is the checkout page accessible?</span></a></li><li><a class="tile" href="#cap-visual-comparison"><b>Visual comparison with baselines</b><span>What changed visually since the last run?</span></a></li><li><a class="tile" href="#cap-defect-intelligence"><b>Defect intelligence: trends and prediction</b><span>Which defects keep coming back?</span></a></li></ul></div>
@@ -1127,10 +1127,10 @@ forgeqe suite cases.yaml --no-code --no-write-back --out .forgeqe/reports/smoke
1127
1127
  </article>
1128
1128
  <article class="spec feat" id="cap-test-case-quality">
1129
1129
  <div class="hd"><span class="mono">Test cases</span><h3>Check and improve test cases</h3></div>
1130
- <p class="ds">Checks test cases before they run (vague or missing expected results, missing test data, placeholders, duplicates) against the story, feature, and epic they test, then rewrites Azure DevOps cases once the user agrees.</p>
1130
+ <p class="ds">Checks test cases before they run (vague or missing expected results, missing test data, placeholders, duplicates) against the story, feature, and epic they test, then rewrites Azure DevOps or Jira cases in place once the user agrees.</p>
1131
1131
  <div class="facts">
1132
1132
  <div class="fact"><span class="mono">Ask it</span><ul class="asks"><li>Are the cases in test plan 12 good enough to run?</li><li>Fix the expected results of case 4512</li></ul></div>
1133
- <div class="fact"><span class="mono">What it needs</span><ul class="needs"><li><span class="need opt">Optional</span><span>Azure DevOps, to rewrite cases in place: set up under sources: in forgeqe.yaml, or sign in with /auth</span></li></ul></div>
1133
+ <div class="fact"><span class="mono">What it needs</span><ul class="needs"><li><span class="need opt">Optional</span><span>Azure DevOps or Jira, to rewrite cases in place: set up under sources: in forgeqe.yaml, or sign in with /auth</span></li></ul></div>
1134
1134
  <div class="fact"><span class="mono">Tools</span><p class="tools"><code>check_test_cases</code> <code>update_test_case</code></p></div>
1135
1135
  </div>
1136
1136
  <div class="detail"><span class="mono">In detail</span>
@@ -1167,11 +1167,11 @@ forgeqe suite cases.yaml --no-code --no-write-back --out .forgeqe/reports/smoke
1167
1167
  </article>
1168
1168
  <article class="spec feat" id="cap-write-test-cases">
1169
1169
  <div class="hd"><span class="mono">Test cases</span><h3>Write test cases from a story</h3></div>
1170
- <p class="ds">Writes test cases from a story's acceptance criteria and saves them in Azure DevOps or Jira, linked to the story.</p>
1170
+ <p class="ds">Writes test cases from a story's acceptance criteria and saves them in Azure DevOps or Jira, linked to the story. Reads the cases already linked first, so asking again adds only what is missing and updates cases in place instead of duplicating them; plans end-to-end journeys from the existing cases.</p>
1171
1171
  <div class="facts">
1172
- <div class="fact"><span class="mono">Ask it</span><ul class="asks"><li>Write test cases for story 1234 and save them</li></ul></div>
1172
+ <div class="fact"><span class="mono">Ask it</span><ul class="asks"><li>Write test cases for story 1234 and save them</li><li>Build an end-to-end journey from story 1234's cases</li></ul></div>
1173
1173
  <div class="fact"><span class="mono">What it needs</span><ul class="needs"><li><span class="need req">Required</span><span>Azure DevOps or Jira: set up under sources: in forgeqe.yaml, or sign in with /auth</span></li></ul></div>
1174
- <div class="fact"><span class="mono">Tools</span><p class="tools"><code>save_test_cases</code></p></div>
1174
+ <div class="fact"><span class="mono">Tools</span><p class="tools"><code>story_test_cases</code> <code>save_test_cases</code> <code>e2e_journey</code></p></div>
1175
1175
  </div>
1176
1176
  <div class="detail"><span class="mono">In detail</span>
1177
1177
  <p class="see">See <a href="#doc-how_to_use-where-cases-come-from">Where cases come from</a>.</p>
@@ -1502,6 +1502,53 @@ Run the tests added since 2026-09-01
1502
1502
  </section>
1503
1503
  </div>
1504
1504
  </article>
1505
+ <article class="spec feat" id="cap-regression-packs">
1506
+ <div class="hd"><span class="mono">Automated tests</span><h3>Regression packs for a release</h3></div>
1507
+ <p class="ds">Builds a regression pack from what goes into a release (an Azure DevOps sprint or work items, a commit range, pull requests, or changes read from any connected tool): the tests those changes can break, each with why, plus risk-area and smoke tests, and the changes no test covers. Runs it locally, on TestMu AI, or in a pipeline, and compares each run with the last.</p>
1508
+ <div class="facts">
1509
+ <div class="fact"><span class="mono">Ask it</span><ul class="asks"><li>Build a regression pack for sprint 12 and run it on TestMu</li><li>Which tests should we run for the PRs merged this week?</li></ul></div>
1510
+ <div class="fact"><span class="mono">What it needs</span><ul class="needs"><li><span class="need input">You give</span><span>a repository with tests</span></li><li><span class="need opt">Optional</span><span>Azure DevOps or Jira, to read a sprint's or release's work items: set up under sources: in forgeqe.yaml, or sign in with /auth</span></li></ul></div>
1511
+ <div class="fact"><span class="mono">Tools</span><p class="tools"><code>build_regression_pack</code> <code>run_regression_pack</code> <code>list_regression_packs</code></p></div>
1512
+ </div>
1513
+ <div class="detail"><span class="mono">In detail</span>
1514
+ <section class="doc" id="doc-how_to_use-regression-packs-for-a-release">
1515
+ <h4>Regression packs for a release</h4>
1516
+ <div class="prose"><p>A regression pack is the set of your repository's tests that a release's changes can break, saved under a name so you can run it again (here, on TestMu AI, or in a pipeline) and compare runs. Ask in your own words:</p>
1517
+ <pre><code class="language-text">Build a regression pack for sprint 12 and run it on TestMu
1518
+ Which tests should we run for the PRs merged this week?
1519
+ Build a pack for Jira fix version 2.4 and the commits since release/2.3 in ../shop-app
1520
+ </code></pre>
1521
+ <p><strong>Where the changes come from.</strong> Any mix of:</p>
1522
+ <ul>
1523
+ <li>an Azure DevOps sprint, area, epic or feature, or work item ids: their stories and bugs, the test cases each is tested by, and the files their linked pull requests changed;</li>
1524
+ <li>the commits between two refs of a repository (<code>from</code> and <code>to</code>): the product's repository, or the test repository's own; work items the commit messages name (<code>AB#123</code>, <code>#123</code>, <code>PAY-12</code>) are read too;</li>
1525
+ <li>pull requests by number or URL, or the ones merged in the last N days (Azure DevOps or GitHub);</li>
1526
+ <li>anything ForgeQE's agent can read through its connected tools (a Jira release, GitHub issues, a Confluence release note): it reads the items and passes them in with their text and links.</li>
1527
+ </ul>
1528
+ <p><strong>Why each test is in.</strong> A test can be in for more than one reason, and the card and <code>&lt;name&gt;.md</code> say each one:</p>
1529
+ <div class="tbl"><table>
1530
+ <thead>
1531
+ <tr><th>Reason</th><th>Meaning</th></tr>
1532
+ </thead>
1533
+ <tbody>
1534
+ <tr><td>linked</td><td>it automates a test case that tests a changed work item (<code>.forgeqe/test-cases.json</code>, or a case id in the test's attributes)</td></tr>
1535
+ <tr><td>test code changed</td><td>the change is in the test repository, in code the test uses</td></tr>
1536
+ <tr><td>matches a change</td><td>the work item's or pull request's words name what the test does: the elements it uses, its page, its name</td></tr>
1537
+ <tr><td>risk area</td><td>the release touches an area with defects or failures before, and the test works there</td></tr>
1538
+ <tr><td>smoke</td><td>the test is tagged smoke, so it is in every pack</td></tr>
1539
+ </tbody>
1540
+ </table></div>
1541
+ <p><strong>Gaps.</strong> Changes no test is in for are listed as <em>not covered</em>, each with the closest existing test and what it lacks, so you can extend that test rather than write a new one.</p>
1542
+ <p><strong>Running it.</strong> ForgeQE asks before it runs anything.</p>
1543
+ <ul>
1544
+ <li><em>This machine</em>: ForgeQE builds one command for exactly the pack's tests, the way the repository already runs a test (for .NET, a <code>--filter</code> with each test, the settings an earlier job used, TRX results), runs it, and reads each result. A failed test runs once more; one that then passes is flaky.</li>
1545
+ <li><em>TestMu AI</em>: the same command, with the variable <code>FORGEQE_PW_WS_ENDPOINT</code> set to TestMu AI's Playwright endpoint for the browser and platform in <code>testmu.yaml</code> (the access key goes in the variable, never in the command, and is removed from the output). The tests must connect to it when it is set: for NUnit, override <code>ConnectOptionsAsync</code> in the test base class; for Playwright Test, set <code>connectOptions</code> from it in <code>playwright.config</code>. ForgeQE refuses a TestMu run when the tests do not read the variable, so a run never looks remote while it ran locally.</li>
1546
+ </ul>
1547
+ <p>Each run is kept with the pack: the card says which tests fail now that passed in the last run, and which were fixed. Packs are saved in <code>.forgeqe/packs/&lt;name&gt;.json</code> and <code>&lt;name&gt;.md</code>; run output and results in <code>.forgeqe/reports/packs/&lt;name&gt;/&lt;time&gt;/</code>.</p>
1548
+ </div>
1549
+ </section>
1550
+ </div>
1551
+ </article>
1505
1552
  <article class="spec feat" id="cap-flaky-tests">
1506
1553
  <div class="hd"><span class="mono">Automated tests</span><h3>Flaky test detection and quarantine</h3></div>
1507
1554
  <p class="ds">Finds tests that flip between passing and failing in the repository's run history, with their likely cause, and quarantines them once the user agrees.</p>
@@ -75,6 +75,13 @@ memory:
75
75
  dir: ./.forgeqe/memory # pages, elements, locators, and recorded flows
76
76
  replay: verify # verify | trust | off
77
77
 
78
+ # Cost-aware execution (docs/COST_ARCHITECTURE.md), on by default. on: a rerun of a passed run (the rerun link,
79
+ # /rerun, "run it again", the same goal word for word) runs as recorded without the agent, and a replay whose
80
+ # recorded checks all hold passes with no model; anything else, or any check that fails, goes to the agent.
81
+ # shadow: only records what it would have done (.forgeqe/registry). off: every request goes to ForgeQE's agent.
82
+ registry:
83
+ mode: on # on | shadow | off
84
+
78
85
  code:
79
86
  # repo: ../my-app # where passed runs become tests (default: the current folder; --no-code turns it off)
80
87
  # test_command: npx playwright test # the repo's test command, for forgeqe heal; default: the agent finds it
@@ -114,6 +121,14 @@ report:
114
121
  screenshots: all # all | failures | off: step screenshots in report.html
115
122
  accessibility: true # check each page the agent visits (names, labels, image text, contrast, lang, zoom)
116
123
 
124
+ # Model spending budgets, in the price currency. They only warn (at 80%, 90% and 100%) and never stop a run.
125
+ # Day and month (UTC) count every ForgeQE process on this machine, from the usage ledger in ~/.forgeqe/usage.
126
+ # budget:
127
+ # run: 2 # one browser run
128
+ # day: 25
129
+ # month: 400
130
+ # # currency: USD # default: the currency of the model's price
131
+
117
132
  # Offline BI with Evidence: ForgeQE exports CSV datasets and runs Evidence (@evidence-dev/evidence 40.x, needs Node.js)
118
133
  # to build a static site, no always-on server. forgeqe bi init scaffolds the Evidence project, forgeqe bi sync refreshes
119
134
  # the data, forgeqe bi build does both and builds the site; without Node.js, or with --static, it writes ForgeQE's own
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capagents/forgeqe",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "description": "ForgeQE: a browser agent CLI that runs goals and test cases in local Chrome or Chromium, or BrowserStack and TestMu AI/LambdaTest when configured, and turns passing runs into tests in your repo",
5
5
  "license": "MIT",
6
6
  "type": "module",