@cratis/pi 7.142.1 → 7.143.1
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.
- package/package/corpus/harnesses/copilot/instructions/profiles.instructions.md +1 -0
- package/package/corpus/harnesses/copilot/instructions/secrets.instructions.md +8 -8
- package/package/corpus/hooks/README.md +39 -1
- package/package/corpus/hooks/scripts/cratis-guard-secrets.sh +150 -18
- package/package/corpus/hooks/scripts/cratis-guard-shell-writes.sh +39 -7
- package/package/corpus/prompts/reverse-engineer.prompt.md +50 -0
- package/package/corpus/rules/profiles.md +1 -0
- package/package/corpus/rules/secrets.md +8 -8
- package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +3 -4
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/evidence-format.md +146 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/understanding-pipeline.md +58 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/verification.json +14 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/SKILL.md +13 -14
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/evidence-table-template.md +15 -18
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/loss-report-template.md +1 -1
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/neighbouring-skills.md +2 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/prologue-safety.md +9 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/re-entry-and-passes.md +6 -6
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/verification.json +9 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/SKILL.md +1 -0
- package/package/corpus/skills/cratis-screenplay-reverse-engineering/LICENSE +14 -0
- package/package/corpus/skills/cratis-screenplay-reverse-engineering/SKILL.md +180 -0
- package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/documentation-intake-and-screens.md +108 -0
- package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/evidence-format.md +43 -0
- package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/executable-intake.md +125 -0
- package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/fidelity-check.md +141 -0
- package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/ground-truth-benchmark.md +75 -0
- package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/intake-sources.md +87 -0
- package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/neighbouring-skills.md +17 -0
- package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/probing-and-naming.md +87 -0
- package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/provenance.md +11 -0
- package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/scoping.md +79 -0
- package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/synthesis-rules.md +140 -0
- package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/target-and-first-validation.md +42 -0
- package/package/corpus/skills/cratis-screenplay-reverse-engineering/verification.json +29 -0
- package/package/profile-catalog.json +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Ground-truth fidelity benchmark
|
|
2
|
+
|
|
3
|
+
Measures how closely a model rebuilt from observation matches an application whose own model is
|
|
4
|
+
known. Use it to judge a skill change: run the same app and the same inputs before and after, and
|
|
5
|
+
compare two scores. It needs an application you own, with its original model and source.
|
|
6
|
+
|
|
7
|
+
## Contents
|
|
8
|
+
|
|
9
|
+
- Rubric
|
|
10
|
+
- Scores
|
|
11
|
+
- Procedure
|
|
12
|
+
- Quirk classification
|
|
13
|
+
- Regression-suite convention
|
|
14
|
+
|
|
15
|
+
## Rubric
|
|
16
|
+
|
|
17
|
+
Compare the rebuilt model with the original, category by category, as an inventory: each original
|
|
18
|
+
item is exact, renamed, partial or missing; each rebuilt item with no original is extra.
|
|
19
|
+
|
|
20
|
+
| Category | Weight | Counted |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| Commands | .20 | names and fields |
|
|
23
|
+
| Events | .15 | names and fields |
|
|
24
|
+
| Read models and queries | .15 | fields, and queries |
|
|
25
|
+
| Screens | .15 | screens and their actions |
|
|
26
|
+
| Constraints and validation | .15 | rules on commands and concepts |
|
|
27
|
+
| Concepts | .10 | concept types |
|
|
28
|
+
| Specifications | .03 | scenarios |
|
|
29
|
+
| Hand-written rules | .07 | rules that live in code, not in the model |
|
|
30
|
+
|
|
31
|
+
Per category report recall (original items found) and precision (rebuilt items that exist in the
|
|
32
|
+
original). Score a category as `(structural exact + 0.5 x partial) / original items`; use recall
|
|
33
|
+
alone where precision is 1. Structural match compares names and base types; strict match also
|
|
34
|
+
compares concept types. Fidelity is `sum(weight x score)`.
|
|
35
|
+
|
|
36
|
+
## Scores
|
|
37
|
+
|
|
38
|
+
Two summary scores carry the result; quote only these:
|
|
39
|
+
|
|
40
|
+
- **Structure**: commands, events, read models, screens and concepts.
|
|
41
|
+
- **Rules**: constraints and validation, hand-written rules and specifications.
|
|
42
|
+
|
|
43
|
+
A model often gets the structure right and the rules wrong or missing; the split shows it.
|
|
44
|
+
|
|
45
|
+
## Procedure
|
|
46
|
+
|
|
47
|
+
1. **Blind run.** The runner rebuilds the model from the running app and its allowed inputs, with
|
|
48
|
+
the original model and source hidden from it.
|
|
49
|
+
Blind-run hygiene: the run under test never reads prior scoring, fidelity reports or the
|
|
50
|
+
original model before its own model is final. Artifacts the original serves that restate its
|
|
51
|
+
model (for a Stage/Arc original: the served scene and generated proxies) are excluded, or
|
|
52
|
+
recorded as a separate evidence class and reported, because they inflate structure scores.
|
|
53
|
+
2. **Compare** on read-only copies of both models and the source. Read the generated source for
|
|
54
|
+
behavior ground truth. Do not re-run the rebuilt model's own checks as part of the scoring.
|
|
55
|
+
3. **Classify quirks** (below) before counting a difference against the skill.
|
|
56
|
+
4. **Rerun after each skill change** on the same app with the same inputs and weights. If a change
|
|
57
|
+
alters the weights or categories, change this rubric in the same edit.
|
|
58
|
+
5. **Record** the full result in the lane's untracked `.ai-work/` folder; quote only the two
|
|
59
|
+
scores in an issue or pull request. Scores never enter the corpus.
|
|
60
|
+
|
|
61
|
+
## Quirk classification
|
|
62
|
+
|
|
63
|
+
Mark each difference as one of:
|
|
64
|
+
|
|
65
|
+
- **original defect**: the original behaves oddly and the rebuild copied what was observed.
|
|
66
|
+
- **misreading**: the rebuild read the evidence wrongly or invented a rule.
|
|
67
|
+
- **correct**: the rebuild is right and the original model differs only in form.
|
|
68
|
+
|
|
69
|
+
Only misreadings and missing items count against the skill.
|
|
70
|
+
|
|
71
|
+
## Regression-suite convention
|
|
72
|
+
|
|
73
|
+
Each platform issue found by a benchmark app (in Screenplay or Stage) gets a minimal model that
|
|
74
|
+
should validate and run once the issue is fixed, kept with that issue. This reference names the
|
|
75
|
+
convention only; it does not claim a tracked suite.
|
package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/intake-sources.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Intake sources
|
|
2
|
+
|
|
3
|
+
Each source writes rows into the same evidence file (`evidence-format.md`). Record what was
|
|
4
|
+
used, what was missing and what each source cannot show. Order: the running system and its
|
|
5
|
+
features first, then the shipped executable, source code last.
|
|
6
|
+
|
|
7
|
+
## Contents
|
|
8
|
+
|
|
9
|
+
- Choosing sources
|
|
10
|
+
- Running app (UI walk)
|
|
11
|
+
- HAR captures
|
|
12
|
+
- OpenAPI documents
|
|
13
|
+
- Screenshots
|
|
14
|
+
- Product documents
|
|
15
|
+
- Shipped executable
|
|
16
|
+
- Source code
|
|
17
|
+
|
|
18
|
+
## Choosing sources
|
|
19
|
+
|
|
20
|
+
| Source | Shows well | Cannot show |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| UI walk | screens, journeys, visible rejections, what a view lists | server rules, authorization, events, idempotency |
|
|
23
|
+
| HAR | exact requests and responses, status codes, field names, ordering | intent, rules that did not trigger, anything not exercised |
|
|
24
|
+
| OpenAPI | the declared surface: routes, inputs, response shapes, auth schemes | behavior, rules, whether a route is used or accurate |
|
|
25
|
+
| Screenshots | what a person saw when no live app is available | structure; treat as weak and say so |
|
|
26
|
+
| Documents | stated purpose, vocabulary, roles, policies | what the system actually does |
|
|
27
|
+
| Executable | exposed commands, menus, routes, strings, embedded schemas, files written, endpoints | whether users reach a feature, rules; see `executable-intake.md` |
|
|
28
|
+
| Source (last, optional) | rules, branches, jobs, schemas | what is deployed or used; see legacy extraction |
|
|
29
|
+
|
|
30
|
+
Combine at least two kinds before claiming a rule. One source alone gives a candidate, not a fact.
|
|
31
|
+
|
|
32
|
+
## Running app (UI walk)
|
|
33
|
+
|
|
34
|
+
Follow `../../cratis-screenplay-legacy-extraction/references/ui-observation.md`: capability check,
|
|
35
|
+
two questions at most, approved test identity, bounded and state-aware walk, before/after
|
|
36
|
+
states, grouping into flows. Differences for this skill:
|
|
37
|
+
|
|
38
|
+
- Observation ids use the `OBS-` prefix and are the locators for evidence rows (the state id).
|
|
39
|
+
- Keep page text and the visible rejection text exactly; screenshots only on a state change that
|
|
40
|
+
text does not show, saved under `captures/screens/` with the state id in the file name.
|
|
41
|
+
- Writes need approval naming the target and action. A read-only walk covers navigation, lists
|
|
42
|
+
and details; submit forms only with approved example values.
|
|
43
|
+
- Log out and destructive actions are skipped unless the brief names them.
|
|
44
|
+
|
|
45
|
+
## HAR captures
|
|
46
|
+
|
|
47
|
+
- Obtain the HAR from an approved session (browser devtools export) or from the walk.
|
|
48
|
+
- **Scrub first**: remove cookies, `Set-Cookie`, `Authorization`, API keys, CSRF and session
|
|
49
|
+
tokens, and personal values from request and response bodies, before extraction or any hosted
|
|
50
|
+
model. Verify by searching the scrubbed file for the header names and for token-shaped
|
|
51
|
+
strings. Keep only the scrubbed copy under `captures/`; delete the raw export.
|
|
52
|
+
- Digest with a script, not the model: group entries by method plus route template, then record
|
|
53
|
+
status-code mix, request field names, response field names, call order and timing. Drop static
|
|
54
|
+
assets, analytics and third-party hosts.
|
|
55
|
+
- Locator: `har:<file>#<entry index>` or a request id from the digest.
|
|
56
|
+
- Only claim an effect the capture confirms (a 201 plus a later read showing the item). A 200
|
|
57
|
+
with no follow-up read is a request, not a confirmed change.
|
|
58
|
+
|
|
59
|
+
## OpenAPI documents
|
|
60
|
+
|
|
61
|
+
- Treat the document as a claim about the surface. Each operation is an L0 inventory row.
|
|
62
|
+
- Locator: `openapi:<operationId or METHOD path>`. Strength: `Declared`.
|
|
63
|
+
- Mutating operations are command candidates; `GET` operations are query candidates. Names are
|
|
64
|
+
hints only. Parameters and schemas give field names, types, required flags and enums.
|
|
65
|
+
- Cross-check with the HAR or walk: unused operations and undocumented calls are both findings.
|
|
66
|
+
|
|
67
|
+
## Screenshots
|
|
68
|
+
|
|
69
|
+
Use when no live app exists. Locator: file name plus a short description of the region. Strength
|
|
70
|
+
`Stated` at best; read visible labels as business terms, and record anything legible only by
|
|
71
|
+
inference as `unknown`. Do not send screenshots with personal data to a hosted model without
|
|
72
|
+
approval.
|
|
73
|
+
|
|
74
|
+
## Product documents
|
|
75
|
+
|
|
76
|
+
Locator: document title plus section heading or page. Strength `Stated`. Documents give
|
|
77
|
+
vocabulary, roles and intended rules; where they disagree with an observation, keep both rows
|
|
78
|
+
and mark the conflict.
|
|
79
|
+
|
|
80
|
+
## Shipped executable
|
|
81
|
+
|
|
82
|
+
A native binary, bundle, .NET assembly, APK, CLI tool, installer or container image. Read
|
|
83
|
+
[executable-intake.md](executable-intake.md) for safe handling, what to inventory and locators.
|
|
84
|
+
|
|
85
|
+
## Source code
|
|
86
|
+
|
|
87
|
+
Last and optional: when offered, use `cratis-screenplay-legacy-extraction` (locator `path:start-end`, strength `Read`).
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Neighbouring skills
|
|
2
|
+
|
|
3
|
+
Which skill owns each task next to reverse engineering.
|
|
4
|
+
|
|
5
|
+
- Faithful migration or documentation with the source, `file:line` evidence, loss report and
|
|
6
|
+
expert verification: `cratis-screenplay-legacy-extraction`.
|
|
7
|
+
- Greenfield discovery from interviews or documents: `cratis-screenplay-discovery`; slice
|
|
8
|
+
shapes: `cratis-screenplay-slice-design`; identity and invariants:
|
|
9
|
+
`cratis-screenplay-streams-and-consistency`; integrations and jobs:
|
|
10
|
+
`cratis-screenplay-automations-and-translations`; coverage:
|
|
11
|
+
`cratis-screenplay-scenario-coverage`.
|
|
12
|
+
- Editing the model through MCP: `cratis-screenplay-model-authoring`; review:
|
|
13
|
+
`cratis-screenplay-model-review`; rendering and gap-fill:
|
|
14
|
+
`cratis-screenplay-render-and-gap-fill`; Stage blocks and the sandbox:
|
|
15
|
+
`cratis-stage-rendering-and-sandbox`.
|
|
16
|
+
- Syntax and verdicts: `cratis-screenplay-toolchain`; phases, identity and acceptance:
|
|
17
|
+
`cratis-screenplay-modeling-lifecycle`; running Chronicle: `cratis-chronicle-cli-operations`.
|
package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/probing-and-naming.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Probing, time, naming and defects
|
|
2
|
+
|
|
3
|
+
What a walk must exercise beyond the happy path, and how to label what it cannot observe. Rows
|
|
4
|
+
follow [evidence-format.md](evidence-format.md). Probes are writes: they need the write approval
|
|
5
|
+
of the walk, on a target the user owns.
|
|
6
|
+
|
|
7
|
+
## Boundary probes
|
|
8
|
+
|
|
9
|
+
Rules that were never submitted are never seen. For every command reached in the walk, probe
|
|
10
|
+
each input and record one row per probe (accepted or rejected, plus the exact message):
|
|
11
|
+
|
|
12
|
+
- empty required text, and whitespace only;
|
|
13
|
+
- over-long text, past any limit the form or schema hints at;
|
|
14
|
+
- zero and negative numbers, and the largest plausible value;
|
|
15
|
+
- repeat submit of the same payload;
|
|
16
|
+
- an unknown or foreign id;
|
|
17
|
+
- **limit + 1**: when a limit is suspected, probe the boundary and one past it (100 and 101 for a
|
|
18
|
+
100 limit), and the common sibling limits (50, 100, 200, 255) when a sibling field has one;
|
|
19
|
+
"100 accepted" alone proves no limit;
|
|
20
|
+
- **field combinations**: a rule that fails only when several fields are empty together
|
|
21
|
+
(at-least-one-of, mutually dependent fields) never shows in per-field probes. Probe all
|
|
22
|
+
fields empty, each one empty alone, and all filled;
|
|
23
|
+
- a duplicate is a second, distinct id with the same value, sent sequentially; read the body.
|
|
24
|
+
|
|
25
|
+
Read the command schema as well as the form: concept names (`x-concept`), enums, required flags
|
|
26
|
+
and formats show value types the screen hides. A field or probe not run is recorded as
|
|
27
|
+
`not probed`, never left silent.
|
|
28
|
+
|
|
29
|
+
Copy `validationResults[].message` verbatim into the rule's `message` and note the member and
|
|
30
|
+
the reason: a framework typing failure is not a model rule. Use fresh ids and a marker on test
|
|
31
|
+
data for every run, in a sandbox instance, so repeated sweeps do not pollute read models.
|
|
32
|
+
An out-of-range or missing value that is coerced or crashes (missing enum defaults to the first
|
|
33
|
+
member, overflow wraps, missing id gives HTTP 500) is an observed defect, not intent: record
|
|
34
|
+
it under "Observed defects" and model the intended behavior.
|
|
35
|
+
|
|
36
|
+
## Confirm surprises and enumerate the query surface
|
|
37
|
+
|
|
38
|
+
A result that contradicts a standard pattern (a uniqueness constraint that accepts a duplicate,
|
|
39
|
+
"no validation at all") needs a confirming second probe, designed differently, before it
|
|
40
|
+
becomes a row; until then it is `unconfirmed`. A wrong `Confirmed` row is worse than a gap.
|
|
41
|
+
|
|
42
|
+
The UI shows only the queries its screens use. On a system the team owns or is authorized to
|
|
43
|
+
probe (the owned-only limit above holds), also enumerate the surface from your own traffic and
|
|
44
|
+
the schema: by-id lookups, filters and argument variants of each query, and the routes seen in
|
|
45
|
+
the capture. Read the error text for required arguments. A query that returns HTTP 202 or
|
|
46
|
+
`isReady: false` is warming up: retry after a few seconds before recording it empty.
|
|
47
|
+
|
|
48
|
+
## Time-based views
|
|
49
|
+
|
|
50
|
+
A query, screen or filter whose name or text mentions time (overdue, due today, dormant, recent)
|
|
51
|
+
has a threshold that only data can reveal. Seed records through the commands' own date fields:
|
|
52
|
+
received or activity dates far in the past, due yesterday, today and tomorrow, done and not done.
|
|
53
|
+
Diff the result sets to find the boundary. If a threshold could not be exercised, record the
|
|
54
|
+
placeholder value as an `unknown` with a question; never ship a guessed number unrecorded.
|
|
55
|
+
The server's time zone and its "today" are standing unknowns: seed near midnight and with
|
|
56
|
+
backdated dates, and look for a zone setting or response header. A today-relative rule the
|
|
57
|
+
dialect cannot express is a comment plus an `event-model.md` gap row, not a guessed filter.
|
|
58
|
+
|
|
59
|
+
## Client-side or server-side
|
|
60
|
+
|
|
61
|
+
A rejection seen only in a UI form is a hypothesis: the form may validate what the server
|
|
62
|
+
accepts. Confirm with a direct API call (or the same field on a sibling command) before modeling
|
|
63
|
+
a rule. Mark each rule row `client-side`, `server-side` or `unconfirmed` in `fact` or
|
|
64
|
+
`unknowns`. Prefer the API response over the form when they differ; an unconfirmed rule is
|
|
65
|
+
modeled as a question, not a `validate` line.
|
|
66
|
+
|
|
67
|
+
## Naming fidelity
|
|
68
|
+
|
|
69
|
+
When the target exposes artifact names (command, field, concept and route names in the UI,
|
|
70
|
+
schema or OpenAPI), record that those names are `Observed`. Event names, streams, event payloads
|
|
71
|
+
and read-model, query and screen names that are not exposed are `Inferred`: label them as
|
|
72
|
+
inferred in model comments, and report naming fidelity separately from structural fidelity,
|
|
73
|
+
because an exposed command name makes its past-tense event name look confirmed when it is not.
|
|
74
|
+
|
|
75
|
+
## Observed defects
|
|
76
|
+
|
|
77
|
+
Model behavior that looks like a defect (a stale join, a missing filter) as observed, with a
|
|
78
|
+
comment flagging the suspected defect, and specify it so the round-trip proves the model is
|
|
79
|
+
faithful. List each in a findings section of the report for the owner to decide; never fix one
|
|
80
|
+
silently, and never present it as intended.
|
|
81
|
+
|
|
82
|
+
## Queries the renderer can serve
|
|
83
|
+
|
|
84
|
+
When an observed rule is expressible declaratively (filter, join, sort, count), prefer a
|
|
85
|
+
declarative query. A code-performed query is opaque: `cratis run` cannot serve it and
|
|
86
|
+
specifications cannot execute it. Record each opaque query as `unverified` in the fidelity
|
|
87
|
+
result and the report.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Provenance
|
|
2
|
+
|
|
3
|
+
| Content | Source | License | How used |
|
|
4
|
+
|---|---|---|---|
|
|
5
|
+
| Evidence rows that carry explicit unknowns, source kinds and locators (`references/evidence-format.md`); static before dynamic, per-kind techniques, tracing a feature across IPC, network and storage, and treating process capture as unisolated (`references/executable-intake.md`); fidelity verification ideas: behavior ledger with case kinds, undecided never passing, authority matching the claim, negative controls, read-only probes of owned originals, withheld effects, run provenance (`references/fidelity-check.md`) | morluto/rea (https://github.com/morluto/rea) | MIT | Ideas only, restated in our own wording and fields; no upstream text or schema is reused |
|
|
6
|
+
| The bounded, state-aware UI walk | Martin Dilger and Nebulit GmbH, agentic-engineer and Eventmodelers Build-Kits, used with their explicit consent; adapted in `cratis-screenplay-legacy-extraction` | see that skill's `LICENSE` and provenance | Referenced, not copied: this skill points to `ui-observation.md` and `signal-to-intent.md` there |
|
|
7
|
+
| Inverse event modeling: following one flow from entry point to persisted effect | Martin Dilger, "Inverse Event Modeling" | idea only | Credited as an idea; no text is reused |
|
|
8
|
+
| Workflow, safety rules, synthesis and fidelity references | Cratis/AI corpus | MIT (Cratis) | Own work |
|
|
9
|
+
|
|
10
|
+
The method spine (L0-L4, evidence ladder, hosted-model disclosure rule) is the legacy extraction
|
|
11
|
+
skill's; see its `references/provenance.md` for the full table of adapted sources.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Scoping a reverse engineering run
|
|
2
|
+
|
|
3
|
+
A system rarely needs to be modeled whole. The user names the key areas they want (for example,
|
|
4
|
+
from a CRM: contacts, companies and the deal pipeline, not marketing email or invoicing) and only
|
|
5
|
+
those become the model. Scope is decided at intake, applied to the inventory, and carried through
|
|
6
|
+
the walk, synthesis and fidelity check.
|
|
7
|
+
|
|
8
|
+
## Contents
|
|
9
|
+
|
|
10
|
+
- Scope statement
|
|
11
|
+
- Tagging the inventory
|
|
12
|
+
- Dependency closure
|
|
13
|
+
- Boundary modeling
|
|
14
|
+
- Walk, probes and evidence
|
|
15
|
+
- Growing the model
|
|
16
|
+
- Changing scope later
|
|
17
|
+
|
|
18
|
+
## Scope statement
|
|
19
|
+
|
|
20
|
+
Record one statement at intake: the target capabilities that are **in**, and what is explicitly
|
|
21
|
+
**out**. Reuse the user's words.
|
|
22
|
+
|
|
23
|
+
If the user gave no scope, do not start modeling or walking deep. Build the L0 feature inventory
|
|
24
|
+
first (a cheap map of everything visible), propose a scope from it, and ask once. That question
|
|
25
|
+
counts toward the intake question budget. With no answer, default to the smallest coherent core:
|
|
26
|
+
the feature the user named or the entry flow, plus its dependency closure.
|
|
27
|
+
|
|
28
|
+
## Tagging the inventory
|
|
29
|
+
|
|
30
|
+
Tag every L0 feature **in**, **out** or **boundary** (an out-of-scope feature that an in-scope one
|
|
31
|
+
refers to). List out-of-scope features by name and source, then stop: never walk, probe or model
|
|
32
|
+
them. An out-of-scope entry costs one line.
|
|
33
|
+
|
|
34
|
+
## Dependency closure
|
|
35
|
+
|
|
36
|
+
When an in-scope feature needs another (a deal needs a company), pull in the minimum: its identity
|
|
37
|
+
plus the fields the in-scope feature displays or uses. Record why it was pulled in, citing the
|
|
38
|
+
in-scope feature. Nothing of its rules, commands or lifecycle comes with it; if more is needed,
|
|
39
|
+
the user widens the scope.
|
|
40
|
+
|
|
41
|
+
## Boundary modeling
|
|
42
|
+
|
|
43
|
+
A reference to an out-of-scope thing becomes either:
|
|
44
|
+
|
|
45
|
+
- a typed reference id (a concept), the default; or
|
|
46
|
+
- a minimal lookup read model fed by a minimal command or event, when the in-scope feature
|
|
47
|
+
displays fields of it.
|
|
48
|
+
|
|
49
|
+
Mark each with a comment so it can be found and replaced:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
// boundary: out of scope (invoicing)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Never model out-of-scope behavior or invariants, even when the capture shows them.
|
|
56
|
+
|
|
57
|
+
## Walk, probes and evidence
|
|
58
|
+
|
|
59
|
+
The UI walk and the probes of
|
|
60
|
+
[probing-and-naming.md](probing-and-naming.md) cover in-scope features and their boundary
|
|
61
|
+
only. Spend the walk budget there. Evidence rows that fall outside scope are dropped, or kept
|
|
62
|
+
with a `scope: out` tag when cheap to keep; they never feed synthesis.
|
|
63
|
+
|
|
64
|
+
## Growing the model
|
|
65
|
+
|
|
66
|
+
Organize the model so scope can grow: one feature area per file or module, with boundary
|
|
67
|
+
references isolated at its edge. Adding an area then adds files instead of reshaping existing ones.
|
|
68
|
+
|
|
69
|
+
Record the scope (in, out, boundary and closure reasons) in the provenance or synthesis notes.
|
|
70
|
+
The fidelity check scores in-scope journeys only and lists the out-of-scope features as not
|
|
71
|
+
covered; do not report them as failed.
|
|
72
|
+
|
|
73
|
+
## Changing scope later
|
|
74
|
+
|
|
75
|
+
Narrowing removes the area's slices (a keep / change / remove decision applies) and turns
|
|
76
|
+
remaining references into boundary references. Widening re-runs intake for the added area only:
|
|
77
|
+
inventory tags, closure, walk, probes and synthesis. Do not re-walk areas whose sources are
|
|
78
|
+
unchanged, and keep evidence ids stable. Replace a boundary lookup with the real slice when its
|
|
79
|
+
area is added.
|
package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/synthesis-rules.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Synthesis rules
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Signal to element
|
|
6
|
+
- Event model readout
|
|
7
|
+
- Intent in the mapping
|
|
8
|
+
- Naming
|
|
9
|
+
- Writing through MCP
|
|
10
|
+
- Specifications
|
|
11
|
+
- Slices and flows
|
|
12
|
+
- Stop conditions
|
|
13
|
+
|
|
14
|
+
How black-box signals become candidate Screenplay elements. Signals are hypotheses: each result
|
|
15
|
+
is a proposal with evidence ids, decided later by a person. The translation rules for code
|
|
16
|
+
signals (tests, generic engines, reference data, ordering) are in
|
|
17
|
+
`../../cratis-screenplay-legacy-extraction/references/signal-to-intent.md`; do not repeat them.
|
|
18
|
+
|
|
19
|
+
## Signal to element
|
|
20
|
+
|
|
21
|
+
| Signal | Candidate | Notes |
|
|
22
|
+
|---|---|---|
|
|
23
|
+
| Observed form submit, or a mutating request (`POST`, `PUT`, `PATCH`, `DELETE`) | a command and a past-tense event | name the business decision, not the verb; one command per decision a person makes |
|
|
24
|
+
| Several requests from one user action | one command; the others are reads or consequences | keep the order seen in the capture |
|
|
25
|
+
| What a screen lists or shows | a read model and a query | built for the screen, not mirrored from tables; each displayed value traces to a command input, a query result or a derivation, else `unknown` |
|
|
26
|
+
| Filters, sorting, search boxes | query parameters on that query | |
|
|
27
|
+
| Before and after state pairs | specifications | given the state before, when the command, then the event and the view after |
|
|
28
|
+
| Rejection or validation message | a refusal rule on the command, with the exact text kept | one specification per observed refusal |
|
|
29
|
+
| Denied or hidden for a role | `authorize` plus a denied specification | only when two roles were observed; otherwise `unknown` |
|
|
30
|
+
| Navigation and journeys | slices and flows | a journey groups slices; a page is not a slice boundary |
|
|
31
|
+
| An email, file or call to another system seen after a command | a reaction or translation | only with an evidenced trigger; see `cratis-screenplay-automations-and-translations` |
|
|
32
|
+
| Server-sent state change without a user action | an automation candidate | usually `unknown` until the trigger is evidenced |
|
|
33
|
+
|
|
34
|
+
## Event model readout
|
|
35
|
+
|
|
36
|
+
Before the first `.play` write, write `event-model.md` in the work area so the human can
|
|
37
|
+
review the behavior in prose. It holds: the actors; a timeline per stream; each command with its
|
|
38
|
+
rules and evidence citations; each view and what feeds it; automations and cascades; state
|
|
39
|
+
machines as a table (status, allowed commands, rejected with) and a diagram; and open questions.
|
|
40
|
+
Mark each rule `sourced` or `assumed` and keep a count of both, so a sparse source shows up as
|
|
41
|
+
such. Ask which rules the dialect can express before the prose settles; a rule it cannot express
|
|
42
|
+
is recorded here as a gap, not dropped. Keep the file current when the model changes, and list
|
|
43
|
+
every rule or automation left out of the run-only copy with its reason (the complete model stays
|
|
44
|
+
the deliverable; see "Runnability" in [fidelity-check.md](fidelity-check.md)).
|
|
45
|
+
|
|
46
|
+
## Intent in the mapping
|
|
47
|
+
|
|
48
|
+
- **Caller identity is not an input.** Model the owner or creator as the signed-in caller
|
|
49
|
+
(authentication, a policy that matches the claim to the subject, `given caller` in
|
|
50
|
+
specifications), never an `actor` or `userId` property the user types. Run with sandbox users
|
|
51
|
+
so the walk can act as each one. Role overrides (host, admin) you cannot express are recorded
|
|
52
|
+
as a gap.
|
|
53
|
+
- **Ask "what would the user have to type?"** Commands a person runs ask only what that person
|
|
54
|
+
knows. Values the system already knows (length, status, notice) come from a protected read in
|
|
55
|
+
the mapping. Derived or internal values (minute of day, minutes until start, day keys) are
|
|
56
|
+
derived, or recorded as a language gap, never exposed as a field. A value computed from text
|
|
57
|
+
(tags parsed from content) is a caller input marked `assumed`.
|
|
58
|
+
- **Data decides, not the user.** Behavior chosen by data (needs confirmation, already paid) is
|
|
59
|
+
one command whose branch lives in a derived property of the read model, not a pair of buttons
|
|
60
|
+
the user picks between. A `produces when` cannot test read state.
|
|
61
|
+
- **Every constraint and guard gets a user-facing `message`.** Without one the UI shows the
|
|
62
|
+
engine text. A missing instance behind a `reads` guard is rejected with a generated message;
|
|
63
|
+
specifications assert that text, not the custom one.
|
|
64
|
+
- **Lists show display values**: the full name or title, not an id, a first name or split
|
|
65
|
+
columns. Pickers and tables use a joined display value; field labels come from
|
|
66
|
+
`field <name> label "..."`, and the walk checks that the label shows on Stage.
|
|
67
|
+
- **A `reads` guard needs a small join-free state read model** next to the display view (one per
|
|
68
|
+
guarded entity, no children, a removal event). A view with joins cannot be the guard.
|
|
69
|
+
- **Public feeds do not list private records.** Express visibility in the read model (a filter,
|
|
70
|
+
a per-owner view); a list without a filter returns everything the caller can see.
|
|
71
|
+
- **Generated identifiers** are not returned to the HTTP caller unless the command declares a
|
|
72
|
+
`returns` clause; otherwise clients find the new row by re-querying a view.
|
|
73
|
+
- **Time facts**: state the rule with its time fact and say in `event-model.md` whether the
|
|
74
|
+
caller or the system supplies it. Without a clock the caller passes the time fact in; with one,
|
|
75
|
+
use it. Spec the boundary both exactly equal and one below.
|
|
76
|
+
- **Cascades and observed defects**: a cascade (deleting a parent removes its children) is an
|
|
77
|
+
automation: model it when the dialect allows, else list it in `event-model.md`. Model the
|
|
78
|
+
intended behavior of an observed defect and flag the defect.
|
|
79
|
+
|
|
80
|
+
## Naming
|
|
81
|
+
|
|
82
|
+
- Events are past-tense business facts. A CRUD mirror (`CustomerUpdated`, `OrderSaved`,
|
|
83
|
+
`RecordChanged`) hides intent. Split by intent: what did the person decide? When the
|
|
84
|
+
evidence shows only that fields changed, propose the most likely intents as separate
|
|
85
|
+
candidates, mark each `Inferred`, and ask.
|
|
86
|
+
- Use the visible labels and document terms as the business vocabulary; one name per concept.
|
|
87
|
+
- Commands name the decision (`ReserveBerth`), not the endpoint (`PostReservation`).
|
|
88
|
+
- Strongly typed identities and values come from the field names and shapes in the evidence
|
|
89
|
+
(`cratis-screenplay-command-surface`); do not use raw strings and numbers for domain values.
|
|
90
|
+
|
|
91
|
+
## Writing through MCP
|
|
92
|
+
|
|
93
|
+
All writes use the Screenplay MCP server of `cratis-screenplay-model-authoring`: pick the
|
|
94
|
+
`propose-*` tool for the edit, read the proposal (`read-proposal`) for its diagnostics and
|
|
95
|
+
before/after, run `run-specifications` with the proposal id, then `apply` the reviewed
|
|
96
|
+
proposal. The contract and the refusal handling belong to that skill; this skill adds only:
|
|
97
|
+
|
|
98
|
+
- One slice per loop, so a refusal names one cause.
|
|
99
|
+
- A diagnostic is a finding. Fix the model or record the gap; never edit the file by hand to get
|
|
100
|
+
past it, and never weaken protection to make it compile.
|
|
101
|
+
- Notes: record each open unknown as an anchored `question` note, and the evidence ids in the
|
|
102
|
+
slice `description`.
|
|
103
|
+
|
|
104
|
+
## Specifications
|
|
105
|
+
|
|
106
|
+
- A specification needs both sides seen: the state before and the state after. One side alone is
|
|
107
|
+
an `unknown`, not a specification.
|
|
108
|
+
- Use observed values for given and expected data; replace personal data with fixtures.
|
|
109
|
+
- A UI success proves a state change was shown. It does not prove uniqueness, idempotency or
|
|
110
|
+
atomicity: those stay `unknown` until a capture or a person confirms them.
|
|
111
|
+
- Optional properties are not defaulted in specifications, so each specification must list
|
|
112
|
+
them; avoid `optional` on commands and events unless the model needs it, and use typed
|
|
113
|
+
`example`s instead of repeating fixtures.
|
|
114
|
+
- A list result is written as `item` lines or `none`; a deleted row is a query with no
|
|
115
|
+
`result`. A read model specification cannot `given` events of another stream, and DateTime
|
|
116
|
+
values are exact round-trip strings. Check the specification vocabulary skill before guessing.
|
|
117
|
+
- For which scenarios a slice needs (refusals, retries, races, removal), use
|
|
118
|
+
`cratis-screenplay-scenario-coverage`.
|
|
119
|
+
|
|
120
|
+
## Slices and flows
|
|
121
|
+
|
|
122
|
+
- Group evidence by the journey observed, then split at decisions: one slice per decision or per
|
|
123
|
+
view. Three to twelve states per flow is typical.
|
|
124
|
+
- A read model is shaped by the screens that use it. Where two screens need conflicting shapes,
|
|
125
|
+
make two read models.
|
|
126
|
+
- Order slices as the user meets them or as events flow; expect "view drawn before its
|
|
127
|
+
producer" notes either way, they are not defects. A command that records a second stream's
|
|
128
|
+
fact uses the `produces ... for <field>` form, not a second command.
|
|
129
|
+
- Where the capture shows ordering (create, then list, then edit), keep it as the flow, and
|
|
130
|
+
state which ordering is observed and which is assumed.
|
|
131
|
+
|
|
132
|
+
## Stop conditions
|
|
133
|
+
|
|
134
|
+
Stop and ask rather than synthesize when:
|
|
135
|
+
|
|
136
|
+
- an element would rest on a single `Inferred` row with no corroboration, and it carries a rule,
|
|
137
|
+
authorization or money;
|
|
138
|
+
- two sources conflict and the difference changes behavior;
|
|
139
|
+
- the model would need protection (`pii`, `secret`, authorization) that the evidence does not
|
|
140
|
+
show: model it as an open question, never silently drop it.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Running target, first validation and no-MCP fallback
|
|
2
|
+
|
|
3
|
+
Short recipes for turning a recovered model into a running Stage app. The commands, verdicts and
|
|
4
|
+
syntax are owned by `cratis-screenplay-toolchain`, `cratis-screenplay-render-and-gap-fill` and
|
|
5
|
+
`cratis-stage-rendering-and-sandbox`; this page only sequences them.
|
|
6
|
+
|
|
7
|
+
## From recovered model to running app
|
|
8
|
+
|
|
9
|
+
1. Validate the folder with warnings as errors, `screenplay <folder> --warnaserror`
|
|
10
|
+
(`cratis-screenplay-toolchain`). Fix the model, never silence a diagnostic.
|
|
11
|
+
2. Run the reference specifications, `screenplay test <folder>`. `Unsupported` is not a pass.
|
|
12
|
+
3. Start it with `cratis run <model folder>` (Stage sandbox, needs Docker), or render with
|
|
13
|
+
`cratis render` and gap-fill (`cratis-screenplay-render-and-gap-fill`).
|
|
14
|
+
4. Re-walk the observed journeys on the running app (`fidelity-check.md`).
|
|
15
|
+
|
|
16
|
+
`render --force`, `prologue` start, the Extractor and `prologue interpret` need approval and stay
|
|
17
|
+
outside this recipe.
|
|
18
|
+
|
|
19
|
+
## First-validation traps
|
|
20
|
+
|
|
21
|
+
Errors that cost iterations on a first pass; each is confirmed in the toolchain references.
|
|
22
|
+
|
|
23
|
+
- A scalar type is `Bool`, not `Boolean`; an unknown type is PLAY0165.
|
|
24
|
+
- A queryless or list read model needs an explicit `key` mark; a read model with two `*Id`
|
|
25
|
+
properties needs one keyed query (`cratis-screenplay-toolchain` traps 12 and 46).
|
|
26
|
+
- A `require` message goes on the next indented line (trap 38).
|
|
27
|
+
- `given clock "<ISO timestamp>"` is one line.
|
|
28
|
+
- Productions from different streams need explicit destinations (PLAY0470).
|
|
29
|
+
- Prove a projection with `given` events, then `when`, then `then readmodel`/`then query`
|
|
30
|
+
(trap 15). When an update-style command (archive, rename, complete) depends on state that
|
|
31
|
+
an earlier event created, give that event in its spec's `given`; a first run that
|
|
32
|
+
reports Unsupported often lacks it. See `cratis-screenplay-specifications`.
|
|
33
|
+
- Add a per-command screen only when no data screen carries the action; command forms come
|
|
34
|
+
from actions on data screens.
|
|
35
|
+
|
|
36
|
+
## Without the Screenplay MCP server
|
|
37
|
+
|
|
38
|
+
The propose, read, apply loop needs the MCP server. When it is unavailable, write the `.play`
|
|
39
|
+
file directly, then validate with `screenplay <folder> --warnaserror` and run
|
|
40
|
+
`screenplay test <folder>` after every slice. A diagnostic is still a finding: fix the model,
|
|
41
|
+
never weaken protection to pass. Record in the report that the MCP loop was not used. Write
|
|
42
|
+
helper scripts to files rather than long inline shell, which guards may block.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"skill": "cratis-screenplay-reverse-engineering",
|
|
3
|
+
"input": "We have a running web app we may test and a HAR capture of its booking flow, but no source code. Reverse engineer it into a Screenplay model and get it running.",
|
|
4
|
+
"fixtures": [],
|
|
5
|
+
"assertions": [
|
|
6
|
+
{ "kind": "skill-contains", "value": "## Decision rule" },
|
|
7
|
+
{ "kind": "skill-contains", "value": "cratis-screenplay-legacy-extraction" },
|
|
8
|
+
{ "kind": "skill-contains", "value": "Read-only by default" },
|
|
9
|
+
{ "kind": "skill-contains", "value": "Scrub cookies" },
|
|
10
|
+
{ "kind": "skill-contains", "value": "cratis run <model folder>" },
|
|
11
|
+
{ "kind": "skill-contains", "value": "Never `render --force` without approval" },
|
|
12
|
+
{ "kind": "skill-contains", "value": "keep / change / remove" },
|
|
13
|
+
{ "kind": "skill-contains", "value": "Only claim effects the capture confirms" },
|
|
14
|
+
{ "kind": "skill-contains", "value": "Unknowns stay visible" },
|
|
15
|
+
{ "kind": "skill-contains", "value": "L0 feature inventory" },
|
|
16
|
+
{ "kind": "skill-contains", "value": "plausible" },
|
|
17
|
+
{ "kind": "skill-contains", "value": "owned" },
|
|
18
|
+
{ "kind": "skill-contains", "value": "ground-truth-benchmark" },
|
|
19
|
+
{ "kind": "skill-contains", "value": "outside an isolated sandbox", "file": "references/executable-intake.md" },
|
|
20
|
+
{ "kind": "skill-contains", "value": "CRUD mirror", "file": "references/synthesis-rules.md" },
|
|
21
|
+
{ "kind": "skill-contains", "value": "evidence.jsonl", "file": "references/evidence-format.md" },
|
|
22
|
+
{ "kind": "skill-contains", "value": "// boundary: out of scope", "file": "references/scoping.md" },
|
|
23
|
+
{ "kind": "skill-contains", "value": "// assumed: <why>", "file": "references/documentation-intake-and-screens.md" },
|
|
24
|
+
{ "kind": "skill-contains", "value": "plausibility report", "file": "references/documentation-intake-and-screens.md" },
|
|
25
|
+
{ "kind": "skill-contains", "value": "morluto/rea", "file": "references/provenance.md" },
|
|
26
|
+
{ "kind": "skill-contains", "value": "limit + 1", "file": "references/probing-and-naming.md" },
|
|
27
|
+
{ "kind": "skill-contains", "value": "Without the Screenplay MCP server", "file": "references/target-and-first-validation.md" }
|
|
28
|
+
]
|
|
29
|
+
}
|
|
@@ -989,6 +989,7 @@
|
|
|
989
989
|
"cratis-screenplay-projections",
|
|
990
990
|
"cratis-screenplay-read-surface",
|
|
991
991
|
"cratis-screenplay-render-and-gap-fill",
|
|
992
|
+
"cratis-screenplay-reverse-engineering",
|
|
992
993
|
"cratis-screenplay-scenario-coverage",
|
|
993
994
|
"cratis-screenplay-slice-design",
|
|
994
995
|
"cratis-screenplay-specifications",
|